campo-sirio/include/spotlite.cpp
alex c75d4c35f7 Patch level : 4.0 657
Ricompilazione Demo : [ ]
Commento            :

Riportata la versione 3.1 patch 855


git-svn-id: svn://10.65.10.50/trunk@15071 c028cbd2-c16b-5b4b-a496-9718f37d4682
2007-03-16 13:33:09 +00:00

99 lines
2.3 KiB
C++
Executable File

#include <applicat.h>
#include <dongle.h>
#include <mask.h>
#include <modaut.h>
#include <spotlite.h>
#include <defmask.h>
#include <bagn003.h>
// Funzione per generare il nome di un file da archiviare
bool spotlite_generate_name(const char* codnum, TFilename& pdf)
{
bool ok = main_app().get_next_pdf(0, -1, codnum, 0, 0, pdf);
if (ok && pdf.exist())
{
TString msg;
msg = TR("Il documento risulta essere gia' archiviato: sovrascrivere");
msg << '\n' << pdf.name();
ok = yesno_box(msg);
}
return ok;
}
KEY spotlite_ask_name(TFilename& pdf)
{
TMask msk("bagn009");
const bool can_arc = dongle().active(RSAUT);
msk.enable(DLG_PDF, can_arc);
TString80 export_name;
const bool gnp = main_app().get_next_pdf(0, 0, NULL, 1, 0, pdf);
if (gnp)
{
pdf.ext("");
export_name = pdf.name();
}
if (export_name.blank())
export_name = "export";
msk.enable(DLG_ARCHIVE, can_arc && gnp);
msk.enable(DLG_EMAIL, can_arc);
msk.show(DLG_EMAIL, can_arc && dongle().active(EEAUT));
pdf.tempdir();
msk.set(F_PRINTER, pdf); // Cartella dei file da esportare
msk.set(F_FORM, export_name); // Nome standard del file da esportare
KEY key = msk.run();
if (key != K_ESC && key != K_QUIT)
{
pdf = msk.get(F_PRINTER);
if (!pdf.exist())
pdf.tempdir();
if (!msk.field(F_FORM).empty())
export_name = msk.get(F_FORM);
pdf.add(export_name);
pdf.ext("pdf");
switch (key)
{
case 'A':
if (!spotlite_generate_name(msk.get(F_FORM), pdf))
key = K_QUIT;
break;
case 'E': pdf.ext("txt"); break;
default : break;
}
}
return key;
}
// Funzione per notificare al sistema l'avvenuta archiviazione
bool spotlite_notify(const TFilename& pdf)
{
bool ok = pdf.exist();
if (ok)
{
TFilename sentinel = pdf.path();
sentinel.add("sentinel.ini");
ofstream s(sentinel, ios::app);
s << pdf.name() << endl;
}
return ok;
}
// Funzione per spedire un pdf via mail
bool spotlite_send_mail(const TFilename& pdf)
{
TToken_string to(15, ';'), cc(15, ';'), ccn(15, ';');
TString subj, text;
TToken_string attach(pdf, ';');
bool ui = true;
bool ok = main_app().get_next_mail(to, cc, ccn, subj, text, attach, ui);
ok = xvt_mail_send(to, cc, ccn, subj, text, attach, ui) != 0;
return ok;
}