diff --git a/ba/ba1200.cpp b/ba/ba1200.cpp index 4100f0953..725928088 100755 --- a/ba/ba1200.cpp +++ b/ba/ba1200.cpp @@ -2,8 +2,8 @@ #include #include +#include #include -#include /////////////////////////////////////////////////////////// // Testfile @@ -15,6 +15,7 @@ protected: void test1(); void test2(); void test3(); + void test4(); clock_t start_timer() const; @@ -131,12 +132,47 @@ void TTest_application::test3() message_box(msg); } +void TTest_application::test4() +{ + long r = 0; + srand(r); + TString8 cod; + + clock_t start; + { + const int times = 10; + TProgind p(times, TR("Lettura casuale tramite cache"), TRUE, TRUE); + cache().get(LF_COMUNI, cod); // Inizializzazione + start = start_timer(); + for (int i = 0; i < times; i++) + { + for (long j = 0; j < 10000; j++) + { + cod.format(" |%c%03d", 'A'+rand()%8, rand() % 1000); + cache().get(LF_COMUNI, cod); + r++; + } + p.addstatus(1); + if (p.iscancelled()) + break; + } + } + + const clock_t t = clock() - start; + TString msg; + msg.format("%ld records in %ld msec\n%lg records per sec", r, t, 1000.0*r/t); + message_box(msg); +} + + + void TTest_application::main_loop() { test1(); test2(); test3(); + test4(); } /////////////////////////////////////////////////////////// diff --git a/ba/ba1400.cpp b/ba/ba1400.cpp index 124c6e47b..2b8bcd9c4 100755 --- a/ba/ba1400.cpp +++ b/ba/ba1400.cpp @@ -502,16 +502,14 @@ bool TSet_users::p_notify(TSheet_field& f, int r, KEY k) void TSet_user_passwd::build_sheet(const TRectype* r) { - TString autstr; - TSheet_field& sf = sheet_field(); + TString autstr, d; if (r != NULL) - { autstr = r->get("AUTSTR"); - } const int l = autstr.len(); + + TSheet_field& sf = sheet_field(); sf.destroy(); - - TString d; + for (int i = 0; i < ENDAUT; i++) { d = _im->get_description_by_order(i); @@ -523,9 +521,7 @@ void TSet_user_passwd::build_sheet(const TRectype* r) if (r!= NULL && moduleget(F_USER) == ::dongle().administrator(); + const bool superuser = _msk->get(F_USER) == ::dongle().administrator(); const int uns = _im->unassigned(); TSheet_field& sf = sheet_field(); const int itms = sf.items(); @@ -577,8 +573,10 @@ void TSet_user_passwd::enable_aut() } else { - sf.enable_cell(i,1,!prassi && has_module(module, CHK_DONGLE)); - if (prassi) riga.add("X",1); + const bool on = !superuser && has_module(module, CHK_DONGLE); + sf.enable_cell(i,1,on); + if (superuser) + riga.add("X",1); } } } @@ -600,14 +598,20 @@ bool TSet_user_passwd::user_has_module(int mod) bool TSet_users::k_notify(TSheet_field& f, int r, KEY k) { - if (k == K_INS) + if (k == K_INS || k == K_DEL) return FALSE; + if (k == K_TAB) + { + TMask& m = f.sheet_mask(); + m.enable(F_ENABLE, f.cell_enabled(r, f.cid2index(F_ENABLE))); + } + return TRUE; } bool TSet_user_passwd::user_create() { - bool superuser = user() == ::dongle().administrator(); + const bool superuser = user() == ::dongle().administrator(); _rel = new TRelation(LF_USER); _im = new TInformazione_moduli; @@ -632,12 +636,7 @@ bool TSet_users::user_create() TSheet_field& sf = sheet_field(); sf.set_notify(k_notify); -#ifdef XVAGA const char* menuname = "bamenu.men"; -#else - const char* menuname = "baprassi.men"; -#endif - if (argc() > 2) menuname = argv(2); diff --git a/ba/ba1500.cpp b/ba/ba1500.cpp index b55fadd60..aef26fc5d 100755 --- a/ba/ba1500.cpp +++ b/ba/ba1500.cpp @@ -582,7 +582,8 @@ bool TAttivazione_moduli::burn_dongle() { const int module = riga->get_int(2); garble(module, str); - if (key == str) + const bool good = key == str; + if (good) { if (!din.active(module) && yesno_box(FR("Confermare l'attivazione del modulo %d:\n%s"),