From 2a0f1f7b2b065928d33dcc88368b3e12b3712873 Mon Sep 17 00:00:00 2001 From: luca Date: Mon, 8 Oct 2007 09:34:54 +0000 Subject: [PATCH] Patch level :4.0 800 Files correlati : Ricompilazione Demo : [ ] Commento :migliorata la gestione riavvio client in aggiornamento (semplicemente non c'era!) git-svn-id: svn://10.65.10.50/trunk@15686 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba1700.cpp | 102 ++++++++++++++++---------------------------------- 1 file changed, 33 insertions(+), 69 deletions(-) diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp index c9a51e50c..61826c33b 100755 --- a/ba/ba1700.cpp +++ b/ba/ba1700.cpp @@ -1514,28 +1514,27 @@ protected: virtual bool test_assistance_year() const; virtual void main_loop(); - bool testdatabase() const; - bool testprograms() const; - int testtype() const; + int test_type() const; void convert_archives(); }; -bool TInstaller::testdatabase() const +int TInstaller::test_type() const { TConfig ini(CONFIG_INSTALL, "Main"); - return ini.get("TestDatabase","Main",-1,"Y") != "N"; -} + int type = ini.get_int("Type"); + //se type non e' definito nei valori giusti (1=standard,2=server,3=client) + if (type < 1 || type > 3) + { + const bool testdb = ini.get_bool("TestDatabase"); + const bool testprg = ini.get_bool("TestPrograms"); + if (testdb) + type = 1; + else + type = 3; -bool TInstaller::testprograms() const -{ - TConfig ini(CONFIG_INSTALL, "Main"); - char c = ini.get("TestPrograms","Main",-1,"N")[0]; - return c == 'X' || c == 'Y'; -} - -int TInstaller::testtype() const -{ - return 0; + ini.set("Type", type); //cosi' lo definisce se non c'e' + } + return type; } bool TInstaller::test_assistance_year() const @@ -1555,17 +1554,24 @@ bool TInstaller::create() else update_dninst(false); // Aggiorna se necessario - if (testprograms()) - { - _m = new TInstaller_mask() ; + //crea la maschera di installazione + _m = new TInstaller_mask(); + + //se e' un client + if (test_type() == 3) + { _m->disable_check(); _m->disable(F_PATH); _m->disable(F_UPDATE); - _m->disable(DLG_USER); - return TSkeleton_application::create(); + _m->disable(DLG_USER); } + else //se e' standalone o server... + { + if (user() != ::dongle().administrator()) + return error_box(TR("Solo l'utente amministratore puo' aggiornare questa postazione!")); + } - return error_box(FR("L'utente %s non è abilitato all'uso di questo programma"), (const char *)user()); + return TSkeleton_application::create(); } void TInstaller::convert_archives() @@ -1585,68 +1591,26 @@ void TInstaller::convert_archives() void TInstaller::main_loop() { _m->run(); - if (_m->run_conversion() && testdatabase()) // Almeno un trr installato ? + if (_m->run_conversion() && test_type() < 3) // Almeno un trr installato e non e' client->conversione ammessa { convert_archives(); } - delete _m; _m = NULL; -} -class TExtendedInstaller : public TInstaller -{ -protected: - virtual bool create(); - virtual void main_loop(); -}; - -bool TExtendedInstaller::create() -{ - if (!TApplication::test_assistance_year()) - { - TExternal_app attivazione("ba1 -4"); - attivazione.run(); - dongle().login(); // Rilegge anno assistenza - } - else - update_dninst(false); // Aggiorna se necessario - - _m = new TInstaller_mask() ; - return TSkeleton_application::create(); -} - -void TExtendedInstaller::main_loop() -{ - _m->run(); - if (_m->run_conversion() && testdatabase()) // Almeno un modulo installato ? - { - convert_archives(); - } - const bool pending = _m->modules_pending(); delete _m; _m = NULL; - //le graffe servono per salvare il file campo.ini!! NON eliminarle + //le graffe servono per salvare il file campo.ini!! NON eliminarle { TConfig campo(CONFIG_INSTALL, "ba0close"); campo.set("ModulesPending", pending ? "1" : "0"); } TExternal_app ba0close("ba0close.exe"); - ba0close.run(true,true,false); // run asynchronous and not iconized! + ba0close.run(true, true, false); // run asynchronous and not iconized! } int ba1700(int argc, char* argv[]) { - const char* const PROGNAME = TR("Installazione moduli"); - - if (user() != ::dongle().administrator()) - { - TInstaller app; - app.run(argc, argv, PROGNAME); - } - else - { - TExtendedInstaller app; - app.run(argc, argv, PROGNAME); - } + TInstaller app; + app.run(argc, argv, TR("Installazione moduli")); return 0; }