Merge lp:~mterry/unity-api/warn-on-xapp into lp:unity-api

Proposed by Michael Terry on 2015-11-18
Status: Work in progress
Proposed branch: lp:~mterry/unity-api/warn-on-xapp
Merge into: lp:unity-api
Diff against target: 262 lines (+71/-3)
13 files modified
debian/changelog (+7/-0)
include/unity/shell/application/ApplicationManagerInterface.h (+19/-0)
include/unity/shell/application/CMakeLists.txt (+1/-1)
include/unity/shell/launcher/CMakeLists.txt (+1/-1)
include/unity/shell/launcher/LauncherItemInterface.h (+7/-0)
include/unity/shell/launcher/LauncherModelInterface.h (+3/-1)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp (+7/-0)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h (+2/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp (+15/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h (+4/-0)
test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp (+2/-0)
test/qmltest/unity/shell/application/tst_Application.qml (+1/-0)
test/qmltest/unity/shell/launcher/tst_Launcher.qml (+2/-0)
To merge this branch: bzr merge lp:~mterry/unity-api/warn-on-xapp
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve on 2016-01-13
Gerry Boland (community) 2015-11-18 Needs Fixing on 2016-01-07
PS Jenkins bot (community) continuous-integration Approve on 2015-12-01
Review via email: mp+277922@code.launchpad.net

Commit message

Add support for isTouchApp property on LauncherItems and support for approving an application before it starts.

Description of the change

This is part of a larger effort to allow warning users before a legacy app is started [1].

==

isTouchApp on LauncherItems may be used by unity8 to render the launcher icons differently (though it isn't used now... waiting on design feedback).

This is a distinct setting from the isTouchApp property on ApplicationInfo since LauncherItems represent a potentially-running app, while ApplicationInfos represent a running app.

I considered making a more generic property. Something like "type" which could be "touch", "legacy", or something new and weird in the future. ("gnome" or "android" or something)

However, I felt that a launcher item backend was not necessarily the best place to condense the various information sources into one single answer (what if the .desktop file somehow indicates touch and android support?).

Plus, I felt that the interface should be as dumb as possible, which helps .desktop file backends simply pass the info they see through.

(And it matches the existing ApplicationInfo property)

==

The approveApplicationStart API is used to support the new upstart-app-launch round trip blocking when an application is starting (it waits for approval before actually finishing the application startup).

==

[1] https://code.launchpad.net/~mterry/unity8/warn-on-xapp/+merge/277915
    https://code.launchpad.net/~mterry/qtmir/warn-on-xapp/+merge/279172
    https://code.launchpad.net/~mterry/ubuntu-app-launch/warn-on-xapp/+merge/278497

To post a comment you must log in.
lp:~mterry/unity-api/warn-on-xapp updated on 2015-12-01
196. By Michael Terry on 2015-12-01

Add new ApplicationManager methods for approving an interface

197. By Michael Terry on 2015-12-01

Merge from trunk

Gerry Boland (gerboland) wrote :

nitpick:
+ * @brief Allow (or not) an application to finish starting.
this is very upstart terminology. Simpler just to say "Allow (or not) an application to start"

Rest looks good to me

Gerry Boland (gerboland) :
review: Needs Fixing
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:197
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-1-ci/3/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity-api-1-ci/3/rebuild

review: Approve (continuous-integration)
lp:~mterry/unity-api/warn-on-xapp updated on 2016-05-16
198. By Michael Terry on 2016-05-16

Merge from trunk

199. By Michael Terry on 2016-05-16

Fix documentation nit from review

200. By Michael Terry on 2016-05-16

Fix changelog/version

Unmerged revisions

200. By Michael Terry on 2016-05-16

Fix changelog/version

199. By Michael Terry on 2016-05-16

Fix documentation nit from review

198. By Michael Terry on 2016-05-16

Merge from trunk

197. By Michael Terry on 2015-12-01

Merge from trunk

196. By Michael Terry on 2015-12-01

Add new ApplicationManager methods for approving an interface

195. By Michael Terry on 2015-11-09

Add isTouchApp to LauncherItemInterface

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 2016-04-26 15:31:50 +0000
3+++ debian/changelog 2016-05-16 18:05:24 +0000
4@@ -1,3 +1,10 @@
5+unity-api (7.112) UNRELEASED; urgency=medium
6+
7+ * Add isTouchApp to LauncherItemInterface
8+ * Add approveApplicationStart to ApplicationManagerInterface
9+
10+ -- Michael Terry <mterry@ubuntu.com> Mon, 09 Nov 2015 16:57:25 -0500
11+
12 unity-api (7.111+16.04.20160426.2-0ubuntu1) xenial; urgency=medium
13
14 [ Pawel Stolowski ]
15
16=== modified file 'include/unity/shell/application/ApplicationManagerInterface.h'
17--- include/unity/shell/application/ApplicationManagerInterface.h 2016-04-13 16:47:27 +0000
18+++ include/unity/shell/application/ApplicationManagerInterface.h 2016-05-16 18:05:24 +0000
19@@ -156,6 +156,15 @@
20 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) = 0;
21
22 /**
23+ * @brief Allow (or not) an application to start.
24+ *
25+ * @param appId The appId for the application to allow.
26+ * @param approved Whether the application is allowed or not.
27+ * @returns True if application approval was successful, else false.
28+ */
29+ Q_INVOKABLE virtual bool approveApplicationStart(const QString &appId, bool approved) = 0;
30+
31+ /**
32 * @brief Stops an application.
33 *
34 * @param appId The application to be stopped.
35@@ -177,6 +186,16 @@
36 void focusRequested(const QString &appId);
37
38 /**
39+ * @brief Will be emitted when an application wants to start.
40+ *
41+ * This can be used to approve or deny the application with
42+ * approveApplicationStart(). For example, maybe an application requires
43+ * further permission. Or an application can't start right now because
44+ * the device is in the wrong mode (phone vs desktop).
45+ */
46+ void applicationStartApprovalRequested(const QString &appId);
47+
48+ /**
49 * @brief Will be emitted whenever the focused application changes.
50 */
51 void focusedApplicationIdChanged();
52
53=== modified file 'include/unity/shell/application/CMakeLists.txt'
54--- include/unity/shell/application/CMakeLists.txt 2016-04-13 16:40:06 +0000
55+++ include/unity/shell/application/CMakeLists.txt 2016-05-16 18:05:24 +0000
56@@ -7,7 +7,7 @@
57
58 set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
59
60-set(VERSION 15)
61+set(VERSION 16)
62 set(PKGCONFIG_NAME "unity-shell-application")
63 set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs")
64 set(PKGCONFIG_REQUIRES "Qt5Core")
65
66=== modified file 'include/unity/shell/launcher/CMakeLists.txt'
67--- include/unity/shell/launcher/CMakeLists.txt 2015-06-19 16:13:00 +0000
68+++ include/unity/shell/launcher/CMakeLists.txt 2016-05-16 18:05:24 +0000
69@@ -7,7 +7,7 @@
70
71 set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
72
73-set(VERSION 7)
74+set(VERSION 8)
75 set(PKGCONFIG_NAME "unity-shell-launcher")
76 set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs")
77 set(PKGCONFIG_REQUIRES "Qt5Core")
78
79=== modified file 'include/unity/shell/launcher/LauncherItemInterface.h'
80--- include/unity/shell/launcher/LauncherItemInterface.h 2015-06-12 11:06:29 +0000
81+++ include/unity/shell/launcher/LauncherItemInterface.h 2016-05-16 18:05:24 +0000
82@@ -112,6 +112,11 @@
83 Q_PROPERTY(bool alerting READ alerting NOTIFY alertingChanged)
84
85 /**
86+ * @brief Whether the application is designed for Ubuntu Touch
87+ */
88+ Q_PROPERTY(bool isTouchApp READ isTouchApp NOTIFY isTouchAppChanged)
89+
90+ /**
91 * @brief The quick list menu contents for the item
92 *
93 * Items can have a quick list menu. This property holds a model for
94@@ -138,6 +143,7 @@
95 virtual bool countVisible() const = 0;
96 virtual bool focused() const = 0;
97 virtual bool alerting() const = 0;
98+ virtual bool isTouchApp() const = 0;
99 virtual unity::shell::launcher::QuickListModelInterface *quickList() const = 0;
100
101 Q_SIGNALS:
102@@ -151,6 +157,7 @@
103 void countVisibleChanged(bool countVisible);
104 void focusedChanged(bool focused);
105 void alertingChanged(bool alerting);
106+ void isTouchAppChanged(bool isTouchApp);
107 /// @endcond
108 };
109
110
111=== modified file 'include/unity/shell/launcher/LauncherModelInterface.h'
112--- include/unity/shell/launcher/LauncherModelInterface.h 2015-06-19 16:13:00 +0000
113+++ include/unity/shell/launcher/LauncherModelInterface.h 2016-05-16 18:05:24 +0000
114@@ -73,6 +73,7 @@
115 m_roleNames.insert(RoleCountVisible, "countVisible");
116 m_roleNames.insert(RoleFocused, "focused");
117 m_roleNames.insert(RoleAlerting, "alerting");
118+ m_roleNames.insert(RoleIsTouchApp, "isTouchApp");
119 }
120 /// @endcond
121
122@@ -93,7 +94,8 @@
123 RoleCount,
124 RoleCountVisible,
125 RoleFocused,
126- RoleAlerting
127+ RoleAlerting,
128+ RoleIsTouchApp
129 };
130
131 virtual ~LauncherModelInterface() {}
132
133=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp'
134--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2015-12-03 17:07:15 +0000
135+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2016-05-16 18:05:24 +0000
136@@ -125,6 +125,13 @@
137 return item;
138 }
139
140+bool MockApplicationManager::approveApplicationStart(const QString &appId, bool approved)
141+{
142+ Q_UNUSED(appId)
143+ Q_UNUSED(approved)
144+ return true;
145+}
146+
147 bool MockApplicationManager::stopApplication(const QString &appId)
148 {
149 Q_UNUSED(appId)
150
151=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h'
152--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2015-06-19 12:02:05 +0000
153+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2016-05-16 18:05:24 +0000
154@@ -52,6 +52,8 @@
155
156 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments);
157
158+ Q_INVOKABLE bool approveApplicationStart(const QString &appId, bool approved);
159+
160 Q_INVOKABLE bool stopApplication(const QString &appId);
161
162 private:
163
164=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp'
165--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2015-06-18 17:03:45 +0000
166+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-05-16 18:05:24 +0000
167@@ -35,6 +35,7 @@
168 m_count(8),
169 m_countVisible(false),
170 m_alerting(false),
171+ m_isTouchApp(false),
172 m_quickListModel(new MockQuickListModel(this))
173 {
174
175@@ -172,6 +173,20 @@
176 }
177 }
178
179+bool MockLauncherItem::isTouchApp() const
180+{
181+ return m_isTouchApp;
182+}
183+
184+void MockLauncherItem::setIsTouchApp(bool isTouchApp)
185+{
186+ if (m_isTouchApp != isTouchApp)
187+ {
188+ m_isTouchApp = isTouchApp;
189+ Q_EMIT isTouchAppChanged(isTouchApp);
190+ }
191+}
192+
193 QuickListModelInterface *MockLauncherItem::quickList() const
194 {
195 return m_quickListModel;
196
197=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h'
198--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2015-06-02 13:52:49 +0000
199+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-05-16 18:05:24 +0000
200@@ -59,6 +59,9 @@
201 bool alerting() const;
202 void setAlerting(bool alerting);
203
204+ bool isTouchApp() const;
205+ void setIsTouchApp(bool isTouchApp);
206+
207 unity::shell::launcher::QuickListModelInterface *quickList() const;
208
209 private:
210@@ -74,6 +77,7 @@
211 bool m_countVisible;
212 bool m_focused;
213 bool m_alerting;
214+ bool m_isTouchApp;
215 QuickListModelInterface *m_quickListModel;
216 };
217
218
219=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp'
220--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp 2015-06-19 16:13:00 +0000
221+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp 2016-05-16 18:05:24 +0000
222@@ -90,6 +90,8 @@
223 return item->focused();
224 case RoleAlerting:
225 return item->alerting();
226+ case RoleIsTouchApp:
227+ return item->isTouchApp();
228 }
229
230 return QVariant();
231
232=== modified file 'test/qmltest/unity/shell/application/tst_Application.qml'
233--- test/qmltest/unity/shell/application/tst_Application.qml 2015-12-03 17:07:15 +0000
234+++ test/qmltest/unity/shell/application/tst_Application.qml 2016-05-16 18:05:24 +0000
235@@ -114,6 +114,7 @@
236 { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" },
237 { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" },
238 { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" },
239+ { tag: "ApplicationManager.methods[approveApplicationStart]", method: "approveApplicationStart" },
240 { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" },
241 ];
242 }
243
244=== modified file 'test/qmltest/unity/shell/launcher/tst_Launcher.qml'
245--- test/qmltest/unity/shell/launcher/tst_Launcher.qml 2015-06-19 16:13:00 +0000
246+++ test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-05-16 18:05:24 +0000
247@@ -88,6 +88,7 @@
248 { tag: "Model.roles[countVisible]", role: "countVisible", type: "boolean" },
249 { tag: "Model.roles[focused]", role: "focused", type: "boolean" },
250 { tag: "Model.roles[alerting]", role: "alerting", type: "boolean" },
251+ { tag: "Model.roles[isTouchApp]", role: "isTouchApp", type: "boolean" },
252 ];
253 }
254
255@@ -146,6 +147,7 @@
256 { tag: "Item.properties[countVisible]", property: "countVisible", type: "boolean" },
257 { tag: "Item.properties[focused]", property: "focused", type: "boolean" },
258 { tag: "Item.properties[alerting]", property: "alerting", type: "boolean" },
259+ { tag: "Item.properties[isTouchApp]", property: "isTouchApp", type: "boolean" },
260 { tag: "Item.properties[quickList]", constant: "quickList", type: "object" },
261 ];
262 }

Subscribers

People subscribed via source and target branches

to all changes: