Merge lp:~michael-sheldon/webbrowser-app/link-share into lp:webbrowser-app

Proposed by Michael Sheldon
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 582
Merged at revision: 585
Proposed branch: lp:~michael-sheldon/webbrowser-app/link-share
Merge into: lp:webbrowser-app
Diff against target: 274 lines (+164/-4)
7 files modified
po/webbrowser-app.pot (+8/-4)
src/app/AddressBar.qml (+4/-0)
src/app/Chrome.qml (+31/-0)
src/app/ContentShareDialog.qml (+50/-0)
src/app/PanelLoader.qml (+1/-0)
src/app/Share.qml (+46/-0)
src/app/actions/ShareLink.qml (+24/-0)
To merge this branch: bzr merge lp:~michael-sheldon/webbrowser-app/link-share
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Olivier Tilloy Approve
Review via email: mp+223421@code.launchpad.net

Commit message

Add support for sharing the URL of the current page via content-hub.

Description of the change

Adds support for sharing links via content-hub. A long press on the URL bar will now show a "Share..." option on mobile devices, which will present the peer picker, allowing the user to select a sharing app.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (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.

 * No

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/webbrowser-app) on device or emulator?

 * Yes

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

 * Added share action to URL bar long press as specified in old designs, this should be replaced with a share action in the top menu when the new design is complete.

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

 * No change

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

This modified version of Ken's hub example can be used to test receiving links: mikeasoft.com/~mike/com.ubuntu.developer.ken-vandine.hub-importer_0.2_all.click

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :
579. By Michael Sheldon

Update translations

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

Seeing a functional issue here: if I clear the address bar, then dismiss the chrome (leaving the address bar empty), then show it again and long press on the empty address bar, I’m still getting the context menu with the share option, even though there doesn’t seem to be anything to share (in fact what happens is that the URL of the current view is being shared, despite the address bar being empty, but I think this is counter-intuitive).

On a related note, instead of disabling the share action when chrome.url is empty or on desktop, this condition should be tested in the onPressAndHold slot before showing the popup. Indeed, the implementation of PopupUtils.open(…) doesn’t check whether the popup is empty, and what happens on desktop is that an empty popover is being shown (and it looks ugly).

review: Needs Fixing
580. By Michael Sheldon

Use correct ellipsis character

581. By Michael Sheldon

Only show share popover if we have a share item to show

582. By Michael Sheldon

Update translation template

Revision history for this message
Olivier Tilloy (osomon) wrote :

Looks good to me now, thanks!

review: Approve
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 'po/webbrowser-app.pot'
2--- po/webbrowser-app.pot 2014-06-18 08:33:20 +0000
3+++ po/webbrowser-app.pot 2014-06-25 16:34:38 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: webbrowser-app\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2014-06-18 10:33+0200\n"
9+"POT-Creation-Date: 2014-06-25 17:33+0100\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -81,15 +81,15 @@
14 msgid "Back to safety"
15 msgstr ""
16
17-#: src/app/Chrome.qml:72 src/app/actions/Back.qml:23
18+#: src/app/Chrome.qml:75 src/app/actions/Back.qml:23
19 msgid "Back"
20 msgstr ""
21
22-#: src/app/Chrome.qml:91 src/app/actions/Forward.qml:23
23+#: src/app/Chrome.qml:94 src/app/actions/Forward.qml:23
24 msgid "Forward"
25 msgstr ""
26
27-#: src/app/Chrome.qml:126 src/app/webbrowser/ActivityView.qml:36
28+#: src/app/Chrome.qml:157 src/app/webbrowser/ActivityView.qml:36
29 msgid "Activity"
30 msgstr ""
31
32@@ -244,6 +244,10 @@
33 msgid "Save image"
34 msgstr ""
35
36+#: src/app/actions/ShareLink.qml:22
37+msgid "Share…"
38+msgstr ""
39+
40 #: src/app/webbrowser/ActivityView.qml:54
41 msgid "Bookmarks"
42 msgstr ""
43
44=== modified file 'src/app/AddressBar.qml'
45--- src/app/AddressBar.qml 2014-06-06 17:01:55 +0000
46+++ src/app/AddressBar.qml 2014-06-25 16:34:38 +0000
47@@ -29,6 +29,7 @@
48 property bool loading
49 signal requestReload()
50 signal requestStop()
51+ signal pressAndHold()
52
53 height: textField.height
54
55@@ -120,6 +121,9 @@
56 textField.forceActiveFocus()
57 textField.selectAll()
58 }
59+ onPressAndHold: {
60+ addressbar.pressAndHold()
61+ }
62 }
63 }
64
65
66=== modified file 'src/app/Chrome.qml'
67--- src/app/Chrome.qml 2014-05-22 12:38:25 +0000
68+++ src/app/Chrome.qml 2014-06-25 16:34:38 +0000
69@@ -18,6 +18,8 @@
70
71 import QtQuick 2.0
72 import Ubuntu.Components 0.1
73+import Ubuntu.Components.Popups 0.1
74+import "actions" as Actions
75
76 Item {
77 id: chrome
78@@ -25,6 +27,7 @@
79 property alias url: addressBar.actualUrl
80 signal urlValidated(url url)
81 property alias addressBar: addressBar
82+ property string title
83 property alias loading: addressBar.loading
84 property alias loadProgress: progressBar.value
85 property alias canGoBack: backButton.enabled
86@@ -92,6 +95,29 @@
87 onTriggered: chrome.goForwardClicked()
88 }
89
90+ Component {
91+ id: addressBarPopover
92+ ActionSelectionPopover {
93+ actions: ActionList {
94+ Actions.ShareLink {
95+ onTriggered: shareLoader.item.shareLink(chrome.url, chrome.title)
96+ }
97+ }
98+ }
99+ }
100+
101+ Item {
102+ id: addressBarPopOverPositioner
103+ anchors.bottom: addressBar.top
104+ anchors.horizontalCenter: addressBar.horizontalCenter
105+ visible: false
106+ }
107+
108+ Loader {
109+ id: shareLoader
110+ source: formFactor == "desktop" ? "" : "Share.qml"
111+ }
112+
113 AddressBar {
114 id: addressBar
115 objectName: "addressBar"
116@@ -107,6 +133,11 @@
117 onValidated: chrome.urlValidated(requestedUrl)
118 onRequestReload: chrome.requestReload()
119 onRequestStop: chrome.requestStop()
120+ onPressAndHold: {
121+ if (chrome.url && shareLoader.status == Loader.Ready) {
122+ PopupUtils.open(addressBarPopover, addressBarPopOverPositioner)
123+ }
124+ }
125 visible: addressBarVisible
126 }
127
128
129=== added file 'src/app/ContentShareDialog.qml'
130--- src/app/ContentShareDialog.qml 1970-01-01 00:00:00 +0000
131+++ src/app/ContentShareDialog.qml 2014-06-25 16:34:38 +0000
132@@ -0,0 +1,50 @@
133+/*
134+ * Copyright 2014 Canonical Ltd.
135+ *
136+ * This file is part of webbrowser-app.
137+ *
138+ * webbrowser-app is free software; you can redistribute it and/or modify
139+ * it under the terms of the GNU General Public License as published by
140+ * the Free Software Foundation; version 3.
141+ *
142+ * webbrowser-app is distributed in the hope that it will be useful,
143+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
144+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145+ * GNU General Public License for more details.
146+ *
147+ * You should have received a copy of the GNU General Public License
148+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
149+ */
150+
151+import QtQuick 2.0
152+import Ubuntu.Components 0.1
153+import Ubuntu.Components.Popups 0.1
154+import Ubuntu.Content 0.1
155+
156+PopupBase {
157+ id: shareDialog
158+ anchors.fill: parent
159+ property var activeTransfer
160+ property var items: []
161+ property alias contentType: peerPicker.contentType
162+
163+ Rectangle {
164+ anchors.fill: parent
165+ ContentPeerPicker {
166+ id: peerPicker
167+ handler: ContentHandler.Share
168+ visible: parent.visible
169+
170+ onPeerSelected: {
171+ activeTransfer = peer.request()
172+ activeTransfer.items = shareDialog.items
173+ activeTransfer.state = ContentTransfer.Charged
174+ shareDialog.hide()
175+ }
176+
177+ onCancelPressed: {
178+ shareDialog.hide()
179+ }
180+ }
181+ }
182+}
183
184=== modified file 'src/app/PanelLoader.qml'
185--- src/app/PanelLoader.qml 2014-06-11 07:03:29 +0000
186+++ src/app/PanelLoader.qml 2014-06-25 16:34:38 +0000
187@@ -75,6 +75,7 @@
188 id: chrome
189
190 anchors.fill: parent
191+ title: currentWebview.title
192
193 Connections {
194 target: chromePanel
195
196=== added file 'src/app/Share.qml'
197--- src/app/Share.qml 1970-01-01 00:00:00 +0000
198+++ src/app/Share.qml 2014-06-25 16:34:38 +0000
199@@ -0,0 +1,46 @@
200+/*
201+ * Copyright 2014 Canonical Ltd.
202+ *
203+ * This file is part of webbrowser-app.
204+ *
205+ * webbrowser-app is free software; you can redistribute it and/or modify
206+ * it under the terms of the GNU General Public License as published by
207+ * the Free Software Foundation; version 3.
208+ *
209+ * webbrowser-app is distributed in the hope that it will be useful,
210+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
211+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
212+ * GNU General Public License for more details.
213+ *
214+ * You should have received a copy of the GNU General Public License
215+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
216+ */
217+
218+import QtQuick 2.0
219+import Ubuntu.Components 0.1
220+import Ubuntu.DownloadManager 0.1
221+import Ubuntu.Content 0.1
222+
223+Item {
224+ id: shareItem
225+
226+ ContentShareDialog {
227+ id: shareDialog
228+ }
229+
230+ Component {
231+ id: contentItemComponent
232+ ContentItem { }
233+ }
234+
235+ function share(url, name, contentType) {
236+ shareDialog.contentType = contentType
237+ shareDialog.items.push(contentItemComponent.createObject(shareItem, {"url" : url, "name" : name}))
238+ shareDialog.show()
239+ }
240+
241+ function shareLink(url, title) {
242+ share(url, title, ContentType.Links)
243+ }
244+
245+}
246
247=== added file 'src/app/actions/ShareLink.qml'
248--- src/app/actions/ShareLink.qml 1970-01-01 00:00:00 +0000
249+++ src/app/actions/ShareLink.qml 2014-06-25 16:34:38 +0000
250@@ -0,0 +1,24 @@
251+/*
252+ * Copyright 2014 Canonical Ltd.
253+ *
254+ * This file is part of webbrowser-app.
255+ *
256+ * webbrowser-app is free software; you can redistribute it and/or modify
257+ * it under the terms of the GNU General Public License as published by
258+ * the Free Software Foundation; version 3.
259+ *
260+ * webbrowser-app is distributed in the hope that it will be useful,
261+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
262+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
263+ * GNU General Public License for more details.
264+ *
265+ * You should have received a copy of the GNU General Public License
266+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
267+ */
268+
269+import Ubuntu.Components 0.1
270+
271+Action {
272+ text: i18n.tr("Share…")
273+ iconName: "share"
274+}

Subscribers

People subscribed via source and target branches

to status/vote changes: