diff --git a/include/bagn009.uml b/include/bagn009.uml index b0872a3cd..b0daabe68 100755 --- a/include/bagn009.uml +++ b/include/bagn009.uml @@ -1,19 +1,19 @@ #include -PAGE "Esportazione" -1 -1 66 5 +PAGE "Esportazione" -1 -1 76 5 -GROUPBOX DLG_NULL 64 4 +GROUPBOX DLG_NULL 74 4 BEGIN PROMPT 1 1 "@bFile di Output" END -STRING F_PRINTER 80 48 +STRING F_PRINTER 80 58 BEGIN PROMPT 2 2 "Cartella " DSELECT END -STRING F_FORM 80 50 +STRING F_FORM 128 60 BEGIN PROMPT 2 3 "File " END @@ -22,35 +22,74 @@ ENDPAGE TOOLBAR "topbar" 0 0 0 2 -BUTTON DLG_PDF 10 2 +BUTTON DLG_PDF 2 2 BEGIN PROMPT 1 1 "~PDF" - PICTURE BMP_PDF + PICTURE TOOL_PDF MESSAGE EXIT,80 + GROUP 12 END -BUTTON DLG_ARCHIVE 10 2 +BUTTON DLG_SIGNPDF 2 2 +BEGIN + PROMPT 1 1 "Firmato" + PICTURE TOOL_SIGNPDF + MESSAGE EXIT,112 + GROUP 12 28 +END + +BUTTON DLG_NULL 2 2 +BEGIN +END + +BUTTON DLG_ARCHIVE 2 2 BEGIN PROMPT 2 1 "~Archivia" - PICTURE BMP_ARCHIVE + PICTURE TOOL_ARCHIVE MESSAGE EXIT,65 + GROUP 12 +END + +BUTTON DLG_SIGNARC 2 2 +BEGIN + PROMPT 2 1 "Firmato" + PICTURE TOOL_SIGNARCH + MESSAGE EXIT,97 + GROUP 12 28 +END + +BUTTON DLG_NULL 2 2 +BEGIN +END + +BUTTON DLG_EMAIL 2 2 +BEGIN + PROMPT 4 1 "~Mail" + PICTURE TOOL_EMAIL + MESSAGE EXIT,77 + GROUP 12 +END + +BUTTON DLG_SIGNMAIL 2 2 +BEGIN + PROMPT 4 1 "Firmata" + PICTURE TOOL_SIGNMAIL + MESSAGE EXIT,109 + GROUP 12 28 +END + +BUTTON DLG_NULL 2 2 +BEGIN END BUTTON DLG_EDIT 10 2 BEGIN PROMPT 3 1 "~Edit" - PICTURE BMP_EDIT + PICTURE TOOL_EDIT MESSAGE EXIT,69 END -BUTTON DLG_EMAIL 10 2 -BEGIN - PROMPT 4 1 "~Mail" - PICTURE BMP_EMAIL - MESSAGE EXIT,77 -END - -BUTTON DLG_CANCEL 10 2 +BUTTON DLG_CANCEL 2 2 BEGIN PROMPT 5 1 "" END diff --git a/include/defmask.h b/include/defmask.h index ebea0abd8..5ba95d18d 100755 --- a/include/defmask.h +++ b/include/defmask.h @@ -39,6 +39,10 @@ #define DLG_EXPORT 35 /* TAG del bottone Esporta*/ #define DLG_IMPORT 36 /* TAG del bottone Importa*/ #define DLG_PREVIEW 37 /* TAG del bottone Anteprima*/ +#define DLG_SIGNMAIL 38 /* TAG del bottone Posta firmata */ +#define DLG_SIGNPDF 39 /* TAG del bottone PDF firmato */ +#define DLG_SIGNARC 40 /* TAG del bottone Archivia firmato */ + #define DLG_USER 100 /* TAG del primo controllo definito dall'utente */ /* @M diff --git a/include/modaut.h b/include/modaut.h index e8087bc5a..31b0ed42b 100755 --- a/include/modaut.h +++ b/include/modaut.h @@ -29,7 +29,7 @@ #define ICAUT 25 #define EPAUT 26 #define TCAUT 27 -#define TMAUT 28 +#define FDAUT 28 #define COAUT 29 #define VEAUT 31 #define MGAUT 32 diff --git a/include/reprint.cpp b/include/reprint.cpp index 3ceb619a6..d30382129 100755 --- a/include/reprint.cpp +++ b/include/reprint.cpp @@ -1494,10 +1494,10 @@ bool TBook::print_page(TWindow& win, size_t page) return true; } -bool TBook::export_text(const TFilename& fname) +bool TBook::export_text(const TFilename& fname, bool signature) { if (fname.ends_with(".pdf", true)) - return export_pdf(fname); + return export_pdf(fname, signature); TToken_string str(1024, '='); @@ -1922,7 +1922,7 @@ bool TBook::print(size_t pagefrom, size_t pageto, word copies) return xvt_print_start_thread(main_loop_callback, (long)this) != 0; } -bool TBook::export_pdf(const TFilename& filename) +bool TBook::export_pdf(const TFilename& filename, bool certified) { bool ok = (pages() > 0) && dongle().active(RSAUT); if (ok) @@ -1932,6 +1932,11 @@ bool TBook::export_pdf(const TFilename& filename) _pageto = 0; _copies = 1; ok = xvt_print_start_thread(main_loop_callback, (long)this) != 0; + if (ok && certified) + { + if (!xvt_pdf_sign(filename)) + error_box(TR("Impossibile apporre la firma digitale al documento")); + } } return ok; } @@ -1945,22 +1950,27 @@ bool TBook::esporta() TFilename fname; const KEY key = spotlite_ask_name(fname); - bool ok = key >= 'A' && key <= 'Z'; + bool ok = isalpha(key) != 0; + const bool signature = key >= 'a'; switch (key) { case 'A': - ok = archive(); + case 'a': + ok = archive(NULL, signature); break; case 'E': - ok = export_text(fname); + case 'e': + ok = export_text(fname, signature); if (ok) xvt_sys_goto_url(fname, "open"); break; case 'M': - ok = send_mail(fname); + case 'm': + ok = send_mail(fname, signature); break; case 'P': - ok = export_pdf(fname); + case 'p': + ok = export_pdf(fname, signature); if (ok) xvt_sys_goto_url(fname, "open"); break; @@ -1970,22 +1980,22 @@ bool TBook::esporta() return ok; } -bool TBook::archive(const char* repname) +bool TBook::archive(const char* repname, bool signature) { TFilename pdf; bool ok = spotlite_generate_name(repname, pdf); if (ok) { - ok = export_pdf(pdf); + ok = export_pdf(pdf, signature); if (ok) spotlite_notify(pdf); } return ok; } -bool TBook::send_mail(const TFilename& file) +bool TBook::send_mail(const TFilename& file, bool signature) { - bool ok = export_pdf(file); + bool ok = export_pdf(file, signature); if (ok) ok = spotlite_send_mail(file); return ok; @@ -2024,7 +2034,7 @@ bool TBook::print_or_preview() case exportprinter: { const TFilename f = printer().get_export_file(); - ok = export_text(f); + ok = export_text(f, false); if (ok) xvt_sys_goto_url(f, "open"); } diff --git a/include/reprint.h b/include/reprint.h index 10b342679..864178d89 100755 --- a/include/reprint.h +++ b/include/reprint.h @@ -85,13 +85,13 @@ public: // virtual void print_doc(TWindow& win, const TFilename& name); virtual bool on_link(const TReport_link&) { return false; } -virtual bool print(size_t pagefrom = 0, size_t pageto = 0, word copies = 0); -virtual bool archive(const char* repname = NULL); + virtual bool print(size_t pagefrom = 0, size_t pageto = 0, word copies = 0); + virtual bool archive(const char* repname = NULL, bool certified = false); virtual bool preview(); - virtual bool export_pdf(const TFilename& fname); - virtual bool export_text(const TFilename& fname); - virtual bool send_mail(const TFilename& fname); + virtual bool export_pdf(const TFilename& fname, bool certified); + virtual bool export_text(const TFilename& fname, bool certified); + virtual bool send_mail(const TFilename& fname, bool certified); virtual bool esporta(); bool print_or_preview(); // Calls one of the above diff --git a/include/spotlite.cpp b/include/spotlite.cpp index 56cd9219f..79d3559be 100755 --- a/include/spotlite.cpp +++ b/include/spotlite.cpp @@ -25,11 +25,14 @@ KEY spotlite_ask_name(TFilename& pdf) { TMask msk("bagn009"); - const bool can_arc = dongle().active(RSAUT); + TApplication& a = main_app(); + const bool can_arc = a.has_module(RSAUT); + const bool can_sign = can_arc && a.has_module(FDAUT); msk.enable(DLG_PDF, can_arc); + msk.enable(DLG_SIGNPDF, can_sign); - TString80 export_name; - const bool gnp = main_app().get_next_pdf(0, 0, NULL, 1, 0, pdf); + TFilename export_name; + const bool gnp = a.get_next_pdf(0, 0, NULL, 1, 0, pdf); if (gnp) { pdf.ext(""); @@ -39,8 +42,10 @@ KEY spotlite_ask_name(TFilename& pdf) export_name = "export"; msk.enable(DLG_ARCHIVE, can_arc && gnp); + msk.enable(DLG_SIGNARC, can_sign && gnp); + msk.enable(DLG_EMAIL, can_arc); - + msk.enable(DLG_SIGNMAIL, can_sign); pdf.tempdir(); msk.set(F_PRINTER, pdf); // Cartella dei file da esportare @@ -59,10 +64,14 @@ KEY spotlite_ask_name(TFilename& pdf) switch (key) { case 'A': + case 'a': if (!spotlite_generate_name(msk.get(F_FORM), pdf)) key = K_QUIT; break; - case 'E': pdf.ext("txt"); break; + case 'E': + case 'e': + pdf.ext("txt"); + break; default : break; } } diff --git a/include/urldefid.h b/include/urldefid.h index 708cbf138..6b66044cd 100755 --- a/include/urldefid.h +++ b/include/urldefid.h @@ -139,6 +139,9 @@ #define TOOL_LASTREC 125 #define TOOL_FINDREC 126 #define TOOL_EMAIL 139 +#define TOOL_SIGNMAIL 140 +#define TOOL_SIGNPDF 141 +#define TOOL_SIGNARCH 142 #define TOOL_IMPORT 150 #define TOOL_EXPORT 151 #define TOOL_CONVERT 156 @@ -147,6 +150,7 @@ #define TOOL_SETPRINT 165 #define TOOL_LENTE 166 #define TOOL_PDF 174 +#define TOOL_ARCHIVE 175 #define TOOL_PREVIEW 176 #define TOOL_FONT 179 #define TOOL_COPY 180