Merge lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-05 into lp:ubuntu-filemanager-app

Proposed by Carlos Jose Mazieri
Status: Merged
Approved by: Arto Jalkanen
Approved revision: 497
Merged at revision: 498
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-05
Merge into: lp:ubuntu-filemanager-app
Prerequisite: lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-04
Diff against target: 117 lines (+39/-24)
3 files modified
src/app/qml/filemanager.qml (+1/-1)
src/app/qml/ui/FileActionDialog.qml (+1/-1)
src/app/qml/ui/FolderListPage.qml (+37/-22)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-05
Reviewer Review Type Date Requested Status
Arto Jalkanen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+276448@code.launchpad.net

Commit message

UI changed to open remote files

Description of the change

UI changed to open remote files

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) :
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/filemanager.qml'
2--- src/app/qml/filemanager.qml 2015-01-03 17:12:34 +0000
3+++ src/app/qml/filemanager.qml 2015-11-02 19:23:17 +0000
4@@ -128,7 +128,7 @@
5 }
6 }
7
8- function openFile(filePath) {
9+ function openLocalFile(filePath) {
10 pageStack.push(Qt.resolvedUrl("content-hub/FileOpener.qml"), { fileUrl: "file://" + filePath} )
11 }
12
13
14=== modified file 'src/app/qml/ui/FileActionDialog.qml'
15--- src/app/qml/ui/FileActionDialog.qml 2014-09-20 10:49:51 +0000
16+++ src/app/qml/ui/FileActionDialog.qml 2015-11-02 19:23:17 +0000
17@@ -35,7 +35,7 @@
18 text: i18n.tr("Open")
19 onClicked: {
20 console.log("Opening file", filePath)
21- openFile(model.filePath)
22+ openLocalFile(model.filePath)
23 onClicked: PopupUtils.close(root)
24 }
25 }
26
27=== modified file 'src/app/qml/ui/FolderListPage.qml'
28--- src/app/qml/ui/FolderListPage.qml 2015-10-01 00:04:00 +0000
29+++ src/app/qml/ui/FolderListPage.qml 2015-11-02 19:23:17 +0000
30@@ -223,6 +223,12 @@
31 console.log("FolderListModel needsAuthentication() signal arrived")
32 authenticationHandler.showDialog(urlPath,user)
33 }
34+ onDownloadTemporaryComplete: {
35+ var paths = filename.split("/")
36+ var nameOnly = paths[paths.length -1]
37+ console.log("onDownloadTemporaryComplete received filename="+filename + "name="+nameOnly)
38+ openFromDisk(filename, nameOnly)
39+ }
40 }
41
42 FolderListModel {
43@@ -722,7 +728,7 @@
44 color: UbuntuColors.red
45 onClicked: {
46 PopupUtils.close(dialog)
47- openFile(filePath)
48+ openLocalFile(filePath)
49 }
50 }
51
52@@ -898,6 +904,34 @@
53 }
54 }
55
56+ function openFromDisk(fullpathname, name) {
57+ console.log("openFromDisk():"+ fullpathname)
58+ // Check if file is an archive. If yes, ask the user whether he wants to extract it
59+ var archiveType = getArchiveType(name)
60+ if (archiveType === "") {
61+ openLocalFile(fullpathname)
62+ } else {
63+ PopupUtils.open(openArchiveDialog, folderListView,
64+ { "filePath" : fullpathname,
65+ "fileName" : name,
66+ "archiveType" : archiveType
67+ })
68+ }
69+
70+ }
71+
72+ //High Level openFile() function
73+ //remote files are saved as temporary files and then opened
74+ function openFile(model) {
75+ if (model.isRemote) {
76+ //download and open later when the signal downloadTemporaryComplete() arrives
77+ pageModel.downloadAsTemporaryFile(model.index)
78+ }
79+ else {
80+ openFromDisk(model.filePath, model.fileName)
81+ }
82+ }
83+
84 function itemClicked(model) {
85 if (model.isBrowsable) {
86 console.log("browsable path="+model.filePath+" isRemote="+model.isRemote+" needsAuthentication="+model.needsAuthentication)
87@@ -920,29 +954,10 @@
88 } else {
89 console.log("Non dir clicked")
90 if (fileSelectorMode) {
91- selectionManager.select(model.index,
92- false,
93- true);
94+ selectionManager.select(model.index,false,true)
95 } else {
96- // Check if file is an archive. If yes, ask the user whether he wants to extract it
97- var archiveType = getArchiveType(model.fileName)
98- if (archiveType === "") {
99- openFile(model.filePath)
100- } else {
101- PopupUtils.open(openArchiveDialog, folderListView,
102- { "filePath" : model.filePath,
103- "fileName" : model.fileName,
104- "archiveType" : archiveType
105- })
106- }
107-
108+ openFile(model)
109 }
110- // PopupUtils.open(Qt.resolvedUrl("FileActionDialog.qml"), root,
111- // {
112- // fileName: model.fileName,
113- // filePath: model.filePath,
114- // folderListModel: root.folderListModel
115- // })
116 }
117 }
118

Subscribers

People subscribed via source and target branches