Index: CtrlLib/CtrlUtil.h =================================================================== --- CtrlLib/CtrlUtil.h (wersja 8303) +++ CtrlLib/CtrlUtil.h (kopia robocza) @@ -68,8 +68,9 @@ bool landscape; String name; String options; + bool dlgSuccess; bool Execute0(bool dodlg); - + public: Draw& GetDraw(); operator Draw&() { return GetDraw(); } Index: CtrlLib/PrinterJob.cpp =================================================================== --- CtrlLib/PrinterJob.cpp (wersja 8303) +++ CtrlLib/PrinterJob.cpp (kopia robocza) @@ -220,6 +220,7 @@ bool IsCanceled(); private: + void StandardizePrinterName(String& printerName); void OnOK(); private: @@ -286,6 +287,7 @@ int q = h.Find(':'); if(q >= 0) { String p = h.Mid(q + 1); + StandardizePrinterName(p); if(printer.HasKey(p)) { printer <<= p; SyncPrinterOptions(); @@ -303,6 +305,13 @@ return canceled; } +void PrinterDlg::StandardizePrinterName(String& printerName) +{ + printerName.Replace(" ", ""); + printerName.Replace("\r", ""); + printerName.Replace("\n", ""); +} + void PrinterDlg::OnOK() { canceled = false; @@ -351,6 +360,7 @@ from = to = 0; current = 0; pgsz = GetDefaultPageSize(); + dlgSuccess = false; } PrinterJob::~PrinterJob() @@ -373,7 +383,7 @@ h.IsEmpty() ? dlg.paper <<= "A4" : dlg.paper <<= h; if(dodlg) { dlg.Run(); - if (!dlg.IsCanceled()) + if(dlg.IsCanceled()) return false; } options.Clear(); @@ -411,7 +421,8 @@ bool PrinterJob::Execute() { - return Execute0(false); + dlgSuccess = Execute0(true); + return dlgSuccess; } struct PrinterDraw : PdfDraw { @@ -429,9 +440,8 @@ Draw& PrinterJob::GetDraw() { if(!draw) { - bool canceled = Execute0(true); PrinterDraw *pd = new PrinterDraw(pgsz); - pd->canceled = canceled; + pd->canceled = !dlgSuccess; pd->options = options; draw = pd; }