Merge lp:~ajalkane/ubuntu-filemanager-app/content-hub-multiselection into lp:ubuntu-filemanager-app

Proposed by Arto Jalkanen
Status: Merged
Approved by: Arto Jalkanen
Approved revision: no longer in the source branch.
Merged at revision: 224
Proposed branch: lp:~ajalkane/ubuntu-filemanager-app/content-hub-multiselection
Merge into: lp:ubuntu-filemanager-app
Diff against target: 378 lines (+202/-8)
11 files modified
CMakeLists.txt (+3/-2)
README.contentHubDesktop (+65/-0)
apparmor.json (+1/-1)
debian/control (+1/-1)
hub-exporter.json (+5/-0)
manifest.json (+4/-2)
src/app/qml/components/FolderIconDelegate.qml (+1/-1)
src/app/qml/components/FolderListDelegate.qml (+2/-0)
src/app/qml/filemanager.qml (+55/-0)
src/app/qml/ui/FolderListPage.qml (+57/-1)
ubuntu-filemanager-app.json (+8/-0)
To merge this branch: bzr merge lp:~ajalkane/ubuntu-filemanager-app/content-hub-multiselection
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Arto Jalkanen Approve
Ken VanDine Pending
Michael Sheldon Pending
Carlos Jose Mazieri Pending
David Planella Pending
Review via email: mp+226914@code.launchpad.net

This proposal supersedes a proposal from 2014-05-19.

Commit message

ContentHub file selecting support improved:

 - Buttons for accepting / cancelling selection
 - Can select multiple files

Description of the change

ContentHub file selecting support improved:

 - Buttons for accepting / cancelling selection
 - Can select multiple files

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Carlos Jose Mazieri (carlos-mazieri) wrote : Posted in a previous version of this proposal

1. How do I test it?
   In order to see something I just changed the property FolderListPage::fileSelectorMode
   Otherwise it looks like normal filemanager

2. Running as I said above (maybe it is wrong) I could see the select button becomming enabled, but I would expect the item background color be changed.

3. %11 instead of %1
+ 89 + error(i18n.tr("File operation error"), i18n.tr("Unable to open '%11'").arg(filePath))

review: Needs Information
Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

Hi Carlos,

to test it you will need:

 - Compile and install FileManager as a click package
 - Compile and run this project: https://code.launchpad.net/~ken-vandine/+junk/hub-importer
 - From hub-importer you should be able to select FileManager as import source

Let me know if there's a problem.

Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

Carlos,

I added more comprehensive instructions for testing on desktop to the branch. After updating please see the file README.contentHubDesktop.

I hope I managed to put everything needed there. If not, let me know - I know I used weeks on this so better to ask if you hit a dead end than to waste time trying to figure it out, because I might have experienced the same problem.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote : Posted in a previous version of this proposal

The content-hub implementation looks fine, I noticed a couple of more general issue you might want to look at though:

 * You'll need to merge from https://code.launchpad.net/~ajalkane/ubuntu-filemanager-app/content-hub-preliminary otherwise you'll run in to conflicts due to "Unable to open '%11'" having been fixed in that branch and also changed in a different way in this one.

 * There doesn't appear to be any visual indication that an item has been selected if it has a short name, items with long names that have been truncated get expanded and highlighted when selected, but items with names short enough not to be truncated don't appear to be highlighted.

 * It doesn't appear to be possible to select files from multiple directories, the original selection is lost when changing directory (this could be intentional though?)

review: Needs Fixing
Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

Thanks for looking into it.

 * Will do the merge

 * There SHOULD be visual indication. For me I see selected items' text in different color. I will try to reproduce this problem. I did only test with the list view, not with the icon view. Perhaps I forgot to make the changes to icon view.

 * This is as intended - That's how Ubuntu's file selection works also, you can't select files from several directories.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

Michael,

I have done the merge and added support for highlighting items in item view (it was missing).

Carlos,

the README for building on desktop was incomplete. I have updated it accordingly (see the changes needed in manifest.json when building).

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
David Planella (dpm) wrote : Posted in a previous version of this proposal

Thanks Arto. Could you look into fixing the merge conflicts in the diff?

review: Needs Fixing
Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

> Thanks Arto. Could you look into fixing the merge conflicts in the diff?

I will look into it on saturday.

Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

> Thanks Arto. Could you look into fixing the merge conflicts in the diff?

I did the merge from trunk, and could build the click package. Unfortunately I'm unable to test because on 14.04 desktop at least I get following error when trying to install the click package (did apt-get update and apt-get dist-upgrade before this):

Cannot install ./com.ubuntu.filemanager_0.3.latest_i386.click: Framework "ubuntu-sdk-14.04-dev2" not present on system (use --force-missing-framework option to override)

So I just hope the merge is okay and perhaps Jenkins will complain if there's something more amiss.

Revision history for this message
David Planella (dpm) wrote : Posted in a previous version of this proposal

On Sat, Jul 5, 2014 at 10:02 PM, Arto Jalkanen <email address hidden> wrote:

> > Thanks Arto. Could you look into fixing the merge conflicts in the diff?
>
> I did the merge from trunk, and could build the click package.
> Unfortunately I'm unable to test because on 14.04 desktop at least I get
> following error when trying to install the click package (did apt-get
> update and apt-get dist-upgrade before this):
>
> Cannot install ./com.ubuntu.filemanager_0.3.latest_i386.click: Framework
> "ubuntu-sdk-14.04-dev2" not present on system (use
> --force-missing-framework option to override)
>
>
Hi Arto,

Thanks for looking into this. You've got two options: either use the
--force-missing-framework as per the message above, or rather, as part of
the branch, fix the manifest to set the framework to ubuntu-sdk-14.*10*
-dev2.

I would recommend the later.

Cheers,
David.

Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

> On Sat, Jul 5, 2014 at 10:02 PM, Arto Jalkanen <email address hidden> wrote:
> Hi Arto,
>
> Thanks for looking into this. You've got two options: either use the
> --force-missing-framework as per the message above, or rather, as part of
> the branch, fix the manifest to set the framework to ubuntu-sdk-14.*10*
> -dev2.
>
> I would recommend the later.

The trunk got the ubuntu-sdk-14.10 fix into manifest.json. Unfortunately after merging it I still get the problem:

Cannot install ./com.ubuntu.filemanager_0.3.latest_i386.click: Framework "ubuntu-sdk-14.10-dev2" not present on system (use --force-missing-framework option to override)

I did manage to install it with --force-misosing-framework. But after doing "upstart-app-list" does not show FIleManager after that. Furthermore kenvandine's hub-importer failed to start now, not sure what that's related to, probably some dist-upgrade I did.

So I'll just push the changes and I hope they're okay from Jenkin's point of view.

Revision history for this message
David Planella (dpm) wrote : Posted in a previous version of this proposal

On Sun, Jul 6, 2014 at 10:11 PM, Arto Jalkanen <email address hidden> wrote:

> > On Sat, Jul 5, 2014 at 10:02 PM, Arto Jalkanen <email address hidden>
> wrote:
> > Hi Arto,
> >
> > Thanks for looking into this. You've got two options: either use the
> > --force-missing-framework as per the message above, or rather, as part of
> > the branch, fix the manifest to set the framework to ubuntu-sdk-14.*10*
> > -dev2.
> >
> > I would recommend the later.
>
> The trunk got the ubuntu-sdk-14.10 fix into manifest.json. Unfortunately
> after merging it I still get the problem:
>
> Cannot install ./com.ubuntu.filemanager_0.3.latest_i386.click: Framework
> "ubuntu-sdk-14.10-dev2" not present on system (use
> --force-missing-framework option to override)
>
> I did manage to install it with --force-misosing-framework. But after
> doing "upstart-app-list" does not show FIleManager after that. Furthermore
> kenvandine's hub-importer failed to start now, not sure what that's related
> to, probably some dist-upgrade I did.
>

Hi Arto, a few questions:

- How are you installing the click package?
- Are you using a device, or the emulator? Which Ubuntu image are you using?
- Why are you using upstart-app-list instead of 'click list' to list the
installed packages? And what is the output of 'click list'?
- What is the output of 'click framework list'?

Cheers,
David.

>
> So I'll just push the changes and I hope they're okay from Jenkin's point
> of view.
>
>
> --
>
> https://code.launchpad.net/~ajalkane/ubuntu-filemanager-app/content-hub-multiselection/+merge/220135
> You are reviewing the proposed merge of
> lp:~ajalkane/ubuntu-filemanager-app/content-hub-multiselection into
> lp:ubuntu-filemanager-app.
>

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

> On Sun, Jul 6, 2014 at 10:11 PM, Arto Jalkanen <email address hidden> wrote:
>
> Hi Arto, a few questions:
>
> - How are you installing the click package?

Like this:

sudo click install --user=$USER ./com.ubuntu.filemanager_0.3.latest_i386.click

> - Are you using a device, or the emulator? Which Ubuntu image are you using?

I'm using desktop (14.04). This was recommended to me. I spent about two months battling with the emulator, but after a suggestion got it working in desktop. Never managed to get it working in emulator and I don't fancy trying to battle with the emulator anytime soon :P.

> - Why are you using upstart-app-list instead of 'click list' to list the
> installed packages? And what is the output of 'click list'?

This was my mistake. Should have used "click list", and using that the FileManager package is shown.

> - What is the output of 'click framework list'?

click: error: unknown command: framework

Revision history for this message
David Planella (dpm) wrote : Posted in a previous version of this proposal

On Tue, Jul 8, 2014 at 10:30 PM, Arto Jalkanen <email address hidden> wrote:

> > On Sun, Jul 6, 2014 at 10:11 PM, Arto Jalkanen <email address hidden>
> wrote:
> >
> > Hi Arto, a few questions:
> >
> > - How are you installing the click package?
>
> Like this:
>
> sudo click install --user=$USER
> ./com.ubuntu.filemanager_0.3.latest_i386.click
>
>
Ah, ok. I'm not sure how good the support for click packages on a Unity 7
session is, though.

> > - Are you using a device, or the emulator? Which Ubuntu image are you
> using?
>
> I'm using desktop (14.04). This was recommended to me. I spent about two
> months battling with the emulator, but after a suggestion got it working in
> desktop. Never managed to get it working in emulator and I don't fancy
> trying to battle with the emulator anytime soon :P.
>
>
It's actually not that hard anymore, you can do everything from within Qt
Creator, and the i386 emulator is much, much faster!

You'll find a video with an intro here:
- http://youtu.be/z7v_N2fKuP0

And the slides:
-
http://www.slideshare.net/DavidPlanella/app-development-with-the-ubuntu-emulator

> > - Why are you using upstart-app-list instead of 'click list' to list the
> > installed packages? And what is the output of 'click list'?
>
> This was my mistake. Should have used "click list", and using that the
> FileManager package is shown.
>
> > - What is the output of 'click framework list'?
>
> click: error: unknown command: framework
>

In this case I believe you're using an old version of click. Do you have
the SDK team PPA installed, and is your 14.04 system up-to-date?

Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

> On Tue, Jul 8, 2014 at 10:30 PM, Arto Jalkanen <email address hidden> wrote:
> > sudo click install --user=$USER
> > ./com.ubuntu.filemanager_0.3.latest_i386.click
> >
> >
> Ah, ok. I'm not sure how good the support for click packages on a Unity 7
> session is, though.
>
> It's actually not that hard anymore, you can do everything from within Qt
> Creator, and the i386 emulator is much, much faster!
>
> You'll find a video with an intro here:
> - http://youtu.be/z7v_N2fKuP0
>
> And the slides:
> -
> http://www.slideshare.net/DavidPlanella/app-development-with-the-ubuntu-
> emulator

Thanks. These seem like good information once I need to venture again into the emulator wonder-land :).

> > > - What is the output of 'click framework list'?
> >
> > click: error: unknown command: framework
>
> In this case I believe you're using an old version of click. Do you have
> the SDK team PPA installed, and is your 14.04 system up-to-date?

This was the problem. My SDK team PPA was disabled, I guess due to some update I had done.

Now it works and lists:

ubuntu-sdk-13.10
ubuntu-sdk-14.04-dev1
ubuntu-sdk-14.04-html-dev1
ubuntu-sdk-14.04-papi-dev1
ubuntu-sdk-14.04-qml-dev1

I tried running File Manager directly with:

upstart-app-launch com.ubuntu.filemanager_filemanager_0.3.latest

But File Manager would not start. The logs were not helpful:

cat ~/.cache/upstart/application-click-com.ubuntu.filemanager_filemanager_0.3.latest.log
pgrep: invalid user name: system

But it doesn't much matter. The merges from FileManager trunk are something that should not impede on content-hub integration changes I've done as such, and I have tested that it works on previous SDKs. Jenkins seems to be ok with the current changes, but of course it would be nice if anyone with working environment can do a quick check that File Manager at least can be started.

Revision history for this message
Arto Jalkanen (ajalkane) wrote : Posted in a previous version of this proposal

Top approving this since all the issues raised have been fixed.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~ajalkane/ubuntu-filemanager-app/content-hub-multiselection/+merge/226914/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) wrote :

Approving after removing dependent branch that was rejected - all relevant changes in the dependent branch should be in this branch.

review: Approve
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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)
224. By Arto Jalkanen

ContentHub file selecting support improved:

 - Buttons for accepting / cancelling selection
 - Can select multiple files.

Approved by Ubuntu Phone Apps Jenkins Bot, Arto Jalkanen.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-04-29 21:20:00 +0000
3+++ CMakeLists.txt 2014-07-15 20:29:29 +0000
4@@ -17,6 +17,7 @@
5 set(ICON_FILE filemanager64.png)
6 set(AUTOPILOT_DIR ${APP_NAME})
7 set(EXEC "${APP_NAME}")
8+set(CONTENT_HUB_EXPORTER hub-exporter.json)
9
10 if(CLICK_MODE)
11 if(NOT DEFINED BZR_SOURCE)
12@@ -42,7 +43,7 @@
13 set(BZR_REVNO "latest")
14 endif(NOT BZR_REVNO)
15 configure_file(manifest.json ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
16- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json apparmor.json DESTINATION ${CMAKE_INSTALL_PREFIX})
17+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json apparmor.json ${CONTENT_HUB_EXPORTER} DESTINATION ${CMAKE_INSTALL_PREFIX})
18 else(CLICK_MODE)
19 execute_process(
20 COMMAND qmake -query QT_INSTALL_QML
21@@ -62,7 +63,7 @@
22
23 file(GLOB SRC_FILES
24 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
25- *.qml *.js *.png *.svg *.js)
26+ *.qml *.js *.png *.svg *.json)
27 install(FILES ${SRC_FILES} DESTINATION ${DATA_DIR})
28
29 configure_file(${DESKTOP_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE})
30
31=== added file 'README.contentHubDesktop'
32--- README.contentHubDesktop 1970-01-01 00:00:00 +0000
33+++ README.contentHubDesktop 2014-07-15 20:29:29 +0000
34@@ -0,0 +1,65 @@
35+# Ubuntu File Manager
36+
37+File manager app for Ubuntu on the desktop and on mobile devices.
38+
39+## Testing Content-Hub support
40+
41+### For the desktop
42+
43+Install the following dependencies to run click applications:
44+
45+ sudo apt-get install upstart-app-launch-tools
46+
47+#### Build FileManager and install FileManager as click package
48+
49+Build FileManager as a click package and install it. At the time of this writing
50+this doesn't seem to be working with the SDK (due to cmake), but it can be done
51+from command line:
52+
53+First you must modify manifest.json and replace "architecture" value of "armhf" with "i386".
54+Just remember to change it back to armhf if you commit changes.
55+
56+After that you can build x86 version of the package and install it:
57+
58+ QT_SELECT=qt5 cmake . -DCLICK_MODE=1 && make -j2 && make install DESTDIR=install && click build install
59+ sudo click install --user=$USER ./com.ubuntu.filemanager_0.3.latest_i386.click
60+
61+#### Build and install hub-importer as click package
62+
63+Get the sources for building:
64+
65+ bzr branch lp:~ken-vandine/+junk/hub-importer
66+
67+You should be able to create click package out of it in SDK by opening the project and using Publish and Create package.
68+
69+Install the created package (example):
70+
71+ sudo click install --user=$USER com.ubuntu.developer.ken-vandine.hub-importer_0.2_all.click
72+
73+#### Running test
74+
75+Run hub-importer (example):
76+
77+ upstart-app-launch com.ubuntu.developer.ken-vandine.hub-importer_hub-importer_0.2
78+
79+Click "Select source" button.
80+
81+You should see File Manager as one of the choices. If you do not see File Manager, look at "Troubleshooting" section.
82+Click on File Manager, and File Manager should start. Now you should choose some pictures as that's the only thing
83+supported at the moment (even though FileManager allows selecting any type). You can select multiple files in a
84+directory if you so choose. Once you're satisfied with the seelction, click "Select". You should see the pictures
85+then in Hub Importer.
86+
87+#### Troubleshooting
88+
89+ - If you don't see File Manager as one of the choises in Hub Importer, then quit Hub Importer and run this script:
90+ /usr/lib/i386-linux-gnu/content-hub/content-hub-peer-hook
91+ Try running Hub Importer again after that and File Manager should show.
92+ If the above script does not exist, you can try locating something similar with:
93+ locate hook
94+ - If you have trouble running Hub Importer or the above still doesn't work, check the installed click packages with:
95+ click list
96+ It should show entry for both File Manager and Hub Importer. If it does not, installing the click package has not succeeded
97+ - If all else fails, check the logs for both Hub Importer and File Manager for further clues at:
98+ $HOME/.cache/upstart/
99+
100
101=== modified file 'apparmor.json'
102--- apparmor.json 2014-07-02 12:28:30 +0000
103+++ apparmor.json 2014-07-15 20:29:29 +0000
104@@ -2,4 +2,4 @@
105 "policy_version": 1.2,
106 "template": "unconfined",
107 "policy_groups": []
108-}
109+}
110\ No newline at end of file
111
112=== modified file 'debian/control'
113--- debian/control 2014-06-21 21:59:52 +0000
114+++ debian/control 2014-07-15 20:29:29 +0000
115@@ -24,7 +24,7 @@
116 qtdeclarative5-qtquick2-plugin,
117 qtdeclarative5-u1db1.0,
118 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
119- ${misc:Depends},
120+ qtdeclarative5-ubuntu-content0.1,
121 Description: File Manager application
122 Core File Manager application
123
124
125=== added file 'hub-exporter.json'
126--- hub-exporter.json 1970-01-01 00:00:00 +0000
127+++ hub-exporter.json 2014-07-15 20:29:29 +0000
128@@ -0,0 +1,5 @@
129+{
130+ "source": [
131+ "pictures"
132+ ]
133+}
134
135=== modified file 'manifest.json'
136--- manifest.json 2014-07-02 16:35:19 +0000
137+++ manifest.json 2014-07-15 20:29:29 +0000
138@@ -1,11 +1,13 @@
139 {
140 "description": "File Manager application",
141 "framework": "ubuntu-sdk-14.10-dev2",
142+ "_comment": "put i386 to architecture if you want build for x86, armhf for arm devices",
143 "architecture": "armhf",
144 "hooks": {
145 "filemanager": {
146 "apparmor": "apparmor.json",
147 "desktop": "com.ubuntu.filemanager.desktop",
148+ "content-hub": "hub-exporter.json",
149 "urls": "com.ubuntu.filemanager_filemanager.url-dispatcher"
150 }
151 },
152@@ -13,10 +15,10 @@
153 "maintainer": "Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>",
154 "name": "com.ubuntu.filemanager",
155 "title": "File Manager",
156- "version": "0.3.@BZR_REVNO@",
157+ "version": "0.3.latest",
158 "x-source": {
159 "vcs-bzr": "lp:ubuntu-filemanager-app",
160- "vcs-bzr-revno": "@BZR_REVNO@"
161+ "vcs-bzr-revno": "latest"
162 },
163 "x-test": {
164 "autopilot": "filemanager"
165
166=== modified file 'src/app/qml/components/FolderIconDelegate.qml'
167--- src/app/qml/components/FolderIconDelegate.qml 2014-06-22 12:45:32 +0000
168+++ src/app/qml/components/FolderIconDelegate.qml 2014-07-15 20:29:29 +0000
169@@ -36,7 +36,7 @@
170 radius: units.gu(2)
171 smooth: true
172 antialiasing: true
173- opacity: selected ? 0.5 : 0
174+ opacity: model.isSelected ? 0.5 : 0
175 color: UbuntuColors.orange
176
177 Behavior on opacity {
178
179=== modified file 'src/app/qml/components/FolderListDelegate.qml'
180--- src/app/qml/components/FolderListDelegate.qml 2014-06-22 12:45:32 +0000
181+++ src/app/qml/components/FolderListDelegate.qml 2014-07-15 20:29:29 +0000
182@@ -34,4 +34,6 @@
183
184 progression: model.isDir
185 iconFrame: false
186+
187+ selected: model.isSelected
188 }
189
190=== modified file 'src/app/qml/filemanager.qml'
191--- src/app/qml/filemanager.qml 2014-06-21 21:59:52 +0000
192+++ src/app/qml/filemanager.qml 2014-07-15 20:29:29 +0000
193@@ -21,6 +21,7 @@
194 import Ubuntu.Components.Popups 0.1
195 import Ubuntu.Unity.Action 1.0 as UnityActions
196 import U1db 1.0 as U1db
197+import Ubuntu.Content 0.1
198 import com.ubuntu.PlacesModel 0.1
199
200 import "ui"
201@@ -61,6 +62,17 @@
202 backgroundColor: "#797979"
203 footerColor: "#808080"
204
205+ QtObject {
206+ id: fileSelector
207+ property var activeTransfer: null
208+ property var fileSelectorComponent: null
209+ }
210+
211+ Component {
212+ id: fileSelectorResultComponent
213+ ContentItem {}
214+ }
215+
216 PlacesModel {
217 id: userplaces
218 }
219@@ -92,6 +104,49 @@
220 tabs.selectedTabIndex = 0
221 }
222
223+ function openFileSelector() {
224+ pageStack.push(fileSelectorComponent, { fileSelectorMode: true} )
225+ }
226+
227+ function cancelFileSelector() {
228+ console.log("Cancel file selector")
229+ pageStack.pop()
230+ fileSelector.fileSelectorComponent = null
231+ fileSelector.activeTransfer.state = ContentTransfer.Aborted
232+ }
233+
234+ function acceptFileSelector(fileUrls) {
235+ console.log("accept file selector " + fileUrls)
236+ var results = fileUrls.map(function(fileUrl) {
237+ return fileSelectorResultComponent.createObject(mainView, {"url": fileUrl})
238+ })
239+
240+ if (fileSelector.activeTransfer !== null) {
241+ fileSelector.activeTransfer.items = results
242+ fileSelector.activeTransfer.state = ContentTransfer.Charged
243+ console.log("set activeTransfer")
244+ } else {
245+ console.log("activeTransfer null, not setting, testing code")
246+ }
247+ }
248+
249+ Connections {
250+ target: ContentHub
251+ onExportRequested: {
252+ fileSelector.activeTransfer = transfer
253+ openFileSelector()
254+ }
255+ }
256+
257+ Component {
258+ id: fileSelectorComponent
259+
260+ FolderListPage {
261+ // TODO: remember last selection
262+ folder: "~"
263+ }
264+ }
265+
266 PageStack {
267 id: pageStack
268
269
270=== modified file 'src/app/qml/ui/FolderListPage.qml'
271--- src/app/qml/ui/FolderListPage.qml 2014-06-30 22:18:57 +0000
272+++ src/app/qml/ui/FolderListPage.qml 2014-07-15 20:29:29 +0000
273@@ -37,6 +37,11 @@
274 property string folder
275 property bool loading: pageModel.awaitingResults
276
277+ // Set to true if called as file selector for ContentHub
278+ property bool fileSelectorMode: false
279+
280+ property FolderListSelection selectionManager: pageModel.selectionObject()
281+
282 onShowHiddenFilesChanged: {
283 pageModel.showHiddenFiles = folderListPage.showHiddenFiles
284 }
285@@ -343,6 +348,49 @@
286 expanded: showSidebar
287 }
288
289+ Item {
290+ id: bottomBar
291+ anchors {
292+ bottom: parent.bottom
293+ left: sidebar.right
294+ right: parent.right
295+ }
296+ height: fileSelectorMode ? bottomBarFileSelectorButtons.height : 0
297+ visible: fileSelectorMode
298+
299+ }
300+
301+ Row {
302+ id: bottomBarFileSelectorButtons
303+ anchors.horizontalCenter: parent.horizontalCenter
304+ anchors.bottom: bottomBar.bottom
305+ spacing: units.gu(5)
306+ visible: fileSelectorMode
307+
308+ Button {
309+ text: i18n.tr("Select")
310+ enabled: selectionManager.counter > 0
311+ onClicked: {
312+ var selectedAbsPaths = selectionManager.selectedAbsFilePaths();
313+ // For now support only selection in filesystem
314+ var selectedAbsUrls = selectedAbsPaths.map(function(item) {
315+ return "file://" + item;
316+ });
317+ console.log("FileSelector OK clicked, selected items: " + selectedAbsUrls)
318+
319+ acceptFileSelector(selectedAbsUrls)
320+ }
321+ }
322+ Button {
323+ text: i18n.tr("Cancel")
324+ onClicked: {
325+ console.log("FileSelector cancelled")
326+ cancelFileSelector()
327+ }
328+ }
329+ }
330+
331+
332 FolderIconView {
333 id: folderIconView
334
335@@ -352,6 +400,7 @@
336 anchors {
337 top: parent.top
338 bottom: parent.bottom
339+ bottomMargin: bottomBar.height
340 left: sidebar.right
341 right: parent.right
342 }
343@@ -368,6 +417,7 @@
344 anchors {
345 top: parent.top
346 bottom: parent.bottom
347+ bottomMargin: bottomBar.height
348 left: sidebar.right
349 right: parent.right
350 }
351@@ -676,7 +726,13 @@
352 }
353 } else {
354 console.log("Non dir clicked")
355- openFile(model.fileName)
356+ if (fileSelectorMode) {
357+ selectionManager.select(model.index,
358+ false,
359+ true);
360+ } else {
361+ openFile(model.fileName)
362+ }
363 // PopupUtils.open(Qt.resolvedUrl("FileActionDialog.qml"), root,
364 // {
365 // fileName: model.fileName,
366
367=== added file 'ubuntu-filemanager-app.json'
368--- ubuntu-filemanager-app.json 1970-01-01 00:00:00 +0000
369+++ ubuntu-filemanager-app.json 2014-07-15 20:29:29 +0000
370@@ -0,0 +1,8 @@
371+{
372+ "policy_groups": [
373+ "networking",
374+ "content_exchange_source",
375+ "content_exchange"
376+ ],
377+ "policy_version": 1
378+}

Subscribers

People subscribed via source and target branches