Merge lp:~mardy/ubuntu-system-settings-online-accounts/ual-desktop into lp:ubuntu-system-settings-online-accounts

Proposed by Alberto Mardegan
Status: Superseded
Proposed branch: lp:~mardy/ubuntu-system-settings-online-accounts/ual-desktop
Merge into: lp:ubuntu-system-settings-online-accounts
Diff against target: 185 lines (+50/-25)
7 files modified
debian/changelog (+8/-0)
debian/control (+2/-1)
online-accounts-service/mir-helper.cpp (+6/-15)
plugins/OnlineAccountsPlugin/OnlineAccountsPlugin.pro (+3/-1)
plugins/OnlineAccountsPlugin/application-manager.cpp (+21/-3)
plugins/module/ServiceItem.qml (+5/-4)
tests/plugin/tst_application_manager.pro (+5/-1)
To merge this branch: bzr merge lp:~mardy/ubuntu-system-settings-online-accounts/ual-desktop
Reviewer Review Type Date Requested Status
Online Accounts Pending
Review via email: mp+317962@code.launchpad.net

Description of the change

Use ubuntu-app-launch to get apps' name and icon

To post a comment you must log in.
422. By Alberto Mardegan

Use ubuntu-app-launch to retrieve the client application's name and icon

423. By Alberto Mardegan

Update UAL version

424. By Alberto Mardegan

fix version

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-01-26 06:46:36 +0000
3+++ debian/changelog 2017-02-22 12:19:12 +0000
4@@ -1,3 +1,11 @@
5+ubuntu-system-settings-online-accounts (0.7+17.04.20170126-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * debian/control:
8+ - Bump dependency version on libmirclient-dev
9+ * Remove calls to deprecated mir_wait_handle() function.
10+
11+ -- Alberto Mardegan <alberto.mardegan@canonical.com> Wed, 22 Feb 2017 11:29:04 +0300
12+
13 ubuntu-system-settings-online-accounts (0.7+17.04.20170126-0ubuntu1) zesty; urgency=medium
14
15 * debian/control:
16
17=== modified file 'debian/control'
18--- debian/control 2017-01-26 06:38:15 +0000
19+++ debian/control 2017-02-22 12:19:12 +0000
20@@ -8,12 +8,13 @@
21 libaccounts-qt5-dev (>= 1.13),
22 libapparmor-dev,
23 libclick-0.4-dev,
24- libmirclient-dev (>= 0.14.0),
25+ libmirclient-dev (>= 0.26.1),
26 libnotify-dev,
27 libqtdbusmock1-dev,
28 libqtdbustest1-dev,
29 libsignon-qt5-dev,
30 libsystemsettings-dev (>= 0.1+13.10.20130806),
31+ libubuntu-app-launch2-dev,
32 qt5-default,
33 qtbase5-dev (>= 5.4),
34 qtdeclarative5-dev,
35
36=== modified file 'online-accounts-service/mir-helper.cpp'
37--- online-accounts-service/mir-helper.cpp 2014-11-25 13:18:32 +0000
38+++ online-accounts-service/mir-helper.cpp 2017-02-22 12:19:12 +0000
39@@ -44,7 +44,6 @@
40
41 MirPromptSession *m_mirSession;
42 pid_t m_initiatorPid;
43- QList<int> m_fds;
44 mutable PromptSession *q_ptr;
45 };
46
47@@ -96,24 +95,16 @@
48 delete d_ptr;
49 }
50
51-static void client_fd_callback(MirPromptSession *, size_t count,
52- int const *fds, void *context)
53-{
54- PromptSessionPrivate *priv = (PromptSessionPrivate *)context;
55- for (size_t i = 0; i < count; i++) {
56- priv->m_fds.append(fds[i]);
57- }
58-}
59-
60 QString PromptSession::requestSocket()
61 {
62 Q_D(PromptSession);
63
64- d->m_fds.clear();
65- mir_wait_for(mir_prompt_session_new_fds_for_prompt_providers(
66- d->m_mirSession, 1, client_fd_callback, d));
67- if (!d->m_fds.isEmpty()) {
68- return QString("fd://%1").arg(d->m_fds[0]);
69+ int fd = -1;
70+ auto count =
71+ mir_prompt_session_new_fds_for_prompt_providers_sync(d->m_mirSession,
72+ 1, &fd);
73+ if (count == 1 && fd >= 0) {
74+ return QString("fd://%1").arg(fd);
75 } else {
76 return QString();
77 }
78
79=== modified file 'plugins/OnlineAccountsPlugin/OnlineAccountsPlugin.pro'
80--- plugins/OnlineAccountsPlugin/OnlineAccountsPlugin.pro 2014-10-09 12:24:45 +0000
81+++ plugins/OnlineAccountsPlugin/OnlineAccountsPlugin.pro 2017-02-22 12:19:12 +0000
82@@ -14,9 +14,11 @@
83
84 PKGCONFIG += \
85 accounts-qt5 \
86- signon-plugins-common
87+ signon-plugins-common \
88+ ubuntu-app-launch-2
89
90 QMAKE_CXXFLAGS += \
91+ -fexceptions \
92 -fvisibility=hidden
93 DEFINES += BUILDING_ONLINE_ACCOUNTS_PLUGIN
94
95
96=== modified file 'plugins/OnlineAccountsPlugin/application-manager.cpp'
97--- plugins/OnlineAccountsPlugin/application-manager.cpp 2017-01-16 13:19:01 +0000
98+++ plugins/OnlineAccountsPlugin/application-manager.cpp 2017-02-22 12:19:12 +0000
99@@ -27,8 +27,12 @@
100 #include <QFile>
101 #include <QSettings>
102 #include <QStandardPaths>
103+#include <ubuntu-app-launch/appid.h>
104+#include <ubuntu-app-launch/application.h>
105+#include <ubuntu-app-launch/registry.h>
106
107 using namespace OnlineAccountsUi;
108+namespace ual = ubuntu::app_launch;
109
110 ApplicationManager *ApplicationManager::m_instance = 0;
111
112@@ -43,10 +47,15 @@
113 const QString &profile) const;
114 static QString stripVersion(const QString &appId);
115 static QString displayId(const QString &appId);
116+
117+private:
118+ friend class ApplicationManager;
119+ std::shared_ptr<ual::Registry> m_registry;
120 };
121 } // namespace
122
123-ApplicationManagerPrivate::ApplicationManagerPrivate()
124+ApplicationManagerPrivate::ApplicationManagerPrivate():
125+ m_registry(new ual::Registry)
126 {
127 }
128
129@@ -173,8 +182,17 @@
130 QVariantMap app;
131 app.insert(QStringLiteral("id"), applicationId);
132 app.insert(QStringLiteral("displayId"), d->displayId(applicationId));
133- app.insert(QStringLiteral("displayName"), application.displayName());
134- app.insert(QStringLiteral("icon"), application.iconName());
135+ try {
136+ auto appId = ual::AppID::find(d->m_registry, applicationId.toStdString());
137+ auto appInfo = ual::Application::create(appId, d->m_registry)->info();
138+ app.insert(QStringLiteral("displayName"), QString::fromStdString(appInfo->name()));
139+ app.insert(QStringLiteral("icon"), QString::fromStdString(appInfo->iconPath()));
140+ } catch (std::exception &e) {
141+ qWarning() << "Reading app info failed, falling back to OA data:" << e.what();
142+ app.insert(QStringLiteral("displayName"), application.displayName());
143+ app.insert(QStringLiteral("icon"), application.iconName());
144+ }
145+
146 /* The applicationMatchesProfile() test above ensures that either the peer
147 * is unconfined, or the profile in the .application file matches the one
148 * we see from our peer.
149
150=== modified file 'plugins/module/ServiceItem.qml'
151--- plugins/module/ServiceItem.qml 2016-02-12 13:30:25 +0000
152+++ plugins/module/ServiceItem.qml 2017-02-22 12:19:12 +0000
153@@ -40,10 +40,11 @@
154 }
155
156 delegate: ServiceItemBase {
157- text: model.displayName ? model.displayName : model.applicationId
158- subText: ApplicationManager.applicationInfo(model.applicationId, "unconfined").displayId
159- iconSource: model.iconName.indexOf("/") === 0 ?
160- model.iconName : "image://theme/" + model.iconName
161+ property var appInfo: ApplicationManager.applicationInfo(model.applicationId, "unconfined")
162+ text: appInfo.displayName ? appInfo.displayName : model.applicationId
163+ subText: appInfo.displayId
164+ iconSource: appInfo.icon.indexOf("/") === 0 ?
165+ appInfo.icon : "image://theme/" + appInfo.icon
166 checked: accountService.serviceEnabled
167 onCheckedChanged: {
168 if (checked != accountService.serviceEnabled) {
169
170=== modified file 'tests/plugin/tst_application_manager.pro'
171--- tests/plugin/tst_application_manager.pro 2015-09-24 12:58:34 +0000
172+++ tests/plugin/tst_application_manager.pro 2017-02-22 12:19:12 +0000
173@@ -11,7 +11,11 @@
174 QT -= gui
175
176 PKGCONFIG += \
177- accounts-qt5
178+ accounts-qt5 \
179+ ubuntu-app-launch-2
180+
181+QMAKE_CXXFLAGS += \
182+ -fexceptions
183
184 DEFINES += \
185 TEST_DATA_DIR=\\\"$${PWD}/data\\\"

Subscribers

People subscribed via source and target branches