Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-merged-trunk-revno-181 into lp:ubuntu-docviewer-app

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Stefano Verzegnassi
Approved revision: 170
Merged at revision: 171
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-merged-trunk-revno-181
Merge into: lp:ubuntu-docviewer-app
Diff against target: 1007 lines (+540/-286)
13 files modified
AUTHORS (+26/-0)
src/app/qml/common/ToastWithAction.qml (+2/-2)
src/app/qml/documentPage/DeleteFileDialog.qml (+12/-2)
src/app/qml/documentPage/DocumentDelegateActions.qml (+41/-0)
src/app/qml/documentPage/DocumentGridDelegate.qml (+65/-169)
src/app/qml/documentPage/DocumentListDelegate.qml (+12/-19)
src/app/qml/documentPage/SortSettingsDialog.qml (+1/-1)
src/app/qml/documentPage/TileBase.qml (+369/-0)
src/plugin/file-qml-plugin/documentmodel.cpp (+0/-6)
src/plugin/poppler-qml-plugin/CMakeLists.txt (+1/-2)
src/plugin/poppler-qml-plugin/pdfdocument.cpp (+11/-8)
src/plugin/poppler-qml-plugin/pdfthread.cpp (+0/-35)
src/plugin/poppler-qml-plugin/pdfthread.h (+0/-42)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-merged-trunk-revno-181
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Roman Shchekin Approve
Review via email: mp+266904@code.launchpad.net

Commit message

Merged trunk (rev. 181) into "reboot" branch

Description of the change

Merged trunk (rev. 181) into "reboot" branch

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Roman Shchekin (mrqtros) wrote :

That's ok!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'AUTHORS'
2--- AUTHORS 1970-01-01 00:00:00 +0000
3+++ AUTHORS 2015-08-04 16:03:21 +0000
4@@ -0,0 +1,26 @@
5+DocViewer was started in 2013 and has received many contributions from the following people.
6+
7+In addition, numerous translations, bug reports and other non-code contributions have been made which are equally valued.
8+
9+Adolfo Jayme Barrientos <fitojb@ubuntu.com>
10+Akiva Abraham <akiva@linux.com>
11+Alan Pope <alan.pope@canonical.com>
12+Andrew Hayzen <ahayzen@gmail.com>
13+Arto Jalkanen <ajalkane@gmail.com>
14+Bartosz Kosiorek <gang65@poczta.onet.pl>
15+Carla Sella <carla.sella@gmail.com>
16+Daniel Holbach <daniel.holbach@canonical.com>
17+David Planella <david.planella@ubuntu.com>
18+Didier Roche <didrocks@ubuntu.com>
19+Fabio Colella <fcole90@gmail.com>
20+Francis Ginther <francis.ginther@canonical.com>
21+Granger Anthony <grangeranthony@gmail.com>
22+Michael Hall <mhall119@ubuntu.com>
23+Nicholas Skaggs <nicholas.skaggs@canonical.com>
24+Olivier Tilloy <olivier.tilloy@canonical.com>
25+Omer Akram <om26er@ubuntu.com>
26+Richard Somlói <level@somloirichard.hu>
27+Roman Shchekin <mrqtros@gmail.com>
28+Sergio Schvezov <sergio.schvezov@canonical.com>
29+Stefano Verzegnassi <stefano92.100@gmail.com>
30+xeranas <anorkus@fastmail.fm>
31
32=== modified file 'src/app/qml/common/ToastWithAction.qml'
33--- src/app/qml/common/ToastWithAction.qml 2015-04-07 22:52:48 +0000
34+++ src/app/qml/common/ToastWithAction.qml 2015-08-04 16:03:21 +0000
35@@ -60,8 +60,8 @@
36 }
37
38 AbstractButton {
39- width: actionLabel.paintedWidth
40- height: parent.height
41+ Layout.preferredWidth: actionLabel.paintedWidth
42+ Layout.fillHeight: true
43
44 onClicked: {
45 action.triggered("[Toast] Action %1 clicked!".arg(action.text))
46
47=== modified file 'src/app/qml/documentPage/DeleteFileDialog.qml'
48--- src/app/qml/documentPage/DeleteFileDialog.qml 2015-04-29 15:23:32 +0000
49+++ src/app/qml/documentPage/DeleteFileDialog.qml 2015-08-04 16:03:21 +0000
50@@ -25,6 +25,14 @@
51 property string path
52 property int __deleteCount: documentPage.view.item.selectedItems.count
53
54+ // WORKAROUND: This property is used only when user wants to remove a single
55+ // file from a delegate action, and the value of the property is read during
56+ // the Component.onDestruction event.
57+ // We do this because we need to avoid that the entry in the model is removed
58+ // before this dialog is closed.
59+ // See src/app/qml/documentPage/DocumentDelegateActions.qml
60+ property bool confirmed: false
61+
62 title: path ? i18n.tr("Delete file") :
63 i18n.tr("Delete %1 file", "Delete %1 files", __deleteCount).arg(__deleteCount)
64 text: path ? i18n.tr("Are you sure you want to permanently delete this file?") :
65@@ -43,17 +51,19 @@
66
67 onClicked: {
68 if (deleteFileDialog.path) {
69- docModel.rm(path)
70+ deleteFileDialog.confirmed = true;
71 } else {
72+ // This is called from selection mode
73 var items = documentPage.view.item.selectedItems;
74
75 for (var i=0; i < items.count; i++) {
76 console.log("Removing:", items.get(i).model.path);
77 docModel.rm(items.get(i).model.path);
78 }
79+
80+ viewLoader.item.endSelection();
81 }
82
83- viewLoader.item.endSelection();
84 PopupUtils.close(deleteFileDialog)
85 }
86 }
87
88=== added file 'src/app/qml/documentPage/DocumentDelegateActions.qml'
89--- src/app/qml/documentPage/DocumentDelegateActions.qml 1970-01-01 00:00:00 +0000
90+++ src/app/qml/documentPage/DocumentDelegateActions.qml 2015-08-04 16:03:21 +0000
91@@ -0,0 +1,41 @@
92+/*
93+ Copyright (C) 2015 Canonical Ltd.
94+
95+ This program is free software: you can redistribute it and/or modify
96+ it under the terms of the GNU General Public License 3 as published by
97+ the Free Software Foundation.
98+
99+ This program is distributed in the hope that it will be useful,
100+ but WITHOUT ANY WARRANTY; without even the implied warranty of
101+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102+ GNU General Public License for more details.
103+
104+ You should have received a copy of the GNU General Public License
105+ along with this program. If not, see http://www.gnu.org/licenses/.
106+*/
107+
108+import QtQuick 2.0
109+import Ubuntu.Components 1.1
110+import Ubuntu.Components.Popups 1.0
111+
112+QtObject {
113+ property list<Action> leadingActions: [
114+ Action {
115+ iconName: "delete"
116+ text: i18n.tr("Delete")
117+ onTriggered: {
118+ var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteFileDialog.qml"),
119+ documentPage, { path: model.path })
120+
121+ dialog.Component.destruction.connect(function() {
122+ if (dialog.confirmed) {
123+ console.log("Removing:", model.path);
124+ docModel.rm(model.path);
125+ }
126+ });
127+ }
128+ }
129+ ]
130+
131+ property list<Action> trailingActions
132+}
133
134=== modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
135--- src/app/qml/documentPage/DocumentGridDelegate.qml 2015-07-14 01:35:59 +0000
136+++ src/app/qml/documentPage/DocumentGridDelegate.qml 2015-08-04 16:03:21 +0000
137@@ -16,14 +16,11 @@
138
139 import QtQuick 2.0
140 import Ubuntu.Components 1.1
141-import QtQuick.Layouts 1.1
142
143 import "../common/utils.js" as Utils
144
145-AbstractButton {
146+TileBase {
147 id: root
148- property bool selected: false
149- property bool selectionMode: false
150
151 function formattedDateTime() {
152 var date = new Date(model.date)
153@@ -49,169 +46,68 @@
154 return Qt.formatDateTime(date, i18n.tr("dd-MM-yyyy hh:mm"))
155 }
156
157- Rectangle {
158- anchors { fill: parent; margins: units.gu(0.5) }
159-
160- color: Qt.lighter(UbuntuColors.lightGrey)
161- clip: true
162-
163- Loader {
164- id: selectionIcon
165-
166- anchors {
167- right: parent.right
168- top: parent.top
169- }
170-
171- z: 10
172-
173- width: (status === Loader.Ready) ? item.implicitWidth : 0
174- visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
175- Behavior on opacity {
176- NumberAnimation {
177- duration: UbuntuAnimation.SnapDuration
178- }
179- }
180- }
181-
182- Icon {
183- id: extStorageIcon
184-
185- width: units.gu(4)
186- height: units.gu(4)
187- anchors {
188- left: parent.left
189- top: parent.top
190- margins: units.gu(0.5)
191- }
192-
193- visible: model.isFromExternalStorage
194- source: Qt.resolvedUrl("../../graphics/sd-card-symbolic.png")
195- }
196-
197- // Document mimetype icon
198- Icon {
199- anchors.centerIn: parent
200- anchors.verticalCenterOffset: - infoColumn.height * 0.3
201-
202- width: units.gu(8); height: width
203-
204- // At the moment the suru icon theme doesn't have much icons.
205- // Just some note for the future:
206- // TODO: Add icons for Office/ODF documents
207- // TODO: Whenever there will be icons for source code files, add them.
208- name: {
209- if (model.mimetype.substring(0, 5) === "text/")
210- return "text-x-generic-symbolic"
211-
212- if (model.mimetype.substring(0, 5) === "image")
213- return "image-x-generic-symbolic"
214-
215- if (model.mimetype === "application/pdf")
216- return "application-pdf-symbolic"
217-
218- if (model.mimetype === "application/vnd.oasis.opendocument.text"
219- || model.mimetype === "application/msword"
220- || model.mimetype === "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
221- return "x-office-document-symbolic"
222-
223- if (model.mimetype === "application/vnd.oasis.opendocument.spreadsheet"
224- || model.mimetype === "application/vnd.ms-excel"
225- || model.mimetype === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
226- return "x-office-spreadsheet-symbolic"
227-
228- if (model.mimetype === "application/vnd.oasis.opendocument.presentation"
229- || model.mimetype === "application/vnd.ms-powerpoint"
230- || model.mimetype === "application/vnd.openxmlformats-officedocument.presentationml.presentation")
231- return "x-office-presentation-symbolic"
232-
233- return "package-x-generic-symbolic"
234- }
235- }
236-
237- // Cover
238- /* Image {
239- anchors.fill: parent
240-
241- source: {
242- if (model.cover !== "" && typeof model.cover !== "undefined")
243- return model.cover
244-
245- if (model.mimetype.toString().indexOf("image") !== -1)
246- return model.path
247-
248- return ""
249- }
250-
251- sourceSize.width: width
252- fillMode: Image.PreserveAspectCrop
253- }*/
254-
255- // Document info overlay
256- Rectangle {
257- id: overlay
258-
259- anchors {
260- left: parent.left
261- right: parent.right
262- bottom: parent.bottom
263- }
264-
265- height: infoColumn.height + units.gu(1)
266-
267- color: UbuntuColors.darkGrey
268- opacity: 0.75
269- layer.enabled: true
270-
271- // Document info
272- Column {
273- id: infoColumn
274- anchors {
275- left: parent.left;
276- right: parent.right
277- verticalCenter: parent.verticalCenter
278- margins: units.gu(0.5)
279- }
280-
281- Label {
282- text: model.name
283- color: "white"
284-
285- elide: Text.ElideRight
286- font.weight: Font.DemiBold
287- fontSize: "small"
288-
289- anchors { left: parent.left; right: parent.right }
290- }
291-
292- Label {
293- text: formattedDateTime()
294- color: "white"
295- fontSize: "small"
296-
297- anchors { left: parent.left; right: parent.right }
298- }
299-
300- Label {
301- text: Utils.printSize(i18n, model.size)
302- color: "white"
303- fontSize: "small"
304-
305- anchors { left: parent.left; right: parent.right }
306- }
307- } // Document info end
308- }
309-
310- states: [
311- State {
312- name: "select"
313- when: selectionMode || selected
314- PropertyChanges {
315- target: selectionIcon
316- source: Qt.resolvedUrl("../upstreamComponents/ListItemWithActionsCheckBox.qml")
317- anchors.margins: units.gu(1)
318- }
319- }
320- ]
321- }
322+ title: model.name
323+ text: formattedDateTime()
324+ subText: Utils.printSize(i18n, model.size)
325+
326+ leadingActions: documentDelegateActions.leadingActions
327+ trailingActions: documentDelegateActions.trailingActions
328+
329+ Icon {
330+ id: extStorageIcon
331+
332+ width: units.gu(4)
333+ height: units.gu(4)
334+ anchors {
335+ left: parent.left
336+ top: parent.top
337+ margins: units.gu(0.5)
338+ }
339+
340+ visible: model.isFromExternalStorage
341+ source: Qt.resolvedUrl("../../graphics/sd-card-symbolic.png")
342+ }
343+
344+ // Document mimetype icon
345+ Icon {
346+ anchors.centerIn: parent
347+ width: units.gu(8); height: width
348+
349+ // At the moment the suru icon theme doesn't have much icons.
350+ // Just some note for the future:
351+ // TODO: Add icons for Office/ODF documents
352+ // TODO: Whenever there will be icons for source code files, add them.
353+ name: {
354+ if (model.mimetype.substring(0, 5) === "text/")
355+ return "text-x-generic-symbolic"
356+
357+ if (model.mimetype.substring(0, 5) === "image")
358+ return "image-x-generic-symbolic"
359+
360+ if (model.mimetype === "application/pdf")
361+ return "application-pdf-symbolic"
362+
363+ return "package-x-generic-symbolic"
364+ }
365+ }
366+
367+ // Cover
368+ /* Image {
369+ anchors.fill: parent
370+
371+ source: {
372+ if (model.cover !== "" && typeof model.cover !== "undefined")
373+ return model.cover
374+
375+ if (model.mimetype.toString().indexOf("image") !== -1)
376+ return model.path
377+
378+ return ""
379+ }
380+
381+ sourceSize.width: width
382+ fillMode: Image.PreserveAspectCrop
383+ }*/
384+
385+ DocumentDelegateActions { id: documentDelegateActions }
386 }
387
388=== modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
389--- src/app/qml/documentPage/DocumentListDelegate.qml 2015-07-14 01:35:59 +0000
390+++ src/app/qml/documentPage/DocumentListDelegate.qml 2015-08-04 16:03:21 +0000
391@@ -23,6 +23,8 @@
392 import "../upstreamComponents"
393
394 ListItemWithActions {
395+ property QtObject documentDelegateActions: DocumentDelegateActions { }
396+
397 function formattedDateTime() {
398 var date = new Date(model.date)
399 var diff = model.dateDiff
400@@ -30,16 +32,14 @@
401 if (sortSettings.sortMode !== 0) { // The sort rule is not "by date"
402 switch(diff) {
403 case 0: // DocumentsModel.Today
404- // TRANSLATORS: this is a datetime formatting string, and the
405- // singlequote is an escape character.
406- // See http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
407- return Qt.formatDateTime(date, i18n.tr("'Today', hh:mm"))
408+ // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
409+ // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
410+ return i18n.tr("Today, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
411
412 case 1: // DocumentsModel.Yesterday
413- // TRANSLATORS: this is a datetime formatting string, and the
414- // singlequote is an escape character.
415- // See http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
416- return Qt.formatDateTime(date, i18n.tr("'Yesterday', hh:mm"))
417+ // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
418+ // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
419+ return i18n.tr("Yesterday, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
420
421 default: // DocumentsModel.LastWeek || DocumentsModel.LastMonth || DocumentsModel.Earlier
422 // TRANSLATORS: this is a datetime formatting string,
423@@ -70,23 +70,16 @@
424
425 locked: documentPage.state == "pickMode"
426
427- // TODO: NEEDS-DESIGN: Enable left action. Still need to find an equivalent for GridDelegate.
428- /* leftSideAction: Action {
429- iconName: "delete"
430- text: i18n.tr("Delete")
431- onTriggered: {
432- PopupUtils.open(Qt.resolvedUrl("DeleteFileDialog.qml"),
433- documentPage, { path: model.filePath })
434- }
435- }*/
436+ leftSideAction: documentDelegateActions.leadingActions[0]
437+ rightSideActions: documentDelegateActions.trailingActions
438
439 contents: RowLayout {
440 anchors.fill: parent
441 spacing: units.gu(2)
442
443 Icon {
444- width: height
445- height: units.gu(5)
446+ Layout.preferredWidth: height
447+ Layout.preferredHeight: units.gu(5)
448
449 // At the moment the suru icon theme doesn't have much icons.
450 name: {
451
452=== modified file 'src/app/qml/documentPage/SortSettingsDialog.qml'
453--- src/app/qml/documentPage/SortSettingsDialog.qml 2015-06-10 17:17:47 +0000
454+++ src/app/qml/documentPage/SortSettingsDialog.qml 2015-08-04 16:03:21 +0000
455@@ -18,7 +18,7 @@
456 import QtQuick 2.0
457 import Ubuntu.Components 1.1
458 import Ubuntu.Components.Popups 1.0
459-import QtQuick.Layouts 1.0
460+import QtQuick.Layouts 1.1
461
462 Dialog {
463 id: sortSettingsDialog
464
465=== added file 'src/app/qml/documentPage/TileBase.qml'
466--- src/app/qml/documentPage/TileBase.qml 1970-01-01 00:00:00 +0000
467+++ src/app/qml/documentPage/TileBase.qml 2015-08-04 16:03:21 +0000
468@@ -0,0 +1,369 @@
469+/*
470+ Copyright (C) 2014, 2015 Canonical Ltd.
471+
472+ This program is free software: you can redistribute it and/or modify
473+ it under the terms of the GNU General Public License 3 as published by
474+ the Free Software Foundation.
475+
476+ This program is distributed in the hope that it will be useful,
477+ but WITHOUT ANY WARRANTY; without even the implied warranty of
478+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
479+ GNU General Public License for more details.
480+
481+ You should have received a copy of the GNU General Public License
482+ along with this program. If not, see http://www.gnu.org/licenses/.
483+*/
484+
485+import QtQuick 2.0
486+import Ubuntu.Components 1.1
487+import Ubuntu.Components.Popups 1.0
488+import Ubuntu.Components.ListItems 1.0 as ListItem
489+
490+AbstractButton {
491+ id: root
492+
493+ property bool selected: false
494+ property bool selectionMode: false
495+
496+ default property alias content: tileContent.data
497+
498+ property alias title: titleLabel.text
499+ property alias text: textLabel.text
500+ property alias subText: subTextLabel.text
501+
502+ // We don't really have swipe gesture here, but we anyway use the same
503+ // properties' name used for UITK1.2 ListItem just for consistency.
504+ property list<Action> trailingActions // Right to Left gesture in ListItem
505+ property list<Action> leadingActions // Left to Right gesture in ListItem
506+
507+ Rectangle {
508+ id: rect
509+
510+ anchors { fill: parent; margins: units.gu(0.5) }
511+
512+ color: Qt.lighter(UbuntuColors.lightGrey)
513+ clip: true
514+
515+ Item {
516+ id: tileContent
517+
518+ height: parent.height - captionsLayout.height * 0.3 - units.gu(2)
519+ anchors {
520+ left: parent.left
521+ right: parent.right
522+ verticalCenter: parent.verticalCenter
523+ verticalCenterOffset: - captionsLayout.height * 0.3
524+ }
525+ }
526+
527+ Loader {
528+ id: overflowButton
529+
530+ anchors {
531+ right: parent.right
532+ top: parent.top
533+ }
534+
535+ z: 10
536+
537+ sourceComponent: actionsOverflowButton
538+
539+ onStatusChanged: {
540+ if (status === Loader.Ready) {
541+ item.iconName = "contextual-menu"
542+ item.color = UbuntuColors.darkGrey
543+ item.width = overflowButton.width
544+ item.height = overflowButton.height
545+
546+ item.triggered.connect(function() {
547+ var overflowPanel = PopupUtils.open(actionsOverflowPopoverComponent, item)
548+ item.overflowPanelVisible = overflowPanel.visible;
549+
550+ overflowPanel.visibleChanged.connect(function() {
551+ item.overflowPanelVisible = overflowPanel.visible
552+ });
553+ });
554+ }
555+ }
556+
557+ width: units.gu(5)
558+ height: units.gu(5)
559+ visible: rect.state !== "select" && (trailingActions.length > 0 || leadingActions.length > 0)
560+
561+ Behavior on opacity {
562+ NumberAnimation {
563+ duration: UbuntuAnimation.SnapDuration
564+ }
565+ }
566+ }
567+
568+ Loader {
569+ id: selectionIcon
570+
571+ anchors {
572+ right: parent.right
573+ top: parent.top
574+ }
575+
576+ z: 10
577+
578+ width: (status === Loader.Ready) ? item.implicitWidth : 0
579+ visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
580+ Behavior on opacity {
581+ NumberAnimation {
582+ duration: UbuntuAnimation.SnapDuration
583+ }
584+ }
585+ }
586+
587+ // Tile captions
588+ Rectangle {
589+ id: captionsRect
590+
591+ anchors {
592+ left: parent.left
593+ right: parent.right
594+ bottom: parent.bottom
595+ }
596+
597+ height: captionsLayout.height + units.gu(1)
598+
599+ color: UbuntuColors.darkGrey
600+ opacity: 0.75
601+ layer.enabled: true
602+
603+ Column {
604+ id: captionsLayout
605+ anchors {
606+ left: parent.left;
607+ right: parent.right
608+ verticalCenter: parent.verticalCenter
609+ margins: units.gu(0.5)
610+ }
611+
612+ Label {
613+ id: titleLabel
614+ color: "white"
615+
616+ elide: Text.ElideRight
617+ font.weight: Font.DemiBold
618+ fontSize: "small"
619+
620+ anchors { left: parent.left; right: parent.right }
621+ }
622+
623+ Label {
624+ id: textLabel
625+ color: "white"
626+ fontSize: "small"
627+
628+ anchors { left: parent.left; right: parent.right }
629+ }
630+
631+ Label {
632+ id: subTextLabel
633+ color: "white"
634+ fontSize: "small"
635+
636+ anchors { left: parent.left; right: parent.right }
637+ }
638+ }
639+ }
640+
641+ states: [
642+ State {
643+ name: "select"
644+ when: selectionMode || selected
645+ PropertyChanges {
646+ target: selectionIcon
647+ sourceComponent: selectionCheckBox
648+ anchors.margins: units.gu(1)
649+ }
650+ }
651+ ]
652+ }
653+
654+ // *** COMPONENTS
655+ Component {
656+ id: selectionCheckBox
657+
658+ CheckBox {
659+ checked: root.selected
660+ width: implicitWidth
661+ // disable item mouse area to avoid conflicts with parent mouse area
662+ __mouseArea.enabled: false
663+ }
664+ }
665+
666+ Component {
667+ id: actionsOverflowButton
668+
669+ AbstractButton {
670+ id: button
671+
672+ property alias color: icon.color
673+ property bool overflowPanelVisible: false
674+
675+ width: visible ? units.gu(5) : 0
676+ height: parent ? parent.height : undefined
677+ Rectangle {
678+ visible: button.pressed || button.overflowPanelVisible
679+ anchors.fill: parent
680+ color: Theme.palette.selected.background
681+ }
682+
683+ Icon {
684+ id: icon
685+ anchors.centerIn: parent
686+
687+ // prevent trying to render the icon with an invalid source
688+ // when the button is invisible by setting width and height to 0
689+ width: visible ? units.gu(2.5) : 0
690+ height: visible ? units.gu(2.5) : 0
691+ source: button.iconSource
692+ color: Qt.rgba(0, 0, 0, 0)
693+ opacity: button.enabled ? 1.0 : 0.3
694+ }
695+
696+ Component {
697+ id: labelComponent
698+ Label {
699+ id: label
700+ objectName: button.objectName + "_label"
701+ color: button.color
702+ opacity: button.enabled ? 1.0 : 0.3
703+ text: button.text
704+ fontSize: "xx-small"
705+ }
706+ }
707+ Loader {
708+ anchors {
709+ top: icon.bottom
710+ topMargin: units.gu(0.5)
711+ horizontalCenter: parent.horizontalCenter
712+ }
713+ sourceComponent: button.state === "IconAndLabel" ? labelComponent : null
714+ }
715+ }
716+ }
717+
718+ Component {
719+ id: actionsOverflowPopoverComponent
720+
721+ Popover {
722+ id: actionsOverflowPopover
723+ property bool square: true
724+ callerMargin: -units.gu(1) + units.dp(4)
725+ contentWidth: units.gu(20)
726+ contentHeight: popoverActionsLayout.height
727+
728+ Connections {
729+ target: root
730+ onLeadingActionsChanged: {
731+ actionsOverflowPopover.hide();
732+ }
733+ onTrailingActionsChanged: {
734+ actionsOverflowPopover.hide();
735+ }
736+ }
737+
738+ Column {
739+ id: popoverActionsLayout
740+ anchors {
741+ left: parent.left
742+ top: parent.top
743+ right: parent.right
744+ }
745+ Repeater {
746+ id: overflowTrailingRepeater
747+ model: root.trailingActions
748+
749+ delegate: overflowPanelDelegate
750+ onItemAdded: {
751+ item.action = model[index]
752+ item.clicked.connect(function() {
753+ actionsOverflowPopover.hide()
754+ })
755+
756+ item.showDivider = (overflowLeadingRepeater.count === 0) ? (index !== overflowTrailingRepeater.count - 1) : true
757+ }
758+ }
759+
760+ Repeater {
761+ id: overflowLeadingRepeater
762+ model: root.leadingActions
763+
764+ delegate: overflowPanelDelegate
765+ onItemAdded: {
766+ item.action = model[index]
767+ item.clicked.connect(function() {
768+ actionsOverflowPopover.hide()
769+ })
770+
771+ item.showDivider = (index !== overflowLeadingRepeater.count - 1)
772+ }
773+ }
774+ }
775+ }
776+ }
777+
778+ Component {
779+ id: overflowPanelDelegate
780+
781+ AbstractButton {
782+ id: rootItem
783+ implicitHeight: units.gu(6) + bottomDividerLine.height
784+ width: parent ? parent.width : units.gu(31)
785+
786+ property bool showDivider: true
787+ property color foregroundColor: Theme.palette.selected.backgroundText
788+
789+ Rectangle {
790+ visible: parent.pressed
791+ anchors {
792+ left: parent.left
793+ right: parent.right
794+ top: parent.top
795+ }
796+ height: parent.height - bottomDividerLine.height
797+ color: Theme.palette.selected.background
798+ }
799+
800+ Icon {
801+ id: actionIcon
802+ source: action.iconSource
803+ color: rootItem.foregroundColor
804+ anchors {
805+ verticalCenter: parent.verticalCenter
806+ verticalCenterOffset: units.dp(-1)
807+ left: parent.left
808+ leftMargin: units.gu(2)
809+ }
810+ width: units.gu(2)
811+ height: units.gu(2)
812+ opacity: action.enabled ? 1.0 : 0.5
813+ }
814+
815+ Label {
816+ anchors {
817+ verticalCenter: parent.verticalCenter
818+ verticalCenterOffset: units.dp(-1)
819+ left: actionIcon.right
820+ leftMargin: units.gu(2)
821+ right: parent.right
822+ }
823+ fontSize: "small"
824+ elide: Text.ElideRight
825+ text: action.text
826+ color: rootItem.foregroundColor
827+ opacity: action.enabled ? 1.0 : 0.5
828+ }
829+
830+ ListItem.ThinDivider {
831+ id: bottomDividerLine
832+ anchors.bottom: parent.bottom
833+ visible: rootItem.showDivider
834+ }
835+ }
836+ }
837+}
838
839=== modified file 'src/plugin/file-qml-plugin/documentmodel.cpp'
840--- src/plugin/file-qml-plugin/documentmodel.cpp 2015-07-14 01:35:59 +0000
841+++ src/plugin/file-qml-plugin/documentmodel.cpp 2015-08-04 16:03:21 +0000
842@@ -240,15 +240,9 @@
843 QString rootPath = volume.rootPath();
844
845 if (rootPath.startsWith("/media/")) {
846- // In a Unix filesystem, names are case sentitive.
847- // For that reason we need to check twice.
848 QDir dir;
849-
850 dir.setPath(rootPath + "/Documents");
851- if (dir.exists())
852- m_docsMonitor->addDirectory(dir.canonicalPath());
853
854- dir.setPath(rootPath + "/documents");
855 if (dir.exists())
856 m_docsMonitor->addDirectory(dir.canonicalPath());
857 }
858
859=== modified file 'src/plugin/poppler-qml-plugin/CMakeLists.txt'
860--- src/plugin/poppler-qml-plugin/CMakeLists.txt 2015-04-15 14:47:28 +0000
861+++ src/plugin/poppler-qml-plugin/CMakeLists.txt 2015-08-04 16:03:21 +0000
862@@ -11,7 +11,6 @@
863 plugin.cpp
864 pdfdocument.cpp
865 pdfimageprovider.cpp
866- pdfthread.cpp
867 pdfitem.cpp
868 verticalview.cpp
869 pdftocmodel.cpp
870@@ -23,7 +22,7 @@
871
872 target_link_libraries(popplerqmlplugin poppler-qt5)
873
874-qt5_use_modules(popplerqmlplugin Gui Qml Quick Xml)
875+qt5_use_modules(popplerqmlplugin Gui Qml Quick Xml Concurrent)
876
877 # Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator
878 if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
879
880=== modified file 'src/plugin/poppler-qml-plugin/pdfdocument.cpp'
881--- src/plugin/poppler-qml-plugin/pdfdocument.cpp 2015-03-25 16:51:53 +0000
882+++ src/plugin/poppler-qml-plugin/pdfdocument.cpp 2015-08-04 16:03:21 +0000
883@@ -19,13 +19,13 @@
884
885 #include "pdfdocument.h"
886 #include "pdfimageprovider.h"
887-#include "pdfthread.h"
888
889 #include <poppler/qt5/poppler-qt5.h>
890 #include <QDebug>
891 #include <QQmlEngine>
892 #include <QQmlContext>
893-#include <QThread>
894+
895+#include <QtConcurrent/QtConcurrent>
896
897 PdfDocument::PdfDocument(QAbstractListModel *parent):
898 QAbstractListModel(parent)
899@@ -145,12 +145,15 @@
900 if (!m_document)
901 return false;
902
903- PdfThread *pdfThread = new PdfThread();
904- pdfThread->setDocument(m_document);
905-
906- connect(pdfThread, SIGNAL(resultReady(PdfPagesList)), this, SLOT(_q_populate(PdfPagesList)));
907- connect(pdfThread, SIGNAL(finished()), pdfThread, SLOT(deleteLater()));
908- pdfThread->start();
909+ Poppler::Document* document = m_document;
910+ QtConcurrent::run( [=] {
911+ PdfPagesList pages;
912+
913+ for( int i = 0; i < document->numPages(); ++i )
914+ pages.append(document->page(i));
915+
916+ QMetaObject::invokeMethod(this, "_q_populate", Qt::QueuedConnection, Q_ARG(PdfPagesList, pages));
917+ });
918
919 return true;
920 }
921
922=== removed file 'src/plugin/poppler-qml-plugin/pdfthread.cpp'
923--- src/plugin/poppler-qml-plugin/pdfthread.cpp 2015-01-30 18:42:00 +0000
924+++ src/plugin/poppler-qml-plugin/pdfthread.cpp 1970-01-01 00:00:00 +0000
925@@ -1,35 +0,0 @@
926-/*
927- * Copyright (C) 2014 Canonical, Ltd.
928- *
929- * This program is free software: you can redistribute it and/or modify it
930- * under the terms of the GNU General Public License version 3, as published
931- * by the Free Software Foundation.
932- *
933- * This program is distributed in the hope that it will be useful, but
934- * WITHOUT ANY WARRANTY; without even the implied warranties of
935- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
936- * PURPOSE. See the GNU General Public License for more details.
937- *
938- * You should have received a copy of the GNU General Public License along
939- * with this program. If not, see <http://www.gnu.org/licenses/>.
940- *
941- * Author: Stefano Verzegnassi <stefano92.100@gmail.com>
942- */
943-
944-#include "pdfthread.h"
945-#include <QDebug>
946-
947-void PdfThread::run()
948-{
949- PdfPagesList pages;
950-
951- for( int i=0; i<m_document->numPages(); i++ )
952- pages.append(m_document->page(i));
953-
954- Q_EMIT resultReady(pages);
955-}
956-
957-void PdfThread::setDocument(Poppler::Document *document)
958-{
959- m_document = document;
960-}
961
962=== removed file 'src/plugin/poppler-qml-plugin/pdfthread.h'
963--- src/plugin/poppler-qml-plugin/pdfthread.h 2015-01-30 18:42:00 +0000
964+++ src/plugin/poppler-qml-plugin/pdfthread.h 1970-01-01 00:00:00 +0000
965@@ -1,42 +0,0 @@
966-/*
967- * Copyright (C) 2014-2015 Canonical, Ltd.
968- *
969- * This program is free software: you can redistribute it and/or modify it
970- * under the terms of the GNU General Public License version 3, as published
971- * by the Free Software Foundation.
972- *
973- * This program is distributed in the hope that it will be useful, but
974- * WITHOUT ANY WARRANTY; without even the implied warranties of
975- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
976- * PURPOSE. See the GNU General Public License for more details.
977- *
978- * You should have received a copy of the GNU General Public License along
979- * with this program. If not, see <http://www.gnu.org/licenses/>.
980- *
981- * Author: Stefano Verzegnassi <stefano92.100@gmail.com>
982- */
983-
984-#ifndef PDFTHREAD_H
985-#define PDFTHREAD_H
986-
987-#include <QThread>
988-#include <poppler/qt5/poppler-qt5.h>
989-
990-typedef QList<Poppler::Page*> PdfPagesList;
991-
992-class PdfThread : public QThread
993-{
994- Q_OBJECT
995-
996-public:
997- void run();
998- void setDocument(Poppler::Document *document);
999-
1000-Q_SIGNALS:
1001- void resultReady(PdfPagesList pages);
1002-
1003-private:
1004- Poppler::Document *m_document;
1005-};
1006-
1007-#endif // PDFTHREAD_H

Subscribers

People subscribed via source and target branches