From 3d7c536a2574868d28b3801b40a0098cfe4723c1 Mon Sep 17 00:00:00 2001 From: luca Date: Wed, 9 May 2007 12:50:42 +0000 Subject: [PATCH] Patch level :4.0 700 Files correlati : Ricompilazione Demo : [ ] Commento :sistemato il problema del lancio di ba0close in caso di installazione con menu old stylish (ripreso dalla 3.0 e 3.1) git-svn-id: svn://10.65.10.50/trunk@15312 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100.cpp | 39 ++++++++++++++++----------- ba/ba0101.cpp | 73 ++++++++++++++++++++++++++------------------------- ba/ba0101.h | 2 ++ 3 files changed, 62 insertions(+), 52 deletions(-) diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index 27564c981..968612c10 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -2,9 +2,9 @@ #include #include -#include +//#include -#include +//#include #include #include #include @@ -13,13 +13,13 @@ #include #include #include -#include +//#include #include #include #include -#include +//#include #include #include @@ -372,11 +372,18 @@ bool TExplorer_mask::stop_run(KEY k) for (i = 2; i >= 0; i--) xvt_image_destroy(image[i]); - if (!yesno_box(TR("Si desidera uscire?"))) //..altrimenti chiede educatamente se si desidera uscire + if (installing()) //se e' stata lanciata la installazione moduli... + { + xvt_sys_sleep(1); //..aspetta un attimo poi forza l'uscita + } + else { - for (i = 0; i < 3; i++) - xvt_dwin_invalidate_rect(window[i], NULL); - return false; + if (!yesno_box(TR("Si desidera uscire?"))) //..altrimenti chiede educatamente se si desidera uscire + { + for (i = 0; i < 3; i++) + xvt_dwin_invalidate_rect(window[i], NULL); + return false; + } } } } @@ -1188,7 +1195,7 @@ bool TMenu_application::test_programs() if (remote_name.exist()) { - TProgind pi(3, TR("Controllo aggiornamento programmi"), false, TRUE); + TProgind pi(3, TR("Controllo aggiornamento programmi"), false, true); TConfig remote_install(remote_name, "Main"); remote_install.write_protect(); @@ -1249,15 +1256,12 @@ bool TMenu_application::test_programs() (!more && !yesno_box(TR("Si desidera aggiornare i moduli adesso?")))) break; - const TString old_user = user(); user() = dongle().administrator(); // Divento temporaneamente amministratore TExternal_app app("ba1 -6"); - app.run(true); //lancia ba1 senza ba0 - user() = old_user; // Ripristino utente normale - more = true; // ricontrolla - - //if (sys_dll_changed()) //costringe ad uscire dal programma se si e' installato il modulo SY - return false; + app.run(true); + set_installing_flag(); + //se lancia un'installazione->esce!!! + return false; } _menu.set_dangerous_modules(dangerous); return true; @@ -1349,6 +1353,9 @@ void TMenu_application::main_loop() _menu.perform(); else run = m >= -1; + + if (installing()) //esce dal ciclo se ha lanciato una installazione moduli + break; } } diff --git a/ba/ba0101.cpp b/ba/ba0101.cpp index bbe7c1057..1858f8e99 100755 --- a/ba/ba0101.cpp +++ b/ba/ba0101.cpp @@ -3,12 +3,11 @@ #include #include #include +#include #include #include #include -#include - #include "ba0100a.h" #include "ba0101.h" #include "ba0100.h" @@ -26,6 +25,17 @@ bool sys_dll_changed() return k > 0; } +static bool _installing = false; + +void set_installing_flag() +{ + _installing = true; +} + +bool installing() +{ + return _installing; +} static bool is_visible(const int cod) { @@ -134,7 +144,7 @@ public: TMenuitem::TMenuitem(TSubmenu* sm) : _submenu(sm), _icon(0),_color(NORMAL_COLOR), _exist(-1), - _firm(FALSE), _password(FALSE), _reloadmenu(FALSE) + _firm(false), _password(false), _reloadmenu(false) { } @@ -175,10 +185,10 @@ bool TMenuitem::create(const char* t) { switch(toupper(flags[i])) { - case 'D': _exist = FALSE; break; - case 'F': _firm = TRUE; break; - case 'P': _password = TRUE; break; - case 'R': _reloadmenu = TRUE; break; + case 'D': _exist = false; break; + case 'F': _firm = true; break; + case 'P': _password = true; break; + case 'R': _reloadmenu = true; break; case 'E': visible = dongle().active(EEAUT); // Nascondi i moduli dipendenti da EE default : break; } @@ -221,7 +231,7 @@ int TMenuitem::icon() const bool TMenuitem::enabled() const { - bool yes = FALSE; + bool yes = false; if (_exist) { if (is_submenu()) @@ -283,14 +293,14 @@ bool TMenuitem::perform_submenu() const bool TMenuitem::perform_program() const { - bool ok = TRUE; + bool ok = true; if (_password) { TMask mask("ba0100a"); mask.disable(F_USER); mask.set(F_USER, "SERVIZIO"); - ok = FALSE; + ok = false; if (mask.run() == K_ENTER) { const TDate oggi(TODAY); @@ -309,32 +319,24 @@ bool TMenuitem::perform_program() const if (ok) { -// const bool maintenance_app = _action.starts_with("ba1 -0", true); - const bool install_app = _action.starts_with("ba1 -6", true); - TCurrency::force_cache_update(); // Chiude cache valute prefix().set(NULL); // Chiude prefix TExternal_app a(_action); - const bool async = install_app; // Lancio l'installazione moduli sempre asincrona - a.run(async, 3); + + const bool install_app = _action.starts_with("ba1 -6", true); + if (install_app) + { + user() = dongle().administrator(); // Divento temporaneamente amministratore + a.run(true,3); //e' una installazione -> applicazione in asincrono + set_installing_flag(); + } + else + a.run(false,3); //e' un programma normale->sincrono prefix().set("DEF"); // Aggiorna prefix - - if (install_app) - { - WINDOW w = cur_win(); - if (w != NULL_WIN) //TExplorer_mask - dispatch_e_char(w, K_FORCE_CLOSE); //chiude senza chiedere conferma (installazione e roba simile) - else - { - EVENT e; memset(&e, 0, sizeof(e)); - e.type = E_CLOSE; - dispatch_event(TASK_WIN, e, true); - } - } printer_destroy(); // Forza rilettura parametri della stampante - } + } return ok; } @@ -358,7 +360,7 @@ bool TMenuitem::perform() const TSubmenu::TSubmenu(TMenu* menu, const char* name) : _menu(menu), _name(name), _items(12), - _enabled(TRUE), _firm(FALSE) + _enabled(true), _firm(false) { } @@ -413,7 +415,7 @@ void TSubmenu::read(TScanner& scanner) TString16 flags; get_next_string(line, 6, flags, brace); if (flags.find('D') >= 0) - _enabled = FALSE; + _enabled = false; if (flags.find('F') >= 0) _firm = true; } else @@ -667,12 +669,12 @@ bool TMenu::can_be_transparent(const TImage& i) const const int h = i.height()-1; const COLOR col = i.get_pixel(0,0); if (i.get_pixel(w,0) != col) - return FALSE; + return false; if (i.get_pixel(w,h) != col) - return FALSE; + return false; if (i.get_pixel(0,h) != col) - return FALSE; - return TRUE; + return false; + return true; } TImage& TMenu::image(const char* name) @@ -684,7 +686,6 @@ TImage& TMenu::image(const char* name) const char* ext[4] = { "jpg", "gif", "bmp", "png" }; bool bFound = false; for (int i = 0; i < 4 && !bFound; i++) - { realname = name; realname.ext(ext[i]); diff --git a/ba/ba0101.h b/ba/ba0101.h index 78318fc68..eb89b4034 100755 --- a/ba/ba0101.h +++ b/ba/ba0101.h @@ -169,5 +169,7 @@ public: bool sys_dll_changed(); +void set_installing_flag(); +bool installing(); #endif