Merge lp:~michael-sheldon/content-hub/download-zip-integration into lp:content-hub

Proposed by Michael Sheldon
Status: Merged
Approved by: Ken VanDine
Approved revision: 145
Merged at revision: 153
Proposed branch: lp:~michael-sheldon/content-hub/download-zip-integration
Merge into: lp:content-hub
Diff against target: 66 lines (+26/-2)
2 files modified
src/com/ubuntu/content/detail/transfer.cpp (+24/-2)
src/com/ubuntu/content/detail/transfer.h (+2/-0)
To merge this branch: bzr merge lp:~michael-sheldon/content-hub/download-zip-integration
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ken VanDine Approve
Ubuntu Phablet Team Pending
Review via email: mp+237764@code.launchpad.net

Commit message

Add support for receiving directories of unzipped files from download manager.

Description of the change

Add support for receiving directories of unzipped files from download manager.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 The following MRs are useful for testing this functionality:

https://code.launchpad.net/~michael-sheldon/webbrowser-app/7digital-album-download/+merge/237763
https://code.launchpad.net/~michael-sheldon/ubuntu-download-manager/extract/+merge/237765
https://code.launchpad.net/~charlesk/indicator-transfer/lp-1378941-throttle-download-status-updates/+merge/237683

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * Yes

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
 * Yes, tested on krillin. There was an error message in music-app, but the import completed and worked fine. That's probably a bug in music-app we can investigate separately.

Did CI run pass? If not, please explain why.
 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
 * Yes

review: Approve
144. By Michael Sheldon

Merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
145. By Michael Sheldon

Merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/com/ubuntu/content/detail/transfer.cpp'
2--- src/com/ubuntu/content/detail/transfer.cpp 2014-08-04 17:56:09 +0000
3+++ src/com/ubuntu/content/detail/transfer.cpp 2014-10-14 11:16:12 +0000
4@@ -20,6 +20,7 @@
5 #include "transfer.h"
6 #include "utils.cpp"
7
8+#include <QFileInfo>
9 #include <com/ubuntu/content/hub.h>
10 #include <com/ubuntu/content/store.h>
11 #include <com/ubuntu/content/transfer.h>
12@@ -214,11 +215,32 @@
13 }
14 }
15
16+void cucd::Transfer::AddItemsFromDir(QDir dir) {
17+ QFileInfoList files = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files);
18+ foreach(const QFileInfo &fileInfo, files) {
19+ QString path = fileInfo.absoluteFilePath();
20+ if(fileInfo.isDir()) {
21+ AddItemsFromDir(QDir(path));
22+ } else {
23+ cuc::Item item = cuc::Item{QUrl::fromLocalFile(path).toString()};
24+ d->items.append(QVariant::fromValue(item));
25+ }
26+ }
27+}
28+
29 void cucd::Transfer::DownloadComplete(QString destFilePath)
30 {
31 TRACE() << __PRETTY_FUNCTION__;
32- cuc::Item item = cuc::Item{QUrl::fromLocalFile(destFilePath).toString()};
33- d->items.append(QVariant::fromValue(item));
34+ QFileInfo fileInfo(destFilePath);
35+ if(fileInfo.isDir()) {
36+ // When downloading and deflating zip files, download manager may
37+ // send us the path of the directory that multiple files have been
38+ // unpacked into.
39+ AddItemsFromDir(QDir(destFilePath));
40+ } else {
41+ cuc::Item item = cuc::Item{QUrl::fromLocalFile(destFilePath).toString()};
42+ d->items.append(QVariant::fromValue(item));
43+ }
44 d->state = cuc::Transfer::downloaded;
45 Q_EMIT(StateChanged(d->state));
46 }
47
48=== modified file 'src/com/ubuntu/content/detail/transfer.h'
49--- src/com/ubuntu/content/detail/transfer.h 2014-08-04 17:56:09 +0000
50+++ src/com/ubuntu/content/detail/transfer.h 2014-10-14 11:16:12 +0000
51@@ -20,6 +20,7 @@
52
53 #include <QObject>
54 #include <QStringList>
55+#include <QDir>
56 #include <ubuntu/download_manager/error.h>
57
58 namespace com
59@@ -84,6 +85,7 @@
60 void Download();
61 void DownloadError(Ubuntu::DownloadManager::Error* error);
62 QString ContentType();
63+ void AddItemsFromDir(QDir dir);
64
65 private:
66 struct Private;

Subscribers

People subscribed via source and target branches