|
|
|
@ -68,8 +68,6 @@ |
|
|
|
#include <KXMLGUIClient> |
|
|
|
#include <KXMLGUIClient> |
|
|
|
#include <KXMLGUIFactory> |
|
|
|
#include <KXMLGUIFactory> |
|
|
|
|
|
|
|
|
|
|
|
#include <KPrintPreview> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
#if 0 |
|
|
|
#include <knewstuff2/engine.h> |
|
|
|
#include <knewstuff2/engine.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
@ -2453,30 +2451,33 @@ void Part::slotPrintPreview() |
|
|
|
if (m_document->pages() == 0) return; |
|
|
|
if (m_document->pages() == 0) return; |
|
|
|
|
|
|
|
|
|
|
|
QPrinter printer; |
|
|
|
QPrinter printer; |
|
|
|
|
|
|
|
QString tempFilePattern; |
|
|
|
|
|
|
|
|
|
|
|
// Native printing supports KPrintPreview, Postscript needs to use FilePrinterPreview
|
|
|
|
if ( m_document->printingSupport() == Okular::Document::PostscriptPrinting ) |
|
|
|
if ( m_document->printingSupport() == Okular::Document::NativePrinting ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
KPrintPreview previewdlg( &printer, widget() ); |
|
|
|
tempFilePattern = (QDir::tempPath() + QLatin1String("/okular_XXXXXX.ps")); |
|
|
|
setupPrint( printer ); |
|
|
|
} |
|
|
|
doPrint( printer ); |
|
|
|
else if ( m_document->printingSupport() == Okular::Document::NativePrinting ) |
|
|
|
previewdlg.exec(); |
|
|
|
{ |
|
|
|
|
|
|
|
tempFilePattern = (QDir::tempPath() + QLatin1String("/okular_XXXXXX.pdf")); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Generate a temp filename for Print to File, then release the file so generator can write to it
|
|
|
|
return; |
|
|
|
QTemporaryFile tf(QDir::tempPath() + QLatin1String("/okular_XXXXXX.ps")); |
|
|
|
} |
|
|
|
tf.setAutoRemove( true ); |
|
|
|
|
|
|
|
tf.open(); |
|
|
|
// Generate a temp filename for Print to File, then release the file so generator can write to it
|
|
|
|
printer.setOutputFileName( tf.fileName() ); |
|
|
|
QTemporaryFile tf(tempFilePattern); |
|
|
|
tf.close(); |
|
|
|
tf.setAutoRemove( true ); |
|
|
|
setupPrint( printer ); |
|
|
|
tf.open(); |
|
|
|
doPrint( printer ); |
|
|
|
printer.setOutputFileName( tf.fileName() ); |
|
|
|
if ( QFile::exists( printer.outputFileName() ) ) |
|
|
|
tf.close(); |
|
|
|
{ |
|
|
|
setupPrint( printer ); |
|
|
|
Okular::FilePrinterPreview previewdlg( printer.outputFileName(), widget() ); |
|
|
|
doPrint( printer ); |
|
|
|
previewdlg.exec(); |
|
|
|
if ( QFile::exists( printer.outputFileName() ) ) |
|
|
|
} |
|
|
|
{ |
|
|
|
|
|
|
|
Okular::FilePrinterPreview previewdlg( printer.outputFileName(), widget() ); |
|
|
|
|
|
|
|
previewdlg.exec(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|