From c93d4a019f22b137c6abedcdbfdbf3a9adc197b9 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sat, 12 Jun 2021 16:54:17 +0200 Subject: [PATCH] Add support for presentations --- qml/components/DocumentFilterOffice.notqml | 30 ++++++++++++++++++++++ qml/pages/FirstPage.qml | 9 +++++++ src/convertworker.cpp | 2 -- src/mimer.cpp | 5 +++- src/mimer.h | 7 +++++ 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/qml/components/DocumentFilterOffice.notqml b/qml/components/DocumentFilterOffice.notqml index b40ff96..0ebe5c7 100644 --- a/qml/components/DocumentFilterOffice.notqml +++ b/qml/components/DocumentFilterOffice.notqml @@ -71,4 +71,34 @@ GalleryFilterUnion { property: "fileName" value: ".RTF" } + + GalleryEndsWithFilter { + property: "fileName" + value: ".ppt" + } + + GalleryEndsWithFilter { + property: "fileName" + value: ".pptx" + } + + GalleryEndsWithFilter { + property: "fileName" + value: ".odp" + } + + GalleryEndsWithFilter { + property: "fileName" + value: ".PPT" + } + + GalleryEndsWithFilter { + property: "fileName" + value: ".PPTX" + } + + GalleryEndsWithFilter { + property: "fileName" + value: ".ODP" + } } diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 1fb19ca..7b83418 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -61,6 +61,7 @@ Page { signal noFileSelected() Component.onCompleted: { + console.log("Selected file is", selectedFile) IppDiscovery.discover(); if(selectedFile != "") { @@ -315,6 +316,14 @@ Page { highlighted: !(selectedFile == "" || canPrint) source: "image://theme/icon-m-file-formatted" } + HighlightImage { + height: Theme.itemSizeExtraSmall/2 + width: Theme.itemSizeExtraSmall/2 + visible: supported_formats.office + highlightColor: "red" + highlighted: !(selectedFile == "" || canPrint) + source: "image://theme/icon-m-file-presentation" + } HighlightImage { height: Theme.itemSizeExtraSmall/2 width: Theme.itemSizeExtraSmall/2 diff --git a/src/convertworker.cpp b/src/convertworker.cpp index 48fae90..848ddbc 100644 --- a/src/convertworker.cpp +++ b/src/convertworker.cpp @@ -391,8 +391,6 @@ try { convertPdf(tmpPdfFile.fileName(), header, targetFormat, Colors, Quality, PaperSize, HwResX, HwResY, TwoSided, Tumble, PageRangeLow, PageRangeHigh, BackHFlip, BackVFlip); - qDebug() << "Finished"; - qDebug() << "posted"; } diff --git a/src/mimer.cpp b/src/mimer.cpp index 388469b..d9615e2 100644 --- a/src/mimer.cpp +++ b/src/mimer.cpp @@ -17,10 +17,13 @@ const QString Mimer::DOCX = "application/vnd.openxmlformats-officedocument.wordp const QString Mimer::RTF = "text/rtf"; const QString Mimer::RTF_APP = "application/rtf"; const QString Mimer::ODT = "application/vnd.oasis.opendocument.text"; +const QString Mimer::PPT = "application/vnd.ms-powerpoint"; +const QString Mimer::PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; +const QString Mimer::ODP = "application/vnd.oasis.opendocument.presentation"; const QString Mimer::Plaintext = "text/plain"; -const QStringList Mimer::OfficeFormats = {DOC, DOCX, RTF, RTF_APP, ODT}; +const QStringList Mimer::OfficeFormats = {DOC, DOCX, RTF, RTF_APP, ODT, PPT, PPTX, ODP}; Mimer::Mimer() { diff --git a/src/mimer.h b/src/mimer.h index bccc046..e281a59 100644 --- a/src/mimer.h +++ b/src/mimer.h @@ -29,6 +29,10 @@ public: Q_PROPERTY(const QString DOCX MEMBER DOCX CONSTANT); Q_PROPERTY(const QString RTF MEMBER RTF CONSTANT); Q_PROPERTY(const QString ODT MEMBER ODT CONSTANT); + Q_PROPERTY(const QString PPT MEMBER PPT CONSTANT); + Q_PROPERTY(const QString PPTX MEMBER PPTX CONSTANT); + Q_PROPERTY(const QString ODP MEMBER ODP CONSTANT); + Q_PROPERTY(const QString Plaintext MEMBER Plaintext CONSTANT); @@ -51,6 +55,9 @@ public: static const QString RTF; static const QString RTF_APP; static const QString ODT; + static const QString PPT; + static const QString PPTX; + static const QString ODP; static const QString Plaintext;