Aggiunto metodo setconfig() per cambiare il tipo di file di configurazione

relativo alla confapp. Corretta la lettura/salvataggio di campi array,
identificati da FIELD xxx[nn].


git-svn-id: svn://10.65.10.50/trunk@3598 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-09-17 10:47:46 +00:00
parent ce341c3cb2
commit 2caafb668b
2 changed files with 11 additions and 6 deletions

View File

@ -72,8 +72,10 @@ void TConfig_application::do_config(int m)
TMask_field& f = m.fld(i); TMask_field& f = m.fld(i);
if (f.field() != NULL) if (f.field() != NULL)
{ {
const char* fname = f.field()->name(); const TFieldref* fr = f.field();
TString& oldvl = cnf.get(fname); const char* fname = fr->name();
const int index = fr->to();
TString& oldvl = cnf.get(fname,NULL, index > -1 ? index : -1);
if (!oldvl.empty()) if (!oldvl.empty())
f.set(oldvl); f.set(oldvl);
} }
@ -98,6 +100,7 @@ void TConfig_application::do_config(int m)
{ {
const char* fname = f.field()->name(); const char* fname = f.field()->name();
const char* value = f.get(); const char* value = f.get();
const int index = f.field()->to();
const char* oldvl = cnf.get(fname); const char* oldvl = cnf.get(fname);
if (!tosave) if (!tosave)
@ -106,7 +109,7 @@ void TConfig_application::do_config(int m)
if (!tosave) break; if (!tosave) break;
if (postprocess_config_changed(par, fname, oldvl, value)) if (postprocess_config_changed(par, fname, oldvl, value))
cnf.set(fname, value, NULL, TRUE); cnf.set(fname, value, NULL, TRUE, index > -1 ? index : -1);
} }
} }
} }

View File

@ -80,6 +80,8 @@ protected:
// @access Public Member // @access Public Member
public: public:
// @cmember Setta il tipo di file di configurazione al quale e' associata l'applicazione
void set_config(int which) {_which_config = which;}
// @cmember Costruttore // @cmember Costruttore
TConfig_application(int which_config = CONFIG_GENERAL) : _which_config(which_config) TConfig_application(int which_config = CONFIG_GENERAL) : _which_config(which_config)
{} {}