Merge lp:~nikwen/ubuntu-filemanager-app/zips into lp:ubuntu-filemanager-app

Proposed by Niklas Wenzel
Status: Merged
Approved by: Arto Jalkanen
Approved revision: 320
Merged at revision: 333
Proposed branch: lp:~nikwen/ubuntu-filemanager-app/zips
Merge into: lp:ubuntu-filemanager-app
Diff against target: 733 lines (+432/-44)
11 files modified
debian/control (+11/-0)
debian/qtdeclarative5-archives0.1.install (+1/-0)
po/com.ubuntu.filemanager.pot (+75/-44)
src/app/qml/ui/FolderListPage.qml (+133/-0)
src/plugin/CMakeLists.txt (+1/-0)
src/plugin/archives/CMakeLists.txt (+35/-0)
src/plugin/archives/archives.cpp (+57/-0)
src/plugin/archives/archives.h (+44/-0)
src/plugin/archives/archives_plugin.cpp (+34/-0)
src/plugin/archives/archives_plugin.h (+39/-0)
src/plugin/archives/qmldir (+2/-0)
To merge this branch: bzr merge lp:~nikwen/ubuntu-filemanager-app/zips
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs (community) Needs Fixing
Niklas Wenzel (community) Approve
Carlos Jose Mazieri Approve
Arto Jalkanen Approve
Review via email: mp+239662@code.launchpad.net

Commit message

Add the ability to extract zip files. Like the ubuntu-download-manager this uses the unzip command line tool to extract the archives (http://bazaar.launchpad.net/~phablet-team/ubuntu-download-manager/trunk/revision/325).

Description of the change

Add the ability to extract zip files. Like the ubuntu-download-manager this uses the unzip command line tool to extract the archives (http://bazaar.launchpad.net/~phablet-team/ubuntu-download-manager/trunk/revision/325).

To post a comment you must log in.
Revision history for this message
Niklas Wenzel (nikwen) wrote :

This one should contain all new files now. :)

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

I have freshly updated image (r299) and I don't have unzip on my phone. So I can't say this or that to this merge request for now, perhaps it's coming in a later image?

Other than that, I'm just pondering... might it be more logical to have an Archiver application, that would register itself for Content-Hub for archives. Then clicking on a zip/tar/tar.gz file could have as target the Archiver where you could extract it. That way archives could be handled from other apps also not just from File Manager. I'm not sure how well Content-Hub is suited for such scenario, so this is just me thinking aloud.

review: Needs Information
Revision history for this message
Carlos Jose Mazieri (carlos-mazieri) wrote :

Hello guys,

How about having all open files stuff available to all applications not only for file manager?

It could be part of Content-Hub or a separated module, as Qt provides Qt::openUrlExternally() we would have something similar as Ubuntu API, so all applications can open files just calling one method.

review: Needs Information
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

unzip landed in the rtm image back on 16th Oct. See http://people.canonical.com/~ogra/touch-image-stats/rtm/112.changes

I'd recommend re-flashing (without wiping) your device using the "ubuntu-touch/ubuntu-rtm/14.09-proposed" channel.

Something like this should do it:-

ubuntu-device-flash --channel=ubuntu-touch/ubuntu-rtm/14.09-proposed

As an aside I'll find out why it didn't land in devel-proposed.

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

With Alan Pope's instructions I got this branch working. Thanks a lot for the good work!

Is it possible to add a "cancel" button to the dialog where it's extracting files? Doing a call on external programs there's always a chance that things get stuck for a variety of reasons. Being able to cancel the operation in such situations is much preferable compared to user having to kill whole FileManager and starting anew.

But if the above suggestion is too much work for this merge proposal, I'll happily approve the current one. It's a great feature.

The image contains many more possibilities for extracting files, containing at least tar, gunzip and bzip2. After this commit lands to trunk I will file bugs to add support for more supported archives. If you can work on those too that'd be just great.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thank you very much for reviewing this.
A cancel button looks like a good addition. I won't be able to look into this before the weekend but then I'll finally do it. I'll check how easy aborting a QProccess is.
I planned to enable extracting for more archive types anyway but I first wanted to make sure this one gets merged. Expect me to do some work on that matter. ;)

Some time ago, I looked into building an archiver application to push to the store as well but that proved to be fairly difficult as running commands like "unzip" or "tar" requires the application to run unconfined. One would therefore have to write a wrapper for respective Qt libraries so adding this functionality to the file manager seemed to be easier.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Just found a close() function so it should be possible: http://qt-project.org/doc/qt-5/qprocess.html#close

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

> Just found a close() function so it should be possible: http://qt-
> project.org/doc/qt-5/qprocess.html#close

Great! If you can try to include that cancel into this merge request, that would be awesome. If it's not straightforward and requires more time then do comment and we'll merge this as it is, and you can continue on another branch on the cancel button.

Regarding the Content-Hub stuff me and Carlos were talking about. I think that would be better, but since it's not clear how well Content-Hub is suited for this kind of stuff it's probably best to leave for future to ponder about.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Hi, I'm sorry to say that but I didn't have the time to work on the cancel button (well, to do any coding) this weekend. I'll try to do it as soon as possible but I'll probably not be able to do it before next weekend.

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

> Hi, I'm sorry to say that but I didn't have the time to work on the cancel
> button (well, to do any coding) this weekend. I'll try to do it as soon as
> possible but I'll probably not be able to do it before next weekend.

Thanks for the heads-up! Let's approve this change, and when you have time to work on the cancel button that would be a great improvement.

Thank you!

review: Approve
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thanks for approving this. I will for sure look into adding a cancel button and into adding more archive formats like tars as soon as I have time for that. :)

Revision history for this message
Carlos Jose Mazieri (carlos-mazieri) wrote :

OK. Let's release one more improvement to the filemanager.

review: Approve
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/~nikwen/ubuntu-filemanager-app/zips/+merge/239662/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Rerun autolanding

review: Approve
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Hm, the comment above says the following: "You can approve the merge proposal yourself to rerun."
However, autolanding hasn't been rerun yet. Does anyone know how to trigger that properly?

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

Needs top-level approve I think to rerun the tests. Done, let's see what happens.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ah, thanks for doing this. I've never contributed code to the core apps before so I didn't know that.
Did I break the tests with my changes or have they been broken before as well?

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

Can someone with autopilot/Jenkins test experience help with that? It seems like a newQML plugin "Archives" is not detected when running Jenkins. It's nevertheless built without problems locally.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

@ajalkane: Would you mind retriggering the tests by doing another top-level approve? I don't seem to have the rights to do this.
The reason why I didn't look into this earlier was that I didn't find the test logs before...

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Oh, sorry. I forgot to add a file. I'll add it now.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

There you go. ;)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ah, great. At least that worked now. Still two tests to fix though. I'll look into them later. ;)

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Does anyone know what was wrong with the tests? I've never done automatic testing before and haven't managed to get the tests to run on my device. Anyone who could help me with that?
I just merged trunk as well. Maybe that will fix the tests. Would require another top-level approve to run them again though...

Thank you for your patience. :)

Revision history for this message
Arto Jalkanen (ajalkane) wrote :
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Looks like the test failures show 'cut'-ing a file brings up the extract archive prompt, which it shouldn't.

review: Needs Fixing
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I would also like to see some tests added to support this new functionality. Ideally the tests would extract and verify a zip, but at least running through the menu options would be good.

review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ah, thank you very much for looking into this. That's something which I should be able to fix and I think I know why it happens. There is some strange behaviour regarding the visible attribute of an Action in an ActionList. Let me have a look at it this weekend. ;)

Regarding tests for archive extraction: I've never worked with autopilot before and, sadly, I don't have enough time to learn about automatic testing at the moment. (I'd love to do so much more coding but I can't...)
So if you really need them, someone else will have to do it for now.

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

> Ah, thank you very much for looking into this. That's something which I should
> be able to fix and I think I know why it happens. There is some strange
> behaviour regarding the visible attribute of an Action in an ActionList. Let
> me have a look at it this weekend. ;)

Thanks!

> Regarding tests for archive extraction: I've never worked with autopilot
> before and, sadly, I don't have enough time to learn about automatic testing
> at the moment. (I'd love to do so much more coding but I can't...)
> So if you really need them, someone else will have to do it for now.

That's understandable. If you can fix it so that existing tests run, maybe we can file a bug about the missing test cases for later implementation if that's okay with all parties?

Revision history for this message
Niklas Wenzel (nikwen) wrote :

I think my latest commit should fix the issue for now. It's actually a workaround since the bug is in the code for the ActionSelectionPopover. It doesn't set the visible property of the list items to false according to the visible property of the Action.
I'll file a bug and submit a merge proposal to upstream tomorrow. Please don't approve that change until then so that I can add the issue and MP links to the comment in the code. ;)

Thanks. :)

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Can you link the bug you worked around in source please?

Revision history for this message
Niklas Wenzel (nikwen) wrote :

> Can you link the bug you worked around in source please?

That's exactly what I wanted to do. I just filed the bug report, created a merge proposal for the UI Toolkit and adjusted the comment (as well as the workaround code so that it's like in the other MP).
Could someone please do a top-level approve again to see whether it passes the tests? I think it will.
Thanks to all of you for your help and patience. :)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
320. By Niklas Wenzel

Fixed variable name

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ah, sorry. I forgot to change a variable name when copying the workaround code into the filemanager code.

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
Niklas Wenzel (nikwen) wrote :

Thanks for approving it again. I'm glad it finally passed the tests.
Why is its status still "Needs review"? May I change it to "Approved"? (I do now have the ability to do that for some reason.)

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ah, I know why I am able to approve this now if I want to. For some reason I was added to the "Ubuntu Core Apps Test Writers" team which makes me an indirect member of the file manager app team.
Nicholas, would you mind telling me why I was added to that team (not that I want to leave it :p)?

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Niklas I added you to the team so jenkins would automatically build things for you. You've helped out in several core apps, it makes sense to have jenkins autorun on your mp's :-)

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thank you very much, Nicholas. I really appreciate it. :)

My other question still remains though: Is there still anything missing to get this merged? Or will it be done automatically later?

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

> My other question still remains though: Is there still anything missing to get
> this merged?

Nope, I will try top-approving again and it should get merged if there's no issues.

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

> My other question still remains though: Is there still anything missing to get
> this merged?

Nope, I will try top-approving again and it should get merged if there's no issues.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ok, great. So it was finally merged. :)
I'll file issues for missing features in the extraction process (like the cancel button or other archive types) tomorrow and assign as many as I can deal with to me.

Thank you very, very much. :)

Revision history for this message
Arto Jalkanen (ajalkane) wrote :

No, thank you very much for your great contributions to make File Manager better! I'm very happy that this gets now merged.

Hopeful to see more contributions when you have the time, and it's a big help even if it's filing bug reports as then we have something concrete to track on!

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Ok, I didn't have the time today to file those bugs but I will definitely do that as soon as possible.
For now, there's the MP for extracting tar archives. ;)
https://code.launchpad.net/~nikwen/ubuntu-filemanager-app/tars/+merge/240986

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-09-04 02:37:45 +0000
+++ debian/control 2014-11-23 14:40:50 +0000
@@ -24,6 +24,7 @@
24 qtdeclarative5-nemo-qml-plugin-folderlistmodel,24 qtdeclarative5-nemo-qml-plugin-folderlistmodel,
25 qtdeclarative5-placesmodel0.1,25 qtdeclarative5-placesmodel0.1,
26 qtdeclarative5-pamauthentication0.1,26 qtdeclarative5-pamauthentication0.1,
27 qtdeclarative5-archives0.1,
27 qtdeclarative5-qtquick2-plugin,28 qtdeclarative5-qtquick2-plugin,
28 qtdeclarative5-u1db1.0,29 qtdeclarative5-u1db1.0,
29 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,30 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
@@ -64,6 +65,16 @@
64 This package contains a plugin that enables QML apps to do65 This package contains a plugin that enables QML apps to do
65 password authentication via the PAM API.66 password authentication via the PAM API.
6667
68Package: qtdeclarative5-archives0.1
69Architecture: any
70Multi-Arch: same
71Depends: ${misc:Depends},
72 ${shlibs:Depends},
73 ${misc:Pre-Depends},
74Description: Archives QML plugin
75 This package contains a plugin that enables QML apps to extract
76 archive files.
77
67Package: ubuntu-filemanager-app-autopilot78Package: ubuntu-filemanager-app-autopilot
68Architecture: all79Architecture: all
69Depends: ${misc:Depends},80Depends: ${misc:Depends},
7081
=== added file 'debian/qtdeclarative5-archives0.1.install'
--- debian/qtdeclarative5-archives0.1.install 1970-01-01 00:00:00 +0000
+++ debian/qtdeclarative5-archives0.1.install 2014-11-23 14:40:50 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/qt5/qml/com/ubuntu/Archives/
02
=== modified file 'po/com.ubuntu.filemanager.pot'
--- po/com.ubuntu.filemanager.pot 2014-11-19 21:03:49 +0000
+++ po/com.ubuntu.filemanager.pot 2014-11-23 14:40:50 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: \n"9"Project-Id-Version: \n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-11-19 21:32+0100\n"11"POT-Creation-Date: 2014-11-23 15:38+0100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -31,7 +31,7 @@
31msgstr ""31msgstr ""
3232
33#: ../src/app/qml/components/PathHistoryRow.qml:8433#: ../src/app/qml/components/PathHistoryRow.qml:84
34#: ../src/app/qml/ui/FolderListPage.qml:62034#: ../src/app/qml/ui/FolderListPage.qml:753
35msgid "Device"35msgid "Device"
36msgstr ""36msgstr ""
3737
@@ -44,7 +44,7 @@
44msgid "Open with"44msgid "Open with"
45msgstr ""45msgstr ""
4646
47#: ../src/app/qml/filemanager.qml:81 ../src/app/qml/ui/FolderListPage.qml:10247#: ../src/app/qml/filemanager.qml:81 ../src/app/qml/ui/FolderListPage.qml:103
48#: ../src/app/qml/ui/SettingsSheet.qml:3148#: ../src/app/qml/ui/SettingsSheet.qml:31
49msgid "Settings"49msgid "Settings"
50msgstr ""50msgstr ""
@@ -53,12 +53,12 @@
53msgid "Change app settings"53msgid "Change app settings"
54msgstr ""54msgstr ""
5555
56#: ../src/app/qml/filemanager.qml:259 ../src/app/qml/ui/FolderListPage.qml:35256#: ../src/app/qml/filemanager.qml:259 ../src/app/qml/ui/FolderListPage.qml:353
57#: ../src/app/qml/ui/ViewPopover.qml:7057#: ../src/app/qml/ui/ViewPopover.qml:70
58msgid "Icons"58msgid "Icons"
59msgstr ""59msgstr ""
6060
61#: ../src/app/qml/filemanager.qml:259 ../src/app/qml/ui/FolderListPage.qml:36861#: ../src/app/qml/filemanager.qml:259 ../src/app/qml/ui/FolderListPage.qml:369
62#: ../src/app/qml/ui/ViewPopover.qml:7162#: ../src/app/qml/ui/ViewPopover.qml:71
63msgid "List"63msgid "List"
64msgstr ""64msgstr ""
@@ -87,7 +87,7 @@
87#: ../src/app/qml/ui/ConfirmDialogWithInput.qml:5787#: ../src/app/qml/ui/ConfirmDialogWithInput.qml:57
88#: ../src/app/qml/ui/FileActionDialog.qml:4588#: ../src/app/qml/ui/FileActionDialog.qml:45
89#: ../src/app/qml/ui/FileOperationProgressDialog.qml:4489#: ../src/app/qml/ui/FileOperationProgressDialog.qml:44
90#: ../src/app/qml/ui/FolderListPage.qml:33090#: ../src/app/qml/ui/FolderListPage.qml:331
91#: ../src/app/qml/ui/GoToDialog.qml:6691#: ../src/app/qml/ui/GoToDialog.qml:66
92msgid "Cancel"92msgid "Cancel"
93msgstr ""93msgstr ""
@@ -149,151 +149,182 @@
149msgid "File operation"149msgid "File operation"
150msgstr ""150msgstr ""
151151
152#: ../src/app/qml/ui/FolderListPage.qml:52152#: ../src/app/qml/ui/FolderListPage.qml:53
153#, qt-format153#, qt-format
154msgid "Paste %1 File"154msgid "Paste %1 File"
155msgid_plural "Paste %1 Files"155msgid_plural "Paste %1 Files"
156msgstr[0] ""156msgstr[0] ""
157msgstr[1] ""157msgstr[1] ""
158158
159#: ../src/app/qml/ui/FolderListPage.qml:56159#: ../src/app/qml/ui/FolderListPage.qml:57
160msgid "Paste files"160msgid "Paste files"
161msgstr ""161msgstr ""
162162
163#: ../src/app/qml/ui/FolderListPage.qml:64163#: ../src/app/qml/ui/FolderListPage.qml:65
164msgid "Clear clipboard"164msgid "Clear clipboard"
165msgstr ""165msgstr ""
166166
167#: ../src/app/qml/ui/FolderListPage.qml:74167#: ../src/app/qml/ui/FolderListPage.qml:75
168#: ../src/app/qml/ui/FolderListPage.qml:92168#: ../src/app/qml/ui/FolderListPage.qml:93
169#: ../src/app/qml/ui/FolderListPage.qml:511169#: ../src/app/qml/ui/FolderListPage.qml:589
170msgid "Properties"170msgid "Properties"
171msgstr ""171msgstr ""
172172
173#: ../src/app/qml/ui/FolderListPage.qml:83173#: ../src/app/qml/ui/FolderListPage.qml:84
174msgid "New Folder"174msgid "New Folder"
175msgstr ""175msgstr ""
176176
177#: ../src/app/qml/ui/FolderListPage.qml:109177#: ../src/app/qml/ui/FolderListPage.qml:110
178msgid "Go To"178msgid "Go To"
179msgstr ""179msgstr ""
180180
181#: ../src/app/qml/ui/FolderListPage.qml:116181#: ../src/app/qml/ui/FolderListPage.qml:117
182msgid "Unlock full access"182msgid "Unlock full access"
183msgstr ""183msgstr ""
184184
185#: ../src/app/qml/ui/FolderListPage.qml:130185#: ../src/app/qml/ui/FolderListPage.qml:131
186msgid "Authentication failed"186msgid "Authentication failed"
187msgstr ""187msgstr ""
188188
189#: ../src/app/qml/ui/FolderListPage.qml:202189#: ../src/app/qml/ui/FolderListPage.qml:203
190#, qt-format190#, qt-format
191msgid "%1 file"191msgid "%1 file"
192msgid_plural "%1 files"192msgid_plural "%1 files"
193msgstr[0] ""193msgstr[0] ""
194msgstr[1] ""194msgstr[1] ""
195195
196#: ../src/app/qml/ui/FolderListPage.qml:227196#: ../src/app/qml/ui/FolderListPage.qml:228
197msgid "Open in a new tab"197msgid "Open in a new tab"
198msgstr ""198msgstr ""
199199
200#: ../src/app/qml/ui/FolderListPage.qml:235200#: ../src/app/qml/ui/FolderListPage.qml:236
201msgid "Close this tab"201msgid "Close this tab"
202msgstr ""202msgstr ""
203203
204#: ../src/app/qml/ui/FolderListPage.qml:248204#: ../src/app/qml/ui/FolderListPage.qml:249
205msgid "Create folder"205msgid "Create folder"
206msgstr ""206msgstr ""
207207
208#: ../src/app/qml/ui/FolderListPage.qml:249208#: ../src/app/qml/ui/FolderListPage.qml:250
209msgid "Enter name for new folder"209msgid "Enter name for new folder"
210msgstr ""210msgstr ""
211211
212#: ../src/app/qml/ui/FolderListPage.qml:265212#: ../src/app/qml/ui/FolderListPage.qml:266
213msgid "Create file"213msgid "Create file"
214msgstr ""214msgstr ""
215215
216#: ../src/app/qml/ui/FolderListPage.qml:266216#: ../src/app/qml/ui/FolderListPage.qml:267
217msgid "Enter name for new file"217msgid "Enter name for new file"
218msgstr ""218msgstr ""
219219
220#: ../src/app/qml/ui/FolderListPage.qml:315220#: ../src/app/qml/ui/FolderListPage.qml:316
221msgid "Select"221msgid "Select"
222msgstr ""222msgstr ""
223223
224#: ../src/app/qml/ui/FolderListPage.qml:383224#: ../src/app/qml/ui/FolderListPage.qml:384
225msgid "No files"225msgid "No files"
226msgstr ""226msgstr ""
227227
228#: ../src/app/qml/ui/FolderListPage.qml:403228#: ../src/app/qml/ui/FolderListPage.qml:404
229#: ../src/app/qml/ui/FolderListPage.qml:485229#: ../src/app/qml/ui/FolderListPage.qml:551
230msgid "Delete"230msgid "Delete"
231msgstr ""231msgstr ""
232232
233#: ../src/app/qml/ui/FolderListPage.qml:404233#: ../src/app/qml/ui/FolderListPage.qml:405
234#, qt-format234#, qt-format
235msgid "Are you sure you want to permanently delete '%1'?"235msgid "Are you sure you want to permanently delete '%1'?"
236msgstr ""236msgstr ""
237237
238#: ../src/app/qml/ui/FolderListPage.qml:409238#: ../src/app/qml/ui/FolderListPage.qml:410
239msgid "Deleting files"239msgid "Deleting files"
240msgstr ""240msgstr ""
241241
242#: ../src/app/qml/ui/FolderListPage.qml:427242#: ../src/app/qml/ui/FolderListPage.qml:428
243#: ../src/app/qml/ui/FolderListPage.qml:498243#: ../src/app/qml/ui/FolderListPage.qml:564
244msgid "Rename"244msgid "Rename"
245msgstr ""245msgstr ""
246246
247#: ../src/app/qml/ui/FolderListPage.qml:428247#: ../src/app/qml/ui/FolderListPage.qml:429
248msgid "Enter a new name"248msgid "Enter a new name"
249msgstr ""249msgstr ""
250250
251#: ../src/app/qml/ui/FolderListPage.qml:437251#: ../src/app/qml/ui/FolderListPage.qml:438
252msgid "Could not rename"252msgid "Could not rename"
253msgstr ""253msgstr ""
254254
255#: ../src/app/qml/ui/FolderListPage.qml:438255#: ../src/app/qml/ui/FolderListPage.qml:439
256msgid "Insufficient permissions or name already exists?"256msgid "Insufficient permissions or name already exists?"
257msgstr ""257msgstr ""
258258
259#: ../src/app/qml/ui/FolderListPage.qml:462259#: ../src/app/qml/ui/FolderListPage.qml:456
260msgid "Extract Archive"
261msgstr ""
262
263#: ../src/app/qml/ui/FolderListPage.qml:457
264#, qt-format
265msgid "Are you sure you want to extract '%1' here?"
266msgstr ""
267
268#: ../src/app/qml/ui/FolderListPage.qml:528
260msgid "Cut"269msgid "Cut"
261msgstr ""270msgstr ""
262271
263#: ../src/app/qml/ui/FolderListPage.qml:473272#: ../src/app/qml/ui/FolderListPage.qml:539
264msgid "Copy"273msgid "Copy"
265msgstr ""274msgstr ""
266275
267#: ../src/app/qml/ui/FolderListPage.qml:531276#: ../src/app/qml/ui/FolderListPage.qml:579
277msgid "Extract archive"
278msgstr ""
279
280#: ../src/app/qml/ui/FolderListPage.qml:609
268msgid "File operation error"281msgid "File operation error"
269msgstr ""282msgstr ""
270283
271#: ../src/app/qml/ui/FolderListPage.qml:591284#: ../src/app/qml/ui/FolderListPage.qml:640
285#, qt-format
286msgid "Extracting archive '%1'"
287msgstr ""
288
289#: ../src/app/qml/ui/FolderListPage.qml:652
290msgid "OK"
291msgstr ""
292
293#: ../src/app/qml/ui/FolderListPage.qml:666
294msgid "Extracting failed"
295msgstr ""
296
297#: ../src/app/qml/ui/FolderListPage.qml:667
298#, qt-format
299msgid "Extracting the archive '%1' failed."
300msgstr ""
301
302#: ../src/app/qml/ui/FolderListPage.qml:724
272msgid "~/Desktop"303msgid "~/Desktop"
273msgstr ""304msgstr ""
274305
275#: ../src/app/qml/ui/FolderListPage.qml:601306#: ../src/app/qml/ui/FolderListPage.qml:734
276msgid "~/Public"307msgid "~/Public"
277msgstr ""308msgstr ""
278309
279#: ../src/app/qml/ui/FolderListPage.qml:603310#: ../src/app/qml/ui/FolderListPage.qml:736
280msgid "~/Programs"311msgid "~/Programs"
281msgstr ""312msgstr ""
282313
283#: ../src/app/qml/ui/FolderListPage.qml:605314#: ../src/app/qml/ui/FolderListPage.qml:738
284msgid "~/Templates"315msgid "~/Templates"
285msgstr ""316msgstr ""
286317
287#: ../src/app/qml/ui/FolderListPage.qml:618318#: ../src/app/qml/ui/FolderListPage.qml:751
288msgid "Home"319msgid "Home"
289msgstr ""320msgstr ""
290321
291#: ../src/app/qml/ui/FolderListPage.qml:688322#: ../src/app/qml/ui/FolderListPage.qml:821
292msgid "Folder not accessible"323msgid "Folder not accessible"
293msgstr ""324msgstr ""
294325
295#. TRANSLATORS: this refers to a folder name326#. TRANSLATORS: this refers to a folder name
296#: ../src/app/qml/ui/FolderListPage.qml:690327#: ../src/app/qml/ui/FolderListPage.qml:823
297#, qt-format328#, qt-format
298msgid "Can not access %1"329msgid "Can not access %1"
299msgstr ""330msgstr ""
300331
=== modified file 'src/app/qml/ui/FolderListPage.qml'
--- src/app/qml/ui/FolderListPage.qml 2014-11-01 23:44:58 +0000
+++ src/app/qml/ui/FolderListPage.qml 2014-11-23 14:40:50 +0000
@@ -21,6 +21,7 @@
21import Ubuntu.Components.ListItems 1.021import Ubuntu.Components.ListItems 1.0
22import org.nemomobile.folderlistmodel 1.022import org.nemomobile.folderlistmodel 1.0
23import com.ubuntu.PlacesModel 0.123import com.ubuntu.PlacesModel 0.1
24import com.ubuntu.Archives 0.1
24import "../components"25import "../components"
25import "../upstream"26import "../upstream"
2627
@@ -448,6 +449,45 @@
448 }449 }
449450
450 Component {451 Component {
452 id: confirmExtractDialog
453 ConfirmDialog {
454 property string filePath
455 property string fileName
456 title: i18n.tr("Extract Archive")
457 text: i18n.tr("Are you sure you want to extract '%1' here?").arg(fileName)
458
459 onAccepted: {
460 console.log("Extract accepted for filePath, fileName", filePath, fileName)
461 PopupUtils.open(extractingDialog, mainView, { "fileName" : fileName })
462 console.log("Extracting...")
463
464 var parentDirectory = filePath.substring(0, filePath.lastIndexOf("/"))
465 var fileNameWithoutExtension = fileName.substring(0, fileName.lastIndexOf("."))
466 var extractDirectory = parentDirectory + "/" + fileNameWithoutExtension
467
468 // Add numbers if the directory already exist: myfile, myfile-1, myfile-2, etc.
469 while (pageModel.existsDir(extractDirectory)) {
470 var i = 0
471 while ("1234567890".indexOf(extractDirectory.charAt(extractDirectory.length - i - 1)) !== -1) {
472 i++
473 }
474 if (i === 0 || extractDirectory.charAt(extractDirectory.length - i - 1) !== "-") {
475 extractDirectory += "-1"
476 } else {
477 extractDirectory = extractDirectory.substring(0, extractDirectory.lastIndexOf("-") + 1) + (parseInt(extractDirectory.substring(extractDirectory.length - i)) + 1)
478 }
479 }
480
481 archives.extractZip(filePath, extractDirectory)
482 }
483 }
484 }
485
486 Archives {
487 id: archives
488 }
489
490 Component {
451 id: actionSelectionPopoverComponent491 id: actionSelectionPopoverComponent
452492
453 ActionSelectionPopover {493 ActionSelectionPopover {
@@ -457,6 +497,32 @@
457 grabDismissAreaEvents: true497 grabDismissAreaEvents: true
458498
459 property var model499 property var model
500
501 property bool isArchive: false
502
503 Component.onCompleted: {
504 var splitName = actionSelectionPopover.model.fileName.split(".")
505 var fileExtension = splitName[splitName.length - 1]
506 isArchive = fileExtension === "zip"
507 }
508
509 delegate: Empty { // NOTE: This is a workaround for LP: #1395118 and should be removed as soon as the patch for upstream gets released (https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1395118)
510 id: listItem
511 Label {
512 text: listItem.text
513 anchors {
514 verticalCenter: parent.verticalCenter
515 horizontalCenter: parent.horizontalCenter
516 }
517 wrapMode: Text.Wrap
518 color: Theme.palette.normal.overlayText
519 }
520 /*! \internal */
521 onTriggered: actionSelectionPopover.hide()
522 visible: enabled && ((action === undefined) || action.visible)
523 height: visible ? implicitHeight : 0
524 }
525
460 actions: ActionList {526 actions: ActionList {
461 Action {527 Action {
462 text: i18n.tr("Cut")528 text: i18n.tr("Cut")
@@ -508,6 +574,18 @@
508 }574 }
509575
510 Action {576 Action {
577 id: extractAction
578 visible: actionSelectionPopover.isArchive
579 text: i18n.tr("Extract archive")
580 onTriggered: {
581 PopupUtils.open(confirmExtractDialog, actionSelectionPopover.caller,
582 { "filePath" : actionSelectionPopover.model.filePath,
583 "fileName" : actionSelectionPopover.model.fileName }
584 )
585 }
586 }
587
588 Action {
511 text: i18n.tr("Properties")589 text: i18n.tr("Properties")
512590
513 onTriggered: {591 onTriggered: {
@@ -539,6 +617,61 @@
539 model: pageModel617 model: pageModel
540 }618 }
541619
620 Component {
621 id: extractingDialog
622
623 Dialog {
624 id: dialog
625 modal: true
626 property string fileName: ""
627
628 Row {
629 id: row
630 width: parent.width
631 spacing: units.gu(2)
632
633 ActivityIndicator {
634 id: loadingSpinner
635 running: true
636 anchors.verticalCenter: parent.verticalCenter
637 }
638
639 Label {
640 text: qsTr(i18n.tr("Extracting archive '%1'")).arg(fileName)
641 color: UbuntuColors.darkGrey
642 anchors.verticalCenter: parent.verticalCenter
643 width: row.width - loadingSpinner.width - row.spacing
644 maximumLineCount: 2
645 wrapMode: Text.WrapAnywhere
646 elide: Text.ElideRight
647 }
648 }
649
650 Button {
651 id: button
652 text: i18n.tr("OK")
653 visible: false
654 onClicked: {
655 PopupUtils.close(dialog)
656 }
657 }
658
659 Connections {
660 target: archives
661 onFinished: {
662 if (success) {
663 PopupUtils.close(dialog)
664 } else {
665 row.visible = false
666 title = i18n.tr("Extracting failed")
667 text = qsTr(i18n.tr("Extracting the archive '%1' failed.")).arg(fileName)
668 button.visible = true
669 }
670 }
671 }
672 }
673 }
674
542 function goTo(location) {675 function goTo(location) {
543 // This allows us to enter "~" as a shortcut to the home folder676 // This allows us to enter "~" as a shortcut to the home folder
544 // when entering a location on the Go To dialog677 // when entering a location on the Go To dialog
545678
=== modified file 'src/plugin/CMakeLists.txt'
--- src/plugin/CMakeLists.txt 2014-08-01 21:02:45 +0000
+++ src/plugin/CMakeLists.txt 2014-11-23 14:40:50 +0000
@@ -7,3 +7,4 @@
7add_subdirectory(folderlistmodel)7add_subdirectory(folderlistmodel)
8add_subdirectory(placesmodel)8add_subdirectory(placesmodel)
9add_subdirectory(pamauthentication)9add_subdirectory(pamauthentication)
10add_subdirectory(archives)
1011
=== added directory 'src/plugin/archives'
=== added file 'src/plugin/archives/CMakeLists.txt'
--- src/plugin/archives/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/plugin/archives/CMakeLists.txt 2014-11-23 14:40:50 +0000
@@ -0,0 +1,35 @@
1include_directories(
2 ${CMAKE_CURRENT_SOURCE_DIR}
3)
4
5set(PLUGIN_DIR com/ubuntu/Archives)
6
7set(archives_SRCS
8 archives.cpp
9 archives.h
10 archives_plugin.cpp
11 archives_plugin.h
12)
13
14add_library(Archives MODULE
15 ${archives_SRCS}
16)
17
18qt5_use_modules(Archives Gui Qml Quick Widgets)
19
20# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator
21if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
22 add_custom_command(TARGET Archives POST_BUILD
23 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
24 COMMENT "Creating plugin directory layout in the build directory"
25 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
26 COMMENT "Copying the qmldir file to the build directory"
27 COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:Archives> ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
28 COMMENT "Copying the plugin binary to the build directory"
29 )
30endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
31
32# Install plugin file
33install(TARGETS Archives DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR})
34install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR})
35
036
=== added file 'src/plugin/archives/archives.cpp'
--- src/plugin/archives/archives.cpp 1970-01-01 00:00:00 +0000
+++ src/plugin/archives/archives.cpp 2014-11-23 14:40:50 +0000
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author : Niklas Wenzel <nikwen.developer@gmail.com>
17 */
18
19#include "archives.h"
20#include "QDebug"
21
22void Archives::extractZip(const QString path, const QString destination)
23{
24 if (_process != nullptr && _process->state() == QProcess::ProcessState::Running) {
25 return; // Do not allow two extractions running in parallel. Due to the way this is used in QML parallelization is not needed.
26 }
27
28 QString program = "unzip"; // This programm is available in the images as it is one of the dependencies of the ubuntu-download-manager package.
29 QStringList arguments;
30 arguments << path << "-d" << destination;
31
32 _process = new QProcess(this);
33
34 // Connect to internal slots in order to have one unified onFinished slot handling both events for QML.
35 connect(_process,
36 static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>
37 (&QProcess::finished), this, &Archives::_onFinished);
38 connect(_process,
39 static_cast<void(QProcess::*)(QProcess::ProcessError)>
40 (&QProcess::error), this, &Archives::_onError);
41
42 _process->start(program, arguments);
43}
44
45void Archives::_onError(QProcess::ProcessError error)
46{
47 emit finished(false, error);
48}
49
50void Archives::_onFinished(int exitCode, QProcess::ExitStatus exitStatus)
51{
52 if ((exitStatus == QProcess::NormalExit || exitCode == 0) && _process->readAllStandardError().isEmpty()) {
53 emit finished(true, -1);
54 } else {
55 emit finished(false, -1);
56 }
57}
058
=== added file 'src/plugin/archives/archives.h'
--- src/plugin/archives/archives.h 1970-01-01 00:00:00 +0000
+++ src/plugin/archives/archives.h 2014-11-23 14:40:50 +0000
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author : Niklas Wenzel <nikwen.developer@gmail.com>
17 */
18
19#ifndef ARCHIVES_H
20#define ARCHIVES_H
21
22#include <QObject>
23#include <QProcess>
24
25class Archives : public QObject
26{
27 Q_OBJECT
28
29public:
30 Q_INVOKABLE void extractZip(const QString path, const QString destination);
31
32signals:
33 void finished(bool success, int errorCode);
34
35private slots:
36 void _onError(QProcess::ProcessError error);
37 void _onFinished(int exitCode, QProcess::ExitStatus exitStatus);
38
39private:
40 QProcess* _process = nullptr;
41};
42
43
44#endif // ARCHIVES_H
045
=== added file 'src/plugin/archives/archives_plugin.cpp'
--- src/plugin/archives/archives_plugin.cpp 1970-01-01 00:00:00 +0000
+++ src/plugin/archives/archives_plugin.cpp 2014-11-23 14:40:50 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author : Niklas Wenzel <nikwen.developer@gmail.com>
17 */
18
19#include <QtQml>
20#include <QtQml/QQmlContext>
21#include "archives_plugin.h"
22#include "archives.h"
23
24void BackendPlugin::registerTypes(const char *uri)
25{
26 Q_ASSERT(uri == QLatin1String("com.ubuntu.Archives"));
27
28 qmlRegisterType<Archives>(uri, 0, 1, "Archives");
29}
30
31void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
32{
33 QQmlExtensionPlugin::initializeEngine(engine, uri);
34}
035
=== added file 'src/plugin/archives/archives_plugin.h'
--- src/plugin/archives/archives_plugin.h 1970-01-01 00:00:00 +0000
+++ src/plugin/archives/archives_plugin.h 2014-11-23 14:40:50 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author : Niklas Wenzel <nikwen.developer@gmail.com>
17 */
18
19#ifndef ARCHIVES_PLUGIN_H
20#define ARCHIVES_PLUGIN_H
21
22#include <QtQml/QQmlEngine>
23#include <QtQml/QQmlExtensionPlugin>
24
25class BackendPlugin : public QQmlExtensionPlugin
26{
27 Q_OBJECT
28 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29
30public:
31 void registerTypes(const char *uri);
32 void initializeEngine(QQmlEngine *engine, const char *uri);
33};
34#endif // ARCHIVES_PLUGIN_H
35
36
37
38
39
040
=== added file 'src/plugin/archives/qmldir'
--- src/plugin/archives/qmldir 1970-01-01 00:00:00 +0000
+++ src/plugin/archives/qmldir 2014-11-23 14:40:50 +0000
@@ -0,0 +1,2 @@
1module com.ubuntu.Archives
2plugin Archives

Subscribers

People subscribed via source and target branches