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:
parent
0e580e607f
commit
7164ce314e
225
ba/ba2200.cpp
225
ba/ba2200.cpp
@ -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,46 +177,60 @@ 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");
|
||||
|
||||
int disk = 0;
|
||||
unsigned long scritti = 0;
|
||||
|
||||
FILE* i = fopen(archive, "rb");
|
||||
if (i == NULL)
|
||||
return FALSE;
|
||||
|
||||
FILE* o = fopen(output, "wb");
|
||||
|
||||
const int BUFSIZE = 1024*16;
|
||||
TString buf(BUFSIZE);
|
||||
char* buffer = buf.get_buffer();
|
||||
|
||||
bool ok = TRUE;
|
||||
while (ok)
|
||||
if (max_chunk > 0 && max_chunk < LONG_MAX) // Devo davvero suddividere archive?
|
||||
{
|
||||
const size_t letti = fread(buffer, 1, BUFSIZE, i);
|
||||
if (letti == 0)
|
||||
break;
|
||||
|
||||
if (scritti >= max_chunk)
|
||||
{
|
||||
fclose(o);
|
||||
add_file(output);
|
||||
|
||||
TString4 ext; ext.format("z%02d", ++disk);
|
||||
output.ext(ext);
|
||||
o = fopen(output, "wb");
|
||||
scritti = 0;
|
||||
}
|
||||
int disk = 0;
|
||||
unsigned long scritti = 0;
|
||||
|
||||
ok = fwrite(buffer, letti, 1, o) > 0;
|
||||
scritti += letti;
|
||||
}
|
||||
fclose(i);
|
||||
fclose(o);
|
||||
add_file(output);
|
||||
FILE* i = fopen(archive, "rb");
|
||||
if (i == NULL)
|
||||
return FALSE;
|
||||
|
||||
FILE* o = fopen(output, "wb");
|
||||
|
||||
const int BUFSIZE = 1024*16;
|
||||
TString buf(BUFSIZE);
|
||||
char* buffer = buf.get_buffer();
|
||||
|
||||
ok = true;
|
||||
while (ok)
|
||||
{
|
||||
const size_t letti = fread(buffer, 1, BUFSIZE, i);
|
||||
if (letti == 0)
|
||||
break;
|
||||
|
||||
if (scritti >= max_chunk)
|
||||
{
|
||||
fclose(o);
|
||||
add_file(output);
|
||||
|
||||
TString4 ext; ext.format("z%02d", ++disk);
|
||||
output.ext(ext);
|
||||
o = fopen(output, "wb");
|
||||
scritti = 0;
|
||||
}
|
||||
|
||||
ok = fwrite(buffer, letti, 1, o) > 0;
|
||||
scritti += letti;
|
||||
}
|
||||
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,20 +241,19 @@ 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;
|
||||
|
||||
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())
|
||||
{
|
||||
if (name.full())
|
||||
{
|
||||
TFilename filenames = name; filenames.add("*.*");
|
||||
TString msg;
|
||||
msg << TR("Creazione del file temporaneo ") << tmp << "...";
|
||||
TIndwin waitw(100, msg, false, false);
|
||||
ok = aga_zip(filenames, tmp);
|
||||
}
|
||||
|
||||
if (ok && tmp.exist())
|
||||
ok = split_file(tmp, max_chunk);
|
||||
remove(tmp);
|
||||
}
|
||||
|
||||
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,70 +295,70 @@ 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;
|
||||
}
|
||||
|
||||
const TDate oggi(TODAY);
|
||||
TFilename name; name = floppy_path; name.add("backup.ini");
|
||||
remove(name);
|
||||
TConfig ini(name, "Main");
|
||||
ini.set("Date", oggi.string());
|
||||
ini.set("Description", desc);
|
||||
ini.set("Disks", disk);
|
||||
ini.set("Format", "zip");
|
||||
|
||||
TFilename last_name;
|
||||
long size = 0;
|
||||
for (i = 0; i < _zip_list.items(); i++)
|
||||
else
|
||||
{
|
||||
const TAFile_info& fi = (const TAFile_info&)_zip_list[i];
|
||||
name = fi._name.name(); name.ext("");
|
||||
if (name != last_name)
|
||||
{
|
||||
ini.set("FirstDisk", fi._disk, name);
|
||||
last_name = name;
|
||||
size = 0;
|
||||
}
|
||||
ini.set("LastDisk", fi._disk);
|
||||
ini.set("Size", size += fi._size);
|
||||
}
|
||||
ini.set_paragraph("Main"); // Forza scrittura ultimo paragrafo
|
||||
if (!xvt_fsys_mkdir(floppy_path))
|
||||
ok = error_box(FR("Impossibile creare la cartella %s"), (const char*)floppy_path);
|
||||
}
|
||||
|
||||
int curr_disk = 1;
|
||||
|
||||
TProgind pi(_zip_list.items(), TR("Salvataggio dati in corso..."), FALSE, TRUE);
|
||||
for (i = 0; i < _zip_list.items(); i++)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
const TAFile_info& fi = (const TAFile_info&)_zip_list[i];
|
||||
if (fi._disk != curr_disk)
|
||||
message_box(FR("Inserire il disco vuoto n.%d"), curr_disk = fi._disk);
|
||||
TFilename dest;
|
||||
dest = floppy_path; dest.add(fi._name.name());
|
||||
while(!can_save_as(fi._name, dest))
|
||||
if (ok)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
TFilename name; name = floppy_path; name.add("backup.ini");
|
||||
name.fremove();
|
||||
TConfig ini(name, "Main");
|
||||
ini.set("Date", oggi.string());
|
||||
ini.set("Description", desc);
|
||||
ini.set("Disks", disk);
|
||||
ini.set("Format", "zip");
|
||||
|
||||
TFilename last_name;
|
||||
long size = 0;
|
||||
for (i = 0; i < _zip_list.items(); i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
fcopy(fi._name, dest);
|
||||
remove(fi._name);
|
||||
}
|
||||
const TAFile_info& fi = (const TAFile_info&)_zip_list[i];
|
||||
name = fi._name.name(); name.ext("");
|
||||
if (name != last_name)
|
||||
{
|
||||
ini.set("FirstDisk", fi._disk, name);
|
||||
last_name = name;
|
||||
size = 0;
|
||||
}
|
||||
ini.set("LastDisk", fi._disk);
|
||||
ini.set("Size", size += fi._size);
|
||||
}
|
||||
ini.set_paragraph("Main"); // Forza scrittura ultimo paragrafo
|
||||
|
||||
int curr_disk = 1;
|
||||
|
||||
TProgind pi(_zip_list.items(), TR("Salvataggio dati in corso..."), FALSE, TRUE);
|
||||
for (i = 0; i < _zip_list.items(); i++)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
const TAFile_info& fi = (const TAFile_info&)_zip_list[i];
|
||||
if (fi._disk != curr_disk)
|
||||
message_box(FR("Inserire il disco vuoto n.%d"), curr_disk = fi._disk);
|
||||
TFilename dest;
|
||||
dest = floppy_path; dest.add(fi._name.name());
|
||||
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 false;
|
||||
}
|
||||
fcopy(fi._name, dest);
|
||||
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))
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
|
||||
#include "ba6300a.h"
|
||||
|
@ -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,9 +218,9 @@ BEGIN
|
||||
MESSAGE ENABLE,F_PERSREP
|
||||
END
|
||||
|
||||
STRING F_PERSREP 255 43
|
||||
STRING F_PERSREP 260 43
|
||||
BEGIN
|
||||
PROMPT 2 19 "Report personalizzato"
|
||||
PROMPT 2 19 "Report personalizzato "
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
Loading…
x
Reference in New Issue
Block a user