Patch level : 10.0

Files correlati     : ba0 ba1 ba8
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione firma digitale e marcatura temporale


git-svn-id: svn://10.65.10.50/trunk@18892 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-05-20 15:36:38 +00:00
parent b3a8f42760
commit da391e0167
12 changed files with 90 additions and 112 deletions

View File

@ -612,7 +612,7 @@ bool TApplication::has_module(int module, int checktype) const
#endif #endif
// Testa bit di attivazione dell'utente // Testa bit di attivazione dell'utente
if (ok && checktype != CHK_DONGLE && module != EEAUT) if (ok && checktype != CHK_DONGLE)
ok = _user_aut[module]; ok = _user_aut[module];
return ok; return ok;
} }
@ -819,7 +819,7 @@ bool TApplication::get_next_pdf(int anno, long ditta, const char* codnum,
bool TApplication::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn, bool TApplication::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
TString& subj, TString& text, TToken_string& attach, bool& ui) const TString& subj, TString& text, TToken_string& attach, bool& ui) const
{ {
bool ok = dongle().active(RSAUT) && dongle().active(EEAUT); bool ok = dongle().active(RSAUT);
ui = ok && to.blank(); ui = ok && to.blank();
return ok; return ok;
} }

View File

@ -104,7 +104,7 @@ public:
// @cmember Setta il tipo di file di configurazione al quale e' associata l'applicazione // @cmember Setta il tipo di file di configurazione al quale e' associata l'applicazione
void set_config(int which); void set_config(int which);
// @cmember Costruttore // @cmember Costruttore
TConfig_application(int which_config = CONFIG_GENERAL) ; TConfig_application(int which_config) ;
// @cmember Distruttore // @cmember Distruttore
virtual ~TConfig_application() ; virtual ~TConfig_application() ;
}; };

View File

@ -686,6 +686,9 @@ static void cfg2file(int which_config, TFilename& file)
{ {
switch (which_config) switch (which_config)
{ {
case CONFIG_GENERAL:
file = "./install.ini";
break;
case CONFIG_DITTA: case CONFIG_DITTA:
file = firm2dir(prefix().get_codditta()); file = firm2dir(prefix().get_codditta());
file.add("ditta.ini"); file.add("ditta.ini");

View File

@ -7,7 +7,7 @@
class TConfig; class TConfig;
// questo sara' il principale, per ora non c'e' // file lista moduli installati (install.ini)
#define CONFIG_GENERAL 0 #define CONFIG_GENERAL 0
// file campo.ini // file campo.ini
#define CONFIG_INSTALL 1 #define CONFIG_INSTALL 1
@ -167,7 +167,7 @@ public:
// @cmember Costruttore (il paragrafo iniziale e' il modulo corrente // @cmember Costruttore (il paragrafo iniziale e' il modulo corrente
// salvo diversa indicazione) // salvo diversa indicazione)
TConfig(int which_config = CONFIG_GENERAL, const char* paragraph = NULL); TConfig(int which_config, const char* paragraph = NULL);
// @cmember Costruttore (il paragrafo iniziale e' il modulo corrente // @cmember Costruttore (il paragrafo iniziale e' il modulo corrente
// salvo diversa indicazione) // salvo diversa indicazione)
TConfig(const char* file, const char* paragraph = NULL); TConfig(const char* file, const char* paragraph = NULL);

View File

@ -140,7 +140,7 @@ inline void reset_bit(word& w, byte b)
TDongle::TDongle() TDongle::TDongle()
: _hardware(_dongle_unknown), _type(_no_dongle), _serno(0xFFFF), : _hardware(_dongle_unknown), _type(_no_dongle), _serno(0xFFFF),
_max_users(1), _year_assist(2006), _dirty(false) _max_users(1), _year_assist(2009), _dirty(false), _OEM(-1)
{ {
memset(_eprom, 0, sizeof(_eprom)); memset(_eprom, 0, sizeof(_eprom));
memset(_assist, 0, sizeof(_assist)); memset(_assist, 0, sizeof(_assist));
@ -155,49 +155,7 @@ TDongle::~TDongle()
const TString& TDongle::administrator(TString* pwd) const const TString& TDongle::administrator(TString* pwd) const
{ {
if (_admin.blank()) if (_admin.blank())
{ oem();
TString& admin = (TString&)_admin; // Sorry
TString& admpwd = (TString&)_admpwd; // Sorry
//nuovo metodo di rilevamento administrator (dalla 10.0 in avanti); l'admin sta nel file oem.ini sotto la cartella
//setup, sia nel CD che soprattutto nel programma installato
int oem = -1;
if (oem < 0)
{
TConfig ini(CONFIG_OEM, "MAIN");
oem = ini.get_int("OEM", NULL, -1, -1);
if (oem >= 0)
{
TString8 para; para << "OEM_" << oem;
admin = ini.get("Administrator", para);
admpwd = ini.get("Password", para);
}
}
//vecchio metodo di rilevamento dell'admin e della sua password: sta in install.ini
//administrator
if (oem < 0)
{
TConfig ini("install.ini", "Main");
admin = ini.get("Administrator");
admpwd = ini.get("Password");
}
if (admin.blank())
admin = "ADMIN";
else
admin = ::decode(_admin);
//password
if (admpwd.blank())
{
admpwd = admin;
admpwd.lower();
admpwd.insert(".", 2);
}
else
admpwd = ::decode(admpwd);
}
if (pwd) if (pwd)
*pwd = _admpwd; *pwd = _admpwd;
return _admin; return _admin;
@ -511,9 +469,7 @@ int TDongle::can_try_server() const
{ {
if (xvt_sys_dongle_server_is_running()) if (xvt_sys_dongle_server_is_running())
return 3; return 3;
const TString& dongle = ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
TConfig ini(CONFIG_INSTALL, "Server");
const TString& dongle = ini.get("Dongle");
return dongle.full(); return dongle.full();
} }
@ -688,43 +644,38 @@ bool TDongle::write_words(word reg, word len, word* data) const
return ok; return ok;
} }
// Ritorna il nome della ditta che vende il programma attuale int TDongle::oem() const
const TString& TDongle::reseller() const
{ {
if (_reseller.blank()) if (_OEM < 0)
{ {
TString& firm = (TString&) _reseller; TString& firm = (TString&) _reseller;
TString& campo = (TString&) _product; TString& campo = (TString&) _product;
TString& breve = (TString&) _shortname; TString& breve = (TString&) _shortname;
TString& admin = (TString&)_admin;
TString& admpwd = (TString&)_admpwd;
int& oem = (int&)_OEM;
//nuovo metodo di rilevamento producer (dalla 10.0 in avanti); il producer sta nel file oem.ini sotto la cartella //nuovo metodo di rilevamento producer (dalla 10.0 in avanti); il producer sta nel file oem.ini sotto la cartella
//setup, sia nel CD che soprattutto nel programma installato //setup, sia nel CD che soprattutto nel programma installato
int oem = -1; TConfig ini(CONFIG_OEM, "MAIN");
if (oem < 0) oem = ini.get_int("OEM", NULL, -1, -1);
if (oem >= 0)
{ {
TConfig ini(CONFIG_OEM, "MAIN"); TString8 para; para << "OEM_" << oem;
oem = ini.get_int("OEM", NULL, -1, -1); ini.set_paragraph(para);
if (oem >= 0) campo = decode(ini.get("Product"));
{ firm = decode(ini.get("Reseller"));
TString8 para; para << "OEM_" << oem; breve = decode(ini.get("Name"));
campo = ini.get("Product", para); admin = decode(ini.get("Administrator"));
firm = ini.get("Reseller", para); admpwd = decode(ini.get("Password"));
breve = ini.get("Name", para);
}
} }
if (firm.blank()) //vecchio metodo di rilevamento del producer: sta in install.ini if (firm.blank()) //vecchio metodo di rilevamento del producer: sta in install.ini
{ {
TConfig ini("install.ini", "Main"); firm = decode(ini_get_string(CONFIG_GENERAL, "Main", "Producer"));
firm = ini.get("Producer");
campo = breve = " "; campo = breve = " ";
} }
//nuovo metodo: cerca produttore (Name) e prodotto (Product) //nuovo metodo: cerca produttore (Name) e prodotto (Product)
if (firm.full())
{
firm = decode(firm);
campo = decode(campo);
breve = decode(breve);
}
if (firm.blank()) if (firm.blank())
{ {
ignore_xvt_errors(true); ignore_xvt_errors(true);
@ -733,41 +684,65 @@ const TString& TDongle::reseller() const
ignore_xvt_errors(false); ignore_xvt_errors(false);
} }
if (admin.blank())
{
admin = decode(ini_get_string(CONFIG_GENERAL, "Main", "Administrator"));
if (admin.blank())
{
admin = "ADMIN";
admpwd = "ad.min";
}
}
if (admpwd.blank())
{
admpwd = decode(ini_get_string(CONFIG_GENERAL, "Main", "Password"));
if (admpwd.blank())
{
admpwd = admin;
admpwd.lower();
admpwd.insert(".", 2);
}
}
if (campo.blank()) if (campo.blank())
campo = "Campo Enterprise"; campo = "Campo Enterprise";
if (firm.blank()) if (firm.blank())
firm = "AGA informatica s.r.l."; firm = "AGA informatica s.r.l.";
if (breve.blank()) if (breve.blank())
breve = "Campo"; breve = "Campo";
if (oem < 0)
oem = firm.starts_with("AGA ") ? 0 : 1;
} }
return _OEM;
}
// Ritorna il nome della ditta che vende il programma attuale
const TString& TDongle::reseller() const
{
if (_reseller.empty())
oem();
return _reseller; return _reseller;
} }
const TString& TDongle::product() const const TString& TDongle::product() const
{ {
if (_product.empty()) if (_product.empty())
reseller(); oem();
return _product; return _product;
} }
const TString& TDongle::shortname() const const TString& TDongle::shortname() const
{ {
if (_shortname.empty()) if (_shortname.empty())
reseller(); oem();
return _shortname; return _shortname;
} }
bool TDongle::active(word module) const bool TDongle::active(word module) const
{ {
bool yes = false; const bool yes = (module < ENDAUT) && _module[module] && shown(module);
if (module == EEAUT)
{
const TString& r = reseller();
yes = r.starts_with("AGA ");
}
else
yes = (module < ENDAUT) && _module[module] && shown(module);
return yes; return yes;
} }
@ -1037,25 +1012,13 @@ const TString& TDongle::module_code2name(word mod) const
const TString_array& modinfo = info(); const TString_array& modinfo = info();
if (mod < modinfo.items()) if (mod < modinfo.items())
return modinfo.row(mod).left(2); return modinfo.row(mod).left(2);
else
{
if (mod == EEAUT)
return get_tmp_string() = "ee";
}
return EMPTY_STRING; return EMPTY_STRING;
} }
const TString& TDongle::module_code2desc(word mod) const const TString& TDongle::module_code2desc(word mod) const
{ {
const TString_array& modinfo = info(); const TString_array& modinfo = info();
if (mod < modinfo.items()) return mod < modinfo.items() ? modinfo.row(mod).mid(3) : EMPTY_STRING;
return modinfo.row(mod).mid(3);
else
{
if (mod == EEAUT)
return get_tmp_string() = "Enterprise Edition";
}
return EMPTY_STRING;
} }
const TString& TDongle::module_name2desc(const char* mod) const const TString& TDongle::module_name2desc(const char* mod) const
@ -1079,13 +1042,16 @@ bool TDongle::shown(word code) const
{ {
const TString4 mod = module_code2name(code); const TString4 mod = module_code2name(code);
yes = mod.not_empty(); yes = mod.not_empty();
if (yes && code > BAAUT) if (yes && code > BAAUT && code < ENDAUT)
{ {
bool do_test = true; TAuto_token_string ee = ini_get_string(CONFIG_GENERAL, mod, "OEM"); // Modern OEM handling
if (code != EEAUT) if (ee.full())
do_test = ini_get_bool("install.ini", mod, "Ee"); yes = ee.get_pos(oem()) >= 0;
if (do_test) else
yes = active(EEAUT); {
if (ini_get_bool(CONFIG_GENERAL, mod, "Ee")) // Legacy Enterprise Edition
yes = oem() == 0;
}
} }
if (yes) if (yes)
((TBit_array&)_shown).set(code); // Setto il flag di visibilta' per la prossima volta ((TBit_array&)_shown).set(code); // Setto il flag di visibilta' per la prossima volta

View File

@ -19,6 +19,7 @@ class TDongle : public TObject
TDongleType _type; TDongleType _type;
TString _admin, _admpwd, _reseller, _product, _shortname; TString _admin, _admpwd, _reseller, _product, _shortname;
int _OEM;
word _serno, _max_users, _year_assist; word _serno, _max_users, _year_assist;
word _eprom[64]; word _eprom[64];
@ -87,6 +88,7 @@ public:
bool pay_assist(int index, real imp, bool lire); bool pay_assist(int index, real imp, bool lire);
const TString& administrator(TString* pwd = NULL) const; const TString& administrator(TString* pwd = NULL) const;
int oem() const;
const TString& reseller() const; const TString& reseller() const;
const TString& product() const; const TString& product() const;
const TString& shortname() const; const TString& shortname() const;

View File

@ -254,7 +254,7 @@ HIDDEN int find_relapp(TConfig& cfg, void* jolly)
bool get_relapp(int logicnum, TString& app) bool get_relapp(int logicnum, TString& app)
{ {
TConfig ini("install.ini"); TConfig ini(CONFIG_GENERAL);
TCallbackFileinfo fi; TCallbackFileinfo fi;
fi._var.format("Edit_%d", logicnum); fi._var.format("Edit_%d", logicnum);
ini.for_each_paragraph(find_relapp, &fi); ini.for_each_paragraph(find_relapp, &fi);
@ -300,7 +300,7 @@ HIDDEN int find_tabapp(TConfig& cfg, void* jolly)
bool get_tabapp(const char * tabname, TString& app) bool get_tabapp(const char * tabname, TString& app)
{ {
TConfig ini("install.ini"); TConfig ini(CONFIG_GENERAL);
TCallbackTableinfo fi; TCallbackTableinfo fi;
TTable t(tabname); TTable t(tabname);
fi._var1.format("Edit_%s", t.name()); fi._var1.format("Edit_%s", t.name());

View File

@ -48,7 +48,4 @@
#define ESAUT 47 #define ESAUT 47
#define ENDAUT 48 #define ENDAUT 48
// Enterprise Edition :-)
#define EEAUT 99
#endif // __MODAUT_H #endif // __MODAUT_H

View File

@ -2833,7 +2833,7 @@ void TSheet_field::highlight() const
if (s->_check_enabled) if (s->_check_enabled)
{ {
int rows; xi_get_list_info(s->_obj, &rows); int rows; xi_get_list_info(s->_obj, &rows);
if (rows > 0) if (rows > 0 && s->_cur_rec >= 0 && s->_cur_rec < rows)
{ {
if (s->notify(s->_cur_rec, K_TAB)) if (s->notify(s->_cur_rec, K_TAB))
{ {

View File

@ -1433,6 +1433,16 @@ bool TBook::print_page(TWindow& win, size_t page)
else else
thickness = width * _phr / 72; // Converte width in 72' di pollice thickness = width * _phr / 72; // Converte width in 72' di pollice
} }
else
{
if (preview)
{
const TPrint_preview_window& pw = (const TPrint_preview_window&)win;
const double alpha = pw.log2dev(20)/100.0;
if (alpha < 1.0)
col = blend_colors(col, COLOR_WHITE, alpha);
}
}
win.set_pen(col, thickness); win.set_pen(col, thickness);
} }
continue; continue;

View File

@ -263,7 +263,7 @@ bool TModule_table::get_relapp(TString& app) const
if (_customer > 0L) if (_customer > 0L)
para.format("%s%06ld", (const char*)_module, _customer); para.format("%s%06ld", (const char*)_module, _customer);
para.lower(); para.lower();
TConfig ini("install.ini", para); TConfig ini(CONFIG_GENERAL, para);
TString8 var; TString8 var;
var << "Edit_" << _tabname; var << "Edit_" << _tabname;

View File

@ -270,7 +270,7 @@ HIDDEN int find_relapp(TConfig& cfg, void* jolly)
bool TTable::get_relapp(TString& app) const bool TTable::get_relapp(TString& app) const
{ {
TConfig ini("install.ini"); TConfig ini(CONFIG_GENERAL);
TCallbackTableinfo fi; TCallbackTableinfo fi;
fi._var1.format("Edit_%s", (const char*)_tabname); fi._var1.format("Edit_%s", (const char*)_tabname);
fi._var2.format("Edit_%d", num()); fi._var2.format("Edit_%d", num());