Print correct number of copies using new Qt api

Add eror code if print to file fails

BUG: 155695

svn path=/trunk/KDE/kdegraphics/okular/; revision=1065863
This commit is contained in:
John Layt 2009-12-24 14:39:49 +00:00
parent c2390f3197
commit ed9bbddace
2 changed files with 9 additions and 3 deletions

View file

@ -80,7 +80,11 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
if ( inputFileInfo.suffix() == outputFileInfo.suffix() ) {
int res = QFile::copy( fileList[0], printer.outputFileName() );
if ( res ) ret = 0;
if ( res ) {
ret = 0;
} else {
ret = -5;
}
} else if ( inputFileInfo.suffix() == "ps" && outputFileInfo.suffix() == "pdf" && ps2pdfAvailable() ) {
exe = "ps2pdf";
argList << fileList[0] << printer.outputFileName();
@ -150,6 +154,7 @@ QList<int> FilePrinter::pageList( QPrinter &printer, int lastPage, const QList<i
for (int i = startPage; i <= endPage; i++ ) {
list << i;
}
return list;
}
@ -336,8 +341,7 @@ QStringList FilePrinter::destination( QPrinter &printer, const QString &version
QStringList FilePrinter::copies( QPrinter &printer, const QString &version )
{
// If CUPS will always return 1 regardless what the user chooses.
int cp = printer.numCopies();
int cp = printer.actualNumCopies();
if ( version == "lp" ) {
return QStringList("-n") << QString("%1").arg( cp );

View file

@ -63,6 +63,7 @@ public:
* -8 if empty file name
* -7 if unable to find file
* -6 if invalid printer state
* -5 if print to file copy failed
* -2 if the KProcess could not be started
* -1 if the KProcess crashed
* otherwise the KProcess exit code
@ -87,6 +88,7 @@ public:
* -8 if empty file list
* -7 if unable to find a file
* -6 if invalid printer state
* -5 if print to file copy failed
* -2 if the KProcess could not be started
* -1 if the KProcess crashed
* otherwise the KProcess exit code