Merge lp:~aacid/unity8/dash_activation_no_special_casing into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 1859
Merged at revision: 1905
Proposed branch: lp:~aacid/unity8/dash_activation_no_special_casing
Merge into: lp:unity8
Diff against target: 275 lines (+71/-38)
10 files modified
debian/changelog (+6/-0)
debian/control (+2/-2)
qml/Dash/GenericScopeView.qml (+50/-26)
qml/Dash/PreviewListView.qml (+2/-1)
qml/Dash/ScopesList.qml (+1/-1)
tests/mocks/Unity/CMakeLists.txt (+1/-1)
tests/mocks/Unity/fake_scope.cpp (+5/-3)
tests/mocks/Unity/fake_scope.h (+2/-2)
tests/mocks/Unity/fake_scopesoverview.cpp (+1/-1)
tests/mocks/Unity/fake_scopesoverview.h (+1/-1)
To merge this branch: bzr merge lp:~aacid/unity8/dash_activation_no_special_casing
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+264024@code.launchpad.net

Commit message

Let the scopes/scopes-plugin-shell take care of activates that are previews

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
https://code.launchpad.net/~stolowski/unity-api/activation-iface-change/+merge/264115

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not needed

 * If you changed the UI, has there been a design review?
N/A

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

 * Did you perform an exploratory manual test run of the code change and any related functionality?
yes
 * Did CI run pass? If not, please explain why.
unrelated
 * Did you make sure that the branch does not contain spurious tags?
y

review: Approve
Revision history for this message
Paweł Stołowski (stolowski) wrote :

+1

review: Approve

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 2015-07-29 12:39:01 +0000
3+++ debian/changelog 2015-08-06 13:06:28 +0000
4@@ -1,3 +1,9 @@
5+unity8 (8.11-0ubuntu1) UNRELEASED; urgency=medium
6+
7+ * Increase version because of new scopes shell communication protocol
8+
9+ -- Albert Astals Cid <albert.astals@canonical.com> Tue, 04 Aug 2015 17:16:32 +0200
10+
11 unity8 (8.10+15.10.20150729-0ubuntu1) wily; urgency=medium
12
13 [ CI Train Bot ]
14
15=== modified file 'debian/control'
16--- debian/control 2015-07-29 12:38:53 +0000
17+++ debian/control 2015-08-06 13:06:28 +0000
18@@ -28,7 +28,7 @@
19 libqt5xmlpatterns5-dev,
20 libsystemsettings-dev,
21 libudev-dev,
22- libunity-api-dev (>= 7.98),
23+ libunity-api-dev (>= 7.99),
24 libusermetricsoutput1-dev,
25 libxcb1-dev,
26 pkg-config,
27@@ -128,7 +128,7 @@
28 unity-application-impl-6,
29 unity-notifications-impl-3,
30 unity-plugin-scopes | unity-scopes-impl,
31- unity-scopes-impl-6,
32+ unity-scopes-impl-7,
33 unity8-fake-env | unity-application-impl,
34 ${misc:Depends},
35 Breaks: unity8 (<< 7.86),
36
37=== modified file 'qml/Dash/GenericScopeView.qml'
38--- qml/Dash/GenericScopeView.qml 2015-07-20 07:38:41 +0000
39+++ qml/Dash/GenericScopeView.qml 2015-08-06 13:06:28 +0000
40@@ -72,28 +72,39 @@
41 pageHeaderLoader.item.resetSearch()
42 }
43
44- function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
45- if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope" || (scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {
46- // TODO Technically it is possible that calling activate() will make the scope emit
47- // previewRequested so that we show a preview but there's no scope that does that yet
48- // so it's not implemented
49- scope.activate(result)
50- } else {
51- if (scope.preview(result)) {
52- openPreview(index, resultsModel, limitedCategoryItemCount);
53- }
54- }
55- }
56-
57- function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
58- if (itemModel.uri.indexOf("scope://") !== 0 && !(scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {
59- if (scope.preview(result)) {
60- openPreview(index, resultsModel, limitedCategoryItemCount);
61- }
62- }
63- }
64-
65- function openPreview(index, resultsModel, limitedCategoryItemCount) {
66+ property var maybePreviewResult;
67+ property int maybePreviewIndex;
68+ property var maybePreviewResultsModel;
69+ property int maybePreviewLimitedCategoryItemCount;
70+ property string maybePreviewCategoryId;
71+
72+ function clearMaybePreviewData() {
73+ scopeView.maybePreviewResult = undefined;
74+ scopeView.maybePreviewIndex = -1;
75+ scopeView.maybePreviewResultsModel = undefined;
76+ scopeView.maybePreviewLimitedCategoryItemCount = -1;
77+ scopeView.maybePreviewCategoryId = "";
78+ }
79+
80+ function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
81+ scopeView.maybePreviewResult = result;
82+ scopeView.maybePreviewIndex = index;
83+ scopeView.maybePreviewResultsModel = resultsModel;
84+ scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
85+ scopeView.maybePreviewCategoryId = categoryId;
86+
87+ scope.activate(result, categoryId);
88+ }
89+
90+ function itemPressedAndHeld(index, result, resultsModel, limitedCategoryItemCount, categoryId) {
91+ clearMaybePreviewData();
92+
93+ if (scope.preview(result, categoryId)) {
94+ openPreview(index, resultsModel, limitedCategoryItemCount, categoryId);
95+ }
96+ }
97+
98+ function openPreview(index, resultsModel, limitedCategoryItemCount, categoryId) {
99 if (limitedCategoryItemCount > 0) {
100 previewLimitModel.model = resultsModel;
101 previewLimitModel.limit = limitedCategoryItemCount;
102@@ -103,6 +114,7 @@
103 }
104 subPageLoader.initialIndex = -1;
105 subPageLoader.initialIndex = index;
106+ subPageLoader.categoryId = categoryId;
107 subPageLoader.openSubPage("preview");
108 }
109
110@@ -149,6 +161,16 @@
111 target: scopeView.scope
112 onShowDash: subPageLoader.closeSubPage()
113 onHideDash: subPageLoader.closeSubPage()
114+ onPreviewRequested: { // (QVariant const& result)
115+ if (result === scopeView.maybePreviewResult) {
116+ openPreview(scopeView.maybePreviewIndex,
117+ scopeView.maybePreviewResultsModel,
118+ scopeView.maybePreviewLimitedCategoryItemCount,
119+ scopeView.maybePreviewCategoryId);
120+
121+ clearMaybePreviewData();
122+ }
123+ }
124 }
125
126 Connections {
127@@ -357,12 +379,12 @@
128
129 Connections {
130 target: rendererLoader.item
131- onClicked: {
132- scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount(), baseItem.category);
133+ onClicked: { // (int index, var result, var item, var itemModel)
134+ scopeView.itemClicked(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
135 }
136
137- onPressAndHold: {
138- scopeView.itemPressedAndHeld(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
139+ onPressAndHold: { // (int index, var result, var itemModel)
140+ scopeView.itemPressedAndHeld(index, result, target.model, categoryItemCount(), baseItem.category);
141 }
142
143 function categoryItemCount() {
144@@ -736,6 +758,7 @@
145 property var scope: scopeView.scope
146 property var scopeStyle: scopeView.scopeStyle
147 property int initialIndex: -1
148+ property string categoryId
149 property var model: null
150
151 readonly property bool processing: item && item.processing || false
152@@ -767,6 +790,7 @@
153 item.open = Qt.binding(function() { return subPageLoader.open; } )
154 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
155 item.model = Qt.binding(function() { return subPageLoader.model; } )
156+ item.categoryId = Qt.binding(function() { return subPageLoader.categoryId; } )
157 }
158 open = true;
159 }
160
161=== modified file 'qml/Dash/PreviewListView.qml'
162--- qml/Dash/PreviewListView.qml 2014-10-23 11:59:22 +0000
163+++ qml/Dash/PreviewListView.qml 2015-08-06 13:06:28 +0000
164@@ -26,6 +26,7 @@
165 property int initialIndex: -1
166 property var scope: null
167 property var scopeStyle: null
168+ property string categoryId
169
170 property alias showSignatureLine: header.showSignatureLine
171
172@@ -99,7 +100,7 @@
173 isCurrent: ListView.isCurrentItem
174
175 previewModel: {
176- var previewStack = root.scope.preview(result);
177+ var previewStack = root.scope.preview(result, root.categoryId);
178 return previewStack.getPreviewModel(0);
179 }
180 scopeStyle: root.scopeStyle
181
182=== modified file 'qml/Dash/ScopesList.qml'
183--- qml/Dash/ScopesList.qml 2015-04-24 07:33:59 +0000
184+++ qml/Dash/ScopesList.qml 2015-08-06 13:06:28 +0000
185@@ -124,7 +124,7 @@
186 onRequestFavorite: root.requestFavorite(scopeId, favorite);
187 onRequestEditMode: root.state = "edit";
188 onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);
189- onRequestActivate: root.scope.activate(result);
190+ onRequestActivate: root.scope.activate(result, categoryId);
191 onRequestRestore: root.requestRestore(scopeId);
192 }
193 }
194
195=== modified file 'tests/mocks/Unity/CMakeLists.txt'
196--- tests/mocks/Unity/CMakeLists.txt 2015-06-23 13:56:06 +0000
197+++ tests/mocks/Unity/CMakeLists.txt 2015-08-06 13:06:28 +0000
198@@ -7,7 +7,7 @@
199 add_subdirectory(DashCommunicator)
200
201 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
202-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=6)
203+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=7)
204
205 include_directories(
206 ${CMAKE_CURRENT_BINARY_DIR}
207
208=== modified file 'tests/mocks/Unity/fake_scope.cpp'
209--- tests/mocks/Unity/fake_scope.cpp 2015-04-09 13:59:41 +0000
210+++ tests/mocks/Unity/fake_scope.cpp 2015-08-06 13:06:28 +0000
211@@ -181,18 +181,20 @@
212 }
213 }
214
215-void Scope::activate(QVariant const& result)
216+void Scope::activate(QVariant const& result, QString const& categoryId)
217 {
218- qDebug() << "Called activate on scope" << m_id << "with result" << result;
219+ qDebug() << "Called activate on scope" << m_id << "with result" << result << "and category" << categoryId;
220 if (result.toString() == "Result.2.2") {
221 Scopes *scopes = dynamic_cast<Scopes*>(parent());
222 m_openScope = scopes->getScopeFromAll("MockScope9");
223 scopes->addTempScope(m_openScope);
224 Q_EMIT openScope(m_openScope);
225+ } else {
226+ Q_EMIT previewRequested(result);
227 }
228 }
229
230-PreviewStack* Scope::preview(QVariant const& result)
231+PreviewStack* Scope::preview(QVariant const& result, QString const& /*categoryId*/)
232 {
233 Q_UNUSED(result);
234
235
236=== modified file 'tests/mocks/Unity/fake_scope.h'
237--- tests/mocks/Unity/fake_scope.h 2015-03-27 12:30:24 +0000
238+++ tests/mocks/Unity/fake_scope.h 2015-08-06 13:06:28 +0000
239@@ -60,8 +60,8 @@
240 Q_INVOKABLE void setName(const QString &name); // This is not invokable in the Interface, here for testing benefits
241 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
242
243- Q_INVOKABLE void activate(QVariant const& result) override;
244- Q_INVOKABLE PreviewStack* preview(QVariant const& result) override;
245+ Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
246+ Q_INVOKABLE PreviewStack* preview(QVariant const& result, QString const& categoryId) override;
247 Q_INVOKABLE void cancelActivation() override;
248 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
249
250
251=== modified file 'tests/mocks/Unity/fake_scopesoverview.cpp'
252--- tests/mocks/Unity/fake_scopesoverview.cpp 2015-02-12 10:33:05 +0000
253+++ tests/mocks/Unity/fake_scopesoverview.cpp 2015-08-06 13:06:28 +0000
254@@ -41,7 +41,7 @@
255 Q_EMIT categoriesChanged();
256 }
257
258-Q_INVOKABLE void ScopesOverview::activate(QVariant const& result)
259+Q_INVOKABLE void ScopesOverview::activate(QVariant const& result, QString const& /*categoryId*/)
260 {
261 Scopes *scopes = dynamic_cast<Scopes*>(parent());
262 if (scopes->getScope(result.toString())) {
263
264=== modified file 'tests/mocks/Unity/fake_scopesoverview.h'
265--- tests/mocks/Unity/fake_scopesoverview.h 2014-09-26 11:21:19 +0000
266+++ tests/mocks/Unity/fake_scopesoverview.h 2015-08-06 13:06:28 +0000
267@@ -32,7 +32,7 @@
268 ScopesOverview(Scopes* parent = 0);
269
270 void setSearchQuery(const QString& search_query) override;
271- Q_INVOKABLE void activate(QVariant const& result) override;
272+ Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
273
274 // This is implementation detail
275 void setFavorite(Scope *scope, bool favorite);

Subscribers

People subscribed via source and target branches