Corretto allineamento bottoni nel menu
Corretta e potenziata la gestione fax git-svn-id: svn://10.65.10.50/trunk@3571 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6ff153a4f5
commit
017502bd1c
18
ba/ba0.cpp
18
ba/ba0.cpp
@ -743,13 +743,19 @@ int TMenu_application::do_level()
|
||||
if (!_enabled[i]) menu.disable(id);
|
||||
}
|
||||
menu.add_static(-1, 0, "Cerca", 1,-3);
|
||||
menu.add_string(DLG_USER, 0, "", -12, -3, 50, "", bwidth+1);
|
||||
menu.set_handler(DLG_USER, menu_find_handler);
|
||||
TEdit_field& ef = menu.add_string(DLG_USER, 0, "", -12, -3, 50, "", bwidth+1);
|
||||
ef.set_handler(menu_find_handler);
|
||||
|
||||
menu.add_button(first ? DLG_CANCEL : DLG_QUIT, 0,
|
||||
first ? "Menu precedente" : "Fine", -22, -1, bwidth, 2);
|
||||
if (first)
|
||||
menu.add_button(DLG_QUIT, 0, "Fine", -12, -1, bwidth, 2);
|
||||
menu.add_button(DLG_QUIT, 0, "Fine", -22, -1, bwidth, 2);
|
||||
if (first)
|
||||
{
|
||||
TButton_field& bf = menu.add_button(DLG_CANCEL, 0, "Menu precedente", -12, -1, bwidth, 2);
|
||||
RCT e_rct; ef.get_rect(e_rct); // Rettangolo cerca
|
||||
RCT b_rct; bf.get_rect(b_rct); // Rettangolo bottone
|
||||
b_rct.left = e_rct.left-2; // Aggiusta rettangolo
|
||||
b_rct.right = e_rct.right+2;
|
||||
bf.set_rect(b_rct); // Modifica bottone
|
||||
}
|
||||
|
||||
if (_find_button && _last_button > first)
|
||||
menu.first_focus(100+_last_button-first);
|
||||
|
@ -95,7 +95,7 @@ bool TIndici_app::user_create()
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
const long items = ditte.items();
|
||||
long ditta = 0L;
|
||||
for (ditte.first(); !found && ditte.ok(); ditte.next())
|
||||
for (ditte.first(); !found && !ditte.eof(); ditte.next())
|
||||
{
|
||||
ditta = ditte.get_long(NDT_CODDITTA);
|
||||
if (prefix().exist(ditta)) found = TRUE;
|
||||
@ -114,7 +114,7 @@ bool TIndici_app::user_create()
|
||||
_maschera->set_handler(F_DITTA, ditta_handler);
|
||||
_maschera->set_handler(F_PANN_LU, annullapagine_handler);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool TIndici_app::user_destroy()
|
||||
{
|
||||
|
366
ba/bafax.cpp
366
ba/bafax.cpp
@ -9,6 +9,8 @@
|
||||
#include <golem.h>
|
||||
#include <mailbox.h>
|
||||
#include <msksheet.h>
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
@ -121,12 +123,16 @@ public:
|
||||
int push(TFax_data* data);
|
||||
TFax_data& peek_last();
|
||||
const TFax_data& peek_last() const;
|
||||
const TFax_data& peek_default();
|
||||
|
||||
TFax_data& pop();
|
||||
|
||||
bool empty() const { return items() == 0; }
|
||||
|
||||
void on_firm_change();
|
||||
|
||||
TFax_queue();
|
||||
~TFax_queue();
|
||||
virtual ~TFax_queue();
|
||||
};
|
||||
|
||||
TFax_queue::TFax_queue()
|
||||
@ -159,6 +165,11 @@ const TFax_data& TFax_queue::peek_last() const
|
||||
return l >= 0 ? (TFax_data&)*objptr(l) : _default;
|
||||
}
|
||||
|
||||
const TFax_data& TFax_queue::peek_default()
|
||||
{
|
||||
on_firm_change();
|
||||
return _default;
|
||||
}
|
||||
|
||||
TFax_data& TFax_queue::pop()
|
||||
{
|
||||
@ -176,6 +187,41 @@ int TFax_queue::push(TFax_data* data)
|
||||
return add(data, -1);
|
||||
}
|
||||
|
||||
void TFax_queue::on_firm_change()
|
||||
{
|
||||
static long old_firm = 0;
|
||||
|
||||
TPrefix& pref = prefix();
|
||||
pref.set("DEF");
|
||||
const long firm = pref.get_codditta();
|
||||
|
||||
if (firm != old_firm)
|
||||
{
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
ditte.put(NDT_CODDITTA, firm);
|
||||
if (ditte.read() == NOERR)
|
||||
{
|
||||
old_firm = firm;
|
||||
|
||||
TString tmp(80);
|
||||
|
||||
tmp = ditte.get(NDT_PFAX);
|
||||
if (tmp.not_empty()) tmp << ',';
|
||||
tmp << ditte.get(NDT_FAX);
|
||||
if (tmp.not_empty())
|
||||
_default.set("FROMFAX", tmp);
|
||||
|
||||
tmp = ditte.get(NDT_PERRIF);
|
||||
if (tmp.not_empty())
|
||||
_default.set("FROMNAME", tmp);
|
||||
|
||||
tmp = ditte.get(NDT_RAGSOC);
|
||||
if (tmp.not_empty())
|
||||
_default.set("FROMFIRM", tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFax_list
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -238,11 +284,13 @@ class TDDE_fax : public TDDE
|
||||
bool _close_when_idle;
|
||||
|
||||
protected:
|
||||
TString_array* log2array(int log);
|
||||
void add_log(int log, PSEND_FAX sf);
|
||||
void remove_log(int log, PSEND_FAX sf);
|
||||
TString_array* log2array(WORD log);
|
||||
const char* error2string(FAXERROR e) const;
|
||||
void add_log(WORD log, PSEND_FAX sf);
|
||||
void remove_log(WORD log, PSEND_FAX sf);
|
||||
void show_status(PSEND_FAX sf);
|
||||
void update_all_logs();
|
||||
void update_log(int log);
|
||||
void update_log(WORD log);
|
||||
|
||||
bool send_next_fax();
|
||||
void push_fax(const char* fax);
|
||||
@ -274,8 +322,10 @@ public: // TDDE
|
||||
public:
|
||||
bool run_mask();
|
||||
|
||||
void log_delete(int log, unsigned long id);
|
||||
void log_delete(WORD log, unsigned long id);
|
||||
bool resend_fax(unsigned long id);
|
||||
|
||||
void on_firm_change();
|
||||
|
||||
bool set_destination(const TString& tipo, const TString& codice, TFax_data& data) const;
|
||||
bool push_destination(const TString& tipo, const TString& codice);
|
||||
@ -392,8 +442,9 @@ bool TFax_mask::code_handler(TMask_field& f, KEY k)
|
||||
bool TFax_mask::button_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TMask_field* fax = ((TFax_mask&)f.mask()).lookup("DESTFAX");
|
||||
{
|
||||
TFax_mask& m = (TFax_mask&)f.mask();
|
||||
TMask_field* fax = m.lookup("DESTFAX");
|
||||
CHECK(fax, "Can't find fax number field");
|
||||
|
||||
TString num = fax->get();
|
||||
@ -407,6 +458,10 @@ bool TFax_mask::button_handler(TMask_field& f, KEY k)
|
||||
num.rtrim(1);
|
||||
fax->set(num);
|
||||
|
||||
const TMask_field* dialmode = m.lookup("DIALING");
|
||||
CHECK(dialmode, "Can't find dial mode field");
|
||||
const bool tone = dialmode->get()[0] == 'T';
|
||||
|
||||
const char* keys[] = { "1", "2", "3",
|
||||
"4", "5", "6",
|
||||
"7", "8", "9",
|
||||
@ -417,10 +472,27 @@ bool TFax_mask::button_handler(TMask_field& f, KEY k)
|
||||
1245, 1335, 1475 };
|
||||
for (int i = 0; i < 12; i++) if (prompt == keys[i])
|
||||
{
|
||||
sound(freqs[i]);
|
||||
const clock_t end = clock() + CLOCKS_PER_SEC / 5;
|
||||
while (clock() < end);
|
||||
nosound();
|
||||
if (tone)
|
||||
{
|
||||
sound(freqs[i]);
|
||||
const clock_t end = clock() + CLOCKS_PER_SEC / 5;
|
||||
while (clock() < end);
|
||||
nosound();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i >= 9 && i <= 11)
|
||||
i = i == 10 ? 9 : 0;
|
||||
for (int t = 0; t <= i; t++)
|
||||
{
|
||||
sound(50);
|
||||
clock_t end = clock();
|
||||
while (clock() == end);
|
||||
nosound();
|
||||
end = clock();
|
||||
while (clock() == end);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -462,7 +534,7 @@ class TLog_mask : public TMask
|
||||
protected:
|
||||
void update_sheet(short id, const TString_array& a);
|
||||
|
||||
int sheet2log(const TSheet_field& s) const;
|
||||
WORD sheet2log(const TSheet_field& s) const;
|
||||
|
||||
void set_notify(short id);
|
||||
static bool log_notify(TSheet_field& f, int row, KEY k);
|
||||
@ -470,7 +542,7 @@ protected:
|
||||
static bool fax_handler(TMask_field& f, KEY k);
|
||||
|
||||
public:
|
||||
void update_log(int log, const TString_array& a);
|
||||
void update_log(WORD log, const TString_array& a);
|
||||
|
||||
TLog_mask(TDDE_fax* fax);
|
||||
virtual ~TLog_mask() { }
|
||||
@ -485,9 +557,9 @@ TLog_mask::TLog_mask(TDDE_fax* fax)
|
||||
set_notify(F_COMPLETE);
|
||||
}
|
||||
|
||||
int TLog_mask::sheet2log(const TSheet_field& s) const
|
||||
WORD TLog_mask::sheet2log(const TSheet_field& s) const
|
||||
{
|
||||
int log;
|
||||
WORD log;
|
||||
switch (s.dlg())
|
||||
{
|
||||
case F_PENDING: log = SUBSCRIBE_LOG_PENDING; break;
|
||||
@ -504,7 +576,7 @@ bool TLog_mask::log_notify(TSheet_field& s, int, KEY k)
|
||||
if (k == K_INS)
|
||||
{
|
||||
TLog_mask& m = (TLog_mask&)s.mask();
|
||||
const int log = m.sheet2log(s);
|
||||
const WORD log = m.sheet2log(s);
|
||||
for (int i = s.items()-1; i >= 0; i--)
|
||||
{
|
||||
const char* strid = s.row(i).get(0);
|
||||
@ -525,7 +597,7 @@ bool TLog_mask::delrec_handler(TMask_field& f, KEY k)
|
||||
TSheet_field& s = *m.get_sheet();
|
||||
|
||||
TLog_mask& l = (TLog_mask&)s.mask();
|
||||
const int log = l.sheet2log(s);
|
||||
const WORD log = l.sheet2log(s);
|
||||
|
||||
if (log)
|
||||
{
|
||||
@ -545,8 +617,11 @@ bool TLog_mask::fax_handler(TMask_field& f, KEY k)
|
||||
TSheet_field& s = *m.get_sheet();
|
||||
TLog_mask& l = (TLog_mask&)s.mask();
|
||||
const char* strid = m.get(101);
|
||||
unsigned long id; sscanf(strid, "%lu", &id);
|
||||
l._fax->resend_fax(id);
|
||||
if (f.yesno_box("Si desidera rispedire il fax %s?", strid))
|
||||
{
|
||||
unsigned long id; sscanf(strid, "%lu", &id);
|
||||
l._fax->resend_fax(id);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -574,7 +649,7 @@ void TLog_mask::update_sheet(short id, const TString_array& a)
|
||||
s.force_update();
|
||||
}
|
||||
|
||||
void TLog_mask::update_log(int log, const TString_array& a)
|
||||
void TLog_mask::update_log(WORD log, const TString_array& a)
|
||||
{
|
||||
// Convere il codice della coda nell'identificatore dello sheet
|
||||
short id;
|
||||
@ -601,16 +676,6 @@ TDDE_fax::TDDE_fax()
|
||||
: _pappinfo(NULL), _log_mask(NULL), _fax_mask(NULL),
|
||||
_close_when_idle(FALSE)
|
||||
{
|
||||
/*
|
||||
const bool already = initiate(get_app_name(), "");
|
||||
if (already)
|
||||
{
|
||||
terminate();
|
||||
xvt_statbar_set("C'e' gia' un server in esecuzione");
|
||||
beep();
|
||||
return;
|
||||
}
|
||||
*/
|
||||
_pappinfo = FaxRegisterApp(get_app_name(), hwnd());
|
||||
if (_pappinfo)
|
||||
{
|
||||
@ -699,15 +764,28 @@ bool TDDE_fax::do_execute(word id, const TString& cmd)
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Genera il nome di un file temporaneo e gli cambia l'estensione:
|
||||
// se esiste gia' ripete il ciclo.
|
||||
// Genera il nome di un file temporaneo: se esiste gia' ripete il ciclo.
|
||||
void TDDE_fax::choose_temp_name(TFilename& name) const
|
||||
{
|
||||
do
|
||||
{
|
||||
name.temp("FAX");
|
||||
name.ext("FMF");
|
||||
{
|
||||
static long lastfax = 0;
|
||||
|
||||
TFilename path;
|
||||
path.tempdir(); // Directory temporanea
|
||||
path.add("FAX"); // Aggiunge la directory FAX
|
||||
|
||||
if (lastfax == 0 && !fexist(path))
|
||||
make_dir(path);
|
||||
|
||||
do
|
||||
{
|
||||
TString16 f; f.format("FAX%05ld.FMF", lastfax++);
|
||||
name = path; name.add(f);
|
||||
} while (fexist(name));
|
||||
}
|
||||
|
||||
void TDDE_fax::on_firm_change()
|
||||
{
|
||||
_queue.on_firm_change();
|
||||
}
|
||||
|
||||
void TDDE_fax::handle_fax_message(word wparam, long lparam)
|
||||
@ -718,10 +796,22 @@ void TDDE_fax::handle_fax_message(word wparam, long lparam)
|
||||
if (lparam)
|
||||
{
|
||||
PFAXDEVICE dev = (PFAXDEVICE)lparam;
|
||||
if (!dev->wFlags)
|
||||
_port.reset(dev->nPort);
|
||||
|
||||
TString msg(24);
|
||||
msg = "E' stata ";
|
||||
if (!dev->wFlags)
|
||||
{
|
||||
_port.reset(dev->nPort); // Removing a port
|
||||
msg << "scollegata";
|
||||
beep();
|
||||
}
|
||||
else
|
||||
_port.set(dev->nPort);
|
||||
{
|
||||
_port.set(dev->nPort); // Adding a port
|
||||
msg << "collegata";
|
||||
}
|
||||
msg << " la porta COM" << dev->nPort;
|
||||
xvt_statbar_set(msg);
|
||||
}
|
||||
break;
|
||||
case FAXGETFILENAME:
|
||||
@ -762,6 +852,13 @@ void TDDE_fax::handle_fax_message(word wparam, long lparam)
|
||||
remove_log(sf->wLog, sf);
|
||||
}
|
||||
break;
|
||||
case FAXSENDMSG:
|
||||
if (lparam)
|
||||
{
|
||||
PSEND_FAX sf = (PSEND_FAX)lparam;
|
||||
show_status(sf);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -838,7 +935,9 @@ bool TDDE_fax::resend_fax(unsigned long id)
|
||||
}
|
||||
|
||||
bool TDDE_fax::send_next_fax()
|
||||
{
|
||||
{
|
||||
static bool no_fax_error = FALSE;
|
||||
|
||||
TTemp_window tw(TASK_WIN);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
@ -847,6 +946,12 @@ bool TDDE_fax::send_next_fax()
|
||||
#endif
|
||||
|
||||
tw.maximize();
|
||||
|
||||
if (_port.ones() == 0 && !no_fax_error)
|
||||
{
|
||||
no_fax_error = TRUE;
|
||||
error_box("Non c'e nessun Modem/Fax collegato");
|
||||
}
|
||||
|
||||
CHECK(_fax_mask == NULL, "Double fax mask");
|
||||
_fax_mask = new TFax_mask(this);
|
||||
@ -889,7 +994,10 @@ bool TDDE_fax::send_next_fax()
|
||||
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
#endif
|
||||
|
||||
tw.iconize();
|
||||
// Non iconizzare se ho aperta la finestra di stato
|
||||
if (_log_mask == NULL)
|
||||
tw.iconize();
|
||||
|
||||
if (_close_when_idle && can_close())
|
||||
main_app().stop_run();
|
||||
|
||||
@ -897,8 +1005,8 @@ bool TDDE_fax::send_next_fax()
|
||||
}
|
||||
|
||||
void TDDE_fax::push_fax(const char* fax)
|
||||
{
|
||||
TFax_data* data = new TFax_data(_queue.peek_last());
|
||||
{
|
||||
TFax_data* data = new TFax_data(_queue.peek_default());
|
||||
data->set_file(fax);
|
||||
_queue.push(data);
|
||||
|
||||
@ -906,7 +1014,7 @@ void TDDE_fax::push_fax(const char* fax)
|
||||
send_next_fax();
|
||||
}
|
||||
|
||||
TString_array* TDDE_fax::log2array(int log)
|
||||
TString_array* TDDE_fax::log2array(WORD log)
|
||||
{
|
||||
TString_array* array;
|
||||
switch(log)
|
||||
@ -920,7 +1028,44 @@ TString_array* TDDE_fax::log2array(int log)
|
||||
return array;
|
||||
}
|
||||
|
||||
void TDDE_fax::add_log(int log, PSEND_FAX sf)
|
||||
const char* TDDE_fax::error2string(FAXERROR e) const
|
||||
{
|
||||
static const char* msg[] =
|
||||
{
|
||||
"", // FAXERR_OK
|
||||
"Comando non ricosciuto (nessun OK)", // FAXERR_ACK
|
||||
"Modem/Fax non riconosciuto", // FAXERR_BADFAXMODEM
|
||||
"Errore di inizializzazione", // FAXERR_INIT
|
||||
"Errore nei parametri FDIS", // FAXERR_FDIS
|
||||
"Errore nell'identificatore locale", // FAXERR_FLID
|
||||
"Errore di composizione del numero", // FAXERR_DIAL
|
||||
"Errore di connessione al fax remoto", // FAXERR_FCON_ERR
|
||||
"Errore nella stringa FCSI", // FAXERR_FCSI
|
||||
"Errore di ricezione FDIS", // FAXERR_NEG_FDIS
|
||||
"Errore di stato errato", // FAXERR_BADSTATE
|
||||
"Linea occupata", // FAXERR_BUSY
|
||||
"Segnale di libero non rilevato", // FAXERR_NODIALTONE
|
||||
"Messaggio CONNECT non ricevuto", // FAXERR_NOCONNECT
|
||||
"Interrotto dall'utente", // FAXERR_CANCEL
|
||||
"FPTS nullo o errato", // FAXERR_FPTS
|
||||
"FHNG nullo o errato", // FAXERR_FHNG
|
||||
"FDCS nullo o errato", // FAXERR_FDCS
|
||||
"Errore di trasmissione", // FAXERR_ERROR
|
||||
"File in formato errato", // FAXERR_FILE
|
||||
"Fax Server incompatibile", // FAXERR_VERSION
|
||||
"Tempo di trasmissione scaduto", // FAXERR_TIMEOUT
|
||||
"Nessuna risposta a MPS", // FAXERR_NO_MPS_RESP
|
||||
"Nessuna risposta a EOP", // FAXERR_NO_EOP_RESP
|
||||
"Errore di connessione", // FAXERR_NOTRAIN
|
||||
};
|
||||
|
||||
if (e < FAXERR_OK || e > FAXERR_NOTRAIN)
|
||||
e = FAXERR_ERROR;
|
||||
|
||||
return msg[e];
|
||||
}
|
||||
|
||||
void TDDE_fax::add_log(WORD log, PSEND_FAX sf)
|
||||
{
|
||||
TString_array* arr = log2array(log);
|
||||
if (arr)
|
||||
@ -931,15 +1076,15 @@ void TDDE_fax::add_log(int log, PSEND_FAX sf)
|
||||
|
||||
l->add(sf->szDestFax); // Dest. fax
|
||||
|
||||
TString destination(80);
|
||||
TString destination(128);
|
||||
destination = sf->szDestName;
|
||||
if (destination.blank())
|
||||
destination.cut(0);
|
||||
else
|
||||
{
|
||||
destination << ", ";
|
||||
}
|
||||
destination << sf->szToCompany;
|
||||
destination.trim();
|
||||
if (*sf->szToCompany)
|
||||
{
|
||||
if (destination.not_empty())
|
||||
destination << ", ";
|
||||
destination << sf->szToCompany;
|
||||
}
|
||||
l->add(destination); // Dest. name
|
||||
|
||||
l->add(TDate(sf->nDay, sf->nMonth, sf->nYear).string()); // Date and time
|
||||
@ -947,14 +1092,16 @@ void TDDE_fax::add_log(int log, PSEND_FAX sf)
|
||||
l->add(ora);
|
||||
|
||||
l->add(sf->szFileList); // Files
|
||||
|
||||
l->add(error2string(sf->fe));
|
||||
|
||||
arr->add(l);
|
||||
if (_log_mask)
|
||||
arr->add(l); // Aggiorna array del log
|
||||
if (_log_mask) // Se aperta, aggiorna anche maschera
|
||||
_log_mask->update_log(log, *arr);
|
||||
}
|
||||
}
|
||||
|
||||
void TDDE_fax::remove_log(int log, PSEND_FAX sf)
|
||||
void TDDE_fax::remove_log(WORD log, PSEND_FAX sf)
|
||||
{
|
||||
TString_array* arr = log2array(log);
|
||||
if (arr)
|
||||
@ -1007,10 +1154,11 @@ void TDDE_fax::update_all_logs()
|
||||
do_custom_message(WM_FAXMSG, FAXLOGADD, (LPARAM)&tmpsf);
|
||||
}
|
||||
|
||||
_port.reset();
|
||||
FaxEnumDevices(_pappinfo);
|
||||
}
|
||||
|
||||
void TDDE_fax::update_log(int log)
|
||||
void TDDE_fax::update_log(WORD log)
|
||||
{
|
||||
if (_log_mask)
|
||||
{
|
||||
@ -1020,7 +1168,37 @@ void TDDE_fax::update_log(int log)
|
||||
}
|
||||
}
|
||||
|
||||
void TDDE_fax::log_delete(int log, unsigned long id)
|
||||
void TDDE_fax::show_status(PSEND_FAX sf)
|
||||
{
|
||||
if (_log_mask)
|
||||
{
|
||||
TString msg(80);
|
||||
switch(sf->fs)
|
||||
{
|
||||
case FAXST_SEND_INIT : msg = "Inizializzazione"; break;
|
||||
case FAXST_SEND_DIALING : msg = "Composizione del numero ";
|
||||
msg << sf->szDestFax;
|
||||
break;
|
||||
case FAXST_SEND_FCSI : msg = "Connessione"; break;
|
||||
case FAXST_SENDING : msg = "Spedizione pagina ";
|
||||
msg << sf->nTotCurPage << " di " << sf->nTotPages
|
||||
<< ": " << sf->nPercent << '%';
|
||||
break;
|
||||
case FAXST_PAGE_END : msg = "Fine pagina "; msg << sf->nTotCurPage; break;
|
||||
case FAXST_COMPLETE : msg = "Fine trasmissione"; break;
|
||||
case FAXST_ABORT : msg = "Operazione abortita"; break;
|
||||
case FAXST_PORTSHUT : msg = "Chiusura COM"; msg << sf->nPort;
|
||||
if (sf->fe != FAXERR_OK)
|
||||
msg << ": " << error2string(sf->fe);
|
||||
break;
|
||||
default : break;
|
||||
}
|
||||
if (msg.not_empty())
|
||||
_log_mask->set(F_STATUS, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void TDDE_fax::log_delete(WORD log, unsigned long id)
|
||||
{
|
||||
if (log == SUBSCRIBE_LOG_SENDING)
|
||||
FaxCancel(_pappinfo, id);
|
||||
@ -1031,7 +1209,40 @@ void TDDE_fax::log_delete(int log, unsigned long id)
|
||||
void TDDE_fax::auto_configure()
|
||||
{
|
||||
const int err = FaxAddDevice(_pappinfo, 0);
|
||||
if (err == 0)
|
||||
if (err != 0)
|
||||
{
|
||||
const int seconds = 4;
|
||||
TProgind pi(seconds, "Ricerca dei Modem/Fax collegati...", FALSE, TRUE, 48);
|
||||
for (int i = 1; i <= seconds; i++)
|
||||
{
|
||||
pi.setstatus(i);
|
||||
const clock_t end = clock() + CLOCKS_PER_SEC;
|
||||
while (clock() < end)
|
||||
do_events();
|
||||
}
|
||||
|
||||
_port.reset(); // Azzera tutti i flag delle porte
|
||||
FaxEnumDevices(_pappinfo); // Richiede la lista delle porte
|
||||
|
||||
pi.set_text("Controllo dei Modem/Fax trovati ...");
|
||||
for (i = 1; i <= seconds; i++)
|
||||
{
|
||||
pi.setstatus(i);
|
||||
const clock_t end = clock() + CLOCKS_PER_SEC;
|
||||
while (clock() < end)
|
||||
do_events();
|
||||
}
|
||||
|
||||
TString msg(24);
|
||||
msg << "Modem/Fax collegati: ";
|
||||
const long np = _port.ones();
|
||||
if (np == 0)
|
||||
msg << "NESSUNO";
|
||||
else
|
||||
msg << np;
|
||||
xvt_statbar_set(msg);
|
||||
}
|
||||
else
|
||||
error_box("Impossibile trovare il server Faxman");
|
||||
}
|
||||
|
||||
@ -1059,9 +1270,12 @@ bool TDDE_fax::run_mask()
|
||||
TString& TDDE_fax::ragsoc2name(TString& ragsoc) const
|
||||
{
|
||||
TString first_name = ragsoc.left(30); first_name.trim();
|
||||
TString last_name = ragsoc.mid(30); last_name.trim();
|
||||
ragsoc = first_name;
|
||||
ragsoc << ' ' << last_name;
|
||||
if (first_name.len() < 30)
|
||||
{
|
||||
TString last_name = ragsoc.mid(30); last_name.trim();
|
||||
ragsoc = first_name;
|
||||
ragsoc << ' ' << last_name;
|
||||
}
|
||||
return ragsoc;
|
||||
}
|
||||
|
||||
@ -1136,15 +1350,16 @@ bool TDDE_fax::ricerca_persone(char fg, const TString& codice, TFax_data& data)
|
||||
bool TDDE_fax::ricerca_ditte(const TString& codice, TFax_data& data) const
|
||||
{
|
||||
TLocalisamfile f(LF_NDITTE);
|
||||
f.put("CODDITTA", codice);
|
||||
f.put(NDT_CODDITTA, codice);
|
||||
const int err = f.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
TToken_string s(f.get("PFAX"), ',');
|
||||
s.add(f.get("FAX"));
|
||||
TToken_string s(128, ',');
|
||||
s.add(f.get(NDT_PFAX));
|
||||
s.add(f.get(NDT_FAX));
|
||||
data.set("DESTFAX", s);
|
||||
data.set("DESTNAME", f.get("PERRIF"));
|
||||
data.set("DESTFIRM", f.get("RAGSOC"));
|
||||
data.set("DESTNAME", f.get(NDT_PERRIF));
|
||||
data.set("DESTFIRM", f.get(NDT_RAGSOC));
|
||||
data.set("TIPO", "Ditte");
|
||||
data.set("DITTE", codice);
|
||||
}
|
||||
@ -1202,8 +1417,8 @@ protected:
|
||||
virtual bool pre_create();
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
virtual bool menu(MENU_TAG mt);
|
||||
virtual void on_firm_change();
|
||||
|
||||
public:
|
||||
TFax_server() : _fax(NULL) { }
|
||||
@ -1224,8 +1439,8 @@ bool TFax_server::create()
|
||||
{
|
||||
bool show_status = FALSE;
|
||||
|
||||
if (argc() == 2)
|
||||
show_status = stricmp(argv(1), "-S") == 0;
|
||||
if (argc() >= 2 && stricmp(argv(1), "-S") == 0)
|
||||
show_status = TRUE;
|
||||
|
||||
if (argc() > 2)
|
||||
{
|
||||
@ -1273,6 +1488,13 @@ bool TFax_server::destroy()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TFax_server::on_firm_change()
|
||||
{
|
||||
TApplication::on_firm_change();
|
||||
if (_fax)
|
||||
_fax->on_firm_change();
|
||||
}
|
||||
|
||||
bool TFax_server::menu(MENU_TAG mt)
|
||||
{
|
||||
if (_fax)
|
||||
|
@ -2,3 +2,4 @@
|
||||
#define F_SENDING 102
|
||||
#define F_COMPLETE 103
|
||||
#define F_FAILED 104
|
||||
#define F_STATUS 110
|
||||
|
@ -9,5 +9,5 @@ MENU TASK_MENUBAR
|
||||
|
||||
MENU BAR_ITEM(1)
|
||||
ITEM MENU_ITEM(1) "~Stato"
|
||||
ITEM MENU_ITEM(2) "~Azzera"
|
||||
ITEM MENU_ITEM(2) "~Riconfigura"
|
||||
|
||||
|
@ -23,7 +23,7 @@ ENDPAGE
|
||||
|
||||
PAGE "In Spedizione" -1 -1 76 10
|
||||
|
||||
SPREADSHEET F_SENDING 0 -3
|
||||
SPREADSHEET F_SENDING 0 -4
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
ITEM "Codice"
|
||||
@ -35,6 +35,12 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING F_STATUS 68
|
||||
BEGIN
|
||||
PROMPT 1 -3 "Stato "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -11 -1 ""
|
||||
@ -74,6 +80,7 @@ BEGIN
|
||||
ITEM "Data@10"
|
||||
ITEM "Ora@8"
|
||||
ITEM "Files@50"
|
||||
ITEM "Errore@30"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
@ -258,6 +265,12 @@ BEGIN
|
||||
FIELD FILELIST
|
||||
END
|
||||
|
||||
STRING 107 30
|
||||
BEGIN
|
||||
PROMPT 1 7 "Errore "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
|
@ -154,6 +154,7 @@
|
||||
15|Utenti|ba1 -3
|
||||
15|Attivazione|ba1 -4
|
||||
15|Backup|ba2 -1
|
||||
15|Gestione Fax|bafax -s
|
||||
16|Servizio|
|
||||
16|Copia Archivi|cg4 -1
|
||||
16|Ripristino stampa registri|cg5 -4
|
||||
|
Loading…
x
Reference in New Issue
Block a user