Merge lp:~andrewsomething/ubuntu-rssreader-app/sharing into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Andrew Starr-Bochicchio
Status: Superseded
Proposed branch: lp:~andrewsomething/ubuntu-rssreader-app/sharing
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 154 lines (+122/-0)
2 files modified
RssFeedPage.qml (+120/-0)
debian/control (+2/-0)
To merge this branch: bzr merge lp:~andrewsomething/ubuntu-rssreader-app/sharing
Reviewer Review Type Date Requested Status
Ken VanDine Needs Fixing
Review via email: mp+183340@code.launchpad.net

This proposal has been superseded by a proposal from 2013-09-06.

Commit message

Add ability to share articles using the friends api. LP: #1219301

Description of the change

This adds the ability to share articles. There is one minor issue with the Popover being hard to read, but that is a known bug in the UI Toolkit:

https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1201864

Not sure if that's a blocker...

To post a comment you must log in.
Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Looks like that is probably the same bug as in LP #1205094, which is Fix Committed:

https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205094

Revision history for this message
Roman Shchekin (mrqtros) wrote :

Must Ubuntu.OnlineAccounts and Friends modules be manually installed or not?
I've got errors: "module "Ubuntu.OnlineAccounts" is not installed". Same for "Friends".

BTW, I think that:
property var article: rssListview.model.get(rssListview.currentIndex)
is bad practice. Better will be set property "article" in PopupUtils.open() method when creating Popover.

And this
article.shareAccountId = accts.accountId
is not pretty clear code too. Use additional property instead of mixing all data in one.

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Thanks for the review.

On Sun, Sep 1, 2013 at 5:33 AM, Roman Shchekin <email address hidden> wrote:
> Must Ubuntu.OnlineAccounts and Friends modules be manually installed or not?
> I've got errors: "module "Ubuntu.OnlineAccounts" is not installed". Same for "Friends".

My understanding is that they should be part of the default image.
They're going to be used for contact sync and are also used by the
Facebook and Friends apps. Though I don't actually have a device
running Ubuntu Touch, so I don't know if this is a reality yet. I
guess the SDK isn't pulling them in yet. I think the packages are
qtdeclarative5-accounts-plugin and qtdeclarative5-friends-plugin. I'm
running saucy, and they are already present here...

> BTW, I think that:
> property var article: rssListview.model.get(rssListview.currentIndex)
> is bad practice. Better will be set property "article" in PopupUtils.open() method when creating Popover.
>
> And this article.shareAccountId = accts.accountId
> is not pretty clear code too. Use additional property instead of mixing all data in one.

I'll try to pretty this up sometime today. This is my first real step
into the QML world. Is there any kind of widely accepted style guide
akin to Python's PEP8?

Thanks!

-- Andrew Starr-Bochicchio

   Ubuntu Developer <https://launchpad.net/~andrewsomething>
   Debian Developer <http://qa.debian.org/developer.php?login=asb>
   PGP/GPG Key ID: D53FDCB1

53. By Andrew Starr-Bochicchio

Don't mix account data into article property.

54. By Andrew Starr-Bochicchio

Remerge on trunk.

Revision history for this message
Joey Chan (qqworini) wrote :

Neither do I have qtdeclarative5-accounts-plugin and qtdeclarative5-friends-plugin, using Kubuntu 12.04

Also I can't access FB and twitter in China, so sorry I can't test it

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

On Tue, Sep 3, 2013 at 10:19 PM, Joey Chan <email address hidden> wrote:
> Also I can't access FB and twitter in China, so sorry I can't test it

There are Sina and Sohu plugins as well.

Revision history for this message
Joey Chan (qqworini) wrote :

Sounds good, but I don't have those plugins in my 12.04 ... that's the problem

> On Tue, Sep 3, 2013 at 10:19 PM, Joey Chan <email address hidden> wrote:
> > Also I can't access FB and twitter in China, so sorry I can't test it
>
> There are Sina and Sohu plugins as well.

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

You should add depends for qtdeclarative5-accounts-plugin and qtdeclarative5-friends0.2 to the package. Also note, that there has been an API version bump in friends recently, use 0.2 now.

review: Needs Fixing
55. By Andrew Starr-Bochicchio

Add dependencies to the Debian packaging and bump Friends version.

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

On Wed, Sep 4, 2013 at 9:33 AM, Ken VanDine <email address hidden> wrote:
> You should add depends for qtdeclarative5-accounts-plugin and qtdeclarative5-friends0.2 to the package. Also note, that there has been an API version bump in friends recently, use 0.2 now.

Done. I hadn't notice that the packaging is kept in this branch.
Strangely, QtCreator doesn't display the debian directory in the
project view, just the filesystem view...

56. By Andrew Starr-Bochicchio

Handle there not being a sharing account more gracefully.

57. By Andrew Starr-Bochicchio

gicon is deprecated, use theme instead.

Unmerged revisions

57. By Andrew Starr-Bochicchio

gicon is deprecated, use theme instead.

56. By Andrew Starr-Bochicchio

Handle there not being a sharing account more gracefully.

55. By Andrew Starr-Bochicchio

Add dependencies to the Debian packaging and bump Friends version.

54. By Andrew Starr-Bochicchio

Remerge on trunk.

53. By Andrew Starr-Bochicchio

Don't mix account data into article property.

52. By Andrew Starr-Bochicchio

Add ability to share articles using the friends api.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'RssFeedPage.qml'
2--- RssFeedPage.qml 2013-09-03 16:58:01 +0000
3+++ RssFeedPage.qml 2013-09-04 14:36:57 +0000
4@@ -10,6 +10,9 @@
5 import QtQuick.XmlListModel 2.0
6 import Ubuntu.Components 0.1
7 import Ubuntu.Components.ListItems 0.1 as ListItem
8+import Ubuntu.Components.Popups 0.1 as Popups
9+import Friends 0.2
10+import Ubuntu.OnlineAccounts 0.1
11 import "./dateutils.js" as DateUtils
12
13 Page {
14@@ -40,6 +43,20 @@
15
16 ToolbarButton {
17 action: Action {
18+ id: shareAction
19+ objectName: "share"
20+
21+ iconSource: Qt.resolvedUrl("./icons_tmp/share.svg")
22+ text: i18n.tr("Share")
23+
24+ onTriggered: {
25+ PopupUtils.open(shareAccountsComponent)
26+ }
27+ }
28+ }
29+
30+ ToolbarButton {
31+ action: Action {
32 text: i18n.tr("Open site")
33 iconSource: Qt.resolvedUrl("./icons_tmp/go-to.svg")
34 onTriggered:
35@@ -132,4 +149,107 @@
36 }
37 } // Flickable
38 } // Component
39+
40+ //////// Sharing feature
41+ FriendsDispatcher {
42+ id: friends
43+ onSendComplete: {
44+ if (success) {
45+ console.log ("Send completed successfully");
46+ } else {
47+ console.log ("Send failed: " + errorMessage);
48+ }
49+ }
50+ }
51+
52+ Component {
53+ id: shareDialogComponent
54+
55+ Popups.Dialog {
56+ id: shareDialog
57+
58+ property var article: null
59+ property var account: null
60+
61+ title: i18n.tr("Share on ") + account.serviceName
62+ text: i18n.tr("Edit your message below")
63+
64+ TextArea {
65+ id: shareMsg
66+ text: {
67+ return article.title + '\n\n' + article.description + '\n\n' + article.link
68+ }
69+ }
70+
71+ Button {
72+ id: shareButton
73+ text: i18n.tr('Share')
74+ onClicked: {
75+ friends.sendForAccountAsync(account.id, shareMsg.text)
76+ PopupUtils.close(shareDialog)
77+ }
78+ }
79+
80+ Button {
81+ id: shareCancel
82+ text: i18n.tr('Cancel')
83+ onClicked: {
84+ PopupUtils.close(shareDialog)
85+ }
86+ }
87+ }
88+ }
89+
90+ Component {
91+ id: shareAccountsComponent
92+
93+ Popups.Popover {
94+ id: shareAccountsPopover
95+
96+ Column {
97+ id: shareAccountsLayout
98+ anchors {
99+ left: parent.left
100+ top: parent.top
101+ right: parent.right
102+ }
103+
104+ AccountServiceModel {
105+ id: socialAccounts
106+ serviceType: 'microblogging'
107+ }
108+
109+ Repeater {
110+ model: socialAccounts
111+ delegate: ListItem.Subtitled {
112+ id: socialAccountsItem
113+ property var accts: AccountService {
114+ id: accts
115+ objectHandle: accountServiceHandle
116+ onAuthenticated: { console.log("Access token is " + reply.AccessToken) }
117+ onAuthenticationError: { console.log("Authentication failed, code " + error.code) }
118+ }
119+ text: accts.provider.displayName
120+ subText: accts.displayName
121+
122+ icon: 'image://gicon/'+accts.provider.iconName
123+ fallbackIconSource: Qt.resolvedUrl("./icons_tmp/share.svg")
124+
125+ property var account: {
126+ 'id': accts.accountId,
127+ 'serviceName': accts.service.displayName
128+ }
129+ property var article: rssListview.model.get(rssListview.currentIndex)
130+
131+ onClicked: {
132+ PopupUtils.close(shareAccountsPopover)
133+ PopupUtils.open(shareDialogComponent, null,
134+ {"article" : article,
135+ "account": account})
136+ }
137+ }
138+ }
139+ }
140+ }
141+ }
142 }
143
144=== modified file 'debian/control'
145--- debian/control 2013-08-15 15:54:31 +0000
146+++ debian/control 2013-09-04 14:36:57 +0000
147@@ -17,6 +17,8 @@
148 qtdeclarative5-xmllistmodel-plugin,
149 libqt5webkit5-qmlwebkitplugin,
150 qtdeclarative5-localstorage-plugin,
151+ qtdeclarative5-accounts-plugin,
152+ qtdeclarative5-friends0.2
153 Description: RSS Reader application
154 Core RSS Reader application
155

Subscribers

People subscribed via source and target branches