Merge lp:~bfiller/gallery-app/gallery-app-share-handler into lp:gallery-app

Proposed by Bill Filler
Status: Merged
Approved by: Bill Filler
Approved revision: 933
Merged at revision: 1008
Proposed branch: lp:~bfiller/gallery-app/gallery-app-share-handler
Merge into: lp:gallery-app
Diff against target: 357 lines (+80/-96)
4 files modified
po/gallery-app.pot (+33/-37)
rc/qml/MediaViewer/MediaViewer.qml (+25/-55)
tests/autopilot/gallery_app/emulators/photo_viewer.py (+9/-4)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+13/-0)
To merge this branch: bzr merge lp:~bfiller/gallery-app/gallery-app-share-handler
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+225355@code.launchpad.net

This proposal supersedes a proposal from 2014-06-20.

Commit message

Switch to using the content-hub for sharing. When selecting the share action, the ContentPeerPicker will be shown with a list of apps that provide sharing.

Description of the change

Switch to using the content-hub for sharing. When selecting the share action, the ContentPeerPicker will be shown with a list of apps that provide sharing.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
932. By Bill Filler

fix import

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
933. By Bill Filler

fix test

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

went through the test plan, all working
Did you perform an exploratory manual test run of the 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/<package-name>) on device or emulator?
yes

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'po/gallery-app.pot'
--- po/gallery-app.pot 2014-05-09 19:52:57 +0000
+++ po/gallery-app.pot 2014-07-02 22:11:28 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: gallery-app\n"9"Project-Id-Version: gallery-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-05-09 16:45-0300\n"11"POT-Creation-Date: 2014-06-05 11:23-0400\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"
@@ -17,7 +17,7 @@
17"Content-Type: text/plain; charset=UTF-8\n"17"Content-Type: text/plain; charset=UTF-8\n"
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1919
20#: desktop/gallery-app.desktop.in:3 rc/qml/MediaViewer/PopupPhotoViewer.qml:6520#: desktop/gallery-app.desktop.in:3 rc/qml/MediaViewer/PopupPhotoViewer.qml:64
21msgid "Gallery"21msgid "Gallery"
22msgstr ""22msgstr ""
2323
@@ -34,16 +34,16 @@
34msgstr ""34msgstr ""
3535
36#: rc/qml/AlbumEditor/AlbumEditMenu.qml:5036#: rc/qml/AlbumEditor/AlbumEditMenu.qml:50
37#: rc/qml/AlbumViewer/AlbumViewer.qml:43937#: rc/qml/AlbumViewer/AlbumViewer.qml:438
38#: rc/qml/MediaViewer/MediaViewer.qml:48838#: rc/qml/MediaViewer/MediaViewer.qml:479
39#: rc/qml/MediaViewer/MediaViewer.qml:49439#: rc/qml/MediaViewer/MediaViewer.qml:485
40#: rc/qml/MediaViewer/MediaViewer.qml:548 rc/qml/Utility/EditingHUD.qml:6740#: rc/qml/MediaViewer/MediaViewer.qml:538 rc/qml/Utility/EditingHUD.qml:67
41#: rc/qml/Utility/SelectionToolbarAction.qml:5141#: rc/qml/Utility/SelectionToolbarAction.qml:51
42msgid "Delete"42msgid "Delete"
43msgstr ""43msgstr ""
4444
45#: rc/qml/AlbumEditor/AlbumEditor.qml:4045#: rc/qml/AlbumEditor/AlbumEditor.qml:40
46#: rc/qml/Components/MediaSelector.qml:90 rc/qml/PickerScreen.qml:11446#: rc/qml/Components/MediaSelector.qml:92 rc/qml/PickerScreen.qml:114
47#: rc/qml/Utility/SelectionToolbarAction.qml:6647#: rc/qml/Utility/SelectionToolbarAction.qml:66
48msgid "Cancel"48msgid "Cancel"
49msgstr ""49msgstr ""
@@ -68,42 +68,42 @@
68msgid "Red"68msgid "Red"
69msgstr ""69msgstr ""
7070
71#: rc/qml/AlbumViewer/AlbumViewer.qml:8471#: rc/qml/AlbumViewer/AlbumViewer.qml:90
72msgid "Album"72msgid "Album"
73msgstr ""73msgstr ""
7474
75#: rc/qml/AlbumViewer/AlbumViewer.qml:42875#: rc/qml/AlbumViewer/AlbumViewer.qml:427
76msgid "Add to album"76msgid "Add to album"
77msgstr ""77msgstr ""
7878
79#: rc/qml/AlbumViewer/AlbumViewer.qml:43479#: rc/qml/AlbumViewer/AlbumViewer.qml:433
80#: rc/qml/MediaViewer/MediaViewer.qml:48380#: rc/qml/MediaViewer/MediaViewer.qml:474
81#: rc/qml/MediaViewer/MediaViewer.qml:538 rc/qml/Utility/EditingHUD.qml:7781#: rc/qml/MediaViewer/MediaViewer.qml:528 rc/qml/Utility/EditingHUD.qml:77
82#: rc/qml/Utility/SelectionToolbarAction.qml:4482#: rc/qml/Utility/SelectionToolbarAction.qml:44
83msgid "Add"83msgid "Add"
84msgstr ""84msgstr ""
8585
86#: rc/qml/AlbumViewer/AlbumViewer.qml:44886#: rc/qml/AlbumViewer/AlbumViewer.qml:447
87#: rc/qml/MediaViewer/MediaViewer.qml:51287#: rc/qml/MediaViewer/MediaViewer.qml:502
88#: rc/qml/MediaViewer/MediaViewer.qml:56788#: rc/qml/MediaViewer/MediaViewer.qml:557
89msgid "Back"89msgid "Back"
90msgstr ""90msgstr ""
9191
92#: rc/qml/AlbumsOverview.qml:186 rc/qml/Components/PopupAlbumPicker.qml:9192#: rc/qml/AlbumsOverview.qml:197 rc/qml/Components/PopupAlbumPicker.qml:91
93msgid "Add new album"93msgid "Add new album"
94msgstr ""94msgstr ""
9595
96#: rc/qml/AlbumsOverview.qml:204 rc/qml/Utility/PhotosToolbarActions.qml:4696#: rc/qml/AlbumsOverview.qml:215 rc/qml/Utility/PhotosToolbarActions.qml:46
97msgid "Camera"97msgid "Camera"
98msgstr ""98msgstr ""
9999
100#: rc/qml/Components/DeleteDialog.qml:36100#: rc/qml/Components/DeleteDialog.qml:36
101#: rc/qml/MediaViewer/MediaViewer.qml:297101#: rc/qml/MediaViewer/MediaViewer.qml:288
102msgid "Yes"102msgid "Yes"
103msgstr ""103msgstr ""
104104
105#: rc/qml/Components/DeleteDialog.qml:45105#: rc/qml/Components/DeleteDialog.qml:45
106#: rc/qml/MediaViewer/MediaViewer.qml:308106#: rc/qml/MediaViewer/MediaViewer.qml:299
107msgid "No"107msgid "No"
108msgstr ""108msgstr ""
109109
@@ -115,8 +115,8 @@
115msgid "Delete album + contents"115msgid "Delete album + contents"
116msgstr ""116msgstr ""
117117
118#: rc/qml/Components/MediaSelector.qml:56118#: rc/qml/Components/MediaSelector.qml:59
119#: rc/qml/Components/MediaSelector.qml:78119#: rc/qml/Components/MediaSelector.qml:80
120msgid "Add to Album"120msgid "Add to Album"
121msgstr ""121msgstr ""
122122
@@ -128,21 +128,21 @@
128msgid "Loading…"128msgid "Loading…"
129msgstr ""129msgstr ""
130130
131#: rc/qml/MainScreen.qml:80131#: rc/qml/MainScreen.qml:96
132msgid "Albums"132msgid "Albums"
133msgstr ""133msgstr ""
134134
135#: rc/qml/MainScreen.qml:97 rc/qml/MainScreen.qml:120135#: rc/qml/MainScreen.qml:113 rc/qml/MainScreen.qml:136
136#: rc/qml/PickerScreen.qml:54136#: rc/qml/PickerScreen.qml:54
137msgid "Events"137msgid "Events"
138msgstr ""138msgstr ""
139139
140#: rc/qml/MainScreen.qml:118 rc/qml/MainScreen.qml:162140#: rc/qml/MainScreen.qml:134 rc/qml/MainScreen.qml:178
141#: rc/qml/Utility/PhotosToolbarActions.qml:33141#: rc/qml/Utility/PhotosToolbarActions.qml:33
142msgid "Select"142msgid "Select"
143msgstr ""143msgstr ""
144144
145#: rc/qml/MainScreen.qml:130 rc/qml/MainScreen.qml:164145#: rc/qml/MainScreen.qml:146 rc/qml/MainScreen.qml:180
146#: rc/qml/PickerScreen.qml:74146#: rc/qml/PickerScreen.qml:74
147msgid "Photos"147msgid "Photos"
148msgstr ""148msgstr ""
@@ -172,37 +172,33 @@
172msgid "Revert to original"172msgid "Revert to original"
173msgstr ""173msgstr ""
174174
175#: rc/qml/MediaViewer/MediaViewer.qml:234175#: rc/qml/MediaViewer/MediaViewer.qml:277 rc/qml/PhotosOverview.qml:75
176msgid "Configure Facebook for photo sharing..."
177msgstr ""
178
179#: rc/qml/MediaViewer/MediaViewer.qml:286 rc/qml/PhotosOverview.qml:75
180msgid "Delete a photo"176msgid "Delete a photo"
181msgstr ""177msgstr ""
182178
183#: rc/qml/MediaViewer/MediaViewer.qml:464179#: rc/qml/MediaViewer/MediaViewer.qml:455
184msgid "Edit"180msgid "Edit"
185msgstr ""181msgstr ""
186182
187#: rc/qml/MediaViewer/MediaViewer.qml:475183#: rc/qml/MediaViewer/MediaViewer.qml:466
188msgid "Add photo to album"184msgid "Add photo to album"
189msgstr ""185msgstr ""
190186
191#: rc/qml/MediaViewer/MediaViewer.qml:501187#: rc/qml/MediaViewer/MediaViewer.qml:492
192msgid "Share photo"188msgid "Share photo"
193msgstr ""189msgstr ""
194190
195#: rc/qml/MediaViewer/MediaViewer.qml:507191#: rc/qml/MediaViewer/MediaViewer.qml:498
196#: rc/qml/MediaViewer/MediaViewer.qml:558 rc/qml/Utility/EditingHUD.qml:72192#: rc/qml/MediaViewer/MediaViewer.qml:548 rc/qml/Utility/EditingHUD.qml:72
197#: rc/qml/Utility/SelectionToolbarAction.qml:58193#: rc/qml/Utility/SelectionToolbarAction.qml:58
198msgid "Share"194msgid "Share"
199msgstr ""195msgstr ""
200196
201#: rc/qml/MediaViewer/MediaViewer.qml:525197#: rc/qml/MediaViewer/MediaViewer.qml:515
202msgid "Pause"198msgid "Pause"
203msgstr ""199msgstr ""
204200
205#: rc/qml/MediaViewer/MediaViewer.qml:525201#: rc/qml/MediaViewer/MediaViewer.qml:515
206msgid "Play"202msgid "Play"
207msgstr ""203msgstr ""
208204
209205
=== modified file 'rc/qml/MediaViewer/MediaViewer.qml'
--- rc/qml/MediaViewer/MediaViewer.qml 2014-06-17 03:23:39 +0000
+++ rc/qml/MediaViewer/MediaViewer.qml 2014-07-02 22:11:28 +0000
@@ -23,7 +23,7 @@
23import Ubuntu.Components 0.123import Ubuntu.Components 0.1
24import Ubuntu.Components.Popups 0.124import Ubuntu.Components.Popups 0.1
25import Ubuntu.Components.ListItems 0.1 as ListItem25import Ubuntu.Components.ListItems 0.1 as ListItem
26import Ubuntu.Components.Extras 0.126import Ubuntu.Content 0.1
27import "../Components"27import "../Components"
28import "../Utility"28import "../Utility"
29import "../../js/Gallery.js" as Gallery29import "../../js/Gallery.js" as Gallery
@@ -224,42 +224,32 @@
224 !editHUD.actionActive224 !editHUD.actionActive
225225
226 Component {226 Component {
227 id: shareConfigurePopover227 id: contentItemComp
228228 ContentItem {}
229 ActionSelectionPopover {
230 objectName: "shareConfigurePopover"
231 visible: false
232 actions: ActionList {
233 Action {
234 text: i18n.tr("Configure Facebook for photo sharing...")
235 onTriggered: {
236 Qt.openUrlExternally("settings:///system/online-accounts");
237 }
238 }
239 }
240 }
241 }229 }
242230
243 FacebookAccount {231 Rectangle {
244 id: facebook232 id: sharePicker
245233 anchors.fill: parent
246 property ActionSelectionPopover _lastPopover: null234 visible: false
247235
248 function configureOrStartSharing(button) {236 ContentPeerPicker {
249 if (_lastPopover) {237 objectName: "sharePicker"
250 PopupUtils.close(_lastPopover);238 anchors.fill: parent
251 _lastPopover = null;239 visible: parent.visible
252 } else {240 contentType: galleryPhotoViewer.media.type === MediaSource.Video ? ContentType.Videos : ContentType.Pictures
253 if (facebook.id == -1) {241 handler: ContentHandler.Share
254 _lastPopover = PopupUtils.open(shareConfigurePopover, button);242
255 } else {243 onPeerSelected: {
256 sharePanel.fileToShare = viewerWrapper.media.path;244 parent.visible = false;
257 sharePanel.userAccountId = facebook.id;245 var curTransfer = peer.request();
258 sharePanel.visible = true;246 if (curTransfer.state === ContentTransfer.InProgress)
259 viewerWrapper.tools.opened = false;247 {
260 _lastPopover = null;248 curTransfer.items = [ contentItemComp.createObject(parent, {"url": viewerWrapper.media.path}) ];
249 curTransfer.state = ContentTransfer.Charged;
261 }250 }
262 }251 }
252 onCancelPressed: parent.visible = false;
263 }253 }
264 }254 }
265255
@@ -546,7 +536,7 @@
546 text: i18n.tr("Share photo")536 text: i18n.tr("Share photo")
547 iconSource: "../../img/share.png"537 iconSource: "../../img/share.png"
548 onTriggered: {538 onTriggered: {
549 facebook.configureOrStartSharing(photoShareButton);539 sharePicker.visible = true;
550 }540 }
551 }541 }
552 text: i18n.tr("Share")542 text: i18n.tr("Share")
@@ -602,7 +592,7 @@
602 text: i18n.tr("Share")592 text: i18n.tr("Share")
603 iconSource: "../../img/share.png"593 iconSource: "../../img/share.png"
604 onTriggered: {594 onTriggered: {
605 facebook.configureOrStartSharing(videoShareButton);595 sharePicker.visible = true;
606 }596 }
607 }597 }
608598
@@ -617,24 +607,4 @@
617 }607 }
618 }608 }
619 }609 }
620
621 Loader {
622 id: sharePanel
623 anchors.fill: parent
624 visible: false
625 sourceComponent: (fileToShare !== "" && userAccountId !== "") ? component_sharePanel : null
626
627 property string fileToShare
628 property string userAccountId
629
630 Component {
631 id: component_sharePanel
632 Share {
633 fileToShare: sharePanel.fileToShare
634 userAccountId: sharePanel.userAccountId
635 onUploadCompleted: sharePanel.visible = false;
636 onCanceled: sharePanel.visible = false;
637 }
638 }
639 }
640}610}
641611
=== modified file 'tests/autopilot/gallery_app/emulators/photo_viewer.py'
--- tests/autopilot/gallery_app/emulators/photo_viewer.py 2014-06-13 13:57:20 +0000
+++ tests/autopilot/gallery_app/emulators/photo_viewer.py 2014-07-02 22:11:28 +0000
@@ -29,10 +29,15 @@
29 return self.app.wait_select_single("PopupAlbumPicker",29 return self.app.wait_select_single("PopupAlbumPicker",
30 objectName="popupAlbumPicker")30 objectName="popupAlbumPicker")
3131
32 def get_share_dialog(self):32 def get_content_peer_picker_cancel_button(self):
33 """Returns the photo viewer share dialog."""33 """Returns the ContentPeerPicker cancel button."""
34 return self.app.wait_select_single("SharePopover",34 return self.app.wait_select_single("Button",
35 objectName="sharePopover")35 objectName="contentPeerPickerCancelButton")
36
37 def get_share_peer_picker(self):
38 """Returns the photo viewer share picker."""
39 return self.app.wait_select_single("ContentPeerPicker",
40 objectName="sharePicker")
3641
37 def get_photo_edit_dialog(self):42 def get_photo_edit_dialog(self):
38 """Returns the photo edit dialog."""43 """Returns the photo edit dialog."""
3944
=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-05-20 15:19:35 +0000
+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-07-02 22:11:28 +0000
@@ -10,6 +10,8 @@
1010
11from testtools.matchers import Equals, NotEquals, GreaterThan, Is11from testtools.matchers import Equals, NotEquals, GreaterThan, Is
12from autopilot.matchers import Eventually12from autopilot.matchers import Eventually
13from testtools import skipIf
14from autopilot.platform import model
1315
14from gallery_app.emulators.photo_viewer import PhotoViewer16from gallery_app.emulators.photo_viewer import PhotoViewer
15from gallery_app.emulators.media_viewer import MediaViewer17from gallery_app.emulators.media_viewer import MediaViewer
@@ -109,6 +111,17 @@
109 photo_viewer = self.photo_viewer.get_main_photo_viewer()111 photo_viewer = self.photo_viewer.get_main_photo_viewer()
110 self.assertThat(photo_viewer.visible, Eventually(Equals(False)))112 self.assertThat(photo_viewer.visible, Eventually(Equals(False)))
111113
114 @skipIf(model() == 'Desktop', 'Share not supported on desktop')
115 def test_share_button(self):
116 """Clicking the share button must show the ContentPeerPicker."""
117 photo_viewer = self.photo_viewer.get_main_photo_viewer()
118 self.main_view.open_toolbar().click_button("shareButton")
119 share_picker = self.photo_viewer.get_share_peer_picker()
120 self.assertThat(share_picker.visible, Eventually(Equals(True)))
121 cancel_button = self.photo_viewer.get_content_peer_picker_cancel_button()
122 self.click_item(cancel_button)
123 self.assertThat(share_picker.visible, Eventually(Equals(False)))
124
112 def delete_one_picture(self):125 def delete_one_picture(self):
113 self.main_view.open_toolbar().click_button("deleteButton")126 self.main_view.open_toolbar().click_button("deleteButton")
114 self.get_delete_dialog()127 self.get_delete_dialog()

Subscribers

People subscribed via source and target branches