Commit ed9bbdda authored by John Layt's avatar John Layt

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
parent c2390f31
......@@ -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 );
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment