summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-13 20:29:50 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-08-13 20:29:50 (GMT)
commit2639b1e8ed45d1c21099debe5ab6cbdf37a279ef (patch)
tree6d22112534d0b42cb874063415ffe2af2d1e727b
parent57fd20e90e3e13a6fd7fdeb638a4d06316f5e809 (diff)
Extend print preview dialog to handle .pdf previews
-rw-r--r--ui/fileprinterpreview.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/ui/fileprinterpreview.cpp b/ui/fileprinterpreview.cpp
index 59d0059..425f104 100644
--- a/ui/fileprinterpreview.cpp
+++ b/ui/fileprinterpreview.cpp
@@ -81,12 +81,18 @@ void FilePrinterPreviewPrivate::getPart()
qCDebug(OkularUiDebug) << "querying trader for application/ps service";
KPluginFactory *factory(0);
- /* Explicitly look for the Okular/Ghostview part: no other PostScript
- parts are available now; other parts which handles text are not
- suitable here (PostScript source code) */
- KService::List offers =
- KMimeTypeTrader::self()->query(QStringLiteral("application/postscript"), QStringLiteral("KParts/ReadOnlyPart"),
- QStringLiteral("[DesktopEntryName] == 'okularghostview'"));
+ KService::List offers;
+ if (filename.endsWith(QStringLiteral(".ps"))) {
+ /* Explicitly look for the Okular/Ghostview part: no other PostScript
+ parts are available now; other parts which handles text are not
+ suitable here (PostScript source code) */
+ offers =
+ KMimeTypeTrader::self()->query(QStringLiteral("application/postscript"),
+ QStringLiteral("KParts/ReadOnlyPart"),
+ QStringLiteral("[DesktopEntryName] == 'okularghostview'"));
+ } else {
+ offers = KMimeTypeTrader::self()->query("application/pdf", "KParts/ReadOnlyPart");
+ }
KService::List::ConstIterator it = offers.constBegin();
while (!factory && it != offers.constEnd()) {