#include #include #include #include #include #include #include // 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); 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, ';'), attach(pdf, ';'); TString subj, text; 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; }