Patch level : 314

Files correlati     : ba2.exe ba2200.msk ba6100a.msk ba6300a.msk
Ricompilazione Demo : [ ]
Commento            :

0001336: Backup
Se nel campo directory imposto una directory che non esiste (con l'intenzione quindi di fargliela creare la pgm stesso) la procedura và in errore.

Aggiunte toolbar moderne.


git-svn-id: svn://10.65.10.50/trunk@18920 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-05-25 09:59:53 +00:00
parent 0e580e607f
commit 7164ce314e
7 changed files with 150 additions and 144 deletions

View File

@ -82,7 +82,7 @@ bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
case F_DITTA:
if (e == fe_modify || e == fe_init)
{
set(F_RAGSOC, (o.get() != "") ? TR("Tutte le ditte") : TR("Nessuna ditta"));
set(F_RAGSOC, !o.empty() ? TR("Tutte le ditte") : TR("Nessuna ditta"));
}
break;
case F_CODDITTA:
@ -102,7 +102,7 @@ bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
default:
break;
}
return TRUE;
return true;
}
///////////////////////////////////////////////////////////
@ -111,7 +111,7 @@ bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
bool TArchive_app::create()
{
bool ok = TRUE;
bool ok = true;
TIsamfile utenti(LF_USER);
utenti.open(_excllock);
@ -177,9 +177,12 @@ void TArchive_app::add_file(const TFilename& name)
bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk)
{
bool ok = true;
TFilename output(archive);
output.ext("z00");
if (max_chunk > 0 && max_chunk < LONG_MAX) // Devo davvero suddividere archive?
{
int disk = 0;
unsigned long scritti = 0;
@ -193,7 +196,7 @@ bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk)
TString buf(BUFSIZE);
char* buffer = buf.get_buffer();
bool ok = TRUE;
ok = true;
while (ok)
{
const size_t letti = fread(buffer, 1, BUFSIZE, i);
@ -216,6 +219,17 @@ bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk)
}
fclose(i);
fclose(o);
archive.fremove();
}
else
{
if (output.exist())
output.fremove();
ok = ::rename(archive, output) == 0; // Basta rinominarlo
}
if (ok)
add_file(output);
return ok;
@ -227,21 +241,20 @@ bool TArchive_app::zip_dir(const TFilename& name, unsigned long max_chunk)
tmp.add(name.name());
tmp.ext("zip");
TFilename filenames = name; filenames.add("*.*");
bool ok = false;
if (name.full())
{
TFilename filenames = name; filenames.add("*.*");
TString msg;
msg << TR("Creazione del file temporaneo ") << tmp << "...";
TIndwin waitw(100,msg,FALSE,FALSE);
TWait_cursor hourglass;
bool ok = aga_zip(filenames, tmp);
if (ok && tmp.exist())
{
ok = split_file(tmp, max_chunk);
remove(tmp);
TIndwin waitw(100, msg, false, false);
ok = aga_zip(filenames, tmp);
}
if (ok && tmp.exist())
ok = split_file(tmp, max_chunk);
return ok;
}
@ -253,7 +266,7 @@ bool TArchive_app::can_save_as(const TFilename& src, const TFilename& dst) const
return xvt_fsys_test_disk_free_space(dst.left(3), s) != 0;
}
void TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk)
bool TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk)
{
// Assegna un disco di destinazione a tutti i files
int disk = 1;
@ -282,13 +295,18 @@ void TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& d
ok = yesno_box(FR("Controllare che il primo disco sia nel drive %c:\n%s"), floppy_path[0], msg);
else
ok = yesno_box(FR("Preparare %d dischetti vuoti e controllare che il primo sia nel drive %c:\n%s"), disk, floppy_path[0], msg);
if (!ok)
return;
}
else
{
if (!xvt_fsys_mkdir(floppy_path))
ok = error_box(FR("Impossibile creare la cartella %s"), (const char*)floppy_path);
}
if (ok)
{
const TDate oggi(TODAY);
TFilename name; name = floppy_path; name.add("backup.ini");
remove(name);
name.fremove();
TConfig ini(name, "Main");
ini.set("Date", oggi.string());
ini.set("Description", desc);
@ -326,26 +344,21 @@ void TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& d
while(!can_save_as(fi._name, dest))
{
if (!yesno_box(FR("Sul disco %d non c'e' spazio sufficiente per il file %s\nSi desidera sostituire il disco e ritentare?"), curr_disk, (const char*)dest))
return;
return false;
}
fcopy(fi._name, dest);
remove(fi._name);
fi._name.fremove();
}
}
return ok;
}
void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, const TString& desc)
{
TPointer_array ditte;
if (firm == 0)
{
TLocalisamfile nditte(LF_NDITTE);
for (int err = nditte.first(); err == NOERR; err = nditte.next())
{
const long f = nditte.get_long(NDT_CODDITTA);
if (prefix().test(f))
ditte.add_long(f);
}
}
prefix().firms(ditte);
else
ditte.add_long(firm);
@ -362,7 +375,7 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
_zip_list.destroy();
bool ok = TRUE;
bool ok = true;
TFilename name;
if (ok && (mode & 0x1))

View File

@ -1,6 +1,6 @@
#include "ba2200.h"
PAGE "Salvataggio / Ripristino archivi" -1 -1 72 10
PAGE "Salvataggio / Ripristino archivi" -1 -1 72 8
LIST F_FLOPPY 1 3
BEGIN
@ -62,20 +62,26 @@ BEGIN
FLAGS "D"
END
BUTTON F_ALL 10 2
BEGIN
PROMPT 58 4 "~Tutti"
MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CUSTOM|"",F_CODDITTA
END
STRING F_DESCR 50
BEGIN
PROMPT 1 7 "Descrizione "
END
ENDPAGE
TOOLBAR "topbar" 0 0 0 2
BUTTON F_ALL 10 2
BEGIN
PROMPT 58 4 "~Tutti"
MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CUSTOM|"",F_CODDITTA
PICTURE TOOL_MULTISEL
END
BUTTON F_SALVA 15 2
BEGIN
PROMPT -13 -1 "~Salvataggio"
PICTURE TOOL_SAVEREC
MESSAGE EXIT,K_SAVE
END
@ -83,13 +89,10 @@ BUTTON F_RIPR 15 2
BEGIN
PROMPT -23 -1 "~Ripristino"
MESSAGE EXIT,K_INS
PICTURE TOOL_IMPORT
END
BUTTON DLG_QUIT 15 2
BEGIN
PROMPT -33 -1 ""
END
#include <helpbar.h>
ENDPAGE

View File

@ -27,7 +27,7 @@ protected:
void restore(int mode, long firm, const TFilename& floppy_path);
void add_file(const TFilename& name);
void save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk);
bool save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk);
void load_zip_files(const TFilename& floppy_path);
bool can_save_as(const TFilename& src, const TFilename& dst) const;

View File

@ -5,28 +5,28 @@ TOOLBAR "Toolbar" 0 0 0 2
BUTTON BUT_BA6_ELENCO 10 2
BEGIN
PROMPT 4 14 "~Elenco"
PICTURE BMP_PRINTELENCO
PICTURE TOOL_PRINTELENCO
MESSAGE EXIT,BUT_BA6_ELENCO
END
BUTTON BUT_BA6_SCHEDE 10 2
BEGIN
PROMPT 16 14 "~Schede"
PICTURE BMP_PRINTSCHEDE
PICTURE TOOL_PRINTSCHEDE
MESSAGE EXIT,BUT_BA6_SCHEDE
END
BUTTON BUT_BA6_ETICHETTE 10 2
BEGIN
PROMPT 40 14 "E~tichette"
PICTURE BMP_PRINTETICH
PICTURE TOOL_PRINTETICH
MESSAGE EXIT,BUT_BA6_ETICHETTE
END
BUTTON BUT_BA6_RUBRICHE 10 2
BEGIN
PROMPT 28 14 "~Rubriche"
PICTURE BMP_PRINTRUBRICA
PICTURE TOOL_PRINTRUBRICA
MESSAGE EXIT,BUT_BA6_RUBRICHE
END
@ -39,28 +39,28 @@ END
BUTTON DLG_SETPRINT 2 2
BEGIN
PROMPT 1 1 "Imposta"
PICTURE BMP_SETPRINT
PICTURE TOOL_SETPRINT
END
BUTTON DLG_INFO 2 2
BEGIN
PROMPT 2 1 "Info"
MESSAGE EXIT,K_F2
PICTURE BMP_INFO
PICTURE TOOL_INFO
END
BUTTON DLG_HELP 2 2
BEGIN
PROMPT 3 1 "Help"
MESSAGE EXIT,K_F1
PICTURE BMP_HELP
PICTURE TOOL_HELP
END
BUTTON DLG_QUIT 2 2
BEGIN
PROMPT 5 1 "Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE TOOL_QUIT
END
ENDPAGE

View File

@ -1,7 +1,7 @@
#include "ba6200.h"
TOOLBAR "topbar" 0 0 0 2
#include "printbar.h"
#include <printbar.h>
ENDPAGE
PAGE "Stampa comuni" -1 -1 67 16

View File

@ -2,7 +2,6 @@
#include <applicat.h>
#include <mask.h>
#include <relation.h>
#include <reprint.h>
#include "ba6300a.h"

View File

@ -5,29 +5,20 @@ TOOLBAR "" 0 0 0 2
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -14 -11 "Nuovo"
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
PICTURE TOOL_NEWREC
END
BUTTON DLG_EDIT 10 2
BEGIN
PROMPT -24 -11 "Modifica"
PICTURE BMP_EDIT
PICTURE TOOL_EDIT
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -34 -11 "Stampa"
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -44 -11 ""
END
#include <printbar.h>
ENDPAGE
PAGE "Definizione Stampe Anagrafiche" 0 2 0 0
PAGE "Stampe Anagrafiche" 0 2 0 0
GROUPBOX DLG_NULL 76 11
BEGIN
PROMPT 1 1 "@bSelezione"
@ -227,7 +218,7 @@ BEGIN
MESSAGE ENABLE,F_PERSREP
END
STRING F_PERSREP 255 43
STRING F_PERSREP 260 43
BEGIN
PROMPT 2 19 "Report personalizzato "
END