Patch level : 2.2

Files correlati     : ba2 ba8
Ricompilazione Demo : [ ]
Commento            :
ba2 aggiunto supporto per pen drive in procedura di backup
ba8 aggiunta esportazione su file dbf per utenti privilegiati, cioe' quelli col ragno :-)


git-svn-id: svn://10.65.10.50/trunk@13635 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-12-20 17:11:37 +00:00
parent 49f3651ba7
commit 3b7adc7723
5 changed files with 50 additions and 14 deletions

View File

@ -42,17 +42,16 @@ TArchive_mask::TArchive_mask() : TAutomask("ba2200")
int k = 0;
for (int d = 0; d < 26; d++)
{
str.format("%c:/", d+'A');
str.format("%c:", d+'A');
const bool isrem = xvt_fsys_is_removable_drive(str) != 0;
const bool isfix = !isrem && xvt_fsys_is_fixed_drive(str);
const bool isnet = !isrem && !isfix && xvt_fsys_is_network_drive(str);
if (isrem || isfix || isnet)
{
str.rtrim(1); // Togli slash finale
codes.add(str);
values.add(str);
TToken_string& message = *lf.message(k++, TRUE);
if (isrem)
if (isrem && str[0]<='B')
message.format("DISABLE,%d", F_PATH);
else
message.format("ENABLE,%d", F_PATH);
@ -250,6 +249,11 @@ 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::is_real_floppy(const TFilename& path) const
{
return (path[0] == 'A' || path[0] == 'B') && xvt_fsys_is_removable_drive(path);
}
void 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
@ -269,8 +273,10 @@ void TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& d
written += fi._size;
}
bool ok = TRUE;
if (xvt_fsys_is_removable_drive(floppy_path.left(3)))
bool ok = true;
const bool is_floppy = is_real_floppy(floppy_path);
if (is_floppy)
{
const char* msg = TR("Si desidera procedere con l'operazione di salvataggio?");
if (disk == 1)
@ -347,7 +353,8 @@ void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, con
prefix().set(NULL); // Libera tutti i lock
long max_chunk = LONG_MAX;
if (xvt_fsys_is_removable_drive(floppy_path))
if (is_real_floppy(floppy_path))
{
message_box(FR("Inserire un disco vuoto nel drive %c:"), floppy_path[0]);
max_chunk = xvt_fsys_get_disk_size(floppy_path, 'B') - (1024L*64L);
@ -449,7 +456,7 @@ void TArchive_app::load_zip_files(const TFilename& floppy_path)
if (pi.iscancelled())
break;
if (xvt_fsys_is_removable_drive(floppy_path.left(3)))
if (is_real_floppy(floppy_path))
{
if (disk != curr_disk)
{
@ -560,7 +567,7 @@ void TArchive_app::interactive_mode()
else
{
TFilename ini_name = floppy_path; ini_name.add("backup.ini");
if (xvt_fsys_is_removable_drive(floppy_path.left(3)))
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);

View File

@ -18,6 +18,8 @@ protected:
virtual void main_loop();
KEY query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const;
bool is_real_floppy(const TFilename& path) const;
bool split_file(const TFilename& archive, unsigned long max_chunk);
bool zip_dir(const TFilename& name, unsigned long max_chunk);

View File

@ -902,6 +902,21 @@ void TQuery_mask::save_as(TRecordsetExportFormat fmt)
if (rex == NULL)
return;
if (fmt == fmt_dbf)
{
TTable_mask tm;
TList_sheet& sht = *tm.efield(F_SON).sheet();
if (sht.run() == K_ENTER)
{
const TString& table = tm.get(F_SON);
const KEY k = yesnocancel_box(FR("Si desidera azzerare il file %s prima dell'esportazione?"),
(const char*)table);
if (k != K_ESC)
rex->save_as(table, fmt_dbf, k == K_YES ? 0x5 : 0x3);
}
return;
}
xvt_fsys_save_dir();
TFilename path; path.tempdir();
@ -1280,7 +1295,9 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
case F_SQL:
if (e == fe_init || e == fe_modify)
{
enable(-2, !o.empty());
const bool on = !o.empty();
enable(-2, on);
enable(F_EXPORT_DBF, on && is_power_station());
if (e == fe_modify)
{
_is_dirty = true;
@ -1304,6 +1321,10 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (e == fe_button)
save_as(fmt_campo);
break;
case F_EXPORT_DBF:
if (e == fe_button)
save_as(fmt_dbf);
break;
case F_SHEET:
enable_sql_button();
break;

View File

@ -13,6 +13,7 @@
#define F_EXPORT_EXCEL 308
#define F_EXPORT_TXT 309
#define F_EXPORT_CAMPO 310
#define F_EXPORT_DBF 311
#define F_SHEET 400
#define F_MOVEUP 401
#define F_MOVEDN 402

View File

@ -136,35 +136,40 @@ END
BUTTON F_EDITQUERY 10 2
BEGIN
PROMPT -15 -1 ""
PROMPT -16 -1 ""
PICTURE BMP_EDIT
GROUP 2
END
BUTTON F_EXPORT_HTML 10 2
BEGIN
PROMPT -25 -1 "~HTML"
PROMPT -26 -1 "~HTML"
GROUP 2
END
BUTTON F_EXPORT_EXCEL 10 2
BEGIN
PROMPT -35 -1 "~Excel"
PROMPT -36 -1 "~Excel"
GROUP 2
END
BUTTON F_EXPORT_TXT 10 2
BEGIN
PROMPT -45 -1 "~Testo+Tab"
PROMPT -46 -1 "~Testo+Tab"
GROUP 2
END
BUTTON F_EXPORT_CAMPO 10 2
BEGIN
PROMPT -55 -1 "~Scarica"
PROMPT -56 -1 "~Scarica"
GROUP 2
END
BUTTON F_EXPORT_DBF 10 2
BEGIN
PROMPT -66 -1 "~DBF"
GROUP 2
END
ENDPAGE