Index: core/fileprinter.cpp =================================================================== --- core/fileprinter.cpp (revisione 1115533) +++ core/fileprinter.cpp (copia locale) @@ -307,6 +307,41 @@ return size; } +Generator::PrintError FilePrinter::printError( int c ) +{ + Generator::PrintError pe; + if ( c >= 0 ) + { + pe = Generator::NoPrintError; + } + switch ( c ) + { + case -1: + pe = Generator::PrintingProcessCrashPrintError; + break; + case -2: + pe = Generator::PrintingProcessStartPrintError; + break; + case -5: + pe = Generator::PrintToFilePrintError; + break; + case -6: + pe = Generator::InvalidPrinterStatePrintError; + break; + case -7: + pe = Generator::UnableToFindFilePrintError; + break; + case -8: + pe = Generator::NoFileToPrintError; + break; + case -9: + pe = Generator::NoBinaryToPrintError; + break; + default: + pe = Generator::UnknownPrintError; + } + return pe; +} Index: core/fileprinter.h =================================================================== --- core/fileprinter.h (revisione 1115533) +++ core/fileprinter.h (copia locale) @@ -18,6 +18,7 @@ #include #include +#include class QPrinter; class QSize; @@ -146,6 +147,12 @@ */ static QSize psPaperSize( QPrinter &printer ); + /** + * Convert the code returned by printFile* to PrintError + * @since 0.11 (KDE 4.5) + */ + static Generator::PrintError printError( int c ); + protected: bool detectCupsService(); Index: generators/poppler/generator_pdf.cpp =================================================================== --- generators/poppler/generator_pdf.cpp (revisione 1115533) +++ generators/poppler/generator_pdf.cpp (copia locale) @@ -937,19 +937,8 @@ Okular::FilePrinter::SystemDeletesFiles, Okular::FilePrinter::ApplicationSelectsPages, document()->bookmarkedPageRange() ); - if ( ret >= 0 ) - { - lastPrintError = NoPrintError; - return true; - } - else if (ret == -1) lastPrintError = PrintingProcessCrashPrintError; - else if (ret == -2) lastPrintError = PrintingProcessStartPrintError; - else if (ret == -5) lastPrintError = PrintToFilePrintError; - else if (ret == -6) lastPrintError = InvalidPrinterStatePrintError; - else if (ret == -7) lastPrintError = UnableToFindFilePrintError; - else if (ret == -8) lastPrintError = NoFileToPrintError; - else if (ret == -9) lastPrintError = NoBinaryToPrintError; - else lastPrintError = UnknownPrintError; + + lastPrintError = Okular::FilePrinter::printError( ret ); } else { @@ -960,7 +949,7 @@ tf.close(); - return false; + return (lastPrintError == NoPrintError); } QVariant PDFGenerator::metaData( const QString & key, const QVariant & option ) const