← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/lo-supported-documents into lp:~ubuntu-docviewer-dev/ubuntu-docviewer-app/lo-tiled-rendering

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/lo-supported-documents into lp:~ubuntu-docviewer-dev/ubuntu-docviewer-app/lo-tiled-rendering.

Commit message:
Added support for all (OpenDocument/OpenXMLFormat/MS) (text/spreadsheet/presentation) documents in DocViewer's documentModel and plugin loader.

Requested reviews:
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/lo-supported-documents/+merge/264686

Added support for all (OpenDocument/OpenXMLFormat/MS) (text/spreadsheet/presentation) documents in DocViewer's documentModel, ContentHub handler and plugin loader.

*** NOTES:
At the moment the code that determines whether the document is supported or not is redundant, in src/plugin/file-qml-plugin/documentmodel.cpp and src/app/content-communicator.cpp.
This will be solved as soon as we switch to the ContentHub QML APIs, since we'll provide some proper helper in the DocumentViewer QML plugin.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/lo-supported-documents into lp:~ubuntu-docviewer-dev/ubuntu-docviewer-app/lo-tiled-rendering.
=== modified file 'src/app/content-communicator.cpp'
--- src/app/content-communicator.cpp	2015-06-24 12:04:16 +0000
+++ src/app/content-communicator.cpp	2015-07-14 09:22:09 +0000
@@ -241,14 +241,17 @@
  */
 bool ContentCommunicator::isSupportedMimetype(QString mimetype)
 {
-    if (mimetype.startsWith("text/"))
-        return true;
-
-    if (mimetype == "application/pdf")
-        return true;
-
-    if (mimetype.startsWith("application/vnd.oasis.opendocument"))
-        return true;
-
-    return false;
+    // TODO: We should use a common shared code for DocumentViewer.DocumentsModel
+    // QML component and ContentHub. That will happen when we'll switch to
+    // QML ContentHub APIs.
+    return (mimetype.startsWith("text/")
+            || mimetype == "application/pdf"
+            || mimetype.startsWith("application/vnd.oasis.opendocument")
+            || mimetype == "application/msword")
+            || mimetype == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+            || mimetype == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+            || mimetype == "application/vnd.openxmlformats-officedocument.presentationml.presentation"
+            || mimetype == "application/msword"
+            || mimetype == "application/vnd.ms-excel"
+            || mimetype == "application/vnd.ms-powerpoint";
 }

=== modified file 'src/app/qml/common/loadComponent.js'
--- src/app/qml/common/loadComponent.js	2015-06-24 12:04:16 +0000
+++ src/app/qml/common/loadComponent.js	2015-07-14 09:22:09 +0000
@@ -28,7 +28,13 @@
         qmlToLoad = Qt.resolvedUrl("../pdfView/PdfView.qml");
 
     // Check if LibreOffice document
-    if (mimetype.indexOf("application/vnd.oasis.opendocument") > -1)
+    if (mimetype.indexOf("application/vnd.oasis.opendocument") > -1
+            || mimetype === "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+            || mimetype === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+            || mimetype === "application/vnd.openxmlformats-officedocument.presentationml.presentation"
+            || mimetype === "application/msword"
+            || mimetype === "application/vnd.ms-excel"
+            || mimetype === "application/vnd.ms-powerpoint")
         qmlToLoad = Qt.resolvedUrl("../loView/LOView.qml")
 
     if (qmlToLoad != "") {

=== modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
--- src/app/qml/documentPage/DocumentGridDelegate.qml	2015-05-13 14:22:36 +0000
+++ src/app/qml/documentPage/DocumentGridDelegate.qml	2015-07-14 09:22:09 +0000
@@ -110,6 +110,21 @@
                 if (model.mimetype === "application/pdf")
                     return "application-pdf-symbolic"
 
+                if (model.mimetype === "application/vnd.oasis.opendocument.text"
+                        || model.mimetype === "application/msword"
+                        || model.mimetype === "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
+                    return "x-office-document-symbolic"
+
+                if (model.mimetype === "application/vnd.oasis.opendocument.spreadsheet"
+                        || model.mimetype === "application/vnd.ms-excel"
+                        || model.mimetype === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+                    return "x-office-spreadsheet-symbolic"
+
+                if (model.mimetype === "application/vnd.oasis.opendocument.presentation"
+                        || model.mimetype === "application/vnd.ms-powerpoint"
+                        || model.mimetype === "application/vnd.openxmlformats-officedocument.presentationml.presentation")
+                    return "x-office-presentation-symbolic"
+
                 return "package-x-generic-symbolic"
             }
         }

=== modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
--- src/app/qml/documentPage/DocumentListDelegate.qml	2015-06-22 17:01:23 +0000
+++ src/app/qml/documentPage/DocumentListDelegate.qml	2015-07-14 09:22:09 +0000
@@ -99,6 +99,21 @@
                 if (model.mimetype === "application/pdf")
                     return "application-pdf-symbolic"
 
+                if (model.mimetype === "application/vnd.oasis.opendocument.text"
+                        || model.mimetype === "application/msword"
+                        || model.mimetype === "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
+                    return "x-office-document-symbolic"
+
+                if (model.mimetype === "application/vnd.oasis.opendocument.spreadsheet"
+                        || model.mimetype === "application/vnd.ms-excel"
+                        || model.mimetype === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+                    return "x-office-spreadsheet-symbolic"
+
+                if (model.mimetype === "application/vnd.oasis.opendocument.presentation"
+                        || model.mimetype === "application/vnd.ms-powerpoint"
+                        || model.mimetype === "application/vnd.openxmlformats-officedocument.presentationml.presentation")
+                    return "x-office-presentation-symbolic"
+
                 return "package-x-generic-symbolic"
             }
 

=== modified file 'src/plugin/file-qml-plugin/documentmodel.cpp'
--- src/plugin/file-qml-plugin/documentmodel.cpp	2015-06-24 12:04:16 +0000
+++ src/plugin/file-qml-plugin/documentmodel.cpp	2015-07-14 09:22:09 +0000
@@ -118,7 +118,16 @@
     QMimeDatabase db;
     QString mimetype = db.mimeTypeForFile(path).name();
 
-    return (mimetype.startsWith("text/") || mimetype == "application/pdf" || mimetype.startsWith("application/vnd.oasis.opendocument"));
+    return (mimetype.startsWith("text/")
+            || mimetype == "application/pdf"
+            || mimetype.startsWith("application/vnd.oasis.opendocument")
+            || mimetype == "application/msword")
+            || mimetype == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+            || mimetype == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+            || mimetype == "application/vnd.openxmlformats-officedocument.presentationml.presentation"
+            || mimetype == "application/msword"
+            || mimetype == "application/vnd.ms-excel"
+            || mimetype == "application/vnd.ms-powerpoint";
 }
 
 QHash<int, QByteArray> DocumentModel::roleNames() const


Follow ups