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

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 299
Merged at revision: 300
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1544149
Merge into: lp:ubuntu-docviewer-app
Diff against target: 138 lines (+34/-21)
3 files modified
src/app/qml/common/ContentHubProxy.qml (+10/-9)
src/app/qml/documentPage/DocumentListView.qml (+1/-1)
src/app/qml/documentPage/DocumentPagePickModeHeader.qml (+23/-11)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-1544149
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+285641@code.launchpad.net

Commit message

Fixed ContentTransferHint being visible during an export

Description of the change

Fixed ContentTransferHint being visible during an export

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
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Tested this on OTA-9. It brings up the document selector, and I can select a document to transfer. However when I then press the tick in the header, nothing happens. I get a vibrate so it did notice I pressed the tick, but it never transfers the file. The document selector still works, I can select and unselect documents, but I can never transfer them.

review: Needs Fixing
298. By Stefano Verzegnassi

Fixed DocumentPagePickModeHeader:
* Use UCListItem 1.2+ APIs
* Use content-hub properly

299. By Stefano Verzegnassi

Restore the browse mode when the content transfer is completed or aborted

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

Fixed!

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Yup! Fixed! Thank you!

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/ContentHubProxy.qml'
2--- src/app/qml/common/ContentHubProxy.qml 2015-10-10 12:03:30 +0000
3+++ src/app/qml/common/ContentHubProxy.qml 2016-02-12 13:03:03 +0000
4@@ -23,11 +23,12 @@
5 Item {
6 id: contentHubProxy
7
8- property var activeTransfer
9+ property var activeImportTransfer
10+ property var activeExportTransfer
11
12 // This property is used in ../documentPage/Document(Grid|List)View.qml
13 // so that we avoid to import Ubuntu.Content module outside this proxy.
14- property bool multipleSelectionType: !activeTransfer || activeTransfer.selectionType == ContentTransfer.Multiple
15+ property bool multipleSelectionType: !activeExportTransfer || activeExportTransfer.selectionType == ContentTransfer.Multiple
16
17 property alias rejectedDocuments: rejectedDocsModel
18 property alias importedDocuments: importedDocsModel
19@@ -36,22 +37,22 @@
20 ListModel { id: importedDocsModel }
21
22 ContentTransferHint {
23- activeTransfer: contentHubProxy.activeTransfer
24+ activeTransfer: contentHubProxy.activeImportTransfer
25 }
26
27 Connections {
28 target: ContentHub
29
30 onImportRequested: {
31- activeTransfer = transfer
32+ activeImportTransfer = transfer
33
34- if (activeTransfer.state === ContentTransfer.Charged) {
35+ if (activeImportTransfer.state === ContentTransfer.Charged) {
36 mainView.switchToBrowseMode()
37
38 internal.clearModels()
39
40- for (var i=0; i<activeTransfer.items.length; i++) {
41- var sourcePath = internal.getPathFromUrl(activeTransfer.items[i].url)
42+ for (var i=0; i<activeImportTransfer.items.length; i++) {
43+ var sourcePath = internal.getPathFromUrl(activeImportTransfer.items[i].url)
44
45 if (DocumentViewer.isFileSupported(sourcePath)) {
46 var documentsLocation = DocumentViewer.getXdgDocumentsLocation()
47@@ -84,7 +85,7 @@
48 }
49
50 onExportRequested: {
51- activeTransfer = transfer
52+ activeExportTransfer = transfer
53 mainView.switchToPickMode()
54 }
55 }
56@@ -125,7 +126,7 @@
57 }
58
59 function finalizeImport() {
60- activeTransfer.finalize()
61+ activeImportTransfer.finalize()
62 }
63
64 function handleNotifications() {
65
66=== modified file 'src/app/qml/documentPage/DocumentListView.qml'
67--- src/app/qml/documentPage/DocumentListView.qml 2015-11-01 16:50:23 +0000
68+++ src/app/qml/documentPage/DocumentListView.qml 2016-02-12 13:03:03 +0000
69@@ -24,7 +24,7 @@
70
71 function isMultipleSelection() {
72 // No active transfer, then we're in selection mode.
73- if (!contentHubProxy.activeTransfer)
74+ if (!contentHubProxy.activeExportTransfer)
75 return true
76
77 // We have an active transfer, get the value from the content hub proxy
78
79=== modified file 'src/app/qml/documentPage/DocumentPagePickModeHeader.qml'
80--- src/app/qml/documentPage/DocumentPagePickModeHeader.qml 2015-10-23 14:10:47 +0000
81+++ src/app/qml/documentPage/DocumentPagePickModeHeader.qml 2016-02-12 13:03:03 +0000
82@@ -29,10 +29,13 @@
83 objectName: "cancelButton"
84 iconName: "close"
85 onTriggered: {
86- if (!contentHubProxy.activeTransfer)
87- return;
88-
89- contentHubProxy.activeTransfer.state = ContentTransfer.Aborted;
90+ if (!contentHubProxy.activeExportTransfer)
91+ return
92+
93+ contentHubProxy.activeExportTransfer.items = []
94+ contentHubProxy.activeExportTransfer.state = ContentTransfer.Aborted
95+
96+ mainView.switchToBrowseMode()
97 }
98 }
99
100@@ -48,23 +51,32 @@
101 Action {
102 text: i18n.tr("Pick")
103 objectName: "pickButton"
104- enabled: viewLoader.item.selectedItems.count > 0
105+ enabled: viewLoader.item.ViewItems.selectedIndices.length > 0
106 iconName: "ok"
107 onTriggered: {
108- if (!enabled || !contentHubProxy.activeTransfer)
109+ if (!enabled || !contentHubProxy.activeExportTransfer)
110 return;
111
112- var urlList = []
113- var indices = documentPage.view.item.selectedIndices;
114+ var contentList = []
115+ var indices = viewLoader.item.ViewItems.selectedIndices
116+
117+ console.log("[content-hub] Following files will be exported:")
118
119 for (var i=0; i < indices.length; i++) {
120- urlList.push("file://" + folderModel.get(i).path);
121+ var filePath = "file://" + folderModel.get(i).path
122+ console.log(filePath)
123+
124+ contentList.push(contentItem.createObject(rootItem, { "url": filePath }))
125 }
126
127- contentHubProxy.activeTransfer.items = urlList
128- contentHubProxy.activeTransfer.state = ContentTransfer.Charged
129+ contentHubProxy.activeExportTransfer.items = contentList
130+ contentHubProxy.activeExportTransfer.state = ContentTransfer.Charged
131+
132+ mainView.switchToBrowseMode()
133 }
134 }
135 ]
136+
137+ property Component contentItem: Component { ContentItem {} }
138 }
139

Subscribers

People subscribed via source and target branches