← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1523886 into lp:ubuntu-docviewer-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1523886 into lp:ubuntu-docviewer-app.

Commit message:
Don't show file extension in the viewer's header

Requested reviews:
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)
Related bugs:
  Bug #1523886 in Ubuntu Document Viewer App: "Don't show file extension in the viewer's header"
  https://bugs.launchpad.net/ubuntu-docviewer-app/+bug/1523886

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/fix-1523886/+merge/281362

Don't show file extension in the viewer's header
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1523886 into lp:ubuntu-docviewer-app.
=== modified file 'src/app/qml/common/PickImportedDialog.qml'
--- src/app/qml/common/PickImportedDialog.qml	2015-10-23 11:19:19 +0000
+++ src/app/qml/common/PickImportedDialog.qml	2015-12-26 18:27:43 +0000
@@ -17,6 +17,7 @@
 import QtQuick 2.4
 import Ubuntu.Components 1.3
 import Ubuntu.Components.Popups 1.3
+import DocumentViewer 1.0
 
 import "utils.js" as Utils
 
@@ -39,7 +40,7 @@
             }
 
             Label {
-                text: Utils.getNameOfFile(model.path)
+                text: DocumentViewer.getFileBaseNameFromPath(model.path)
                 anchors {
                     left: parent.left; right: parent.right
                     margins: units.gu(2)

=== modified file 'src/app/qml/common/utils.js'
--- src/app/qml/common/utils.js	2015-10-10 12:03:30 +0000
+++ src/app/qml/common/utils.js	2015-12-26 18:27:43 +0000
@@ -33,10 +33,6 @@
     return i18n.tr("%1 byte").arg(size);
 }
 
-function getNameOfFile(path) {
-    return path.toString().substring(path.lastIndexOf('/') + 1);
-}
-
 function getIconNameFromMimetype(mimetype) {
     if (mimetype.substring(0, 5) === "text/")
         return "text-x-generic-symbolic"

=== modified file 'src/app/qml/loView/LOViewPage.qml'
--- src/app/qml/loView/LOViewPage.qml	2015-11-30 12:25:13 +0000
+++ src/app/qml/loView/LOViewPage.qml	2015-12-26 18:27:43 +0000
@@ -17,6 +17,7 @@
 import QtQuick 2.4
 import Ubuntu.Components 1.3
 import Ubuntu.Layouts 1.0
+import DocumentViewer 1.0
 import DocumentViewer.LibreOffice 1.0 as LibreOffice
 
 import "../common"
@@ -30,7 +31,7 @@
     property bool isPresentation: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.PresentationDocument)
     property bool isTextDocument: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.TextDocument)
 
-    title: Utils.getNameOfFile(file.path);
+    title: DocumentViewer.getFileBaseNameFromPath(file.path);
     flickable: isTextDocument ? loPage.contentItem.loView : null
 
     splashScreen: Splashscreen { }

=== modified file 'src/app/qml/pdfView/PdfView.qml'
--- src/app/qml/pdfView/PdfView.qml	2015-11-27 11:46:16 +0000
+++ src/app/qml/pdfView/PdfView.qml	2015-12-26 18:27:43 +0000
@@ -16,6 +16,7 @@
 
 import QtQuick 2.4
 import Ubuntu.Components 1.3
+import DocumentViewer 1.0
 import DocumentViewer.PDF 1.0 as PDF
 
 import "../common"
@@ -25,7 +26,7 @@
 
 PageWithBottomEdge {
     id: pdfPage
-    title: Utils.getNameOfFile(file.path)
+    title: DocumentViewer.getFileBaseNameFromPath(file.path)
 
     flickable: pdfView
 

=== modified file 'src/app/qml/textView/TextView.qml'
--- src/app/qml/textView/TextView.qml	2015-11-27 11:46:16 +0000
+++ src/app/qml/textView/TextView.qml	2015-12-26 18:27:43 +0000
@@ -17,12 +17,13 @@
 import QtQuick 2.4
 import Ubuntu.Components 1.3
 import Ubuntu.Components.Themes.Ambiance 1.3
+import DocumentViewer 1.0
 
 import "../common/utils.js" as Utils
 
 Page {
     id: textPage
-    title: Utils.getNameOfFile(file.path)
+    title: DocumentViewer.getFileBaseNameFromPath(file.path)
 
     // Reset night mode shader settings when closing the page
     // Component.onDestruction: mainView.nightModeEnabled = false

=== modified file 'src/plugin/file-qml-plugin/docviewerutils.cpp'
--- src/plugin/file-qml-plugin/docviewerutils.cpp	2015-10-12 19:03:24 +0000
+++ src/plugin/file-qml-plugin/docviewerutils.cpp	2015-12-26 18:27:43 +0000
@@ -167,3 +167,8 @@
 
     return QString();
 }
+
+QString DocviewerUtils::getFileBaseNameFromPath(const QString &filePath)
+{
+    return QFileInfo(filePath).completeBaseName();
+}

=== modified file 'src/plugin/file-qml-plugin/docviewerutils.h'
--- src/plugin/file-qml-plugin/docviewerutils.h	2015-10-12 19:03:24 +0000
+++ src/plugin/file-qml-plugin/docviewerutils.h	2015-12-26 18:27:43 +0000
@@ -18,7 +18,6 @@
 #define DOCVIEWERUTILS_H
 
 #include <QObject>
-#include <QThread>
 
 class DocviewerUtils : public QObject
 {
@@ -37,6 +36,8 @@
     Q_INVOKABLE static QString buildDestinationPath(const QString &destinationDir, const QString &sourcePath);
 
     Q_INVOKABLE static QString checkIfFileAlreadyImported(const QString &filePath, const QStringList &storageLocationList);
+
+    Q_INVOKABLE static QString getFileBaseNameFromPath(const QString &filePath);
 };
 
 #endif // DOCVIEWERUTILS_H