← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-05 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-04 as a prerequisite.

Commit message:
UI changed to open remote files

Requested reviews:
  Ubuntu File Manager Developers (ubuntu-filemanager-dev)

For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-05/+merge/276448

UI changed to open remote files
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/open-remote-files-05 into lp:ubuntu-filemanager-app.
=== modified file 'src/app/qml/filemanager.qml'
--- src/app/qml/filemanager.qml	2015-01-03 17:12:34 +0000
+++ src/app/qml/filemanager.qml	2015-11-02 19:23:17 +0000
@@ -128,7 +128,7 @@
         }
     }
 
-    function openFile(filePath) {
+    function openLocalFile(filePath) {
         pageStack.push(Qt.resolvedUrl("content-hub/FileOpener.qml"), { fileUrl: "file://" + filePath} )
     }
 

=== modified file 'src/app/qml/ui/FileActionDialog.qml'
--- src/app/qml/ui/FileActionDialog.qml	2014-09-20 10:49:51 +0000
+++ src/app/qml/ui/FileActionDialog.qml	2015-11-02 19:23:17 +0000
@@ -35,7 +35,7 @@
         text: i18n.tr("Open")
         onClicked: {
             console.log("Opening file", filePath)
-            openFile(model.filePath)
+            openLocalFile(model.filePath)
             onClicked: PopupUtils.close(root)
         }
     }

=== modified file 'src/app/qml/ui/FolderListPage.qml'
--- src/app/qml/ui/FolderListPage.qml	2015-10-01 00:04:00 +0000
+++ src/app/qml/ui/FolderListPage.qml	2015-11-02 19:23:17 +0000
@@ -223,6 +223,12 @@
             console.log("FolderListModel needsAuthentication() signal arrived")
             authenticationHandler.showDialog(urlPath,user)
         }
+        onDownloadTemporaryComplete: {
+            var paths = filename.split("/")
+            var nameOnly = paths[paths.length -1]
+            console.log("onDownloadTemporaryComplete received filename="+filename + "name="+nameOnly)
+            openFromDisk(filename, nameOnly)
+        }
     }
 
     FolderListModel {
@@ -722,7 +728,7 @@
                 color: UbuntuColors.red
                 onClicked: {
                     PopupUtils.close(dialog)
-                    openFile(filePath)
+                    openLocalFile(filePath)
                 }
             }
 
@@ -898,6 +904,34 @@
         }
     }
 
+    function openFromDisk(fullpathname, name) {
+        console.log("openFromDisk():"+ fullpathname)
+        // Check if file is an archive. If yes, ask the user whether he wants to extract it
+        var archiveType = getArchiveType(name)
+        if (archiveType === "") {
+            openLocalFile(fullpathname)
+        } else {
+            PopupUtils.open(openArchiveDialog, folderListView,
+                            {   "filePath" : fullpathname,
+                                "fileName" : name,
+                                "archiveType" : archiveType
+                            })
+        }
+
+    }
+
+    //High Level openFile() function
+    //remote files are saved as temporary files and then opened
+    function openFile(model) {
+        if (model.isRemote) {
+            //download and open later when the signal downloadTemporaryComplete() arrives
+            pageModel.downloadAsTemporaryFile(model.index)
+        }
+        else {
+            openFromDisk(model.filePath, model.fileName)
+        }
+    }
+
     function itemClicked(model) {      
         if (model.isBrowsable) {
             console.log("browsable path="+model.filePath+" isRemote="+model.isRemote+" needsAuthentication="+model.needsAuthentication)
@@ -920,29 +954,10 @@
         } else {
             console.log("Non dir clicked")
             if (fileSelectorMode) {
-                selectionManager.select(model.index,
-                                        false,
-                                        true);
+                selectionManager.select(model.index,false,true)
             } else {
-                // Check if file is an archive. If yes, ask the user whether he wants to extract it
-                var archiveType = getArchiveType(model.fileName)
-                if (archiveType === "") {
-                    openFile(model.filePath)
-                } else {
-                    PopupUtils.open(openArchiveDialog, folderListView,
-                                    { "filePath" : model.filePath,
-                                        "fileName" : model.fileName,
-                                        "archiveType" : archiveType
-                                    })
-                }
-
+               openFile(model)
             }
-            //            PopupUtils.open(Qt.resolvedUrl("FileActionDialog.qml"), root,
-            //                            {
-            //                                fileName: model.fileName,
-            //                                filePath: model.filePath,
-            //                                folderListModel: root.folderListModel
-            //                            })
         }
     }
 


Follow ups