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

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Roman Shchekin
Approved revision: 242
Merged at revision: 244
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1523886
Merge into: lp:ubuntu-docviewer-app
Diff against target: 130 lines (+15/-9)
7 files modified
src/app/qml/common/PickImportedDialog.qml (+2/-1)
src/app/qml/common/utils.js (+0/-4)
src/app/qml/loView/LOViewPage.qml (+2/-1)
src/app/qml/pdfView/PdfView.qml (+2/-1)
src/app/qml/textView/TextView.qml (+2/-1)
src/plugin/file-qml-plugin/docviewerutils.cpp (+5/-0)
src/plugin/file-qml-plugin/docviewerutils.h (+2/-1)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1523886
Reviewer Review Type Date Requested Status
Roman Shchekin Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+281362@code.launchpad.net

Commit message

Don't show file extension in the viewer's header

Description of the change

Don't show file extension in the viewer's header

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Roman Shchekin (mrqtros) wrote :

Good solution, approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/common/PickImportedDialog.qml'
2--- src/app/qml/common/PickImportedDialog.qml 2015-10-23 11:19:19 +0000
3+++ src/app/qml/common/PickImportedDialog.qml 2015-12-26 18:27:43 +0000
4@@ -17,6 +17,7 @@
5 import QtQuick 2.4
6 import Ubuntu.Components 1.3
7 import Ubuntu.Components.Popups 1.3
8+import DocumentViewer 1.0
9
10 import "utils.js" as Utils
11
12@@ -39,7 +40,7 @@
13 }
14
15 Label {
16- text: Utils.getNameOfFile(model.path)
17+ text: DocumentViewer.getFileBaseNameFromPath(model.path)
18 anchors {
19 left: parent.left; right: parent.right
20 margins: units.gu(2)
21
22=== modified file 'src/app/qml/common/utils.js'
23--- src/app/qml/common/utils.js 2015-10-10 12:03:30 +0000
24+++ src/app/qml/common/utils.js 2015-12-26 18:27:43 +0000
25@@ -33,10 +33,6 @@
26 return i18n.tr("%1 byte").arg(size);
27 }
28
29-function getNameOfFile(path) {
30- return path.toString().substring(path.lastIndexOf('/') + 1);
31-}
32-
33 function getIconNameFromMimetype(mimetype) {
34 if (mimetype.substring(0, 5) === "text/")
35 return "text-x-generic-symbolic"
36
37=== modified file 'src/app/qml/loView/LOViewPage.qml'
38--- src/app/qml/loView/LOViewPage.qml 2015-11-30 12:25:13 +0000
39+++ src/app/qml/loView/LOViewPage.qml 2015-12-26 18:27:43 +0000
40@@ -17,6 +17,7 @@
41 import QtQuick 2.4
42 import Ubuntu.Components 1.3
43 import Ubuntu.Layouts 1.0
44+import DocumentViewer 1.0
45 import DocumentViewer.LibreOffice 1.0 as LibreOffice
46
47 import "../common"
48@@ -30,7 +31,7 @@
49 property bool isPresentation: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.PresentationDocument)
50 property bool isTextDocument: loPage.contentItem && (loPage.contentItem.loDocument.documentType === LibreOffice.Document.TextDocument)
51
52- title: Utils.getNameOfFile(file.path);
53+ title: DocumentViewer.getFileBaseNameFromPath(file.path);
54 flickable: isTextDocument ? loPage.contentItem.loView : null
55
56 splashScreen: Splashscreen { }
57
58=== modified file 'src/app/qml/pdfView/PdfView.qml'
59--- src/app/qml/pdfView/PdfView.qml 2015-11-27 11:46:16 +0000
60+++ src/app/qml/pdfView/PdfView.qml 2015-12-26 18:27:43 +0000
61@@ -16,6 +16,7 @@
62
63 import QtQuick 2.4
64 import Ubuntu.Components 1.3
65+import DocumentViewer 1.0
66 import DocumentViewer.PDF 1.0 as PDF
67
68 import "../common"
69@@ -25,7 +26,7 @@
70
71 PageWithBottomEdge {
72 id: pdfPage
73- title: Utils.getNameOfFile(file.path)
74+ title: DocumentViewer.getFileBaseNameFromPath(file.path)
75
76 flickable: pdfView
77
78
79=== modified file 'src/app/qml/textView/TextView.qml'
80--- src/app/qml/textView/TextView.qml 2015-11-27 11:46:16 +0000
81+++ src/app/qml/textView/TextView.qml 2015-12-26 18:27:43 +0000
82@@ -17,12 +17,13 @@
83 import QtQuick 2.4
84 import Ubuntu.Components 1.3
85 import Ubuntu.Components.Themes.Ambiance 1.3
86+import DocumentViewer 1.0
87
88 import "../common/utils.js" as Utils
89
90 Page {
91 id: textPage
92- title: Utils.getNameOfFile(file.path)
93+ title: DocumentViewer.getFileBaseNameFromPath(file.path)
94
95 // Reset night mode shader settings when closing the page
96 // Component.onDestruction: mainView.nightModeEnabled = false
97
98=== modified file 'src/plugin/file-qml-plugin/docviewerutils.cpp'
99--- src/plugin/file-qml-plugin/docviewerutils.cpp 2015-10-12 19:03:24 +0000
100+++ src/plugin/file-qml-plugin/docviewerutils.cpp 2015-12-26 18:27:43 +0000
101@@ -167,3 +167,8 @@
102
103 return QString();
104 }
105+
106+QString DocviewerUtils::getFileBaseNameFromPath(const QString &filePath)
107+{
108+ return QFileInfo(filePath).completeBaseName();
109+}
110
111=== modified file 'src/plugin/file-qml-plugin/docviewerutils.h'
112--- src/plugin/file-qml-plugin/docviewerutils.h 2015-10-12 19:03:24 +0000
113+++ src/plugin/file-qml-plugin/docviewerutils.h 2015-12-26 18:27:43 +0000
114@@ -18,7 +18,6 @@
115 #define DOCVIEWERUTILS_H
116
117 #include <QObject>
118-#include <QThread>
119
120 class DocviewerUtils : public QObject
121 {
122@@ -37,6 +36,8 @@
123 Q_INVOKABLE static QString buildDestinationPath(const QString &destinationDir, const QString &sourcePath);
124
125 Q_INVOKABLE static QString checkIfFileAlreadyImported(const QString &filePath, const QStringList &storageLocationList);
126+
127+ Q_INVOKABLE static QString getFileBaseNameFromPath(const QString &filePath);
128 };
129
130 #endif // DOCVIEWERUTILS_H

Subscribers

People subscribed via source and target branches