Merge branch 'R12.00.1244' of http://10.65.20.33/sirio/CAMPO/campo into R12.00.1244

This commit is contained in:
smen 2023-02-22 14:14:18 +01:00
commit c6fdb42271
4 changed files with 517 additions and 97 deletions

View File

@ -6,12 +6,16 @@
#include <mailbox.h>
#include <progind.h>
#include <utility.h>
#include <mask.h>
#include "ba2200.h"
#include "ba2201.h"
#include <user.h>
#include <nditte.h>
#include <sheet.h>
#include "mask.h"
struct TAFile_info : public TObject
{
@ -30,13 +34,20 @@ bool is_real_floppy(const TFilename& path)
// Archiving mask
///////////////////////////////////////////////////////////
class TArchive_mask : public TAutomask
class TArchive_mask : public TAutomask
{
private:
int _selected=-1; // -1: nessuna selezione altrimenti si sala la riga selezionata
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual bool on_key(KEY key);
public:
TArchive_mask();
void load_sheet();
void fill_field();
const TString& get_selected() const;
};
TArchive_mask::TArchive_mask() : TAutomask("ba2200")
@ -45,6 +56,7 @@ TArchive_mask::TArchive_mask() : TAutomask("ba2200")
TToken_string codes, values;
TString4 str;
int k = 0;
for (int d = 0; d < 26; d++)
{
str.format("%c:", 'A'+d);
@ -62,11 +74,42 @@ TArchive_mask::TArchive_mask() : TAutomask("ba2200")
message.format("ENABLE,%d", F_PATH);
}
}
enable(F_RIPR, false);
enable(F_DELETE, false);
lf.replace_items(codes, values);
fill_field();
load_sheet();
}
void TArchive_mask::fill_field()
{
TFilename bkp_path = ini_get_string(CONFIG_STUDIO, "ba", "BkpPath");
if (bkp_path.full())
{
TList_field& lf = lfield(F_FLOPPY);
if (bkp_path[1] == ':')
{
lf.set(bkp_path.left(2));
TString b = get(F_FLOPPY);
set(F_PATH, bkp_path.mid(2));
TFilename path = get(F_FLOPPY); path << SLASH; path.add(get(F_PATH));
}
if (!bkp_path.exist())
error_box(FR("Percorso non valido: %s"), (const char*)bkp_path);
else
{
enable(F_PATH, false);
enable(F_FLOPPY, false);
}
}
}
bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
{
short a = o.dlg();
TSheet_field& sf = sfield(F_BKPTABLE);
switch (o.dlg())
{
case F_PATH:
@ -87,11 +130,18 @@ bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
if (path[1] == ':')
{
set(F_FLOPPY, path.left(2));
TString a = get(F_FLOPPY);
o.set(path.mid(2));
}
path = get(F_FLOPPY); path << SLASH; path.add(o.get());
if (!path.exist())
return error_box(FR("Percorso non valido: %s"), (const char*)path);
if (!path.exist())
return error_box(FR("Percorso non valido: %s"), (const char*)path);
else
{
ini_set_string(CONFIG_STUDIO, "ba", "BkpPath", path);
load_sheet();
}
}
break;
case F_DITTA:
@ -114,12 +164,108 @@ bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
if (ditta > 0L && !prefix().exist(ditta))
return error_box(FR("La ditta %ld non esiste"), ditta);
}
break;
case F_RELOAD:
if (e == fe_button)
{
load_sheet();
}
break;
case F_DELETE:
if (e == fe_button)
{
TFilename path = get(F_FLOPPY); path << SLASH; path.add(get(F_PATH))<<SLASH;
path.add(sf.get_str_row_cell(_selected, S_NOME));
TFilename mask = path << SLASH; mask.add("*.*");
SLIST files = xvt_fsys_list_files("", mask, false);
xvt_fsys_files_remove(path, files);
xvt_fsys_rmdir(path);
load_sheet();
//sf.force_update();
}
break;
case S_SELECTED:
if (e == fe_modify)
{
bool deselect = false;
int current = sf.selected();
set(F_SELECTED, sf.get_str_row_cell(current, S_NOME));
FOR_EACH_SHEET_ROW(sf, r, row)
{
if (r != current)
{
sf.set_row_cell(S_SELECTED, false, r);
}
}
if (current == _selected)
{
_selected = -1;
enable(F_RIPR, false);
enable(F_DELETE, false);
}
else
{
_selected = current;
enable(F_RIPR, true);
enable(F_DELETE, true);
}
sf.force_update();
}
break;
default:
break;
}
return true;
}
bool TArchive_mask::on_key(KEY key)
{
if (key == K_SHIFT + K_F12)
{
enable(F_PATH, true);
enable(F_FLOPPY, true);
}
return TAutomask::on_key(key);
}
void TArchive_mask::load_sheet()
{
TSheet_field& sf = sfield(F_BKPTABLE);
sf.destroy();
const TString& bkp_path = ini_get_string(CONFIG_STUDIO, "ba", "BkpPath");
TFilename mask = bkp_path; mask.add("*.*");
SLIST bkp_list = xvt_fsys_list_files("", mask, true);
for (SLIST_ELT e = xvt_slist_get_first(bkp_list); e; e = xvt_slist_get_next(bkp_list, e))
{
TFilename element = xvt_slist_get(bkp_list, e, xvt_slist_get_data(e));
TFilename ini_file = element; ini_file.add("backup.ini");
const TString& ini_descr = ini_get_string(ini_file, "Main", "Description");
const TDate& ini_date = ini_get_date(ini_file, "Main", "Date");
const TString& ini_usr = ini_get_string(ini_file, "Main", "User");
const TString& pkg_name = element.name();
int r = sf.set_row_cell(S_SELECTED, false);
sf.set_row_cell(S_NOME, pkg_name);
sf.set_row_cell(S_DESCR, ini_descr, r);
sf.set_row_cell(S_DATACR, ini_date, r);
sf.set_row_cell(S_USER, ini_usr, r);
}
int n = bkp_list->count;
enable(F_RIPR, false);
enable(F_DELETE, false);
_selected = -1;
sf.force_update();
}
const TString& TArchive_mask::get_selected() const
{
TSheet_field& sf = sfield(F_BKPTABLE);
const TString& name = sf.get_str_row_cell(sf.selected(), S_NOME);
return name;
}
///////////////////////////////////////////////////////////
// Archiving application
///////////////////////////////////////////////////////////
@ -127,7 +273,6 @@ bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
bool TArchive_app::create()
{
bool ok = true;
TIsamfile utenti(LF_USER);
utenti.open(_excllock);
for (int err = utenti.first(); err == NOERR; err = utenti.next())
@ -141,14 +286,17 @@ bool TArchive_app::create()
#endif
}
utenti.close();
if (ok)
ok = TSkeleton_application::create();
if (ok)
{
ok = TSkeleton_application::create();
}
return ok;
}
KEY TArchive_app::query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const
KEY TArchive_app::query(int& mode, long& firm, TFilename& floppy_path, TString& desc, TString& pkgname) const
{
TArchive_mask m;
@ -173,9 +321,18 @@ KEY TArchive_app::query(int& mode, long& firm, TFilename& floppy_path, TString&
mode |= 0x10;
floppy_path.format("%c:%c", toupper(m.get(F_FLOPPY)[0]), SLASH);
const TString& bkp_path = ini_get_string(CONFIG_STUDIO, "ba", "BkpPath");
floppy_path.add(m.get(F_PATH));
desc = m.get(F_DESCR);
if (k == K_SAVE)
pkgname = m.get(F_NOMEPKG);
else if (k == K_INS)
pkgname = m.get(F_SELECTED);
}
return k;
@ -250,9 +407,13 @@ bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk)
return ok;
}
bool TArchive_app::zip_dir(const TFilename& name, unsigned long max_chunk)
bool TArchive_app::zip_dir(const TFilename& name, unsigned long max_chunk, const TString dir_name)
{
TFilename tmp; tmp.tempdir();
tmp.add(dir_name);
if (!tmp.exist())
xvt_fsys_mkdir(tmp);
tmp.add(name.name());
tmp.ext("zip");
@ -273,6 +434,118 @@ bool TArchive_app::zip_dir(const TFilename& name, unsigned long max_chunk)
return ok;
}
bool TArchive_app::prepare_package(const TString pkg_name, unsigned long max_chunk, const TFilename& floppy_path, const TString& desc)
{
TFilename pkg_tmp; TFilename bak_dir;
pkg_tmp.tempdir(); bak_dir.tempdir();
pkg_tmp.add(pkg_name);
if (!pkg_tmp.exist())
{
error_box("Errore imprevisto! Pacchetto non trovato");
}
else
{
bak_dir.add(pkg_name); bak_dir.add("bakup");
if(!bak_dir.exist())
xvt_fsys_mkdir(bak_dir);
//pkg_tmp.ext("zip");
}
// Assegna un disco di destinazione a tutti i files
int disk = 1;
unsigned long written = 0;
int i;
for (i = 0; i < _zip_list.items(); i++)
{
TAFile_info& fi = (TAFile_info&)_zip_list[i];
if (written > 0 && (written + fi._size) >= max_chunk)
{
disk++;
written = 0;
}
const TFilename& from = fi._name;
const TString& fname = from.name();
TFilename to = bak_dir; to.add(fname);
fmove(fi._name, to);
fi._disk = disk;
written += fi._size;
}
bool ok = true;
TFilename bak_zip = pkg_tmp; bak_zip.add("backup.zip");
if (ok)
{
const TDate oggi(TODAY);
TFilename inifile = pkg_tmp; inifile.add("backup.ini");
//TFilename name; name = floppy_path; name.add("backup.ini");
inifile.fremove();
TConfig ini(inifile, "Main");
ini.set("Date", oggi.string());
ini.set("Description", desc);
ini.set("User", user());
ini.set("Disks", disk);
ini.set("Format", "zip");
TFilename last_name;
long size = 0;
for (i = 0; i < _zip_list.items(); i++)
{
const TAFile_info& fi = (const TAFile_info&)_zip_list[i];
inifile = fi._name.name(); inifile.ext("");
if (inifile != last_name)
{
ini.set("FirstDisk", fi._disk, inifile);
last_name = inifile;
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;
}
if (pkg_name.full())
{
TFilename all_files = bak_dir; all_files.add("*.*");
TString msg;
msg << TR("Creazione del file temporaneo ") << pkg_tmp << "...";
TIndwin waitw(100, msg, false, false);
ok &= aga_zip(all_files, bak_zip);
}
if (ok && bak_zip.exist())
{
ok &= split_file(bak_zip, max_chunk);
remove_files(bak_dir, true);
xvt_fsys_rmdir(bak_dir);
}
int curr_disk = 1;
if (!can_save_as(pkg_tmp, floppy_path))
{
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*)floppy_path))
return false;
}
TFilename destination = floppy_path; destination.add(pkg_name);
TFilename mask = pkg_tmp; mask.add("*.*");
SLIST files = xvt_fsys_list_files("", mask, false);
if (!destination.exist())
ok &= xvt_fsys_mkdir(destination);
ok &= xvt_fsys_files_move(pkg_tmp, files, destination) == files->count;
ok &= xvt_fsys_rmdir(pkg_tmp);
return ok;
}
bool TArchive_app::can_save_as(const TFilename& src, const TFilename& dst) const
{
if (dst.exist())
@ -281,7 +554,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;
}
bool 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, const TString dir_name)
{
// Assegna un disco di destinazione a tutti i files
int disk = 1;
@ -355,7 +628,11 @@ bool TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& d
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());
dest = floppy_path;
dest.add(dir_name);
if (!dest.exist())
xvt_fsys_mkdir(dest);
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))
@ -369,7 +646,7 @@ bool TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& d
return ok;
}
void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, const TString& desc)
void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, const TString& desc, const TString& pkgname)
{
TPointer_array ditte;
if (firm == 0)
@ -382,6 +659,12 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
long max_chunk = LONG_MAX;
const TDate today(TODAY);
TString dir_name = pkgname;
dir_name << today.date2ansi();
if (is_real_floppy(floppy_path))
{
message_box(FR("Inserire un disco vuoto nel drive %c:"), floppy_path[0]);
@ -396,7 +679,7 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
if (ok && (mode & 0x1))
{
name = firm2dir(0);
ok = zip_dir(name, max_chunk);
ok &= zip_dir(name, max_chunk, dir_name);
}
if (ok && (mode & 0x2))
@ -407,7 +690,7 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
if (prefix().exist(firm))
{
name = firm2dir(firm);
ok = zip_dir(name, max_chunk);
ok &= zip_dir(name, max_chunk, dir_name);
}
}
}
@ -416,32 +699,38 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
{
name = firm2dir(-1); // __ptprf
name.add("config"); // Aggiungi configurazioni
ok = zip_dir(name, max_chunk);
ok &= zip_dir(name, max_chunk, dir_name);
}
if (ok && (mode & 0x8))
{
name = firm2dir(-1); // __ptprf
name.add("m770"); // Aggiungi 770
if (name.exist())
ok = zip_dir(name, max_chunk);
ok &= zip_dir(name, max_chunk, dir_name);
}
if (ok && (mode & 0x10))
{
name = firm2dir(-1); // __ptprf
name.add("custom"); // Aggiungi personalizzazioni
if (name.exist())
ok = zip_dir(name, max_chunk);
ok &= zip_dir(name, max_chunk, dir_name);
}
prefix().set(old); // Ripristina prefix
if (ok)
save_zip_files(floppy_path, desc, max_chunk);
if (ok)
{
ok &= prepare_package(dir_name, max_chunk, floppy_path, desc);
}
else
error_box(TR("Si è verificato un errore di accesso al disco:\nVerificare lo spazio disponibile"));
if (ok)
message_box(TR("Backup avvenuto con successo!"));
else
warning_box(TR("Errore nella procedura di backup! Contattare l'assistenza"));
}
bool TArchive_app::read_paragraph(TConfig& ini, const char* para)
bool TArchive_app::read_paragraph(TConfig& ini, const char* para, const TString& pkgname)
{
const int first = ini.get_int("FirstDisk", para);
const int last = ini.get_int("LastDisk");
@ -449,6 +738,7 @@ bool TArchive_app::read_paragraph(TConfig& ini, const char* para)
if (ok)
{
TFilename dir; dir.tempdir();
dir.add(pkgname);
TString16 ext;
int e = 0;
for (int d = first; d <= last; d++)
@ -456,7 +746,7 @@ bool TArchive_app::read_paragraph(TConfig& ini, const char* para)
TAFile_info* fi = new TAFile_info;
TFilename& name = fi->_name;
ext.format("z%02d", e++);
name = dir; name.add(para); name.ext(ext);
name = dir; name.add("backup"); name.add(para); name.ext(ext);
fi->_disk = d;
fi->_last_disk = last;
fi->_size = ini.get_int("Size");
@ -466,7 +756,7 @@ bool TArchive_app::read_paragraph(TConfig& ini, const char* para)
return ok;
}
void TArchive_app::load_zip_files(const TFilename& floppy_path)
void TArchive_app::load_zip_files(const TFilename& pkgpath, const TFilename& tmppkg)
{
TString msg;
TFilename dir; dir.tempdir();
@ -484,7 +774,7 @@ void TArchive_app::load_zip_files(const TFilename& floppy_path)
if (pi.iscancelled())
break;
if (is_real_floppy(floppy_path))
if (is_real_floppy(pkgpath.path()))
{
if (disk != curr_disk)
{
@ -492,9 +782,11 @@ void TArchive_app::load_zip_files(const TFilename& floppy_path)
curr_disk = disk;
}
}
TFilename src; src = floppy_path; src.add(info._name.name());
TFilename dst; dst = dir; dst.add(info._name.name()); dst.ext("zip");
TFilename studio = prefix().get_studio();
TFilename src; src = tmppkg; src.add(info._name.name());
TFilename dst; dst = studio; dst.add(info._name.name()); dst.ext("zip");
while (!fcopy(src, dst, i > 0))
if (!yesno_box(TR("Si desidera ritentare?")))
return;
@ -507,23 +799,33 @@ void TArchive_app::load_zip_files(const TFilename& floppy_path)
}
}
void TArchive_app::restore(int mode, long firm, const TFilename& floppy_path)
void TArchive_app::restore(int mode, long firm, const TFilename& pkgpath)
{
_zip_list.destroy();
TFilename name; name = floppy_path; name.add("backup.ini");
TConfig ini(name, "Main");
const TString& pkgname = pkgpath.name();
TFilename tmp_path; tmp_path.tempdir(); tmp_path.add(pkgname);
TFilename ini_path; ini_path = pkgpath; ini_path.add("backup.ini");
TFilename z00_path; z00_path = pkgpath; z00_path.add("backup.z00");
if (!ini_path.exist())
TR("Errore! Il pacchetto è sprovvisto del file .ini e non può essere ripristinato");
if (!z00_path.exist())
TR("Errore! Il pacchetto è corrotto e non può essere ripristinato");
TConfig ini(ini_path, "Main");
ini.write_protect();
if (mode & 0x1)
read_paragraph(ini, "com");
read_paragraph(ini, "com", pkgname);
if (mode & 0x2)
{
if (firm > 0)
{
TString8 para; para.format("%05lda", firm);
read_paragraph(ini, para);
read_paragraph(ini, para, pkgname);
}
else
{
@ -533,19 +835,19 @@ void TArchive_app::restore(int mode, long firm, const TFilename& floppy_path)
{
const TString& n = para.row(i);
if (atol(n) > 0 && n.right(1) == "a")
read_paragraph(ini, n);
read_paragraph(ini, n, pkgname);
}
}
}
if (mode & 0x4)
read_paragraph(ini, "config");
read_paragraph(ini, "config", pkgname);
if (mode & 0x8)
read_paragraph(ini, "m770");
read_paragraph(ini, "m770", pkgname);
if (mode & 0x10)
read_paragraph(ini, "custom");
read_paragraph(ini, "custom", pkgname);
const int tot = _zip_list.items();
if (tot > 0)
@ -567,9 +869,14 @@ void TArchive_app::restore(int mode, long firm, const TFilename& floppy_path)
if (yesno_box(fola))
{
const TString16 old = prefix().name();
prefix().set(NULL); // Libera tutti i lock
load_zip_files(floppy_path); // Scompatta i files
prefix().set(old); // Ripristina prefix
prefix().set(NULL); // Libera tutti i lock
aga_unzip(z00_path, tmp_path); // scompatta il file backup.z00
load_zip_files(pkgpath, tmp_path); // Scompatta i files
TFilename mask = tmp_path; mask.add("*.*"); // Elimina i file temporanei
remove_files(mask, true);
xvt_fsys_rmdir(tmp_path);
prefix().set(old); // Ripristina prefix
}
}
else
@ -583,22 +890,31 @@ void TArchive_app::interactive_mode()
long firm;
TFilename floppy_path;
TString80 desc;
TString pkgname;
while ((k = query(mode, firm, floppy_path, desc)) != K_QUIT)
while ((k = query(mode, firm, floppy_path, desc, pkgname)) != K_QUIT)
{
if (mode)
{
if (k == K_SAVE)
{
backup(mode, firm, floppy_path, desc);
{
if (pkgname.empty())
error_box(FR("Inserire un Nome Pacchetto valido!"));
else
backup(mode, firm, floppy_path, desc, pkgname);
}
else
{
TFilename ini_name = floppy_path; ini_name.add("backup.ini");
{
TFilename pkgpath = floppy_path; pkgpath.add(pkgname);
TFilename ini_name = pkgpath; ini_name.add("backup.ini");
if (is_real_floppy(floppy_path))
message_box(FR("Inserire il primo disco del backup nel drive %c"), floppy_path[0]);
if (ini_name.exist())
restore(mode, firm, floppy_path);
{
bool yn = yesno_box(FR("Attenzione! I dati attualmente presenti negli archivi verranno sovrascritti.\nAssicurarsi di aver fatto un backup prima di continuare.\nProcedere?"));
if(yn)
restore(mode, firm, pkgpath);
}
else
error_box(FR("Impossibile trovare il file %s"), (const char*)ini_name);
}
@ -616,6 +932,7 @@ void TArchive_app::batch_mode(const TString& cmd)
restore(mode, firm, floppy_path);
}
void TArchive_app::main_loop()
{
TString cmd;
@ -665,7 +982,8 @@ void TArchive_app::main_loop()
int ba2200(int argc, char* argv[])
{
TArchive_app a;
a.run(argc, argv, TR("Archiviazione"));
a.run(argc, argv, TR("Archiviazione"));
return 0;
}

View File

@ -1,14 +1,33 @@
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_FLOPPY 104
#define F_DESCR 105
#define F_PATH 106
#define F_SALVA 107
#define F_RIPR 108
#define F_CODDITTA 201
#define F_RAGSOC 202
#define F_SELECTED 203
#define F_FLOPPY 204
#define F_DESCR 205
#define F_PATH 206
#define F_SALVA 207
#define F_RIPR 208
#define F_RELOAD 218
#define F_DELETE 220
#define F_ALL 109
#define F_DITTA 110
#define F_COM 111
#define F_CONFIG 112
#define F_770 113
#define F_CUSTOM 114
#define F_ALL 209
#define F_DITTA 210
#define F_COM 211
#define F_CONFIG 212
#define F_770 213
#define F_CUSTOM 214
#define F_NOMEPKG 215
#define F_BKPBOX 216
#define F_PARAMBOX 217
#define F_RFLOPPY 218
#define F_RPATH 219
#define F_BKPTABLE 300
#define S_SELECTED 101
#define S_NOME 102
#define S_DESCR 103
#define S_DATACR 104
#define S_USER 105

View File

@ -1,6 +1,49 @@
#include "ba2200.h"
PAGE "Salvataggio / Ripristino archivi" -1 -1 72 8
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
BUTTON F_RIPR 15 2
BEGIN
PROMPT -23 -1 "~Ripristino"
MESSAGE EXIT,K_INS
PICTURE TOOL_IMPORT
END
BUTTON F_RELOAD 15 2
BEGIN
PROMPT -33 -1 "~Ricarica"
PICTURE TOOL_CONVERT
END
BUTTON F_DELETE 15 2
BEGIN
PROMPT -43 -1 "~Elimina"
PICTURE TOOL_DELREC
END
#include <helpbar.h>
ENDPAGE
PAGE "Salvataggio" 0 2 0 0
GROUPBOX F_PARAMBOX 78 6
BEGIN
PROMPT 0 0 "@bParametri"
END
LIST F_FLOPPY 1 3
BEGIN
@ -36,12 +79,12 @@ END
BOOLEAN F_CUSTOM
BEGIN
PROMPT 1 5 "Personalizzazioni"
PROMPT 30 3 "Personalizzazioni"
END
BOOLEAN F_770
BEGIN
PROMPT 1 6 "Dati 770"
PROMPT 30 4 "Dati 770"
END
NUMBER F_CODDITTA 5
@ -63,38 +106,72 @@ BEGIN
FLAGS "D"
END
GROUPBOX F_BKPBOX 78 4
BEGIN
PROMPT 0 6 "@bBackup"
END
STRING F_NOMEPKG 15
BEGIN
PROMPT 1 7 "Nome Pacchetto "
END
STRING F_DESCR 50
BEGIN
PROMPT 1 7 "Descrizione "
PROMPT 1 8 "Descrizione "
END
SPREADSHEET F_BKPTABLE
BEGIN
PROMPT 0 11 ""
ITEM " "
ITEM "Nome Pacchetto"
ITEM "Descrizione@50"
ITEM "Data Creazione"
ITEM "Utente"
END
STRING F_SELECTED 50
BEGIN
PROMPT -1 -1 ""
FLAG "H"
END
ENDPAGE
ENDMASK
PAGE "Message" -1 -1 78 19
BOOLEAN S_SELECTED
BEGIN
PROMPT 1 1 ""
END
STRING S_NOME 25
BEGIN
PROMPT 1 4 "Nome Pachetto"
FLAGS "D"
END
STRING S_DESCR 50
BEGIN
PROMPT 1 1 "Descrz."
FLAGS "D"
END
DATE S_DATACR
BEGIN
PROMPT 1 4 "Data Creazione"
FLAGS "D"
END
STRING S_USER 50
BEGIN
PROMPT 1 4 "Utente"
FLAGS "D"
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
BUTTON F_RIPR 15 2
BEGIN
PROMPT -23 -1 "~Ripristino"
MESSAGE EXIT,K_INS
PICTURE TOOL_IMPORT
END
#include <helpbar.h>
ENDPAGE
ENDMASK

View File

@ -9,31 +9,37 @@
#include <config.h>
#endif
class TArchive_app : public TSkeleton_application
{
TArray _zip_list;
protected:
virtual bool create();
virtual void main_loop();
KEY query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const;
KEY query(int& mode, long& firm, TFilename& floppy_path, TString& desc, TString& pkgname) const;
bool split_file(const TFilename& archive, unsigned long max_chunk);
bool zip_dir(const TFilename& name, unsigned long max_chunk);
bool zip_dir(const TFilename& name, unsigned long max_chunk, const TString dir_name);
bool prepare_package(const TString pkg_name, unsigned long max_chunk, const TFilename& floppy_path, const TString& desc);
TString check_tab_progressivo() const;
bool read_paragraph(TConfig& ini, const char* para);
bool read_paragraph(TConfig& ini, const char* para, const TString& pkgname);
void backup(int mode, long firm, const TFilename& floppy_path, const TString& desc);
void restore(int mode, long firm, const TFilename& floppy_path);
void backup(int mode, long firm, const TFilename& floppy_path, const TString& desc, const TString& pkgname);
void restore(int mode, long firm, const TFilename& pkgpath);
void add_file(const TFilename& name);
bool save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk);
void load_zip_files(const TFilename& floppy_path);
bool save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk, const TString dir_name);
bool save_pkg(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk, const TString& dir_name);
void load_zip_files(const TFilename& pkgpath, const TFilename& tmppkg);
bool can_save_as(const TFilename& src, const TFilename& dst) const;
void interactive_mode();
void batch_mode(const TString& cmd);
public:
void stop_job();