Resa possibile convivenza di due istanze di campo installate in diverse cartelle
git-svn-id: svn://10.65.10.50/branches/R_10_00@22915 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									0dff96647c
								
							
						
					
					
						commit
						0a00dffb16
					
				
							
								
								
									
										112
									
								
								ba/ba0100.cpp
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								ba/ba0100.cpp
									
									
									
									
									
								
							@ -1746,12 +1746,62 @@ HIDDEN int dir_sort(const TObject** d1, const TObject** d2)
 | 
			
		||||
 | 
			
		||||
class TStudy_mask : public TAutomask
 | 
			
		||||
{
 | 
			
		||||
  bool is_valid_study(const char* path) const;
 | 
			
		||||
  void list_studies(TString_array& s, bool count_firms) const;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TStudy_mask();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool TStudy_mask::is_valid_study(const char* path) const
 | 
			
		||||
{
 | 
			
		||||
  TFilename n = path;
 | 
			
		||||
  n.add("com/dir.gen");
 | 
			
		||||
  return n.find(' ') < 0 && n.exist();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TStudy_mask::list_studies(TString_array& sht, bool firms_count) const
 | 
			
		||||
{
 | 
			
		||||
  TFilename str = firm2dir(-1);
 | 
			
		||||
  for (int i = str.len()-2; i > 0; i--)
 | 
			
		||||
  {
 | 
			
		||||
    if (str[i] == '\\' || str[i] == '/') 
 | 
			
		||||
    {
 | 
			
		||||
      str.cut(i);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  str.add("*");
 | 
			
		||||
  SLIST dirs = xvt_fsys_list_files(DIR_TYPE, str, true);
 | 
			
		||||
 | 
			
		||||
  for (SLIST_ELT e = xvt_slist_get_first(dirs); e; e = xvt_slist_get_next(dirs, e))
 | 
			
		||||
  { 
 | 
			
		||||
    const char* f = xvt_slist_get(dirs, e, NULL);
 | 
			
		||||
    if (is_valid_study(f))
 | 
			
		||||
    {
 | 
			
		||||
      if (firms_count)
 | 
			
		||||
      {
 | 
			
		||||
        str = f; str.add("?????A");
 | 
			
		||||
        SLIST firms = xvt_fsys_list_files(DIR_TYPE, str, true);
 | 
			
		||||
        const int nf = xvt_slist_count(firms);
 | 
			
		||||
        xvt_slist_destroy(firms);
 | 
			
		||||
        if (nf > 0)
 | 
			
		||||
        {
 | 
			
		||||
          TToken_string row = f;
 | 
			
		||||
          row.add(nf);
 | 
			
		||||
          sht.add(row);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
        sht.add(f);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  xvt_slist_destroy(dirs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TStudy_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
{
 | 
			
		||||
  switch (o.dlg())
 | 
			
		||||
@ -1765,48 +1815,34 @@ bool TStudy_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
      o.set(firm2dir(-1));
 | 
			
		||||
    if (e == fe_modify || e == fe_close)
 | 
			
		||||
    {
 | 
			
		||||
      TFilename path(o.get());
 | 
			
		||||
      path.add("com");
 | 
			
		||||
      path.add("dir.gen");
 | 
			
		||||
      if (!path.exist() || path.find(' ') >= 0)
 | 
			
		||||
        return error_box("%s %s", (const char*)o.get(), TR("non e' uno studio valido!"));
 | 
			
		||||
      TFilename s = o.get();
 | 
			
		||||
      if (e == fe_modify && s.full() && !is_valid_study(s))
 | 
			
		||||
      {
 | 
			
		||||
        const TString name = s.name_only();
 | 
			
		||||
        TString_array std; list_studies(std, false);
 | 
			
		||||
        TString strBest;
 | 
			
		||||
        double dBest = 0;
 | 
			
		||||
        FOR_EACH_ARRAY_ROW(std, i, row)
 | 
			
		||||
        {   
 | 
			
		||||
          const TFilename study = *row;
 | 
			
		||||
          const TString& sn = study.name_only();
 | 
			
		||||
          const double score = xvt_str_fuzzy_compare_ignoring_case(name, sn);
 | 
			
		||||
          if (score > dBest)
 | 
			
		||||
          {
 | 
			
		||||
            strBest = study;
 | 
			
		||||
            dBest = score;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        if (dBest > 0.75)
 | 
			
		||||
          o.set(s = strBest);
 | 
			
		||||
      }
 | 
			
		||||
      if (!is_valid_study(s))
 | 
			
		||||
        return error_box("%s %s", (const char*)s, TR("non è uno studio valido!"));
 | 
			
		||||
    }
 | 
			
		||||
    if (e == fe_button)
 | 
			
		||||
    {
 | 
			
		||||
      TFilename str = firm2dir(-1);
 | 
			
		||||
      for (int i = str.len()-2; i > 0; i--)
 | 
			
		||||
      {
 | 
			
		||||
        if (str[i] == '\\' || str[i] == '/') 
 | 
			
		||||
        {
 | 
			
		||||
          str.cut(i);
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      str.add("*");
 | 
			
		||||
      SLIST dirs = xvt_fsys_list_files(DIR_TYPE, str, true);
 | 
			
		||||
 | 
			
		||||
      TFilename dirgen;
 | 
			
		||||
      TArray_sheet sht(-1, -1, 78, 20, TR("Scelta studio"), HR("Studio@70|Ditte"));
 | 
			
		||||
      for (SLIST_ELT e = xvt_slist_get_first(dirs); e; e = xvt_slist_get_next(dirs, e))
 | 
			
		||||
      { 
 | 
			
		||||
        const char* f = xvt_slist_get(dirs, e, NULL);
 | 
			
		||||
        dirgen = f;
 | 
			
		||||
        if (dirgen.find(' ') < 0) // Scarta gli studi contenenti spazi
 | 
			
		||||
        {
 | 
			
		||||
          dirgen.add("com/dir.gen");
 | 
			
		||||
          if (dirgen.exist())
 | 
			
		||||
          {
 | 
			
		||||
            TToken_string row = f;
 | 
			
		||||
            str = f; str.add("?????A");
 | 
			
		||||
            SLIST firms = xvt_fsys_list_files(DIR_TYPE, str, true);
 | 
			
		||||
            row.add(xvt_slist_count(firms));
 | 
			
		||||
            xvt_slist_destroy(firms);
 | 
			
		||||
            sht.add(row);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      xvt_slist_destroy(dirs);
 | 
			
		||||
 | 
			
		||||
      list_studies(sht.rows_array(), true);
 | 
			
		||||
      sht.rows_array().TArray::sort(dir_sort); 
 | 
			
		||||
      if (sht.run() == K_ENTER)
 | 
			
		||||
        o.set(sht.row(-1).get(0)); // -1 = selected row
 | 
			
		||||
 | 
			
		||||
@ -636,7 +636,7 @@ bool TOutlook_mask::can_be_closed() const
 | 
			
		||||
    TBook_field& bf = book_field();
 | 
			
		||||
    if (bf.pages() > 0)
 | 
			
		||||
    {
 | 
			
		||||
      TMask cm(TR("Chiusura applicazioni"), 1, 50, 8);
 | 
			
		||||
      TMask cm(TR("Chiusura applicazioni"), 1, 50, 9);
 | 
			
		||||
 | 
			
		||||
      TToken_string options;
 | 
			
		||||
      options = TR("Non chiudere le applicazioni in esecuzione");
 | 
			
		||||
 | 
			
		||||
@ -1279,7 +1279,7 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
      next_page(1001);
 | 
			
		||||
      bool ok = true;
 | 
			
		||||
      if (_sql_dirty && !field(F_SQL).empty())
 | 
			
		||||
        ok = yesno_box(TR("Attenzione: la query verra' rigenerata\n"
 | 
			
		||||
        ok = yesno_box(TR("Attenzione: la query verrà rigenerata\n"
 | 
			
		||||
                          "annullando eventuali modifiche manuali.\n"
 | 
			
		||||
                          "Si desidera proseguire?"));
 | 
			
		||||
      if (ok)
 | 
			
		||||
 | 
			
		||||
@ -140,7 +140,7 @@ PAGE "Sql" -1 -1 78 23
 | 
			
		||||
 | 
			
		||||
MEMO F_SQL 78 -3
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 0 "SQL query"
 | 
			
		||||
  PROMPT 1 0 "ISAM / SQL query"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BUTTON F_EDITQUERY 10 2
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user