Use Okular's own print preview dialog for all documents

frameworks
Martin T. H. Sandsmark 10 years ago
parent 2639b1e8ed
commit decd4849a8
  1. 21
      part.cpp

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

Loading…
Cancel
Save