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

Proposed by Michael Terry
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
Gerry Boland (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
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.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~mterry/unity-api/warn-on-xapp updated
196. By Michael Terry

Add new ApplicationManager methods for approving an interface

197. By Michael Terry

Merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
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

Revision history for this message
Gerry Boland (gerboland) :
review: Needs Fixing
Revision history for this message
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
198. By Michael Terry

Merge from trunk

199. By Michael Terry

Fix documentation nit from review

200. By Michael Terry

Fix changelog/version

Unmerged revisions

200. By Michael Terry

Fix changelog/version

199. By Michael Terry

Fix documentation nit from review

198. By Michael Terry

Merge from trunk

197. By Michael Terry

Merge from trunk

196. By Michael Terry

Add new ApplicationManager methods for approving an interface

195. By Michael Terry

Add isTouchApp to LauncherItemInterface

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2016-04-26 15:31:50 +0000
+++ debian/changelog 2016-05-16 18:05:24 +0000
@@ -1,3 +1,10 @@
1unity-api (7.112) UNRELEASED; urgency=medium
2
3 * Add isTouchApp to LauncherItemInterface
4 * Add approveApplicationStart to ApplicationManagerInterface
5
6 -- Michael Terry <mterry@ubuntu.com> Mon, 09 Nov 2015 16:57:25 -0500
7
1unity-api (7.111+16.04.20160426.2-0ubuntu1) xenial; urgency=medium8unity-api (7.111+16.04.20160426.2-0ubuntu1) xenial; urgency=medium
29
3 [ Pawel Stolowski ]10 [ Pawel Stolowski ]
411
=== modified file 'include/unity/shell/application/ApplicationManagerInterface.h'
--- include/unity/shell/application/ApplicationManagerInterface.h 2016-04-13 16:47:27 +0000
+++ include/unity/shell/application/ApplicationManagerInterface.h 2016-05-16 18:05:24 +0000
@@ -156,6 +156,15 @@
156 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) = 0;156 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) = 0;
157157
158 /**158 /**
159 * @brief Allow (or not) an application to start.
160 *
161 * @param appId The appId for the application to allow.
162 * @param approved Whether the application is allowed or not.
163 * @returns True if application approval was successful, else false.
164 */
165 Q_INVOKABLE virtual bool approveApplicationStart(const QString &appId, bool approved) = 0;
166
167 /**
159 * @brief Stops an application.168 * @brief Stops an application.
160 *169 *
161 * @param appId The application to be stopped.170 * @param appId The application to be stopped.
@@ -177,6 +186,16 @@
177 void focusRequested(const QString &appId);186 void focusRequested(const QString &appId);
178187
179 /**188 /**
189 * @brief Will be emitted when an application wants to start.
190 *
191 * This can be used to approve or deny the application with
192 * approveApplicationStart(). For example, maybe an application requires
193 * further permission. Or an application can't start right now because
194 * the device is in the wrong mode (phone vs desktop).
195 */
196 void applicationStartApprovalRequested(const QString &appId);
197
198 /**
180 * @brief Will be emitted whenever the focused application changes.199 * @brief Will be emitted whenever the focused application changes.
181 */200 */
182 void focusedApplicationIdChanged();201 void focusedApplicationIdChanged();
183202
=== modified file 'include/unity/shell/application/CMakeLists.txt'
--- include/unity/shell/application/CMakeLists.txt 2016-04-13 16:40:06 +0000
+++ include/unity/shell/application/CMakeLists.txt 2016-05-16 18:05:24 +0000
@@ -7,7 +7,7 @@
77
8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
99
10set(VERSION 15)10set(VERSION 16)
11set(PKGCONFIG_NAME "unity-shell-application")11set(PKGCONFIG_NAME "unity-shell-application")
12set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs")12set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs")
13set(PKGCONFIG_REQUIRES "Qt5Core")13set(PKGCONFIG_REQUIRES "Qt5Core")
1414
=== modified file 'include/unity/shell/launcher/CMakeLists.txt'
--- include/unity/shell/launcher/CMakeLists.txt 2015-06-19 16:13:00 +0000
+++ include/unity/shell/launcher/CMakeLists.txt 2016-05-16 18:05:24 +0000
@@ -7,7 +7,7 @@
77
8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)8set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE)
99
10set(VERSION 7)10set(VERSION 8)
11set(PKGCONFIG_NAME "unity-shell-launcher")11set(PKGCONFIG_NAME "unity-shell-launcher")
12set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs")12set(PKGCONFIG_DESCRIPTION "Unity shell Launcher APIs")
13set(PKGCONFIG_REQUIRES "Qt5Core")13set(PKGCONFIG_REQUIRES "Qt5Core")
1414
=== modified file 'include/unity/shell/launcher/LauncherItemInterface.h'
--- include/unity/shell/launcher/LauncherItemInterface.h 2015-06-12 11:06:29 +0000
+++ include/unity/shell/launcher/LauncherItemInterface.h 2016-05-16 18:05:24 +0000
@@ -112,6 +112,11 @@
112 Q_PROPERTY(bool alerting READ alerting NOTIFY alertingChanged)112 Q_PROPERTY(bool alerting READ alerting NOTIFY alertingChanged)
113113
114 /**114 /**
115 * @brief Whether the application is designed for Ubuntu Touch
116 */
117 Q_PROPERTY(bool isTouchApp READ isTouchApp NOTIFY isTouchAppChanged)
118
119 /**
115 * @brief The quick list menu contents for the item120 * @brief The quick list menu contents for the item
116 *121 *
117 * Items can have a quick list menu. This property holds a model for122 * Items can have a quick list menu. This property holds a model for
@@ -138,6 +143,7 @@
138 virtual bool countVisible() const = 0;143 virtual bool countVisible() const = 0;
139 virtual bool focused() const = 0;144 virtual bool focused() const = 0;
140 virtual bool alerting() const = 0;145 virtual bool alerting() const = 0;
146 virtual bool isTouchApp() const = 0;
141 virtual unity::shell::launcher::QuickListModelInterface *quickList() const = 0;147 virtual unity::shell::launcher::QuickListModelInterface *quickList() const = 0;
142148
143Q_SIGNALS:149Q_SIGNALS:
@@ -151,6 +157,7 @@
151 void countVisibleChanged(bool countVisible);157 void countVisibleChanged(bool countVisible);
152 void focusedChanged(bool focused);158 void focusedChanged(bool focused);
153 void alertingChanged(bool alerting);159 void alertingChanged(bool alerting);
160 void isTouchAppChanged(bool isTouchApp);
154 /// @endcond161 /// @endcond
155};162};
156163
157164
=== modified file 'include/unity/shell/launcher/LauncherModelInterface.h'
--- include/unity/shell/launcher/LauncherModelInterface.h 2015-06-19 16:13:00 +0000
+++ include/unity/shell/launcher/LauncherModelInterface.h 2016-05-16 18:05:24 +0000
@@ -73,6 +73,7 @@
73 m_roleNames.insert(RoleCountVisible, "countVisible");73 m_roleNames.insert(RoleCountVisible, "countVisible");
74 m_roleNames.insert(RoleFocused, "focused");74 m_roleNames.insert(RoleFocused, "focused");
75 m_roleNames.insert(RoleAlerting, "alerting");75 m_roleNames.insert(RoleAlerting, "alerting");
76 m_roleNames.insert(RoleIsTouchApp, "isTouchApp");
76 }77 }
77 /// @endcond78 /// @endcond
7879
@@ -93,7 +94,8 @@
93 RoleCount,94 RoleCount,
94 RoleCountVisible,95 RoleCountVisible,
95 RoleFocused,96 RoleFocused,
96 RoleAlerting97 RoleAlerting,
98 RoleIsTouchApp
97 };99 };
98100
99 virtual ~LauncherModelInterface() {}101 virtual ~LauncherModelInterface() {}
100102
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2015-12-03 17:07:15 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2016-05-16 18:05:24 +0000
@@ -125,6 +125,13 @@
125 return item;125 return item;
126}126}
127127
128bool MockApplicationManager::approveApplicationStart(const QString &appId, bool approved)
129{
130 Q_UNUSED(appId)
131 Q_UNUSED(approved)
132 return true;
133}
134
128bool MockApplicationManager::stopApplication(const QString &appId)135bool MockApplicationManager::stopApplication(const QString &appId)
129{136{
130 Q_UNUSED(appId)137 Q_UNUSED(appId)
131138
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2015-06-19 12:02:05 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2016-05-16 18:05:24 +0000
@@ -52,6 +52,8 @@
5252
53 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments);53 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments);
5454
55 Q_INVOKABLE bool approveApplicationStart(const QString &appId, bool approved);
56
55 Q_INVOKABLE bool stopApplication(const QString &appId);57 Q_INVOKABLE bool stopApplication(const QString &appId);
5658
57private:59private:
5860
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2015-06-18 17:03:45 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.cpp 2016-05-16 18:05:24 +0000
@@ -35,6 +35,7 @@
35 m_count(8),35 m_count(8),
36 m_countVisible(false),36 m_countVisible(false),
37 m_alerting(false),37 m_alerting(false),
38 m_isTouchApp(false),
38 m_quickListModel(new MockQuickListModel(this))39 m_quickListModel(new MockQuickListModel(this))
39{40{
4041
@@ -172,6 +173,20 @@
172 }173 }
173}174}
174175
176bool MockLauncherItem::isTouchApp() const
177{
178 return m_isTouchApp;
179}
180
181void MockLauncherItem::setIsTouchApp(bool isTouchApp)
182{
183 if (m_isTouchApp != isTouchApp)
184 {
185 m_isTouchApp = isTouchApp;
186 Q_EMIT isTouchAppChanged(isTouchApp);
187 }
188}
189
175QuickListModelInterface *MockLauncherItem::quickList() const190QuickListModelInterface *MockLauncherItem::quickList() const
176{191{
177 return m_quickListModel;192 return m_quickListModel;
178193
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2015-06-02 13:52:49 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherItem.h 2016-05-16 18:05:24 +0000
@@ -59,6 +59,9 @@
59 bool alerting() const;59 bool alerting() const;
60 void setAlerting(bool alerting);60 void setAlerting(bool alerting);
6161
62 bool isTouchApp() const;
63 void setIsTouchApp(bool isTouchApp);
64
62 unity::shell::launcher::QuickListModelInterface *quickList() const;65 unity::shell::launcher::QuickListModelInterface *quickList() const;
6366
64private:67private:
@@ -74,6 +77,7 @@
74 bool m_countVisible;77 bool m_countVisible;
75 bool m_focused;78 bool m_focused;
76 bool m_alerting;79 bool m_alerting;
80 bool m_isTouchApp;
77 QuickListModelInterface *m_quickListModel;81 QuickListModelInterface *m_quickListModel;
78};82};
7983
8084
=== modified file 'test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp'
--- test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp 2015-06-19 16:13:00 +0000
+++ test/qmltest/mocks/plugins/Unity/Launcher/Mocks/MockLauncherModel.cpp 2016-05-16 18:05:24 +0000
@@ -90,6 +90,8 @@
90 return item->focused();90 return item->focused();
91 case RoleAlerting:91 case RoleAlerting:
92 return item->alerting();92 return item->alerting();
93 case RoleIsTouchApp:
94 return item->isTouchApp();
93 }95 }
9496
95 return QVariant();97 return QVariant();
9698
=== modified file 'test/qmltest/unity/shell/application/tst_Application.qml'
--- test/qmltest/unity/shell/application/tst_Application.qml 2015-12-03 17:07:15 +0000
+++ test/qmltest/unity/shell/application/tst_Application.qml 2016-05-16 18:05:24 +0000
@@ -114,6 +114,7 @@
114 { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" },114 { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" },
115 { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" },115 { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" },
116 { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" },116 { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" },
117 { tag: "ApplicationManager.methods[approveApplicationStart]", method: "approveApplicationStart" },
117 { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" },118 { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" },
118 ];119 ];
119 }120 }
120121
=== modified file 'test/qmltest/unity/shell/launcher/tst_Launcher.qml'
--- test/qmltest/unity/shell/launcher/tst_Launcher.qml 2015-06-19 16:13:00 +0000
+++ test/qmltest/unity/shell/launcher/tst_Launcher.qml 2016-05-16 18:05:24 +0000
@@ -88,6 +88,7 @@
88 { tag: "Model.roles[countVisible]", role: "countVisible", type: "boolean" },88 { tag: "Model.roles[countVisible]", role: "countVisible", type: "boolean" },
89 { tag: "Model.roles[focused]", role: "focused", type: "boolean" },89 { tag: "Model.roles[focused]", role: "focused", type: "boolean" },
90 { tag: "Model.roles[alerting]", role: "alerting", type: "boolean" },90 { tag: "Model.roles[alerting]", role: "alerting", type: "boolean" },
91 { tag: "Model.roles[isTouchApp]", role: "isTouchApp", type: "boolean" },
91 ];92 ];
92 }93 }
9394
@@ -146,6 +147,7 @@
146 { tag: "Item.properties[countVisible]", property: "countVisible", type: "boolean" },147 { tag: "Item.properties[countVisible]", property: "countVisible", type: "boolean" },
147 { tag: "Item.properties[focused]", property: "focused", type: "boolean" },148 { tag: "Item.properties[focused]", property: "focused", type: "boolean" },
148 { tag: "Item.properties[alerting]", property: "alerting", type: "boolean" },149 { tag: "Item.properties[alerting]", property: "alerting", type: "boolean" },
150 { tag: "Item.properties[isTouchApp]", property: "isTouchApp", type: "boolean" },
149 { tag: "Item.properties[quickList]", constant: "quickList", type: "object" },151 { tag: "Item.properties[quickList]", constant: "quickList", type: "object" },
150 ];152 ];
151 }153 }

Subscribers

People subscribed via source and target branches

to all changes: