From 7efdf9a23f31e8acacf50a1ff7707554ca537cc1 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 22 Sep 2014 13:50:33 +0000 Subject: [PATCH] Migliorata presentazione ed esportazione tracciati record git-svn-id: svn://10.65.10.50/branches/R_10_00@22990 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100.cpp | 35 +++++++++--------------- ba/ba0103.cpp | 7 +++-- ba/ba1100.cpp | 73 +++++++++++++++++++++----------------------------- ba/ba1100d.uml | 6 ++--- ba/ba1200.cpp | 6 ++--- ba/ba1600.cpp | 6 ++--- ba/ba1700.cpp | 13 +-------- ba/ba8200.cpp | 10 ++++--- 8 files changed, 62 insertions(+), 94 deletions(-) diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index cae7d2c2b..5b96ae737 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -983,20 +983,9 @@ int TMenu_application::do_level() void TMenu_application::test_temp() { - TFilename dir; dir.tempdir(); // Directory temporanea - dir.add("*"); - TString_array files; - const int count = ::list_files(dir, files); - - if (count > 0 && yesno_box(TR("Cancellare tutti i file temporanei in %s?"), dir.path())) - { - TProgress_monitor bar(count, TR("Cancellazione file temporanei")); - for (int i = count-1; i >= 0 && bar.add_status(); i--) - { - const char* e = files.row(i); - ::remove(e); - } - } + TFilename dir; dir.tempdir(); // Directory temporanea + if (count_files(dir, true) > 20 && yesno_box(FR("Cancellare tutti i file temporanei in %s?"), (const char*)dir)) + remove_files(dir, true); } HIDDEN bool pwd_handler(TMask_field& fld, KEY key) @@ -1767,9 +1756,7 @@ long TStudy_mask::handler(WINDOW win, EVENT* e) bool TStudy_mask::is_valid_study(const char* path) const { - TFilename n = path; - n.add("com/dir.gen"); - //return n.find(' ') < 0 && n.exist(); + TFilename n = path; n.add("com/dir.gen"); return n.find(' ') < 0 && xvt_fsys_access(n, 0x2) == 0; // NO blanks and write permission } @@ -1841,6 +1828,8 @@ bool TStudy_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { strBest = study; dBest = score; + if (score == 1.0) + break; } } if (dBest > 0.75) @@ -1888,19 +1877,19 @@ bool TMenu_application::choose_study() long ditta = prefix().get_codditta(); if (ditta > 0) ini_set_int(CONFIG_STUDIO, "Main", "Firm", ditta); - deconnect_user(); - prefix().set_studio(m.get(DLG_USER)); - ok = check_user(); + + ok = prefix().set_studio(m.get(DLG_USER)); if (ok) { ditta = ini_get_int(CONFIG_STUDIO, "Main", "Firm", 0); _menu.set_firm(ditta); + deconnect_user(); + ok = check_user(); + } + if (ok) _mask->stop_run(K_F9); // Ricarica maschera - } else - { dispatch_e_menu(M_FILE_QUIT); // Termina applicazione gracefully - } } // Abilita le voci di personalizzazione diff --git a/ba/ba0103.cpp b/ba/ba0103.cpp index 668953d7d..241cb382d 100755 --- a/ba/ba0103.cpp +++ b/ba/ba0103.cpp @@ -676,14 +676,13 @@ long TOutlook_mask::handler(WINDOW w, EVENT* ep) switch (ep->v.cmd.tag) { case 8001: - set(DLG_LOOK, "", true); // Seleziona menu completo + set(DLG_LOOK, "", true); // Seleziona menu completo break; case 8002: - load_perspective(0); // Ricarica default + load_perspective(0); // Ricarica default break; case 8003: - xvt_dm_post_string_prompt(TR("Testo da cercare"), - _last_search.get_buffer(), _last_search.size()); + xvt_dm_post_string_prompt(TR("Testo da cercare"), _last_search.get_buffer(), _last_search.size()); // continue to 8004 case 8004: if (_last_search.full() && _tree.find_string(_last_search)) diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index ffdfe883c..2da6d7dc0 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -54,7 +54,7 @@ protected: bool set_converting(); bool reset_converting(); - bool recover(TSystemisamfile& f, int err); + bool try_to_recover(TSystemisamfile& f, int err); void update(); void update_dir(); void convert_dir(); @@ -87,7 +87,6 @@ HIDDEN bool browse_file_handler(TMask_field& f, KEY k) TFilename fname = f.get(); fname.ext("dbf"); xvt_fsys_convert_str_to_fspec(fname, &fs); xvt_fsys_get_default_dir(&fs.dir); - xvt_fsys_save_dir(); if (xvt_dm_post_file_open(&fs, TR("Selezione file")) == FL_OK) { TFilename n; @@ -95,7 +94,6 @@ HIDDEN bool browse_file_handler(TMask_field& f, KEY k) n.add(fs.name); f.set(n); } - xvt_fsys_restore_dir(); f.set_focus(); } @@ -115,11 +113,7 @@ TManutenzione_app::TManutenzione_app() : _browse(NULL), _mask(NULL), _firm(0), _ fd.EOD = fd.EOX = 1L; fd.Flags = 0; -#ifdef WIN32 int handle = sopen(Dir_file, O_RDWR|O_BINARY|O_CREAT,SH_DENYNO,S_IREAD|S_IWRITE); -#else - int handle = open(Dir_file, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); -#endif if (handle != -1) { if (write( handle, &fd, sizeof(FileDes)) == -1) @@ -133,11 +127,7 @@ TManutenzione_app::TManutenzione_app() : _browse(NULL), _mask(NULL), _firm(0), _ { TTrec r; RecDes& rd = r.rec(); -#ifdef WIN32 int handle = sopen(Trc_file, O_RDWR|O_BINARY|O_CREAT,SH_DENYNO,S_IREAD|S_IWRITE); -#else - int handle = open(Trc_file, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); -#endif if (handle != -1) { if (write( handle, (void*)&rd, sizeof(RecDes)) == -1) @@ -179,6 +169,7 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r) row.put(TR("Pag. @#"), 69); p.setheaderline(2, row); row.reset(); + row.put(HR("N."), 2); row.put(HR("Nome"), 7); row.put(HR("Tipo"), 18); row.put(HR("Lun."), 38); @@ -189,6 +180,7 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r) TString riga(78); riga.fill('-'); row.put(riga, 1); + p.setheaderline(3, row); p.setheaderline(5, row); int i; @@ -334,16 +326,12 @@ bool TManutenzione_app::create() // initvar e arrmask bool des_too = true; // Anche le descrizioni long modules = -1; // Tutti i moduli if (c < 4) - { - error_box("Usage: BA1 -0 -D [0|1] []"); - return false; - } - TFilename dir(argv(3)); - if (!fexist(dir)) - { - error_box(FR("Non esiste il direttorio %s"), (const char*)dir); - return false; - } + return error_box("Usage: BA1 -0 -D [0|1] []"); + + const TFilename dir(argv(3)); + if (!dexist(dir)) + return error_box(FR("Non esiste la cartella %s"), (const char*)dir); + if (c == 5) des_too = atoi(argv(4)) ? true : false; if (c == 6) @@ -691,8 +679,8 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga) } if (tasto == K_F5 && logicnum >= LF_USER) { - f.packfile(); - f.packindex(); + f.packfile(true); + f.packindex(true); // le 4 righe seguenti servono per allineare i valori di EOD ed EOX dopo una compattazione forzata dir.get(logicnum, _lock, _nordir, _sysdirop); dir.set(dep.SysName, dep.EOD, dep.Flags, dep.Des, dep.FCalc); @@ -794,10 +782,10 @@ void TManutenzione_app::delete_riga (long riga_sel) error_box(FR("Eliminazione del file %d non effettuata"), logicnum); } -bool TManutenzione_app::recover(TSystemisamfile& f, int err) +bool TManutenzione_app::try_to_recover(TSystemisamfile& f, int err) { if (err == -60 || err == -64 || err == _ispatherr || (err > -600 && err <= -300)) - err = f.packindex(false, false); + err = f.packindex(true, false); return err == NOERR; } @@ -869,7 +857,8 @@ void TManutenzione_app::update_dir() if (is_com) prompt << TR("Aggiornamento dati comuni"); else - prompt << TR("Aggiornamento ditta") << ' ' << atol(pref) << '.'; + prompt << TR("Aggiornamento ditta") << ' ' << atol(pref); + prompt << ".\n"; TProgind p(update_items ? update_items : 1, prompt, false, true); @@ -960,6 +949,10 @@ void TManutenzione_app::update_dir() if (err != NOERR && flags < 10000L) { + TString msg(_MAX_PATH); + msg << prompt << TR("Recupero file ") << d.filename(); + p.set_text(msg); + if (err == _istrcerr || err == _isbadtrc) { repair_file(i); @@ -967,9 +960,8 @@ void TManutenzione_app::update_dir() } if (err != NOERR && flags < 10000L) { - if (!recover(b, err)) + if (!try_to_recover(b, err)) { - TString msg(_MAX_PATH); msg.format(TR("Impossibile compattare il file %d - %s : errore n.ro %d"), i, (const char*)d.filename(), err); write_log(msg, 2); @@ -1182,13 +1174,12 @@ void TManutenzione_app::convert_dir() const int update_items = (last_new_item < last_curr_item) ? last_new_item : last_curr_item; TString s; + s << TR("Aggiornamento archivi "); if (is_com) - s = TR("Aggiornamento archivi comuni.\n"); + s << TR("comuni"); else - { - s = TR("Aggiornamento archivi della ditta "); - s << atol (pref) << ".\n"; - } + s << TR("ditta ") << atol (pref); + s << ".\n"; TProgind p(update_items ? update_items : 1, s, is_power_station()); for (int i = LF_USER; i <= update_items; i++) @@ -1207,7 +1198,7 @@ void TManutenzione_app::convert_dir() d.get(i, _nolock, _nordir, _sysdirop); TString msg = s; msg << d.filename(); - p.set_text(msg); + p.set_text(msg); const int module = abs((int)ds.flags()); TSystemisamfile f(i); @@ -1393,6 +1384,7 @@ void TManutenzione_app::load_des() if (prefix().is_com()) s << TR("comuni"); else s << TR("ditta ") << atol (pref); } + TProgress_monitor p(items ? items : 1, s, false); for (int i = LF_USER; i <= items; i++) { @@ -1511,33 +1503,28 @@ void TManutenzione_app::update() if (firm == 0) pref = prefix().name(); - do_events(); - prefix().set(""); load_des(); prefix().set_codditta(0L); + TString mxs; mxs = TR("Conversione dati comuni"); + open_log(); - write_log(TR("Conversione Dati comuni")); + write_log(mxs); write_log(""); TPointer_array ditte; // Evita di aprire LF_NDITTE const int nditte = prefix().firms(ditte); - TProgress_monitor p(nditte, TR("Conversione archivi ditte."), is_power_station()); - p.addstatus(1); update_dir(); convert_dir(); for (int i = 0; i < nditte; i++) { - if (!p.add_status()) - break; const long codditta = ditte.get_long(i); - TString80 mxs; mxs << TR("Conversione Ditta") << ' ' << codditta; - p.set_text(mxs); if (codditta > _history_firm && prefix().exist(codditta) && set_firm(codditta)) { + mxs.cut(0) << TR("Conversione Ditta") << ' ' << codditta; write_log(""); write_log(mxs); write_log(""); diff --git a/ba/ba1100d.uml b/ba/ba1100d.uml index ad30af99f..30012fd9b 100755 --- a/ba/ba1100d.uml +++ b/ba/ba1100d.uml @@ -54,7 +54,7 @@ BEGIN FLAGS "D" END -SPREADSHEET F_FIELDS 0 14 +SPREADSHEET F_FIELDS 0 -7 BEGIN PROMPT 0 1 "Fields" ITEM "Nome@10" @@ -64,9 +64,9 @@ BEGIN ITEM "Descrizione@72" END -SPREADSHEET F_KEYS +SPREADSHEET F_KEYS 0 5 BEGIN - PROMPT 0 16 "Keys" + PROMPT 0 -2 "Keys" ITEM "Espressione@65" ITEM "Chiavi duplicate" END diff --git a/ba/ba1200.cpp b/ba/ba1200.cpp index 61ac05cd3..712d3c701 100755 --- a/ba/ba1200.cpp +++ b/ba/ba1200.cpp @@ -15,7 +15,7 @@ public: TProfiler_mask(); }; -TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 14) +TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 15) { add_button_tool(DLG_OK, PR("Elabora"), TOOL_ELABORA); add_button_tool(DLG_INFO, PR("Info"), TOOL_INFO); @@ -239,7 +239,7 @@ bool TTest_application::test4(TLog_report& log) const clock_t t = clock() - start; TString msg; - msg.format("Lettura casuale di %ld records in %ld msec - %lg records per sec", + msg.format("Lettura cached di %ld records in %ld msec - %lg records per sec", r, t, 1000.0*r/t); log.log(0, msg); return ok; @@ -454,7 +454,7 @@ void TTest_application::main_loop() TLog_report log(TR("Report")); bool ok = true; - for (int t = 1; ok && t <= 6; t++) + for (int t = 1; ok && t <= 7; t++) { if (te <= 0 || te == t) { diff --git a/ba/ba1600.cpp b/ba/ba1600.cpp index 7834df31f..ee2f2c5ea 100755 --- a/ba/ba1600.cpp +++ b/ba/ba1600.cpp @@ -169,7 +169,7 @@ int TInstall_ini::build_app_list(const TString& module, TString_array& a) FOR_EACH_ASSOC_STRING(varlist, obj, key, str) { int num = 0; - if (sscanf(key, "Edit_%d", &num) == 1) + if (sscanf_s(key, "Edit_%d", &num) == 1) { row = "Edit"; row.add(num); @@ -1847,7 +1847,7 @@ int TCreadischi_mask::split_file(const TFilename& archive, size_t chunk_size) co if (chunk_size < minsize) chunk_size = minsize; - FILE* inf = fopen(archive, "rb"); + FILE* inf = NULL; fopen_s(&inf, archive, "rb"); if (inf == NULL) return 0; @@ -1863,7 +1863,7 @@ int TCreadischi_mask::split_file(const TFilename& archive, size_t chunk_size) co { TFilename chunk(archive); chunk.ext(""); chunk << d; chunk.ext("zip"); - FILE* ouf = fopen(chunk, "wb"); + FILE* ouf = NULL; fopen_s(&ouf, chunk, "wb"); fwrite(buff, r, 1, ouf); fclose(ouf); disks = d; diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp index da20dc39f..87fcd6ce8 100755 --- a/ba/ba1700.cpp +++ b/ba/ba1700.cpp @@ -460,18 +460,7 @@ bool TInstaller_mask::autoload() parse_internet_path(http_server, http_path); //controlla il path internet scritto nel campo sulla maschera //se si ritrova dei vecchi file nella directory temporanea, la pulisce per evitare casini - ininame = path; ininame.add("*.*"); - TString_array list; - const int cache_files = ::list_files(ininame, list); - if (cache_files > 0) - { - TProgress_monitor pi(cache_files, TR("Azzeramento cache"), false); - FOR_EACH_ARRAY_ROW(list, i, row) - { - pi.add_status(); - xvt_fsys_remove_file(*row); - } - } + remove_files(path, true); ininame = path; ininame.add(TInstall_ini::default_name()); diff --git a/ba/ba8200.cpp b/ba/ba8200.cpp index 65c004f09..2b0c43beb 100755 --- a/ba/ba8200.cpp +++ b/ba/ba8200.cpp @@ -809,6 +809,10 @@ bool TQuery_mask::ask_vars(const char* maskname, TRecordset& recset) const return recset.ask_variables(true); TMask m(maskname); + TString title; m.get_caption(title); + if (title.full()) + main_app().set_title(title); + TVariant var; for (int i = m.fields()-1; i >= 0; i--) { @@ -914,10 +918,7 @@ void TQuery_mask::save_as(TRecordsetExportFormat fmt, const char* ext) return; } - - xvt_fsys_save_dir(); TFilename path; path.tempdir(); - if (ext == NULL || *ext == '\0') { switch (fmt) @@ -1187,7 +1188,10 @@ bool TQuery_mask::load_query() if (desc != NULL) { TString str; desc->GetEnclosedText(str); + if (str.blank()) + str = path.name_only(); set(F_DESCR, str); + main_app().set_title(str); } TXmlItem* tables = xml.FindFirst("tables");