← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mzanetti/ubuntu-filemanager-app/share-files into lp:ubuntu-filemanager-app

 

Michael Zanetti has proposed merging lp:~mzanetti/ubuntu-filemanager-app/share-files into lp:ubuntu-filemanager-app.

Commit message:
Add support for sharing files via contenthub on longpress

Requested reviews:
  Ubuntu File Manager Developers (ubuntu-filemanager-dev)
Related bugs:
  Bug #1525584 in Ubuntu File Manager App: "share files"
  https://bugs.launchpad.net/ubuntu-filemanager-app/+bug/1525584

For more details, see:
https://code.launchpad.net/~mzanetti/ubuntu-filemanager-app/share-files/+merge/299821
-- 
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~mzanetti/ubuntu-filemanager-app/share-files into lp:ubuntu-filemanager-app.
=== modified file 'src/app/qml/content-hub/FileOpener.qml'
--- src/app/qml/content-hub/FileOpener.qml	2016-03-16 16:15:41 +0000
+++ src/app/qml/content-hub/FileOpener.qml	2016-07-12 15:10:37 +0000
@@ -29,6 +29,7 @@
     property var activeTransfer
 
     property string fileUrl
+    property bool share: false
 
     Component.onCompleted: {
         var contentType = Resolver.resolveContentType(fileUrl)
@@ -53,7 +54,7 @@
         showTitle: false
 
         // Type of handler: Source, Destination, or Share
-        handler: ContentHandler.Destination
+        handler: root.share ? ContentHandler.Share : ContentHandler.Destination
         contentType: ContentType.Pictures
 
         onPeerSelected: {

=== modified file 'src/app/qml/filemanager.qml'
--- src/app/qml/filemanager.qml	2016-03-16 16:15:41 +0000
+++ src/app/qml/filemanager.qml	2016-07-12 15:10:37 +0000
@@ -127,8 +127,8 @@
         }
     }
 
-    function openLocalFile(filePath) {
-        pageStack.push(Qt.resolvedUrl("content-hub/FileOpener.qml"), { fileUrl: "file://" + filePath} )
+    function openLocalFile(filePath, share) {
+        pageStack.push(Qt.resolvedUrl("content-hub/FileOpener.qml"), { fileUrl: "file://" + filePath, share: share} )
     }
 
     Connections {

=== modified file 'src/app/qml/ui/FolderListPage.qml'
--- src/app/qml/ui/FolderListPage.qml	2016-06-05 06:58:11 +0000
+++ src/app/qml/ui/FolderListPage.qml	2016-07-12 15:10:37 +0000
@@ -598,6 +598,14 @@
                 }
 
                 Action {
+                    id: shareAction
+                    text: i18n.tr("Share")
+                    onTriggered: {
+                        openFile(actionSelectionPopover.model, true)
+                    }
+                }
+
+                Action {
                     id: extractAction
                     visible: actionSelectionPopover.isArchive
                     text: i18n.tr("Extract archive")
@@ -911,12 +919,12 @@
         }
     }
 
-    function openFromDisk(fullpathname, name) {
+    function openFromDisk(fullpathname, name, share) {
         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)
+            openLocalFile(fullpathname, share)
         } else {
             PopupUtils.open(openArchiveDialog, folderListView,
                             {   "filePath" : fullpathname,
@@ -929,13 +937,13 @@
 
     //High Level openFile() function
     //remote files are saved as temporary files and then opened
-    function openFile(model) {
+    function openFile(model, share) {
         if (model.isRemote) {
             //download and open later when the signal downloadTemporaryComplete() arrives
             pageModel.downloadAsTemporaryFile(model.index)
         }
         else {
-            openFromDisk(model.filePath, model.fileName)
+            openFromDisk(model.filePath, model.fileName, share)
         }
     }
 


Follow ups