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
=== modified file 'debian/changelog'
--- debian/changelog 2015-07-29 12:39:01 +0000
+++ debian/changelog 2015-08-06 13:06:28 +0000
@@ -1,3 +1,9 @@
1unity8 (8.11-0ubuntu1) UNRELEASED; urgency=medium
2
3 * Increase version because of new scopes shell communication protocol
4
5 -- Albert Astals Cid <albert.astals@canonical.com> Tue, 04 Aug 2015 17:16:32 +0200
6
1unity8 (8.10+15.10.20150729-0ubuntu1) wily; urgency=medium7unity8 (8.10+15.10.20150729-0ubuntu1) wily; urgency=medium
28
3 [ CI Train Bot ]9 [ CI Train Bot ]
410
=== modified file 'debian/control'
--- debian/control 2015-07-29 12:38:53 +0000
+++ debian/control 2015-08-06 13:06:28 +0000
@@ -28,7 +28,7 @@
28 libqt5xmlpatterns5-dev,28 libqt5xmlpatterns5-dev,
29 libsystemsettings-dev,29 libsystemsettings-dev,
30 libudev-dev,30 libudev-dev,
31 libunity-api-dev (>= 7.98),31 libunity-api-dev (>= 7.99),
32 libusermetricsoutput1-dev,32 libusermetricsoutput1-dev,
33 libxcb1-dev,33 libxcb1-dev,
34 pkg-config,34 pkg-config,
@@ -128,7 +128,7 @@
128 unity-application-impl-6,128 unity-application-impl-6,
129 unity-notifications-impl-3,129 unity-notifications-impl-3,
130 unity-plugin-scopes | unity-scopes-impl,130 unity-plugin-scopes | unity-scopes-impl,
131 unity-scopes-impl-6,131 unity-scopes-impl-7,
132 unity8-fake-env | unity-application-impl,132 unity8-fake-env | unity-application-impl,
133 ${misc:Depends},133 ${misc:Depends},
134Breaks: unity8 (<< 7.86),134Breaks: unity8 (<< 7.86),
135135
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2015-07-20 07:38:41 +0000
+++ qml/Dash/GenericScopeView.qml 2015-08-06 13:06:28 +0000
@@ -72,28 +72,39 @@
72 pageHeaderLoader.item.resetSearch()72 pageHeaderLoader.item.resetSearch()
73 }73 }
7474
75 function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {75 property var maybePreviewResult;
76 if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope" || (scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {76 property int maybePreviewIndex;
77 // TODO Technically it is possible that calling activate() will make the scope emit77 property var maybePreviewResultsModel;
78 // previewRequested so that we show a preview but there's no scope that does that yet78 property int maybePreviewLimitedCategoryItemCount;
79 // so it's not implemented79 property string maybePreviewCategoryId;
80 scope.activate(result)80
81 } else {81 function clearMaybePreviewData() {
82 if (scope.preview(result)) {82 scopeView.maybePreviewResult = undefined;
83 openPreview(index, resultsModel, limitedCategoryItemCount);83 scopeView.maybePreviewIndex = -1;
84 }84 scopeView.maybePreviewResultsModel = undefined;
85 }85 scopeView.maybePreviewLimitedCategoryItemCount = -1;
86 }86 scopeView.maybePreviewCategoryId = "";
8787 }
88 function itemPressedAndHeld(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {88
89 if (itemModel.uri.indexOf("scope://") !== 0 && !(scope.id === "videoaggregator" && categoryId === "myvideos-getstarted")) {89 function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
90 if (scope.preview(result)) {90 scopeView.maybePreviewResult = result;
91 openPreview(index, resultsModel, limitedCategoryItemCount);91 scopeView.maybePreviewIndex = index;
92 }92 scopeView.maybePreviewResultsModel = resultsModel;
93 }93 scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
94 }94 scopeView.maybePreviewCategoryId = categoryId;
9595
96 function openPreview(index, resultsModel, limitedCategoryItemCount) {96 scope.activate(result, categoryId);
97 }
98
99 function itemPressedAndHeld(index, result, resultsModel, limitedCategoryItemCount, categoryId) {
100 clearMaybePreviewData();
101
102 if (scope.preview(result, categoryId)) {
103 openPreview(index, resultsModel, limitedCategoryItemCount, categoryId);
104 }
105 }
106
107 function openPreview(index, resultsModel, limitedCategoryItemCount, categoryId) {
97 if (limitedCategoryItemCount > 0) {108 if (limitedCategoryItemCount > 0) {
98 previewLimitModel.model = resultsModel;109 previewLimitModel.model = resultsModel;
99 previewLimitModel.limit = limitedCategoryItemCount;110 previewLimitModel.limit = limitedCategoryItemCount;
@@ -103,6 +114,7 @@
103 }114 }
104 subPageLoader.initialIndex = -1;115 subPageLoader.initialIndex = -1;
105 subPageLoader.initialIndex = index;116 subPageLoader.initialIndex = index;
117 subPageLoader.categoryId = categoryId;
106 subPageLoader.openSubPage("preview");118 subPageLoader.openSubPage("preview");
107 }119 }
108120
@@ -149,6 +161,16 @@
149 target: scopeView.scope161 target: scopeView.scope
150 onShowDash: subPageLoader.closeSubPage()162 onShowDash: subPageLoader.closeSubPage()
151 onHideDash: subPageLoader.closeSubPage()163 onHideDash: subPageLoader.closeSubPage()
164 onPreviewRequested: { // (QVariant const& result)
165 if (result === scopeView.maybePreviewResult) {
166 openPreview(scopeView.maybePreviewIndex,
167 scopeView.maybePreviewResultsModel,
168 scopeView.maybePreviewLimitedCategoryItemCount,
169 scopeView.maybePreviewCategoryId);
170
171 clearMaybePreviewData();
172 }
173 }
152 }174 }
153175
154 Connections {176 Connections {
@@ -357,12 +379,12 @@
357379
358 Connections {380 Connections {
359 target: rendererLoader.item381 target: rendererLoader.item
360 onClicked: {382 onClicked: { // (int index, var result, var item, var itemModel)
361 scopeView.itemClicked(index, result, item, itemModel, target.model, categoryItemCount(), baseItem.category);383 scopeView.itemClicked(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
362 }384 }
363385
364 onPressAndHold: {386 onPressAndHold: { // (int index, var result, var itemModel)
365 scopeView.itemPressedAndHeld(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);387 scopeView.itemPressedAndHeld(index, result, target.model, categoryItemCount(), baseItem.category);
366 }388 }
367389
368 function categoryItemCount() {390 function categoryItemCount() {
@@ -736,6 +758,7 @@
736 property var scope: scopeView.scope758 property var scope: scopeView.scope
737 property var scopeStyle: scopeView.scopeStyle759 property var scopeStyle: scopeView.scopeStyle
738 property int initialIndex: -1760 property int initialIndex: -1
761 property string categoryId
739 property var model: null762 property var model: null
740763
741 readonly property bool processing: item && item.processing || false764 readonly property bool processing: item && item.processing || false
@@ -767,6 +790,7 @@
767 item.open = Qt.binding(function() { return subPageLoader.open; } )790 item.open = Qt.binding(function() { return subPageLoader.open; } )
768 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )791 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
769 item.model = Qt.binding(function() { return subPageLoader.model; } )792 item.model = Qt.binding(function() { return subPageLoader.model; } )
793 item.categoryId = Qt.binding(function() { return subPageLoader.categoryId; } )
770 }794 }
771 open = true;795 open = true;
772 }796 }
773797
=== modified file 'qml/Dash/PreviewListView.qml'
--- qml/Dash/PreviewListView.qml 2014-10-23 11:59:22 +0000
+++ qml/Dash/PreviewListView.qml 2015-08-06 13:06:28 +0000
@@ -26,6 +26,7 @@
26 property int initialIndex: -126 property int initialIndex: -1
27 property var scope: null27 property var scope: null
28 property var scopeStyle: null28 property var scopeStyle: null
29 property string categoryId
2930
30 property alias showSignatureLine: header.showSignatureLine31 property alias showSignatureLine: header.showSignatureLine
3132
@@ -99,7 +100,7 @@
99 isCurrent: ListView.isCurrentItem100 isCurrent: ListView.isCurrentItem
100101
101 previewModel: {102 previewModel: {
102 var previewStack = root.scope.preview(result);103 var previewStack = root.scope.preview(result, root.categoryId);
103 return previewStack.getPreviewModel(0);104 return previewStack.getPreviewModel(0);
104 }105 }
105 scopeStyle: root.scopeStyle106 scopeStyle: root.scopeStyle
106107
=== modified file 'qml/Dash/ScopesList.qml'
--- qml/Dash/ScopesList.qml 2015-04-24 07:33:59 +0000
+++ qml/Dash/ScopesList.qml 2015-08-06 13:06:28 +0000
@@ -124,7 +124,7 @@
124 onRequestFavorite: root.requestFavorite(scopeId, favorite);124 onRequestFavorite: root.requestFavorite(scopeId, favorite);
125 onRequestEditMode: root.state = "edit";125 onRequestEditMode: root.state = "edit";
126 onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);126 onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);
127 onRequestActivate: root.scope.activate(result);127 onRequestActivate: root.scope.activate(result, categoryId);
128 onRequestRestore: root.requestRestore(scopeId);128 onRequestRestore: root.requestRestore(scopeId);
129 }129 }
130 }130 }
131131
=== modified file 'tests/mocks/Unity/CMakeLists.txt'
--- tests/mocks/Unity/CMakeLists.txt 2015-06-23 13:56:06 +0000
+++ tests/mocks/Unity/CMakeLists.txt 2015-08-06 13:06:28 +0000
@@ -7,7 +7,7 @@
7add_subdirectory(DashCommunicator)7add_subdirectory(DashCommunicator)
88
9pkg_search_module(GOBJECT gobject-2.0 REQUIRED)9pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
10pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=6)10pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=7)
1111
12include_directories(12include_directories(
13 ${CMAKE_CURRENT_BINARY_DIR}13 ${CMAKE_CURRENT_BINARY_DIR}
1414
=== modified file 'tests/mocks/Unity/fake_scope.cpp'
--- tests/mocks/Unity/fake_scope.cpp 2015-04-09 13:59:41 +0000
+++ tests/mocks/Unity/fake_scope.cpp 2015-08-06 13:06:28 +0000
@@ -181,18 +181,20 @@
181 }181 }
182}182}
183183
184void Scope::activate(QVariant const& result)184void Scope::activate(QVariant const& result, QString const& categoryId)
185{185{
186 qDebug() << "Called activate on scope" << m_id << "with result" << result;186 qDebug() << "Called activate on scope" << m_id << "with result" << result << "and category" << categoryId;
187 if (result.toString() == "Result.2.2") {187 if (result.toString() == "Result.2.2") {
188 Scopes *scopes = dynamic_cast<Scopes*>(parent());188 Scopes *scopes = dynamic_cast<Scopes*>(parent());
189 m_openScope = scopes->getScopeFromAll("MockScope9");189 m_openScope = scopes->getScopeFromAll("MockScope9");
190 scopes->addTempScope(m_openScope);190 scopes->addTempScope(m_openScope);
191 Q_EMIT openScope(m_openScope);191 Q_EMIT openScope(m_openScope);
192 } else {
193 Q_EMIT previewRequested(result);
192 }194 }
193}195}
194196
195PreviewStack* Scope::preview(QVariant const& result)197PreviewStack* Scope::preview(QVariant const& result, QString const& /*categoryId*/)
196{198{
197 Q_UNUSED(result);199 Q_UNUSED(result);
198200
199201
=== modified file 'tests/mocks/Unity/fake_scope.h'
--- tests/mocks/Unity/fake_scope.h 2015-03-27 12:30:24 +0000
+++ tests/mocks/Unity/fake_scope.h 2015-08-06 13:06:28 +0000
@@ -60,8 +60,8 @@
60 Q_INVOKABLE void setName(const QString &name); // This is not invokable in the Interface, here for testing benefits60 Q_INVOKABLE void setName(const QString &name); // This is not invokable in the Interface, here for testing benefits
61 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits61 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
6262
63 Q_INVOKABLE void activate(QVariant const& result) override;63 Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
64 Q_INVOKABLE PreviewStack* preview(QVariant const& result) override;64 Q_INVOKABLE PreviewStack* preview(QVariant const& result, QString const& categoryId) override;
65 Q_INVOKABLE void cancelActivation() override;65 Q_INVOKABLE void cancelActivation() override;
66 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;66 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
6767
6868
=== modified file 'tests/mocks/Unity/fake_scopesoverview.cpp'
--- tests/mocks/Unity/fake_scopesoverview.cpp 2015-02-12 10:33:05 +0000
+++ tests/mocks/Unity/fake_scopesoverview.cpp 2015-08-06 13:06:28 +0000
@@ -41,7 +41,7 @@
41 Q_EMIT categoriesChanged();41 Q_EMIT categoriesChanged();
42}42}
4343
44Q_INVOKABLE void ScopesOverview::activate(QVariant const& result)44Q_INVOKABLE void ScopesOverview::activate(QVariant const& result, QString const& /*categoryId*/)
45{45{
46 Scopes *scopes = dynamic_cast<Scopes*>(parent());46 Scopes *scopes = dynamic_cast<Scopes*>(parent());
47 if (scopes->getScope(result.toString())) {47 if (scopes->getScope(result.toString())) {
4848
=== modified file 'tests/mocks/Unity/fake_scopesoverview.h'
--- tests/mocks/Unity/fake_scopesoverview.h 2014-09-26 11:21:19 +0000
+++ tests/mocks/Unity/fake_scopesoverview.h 2015-08-06 13:06:28 +0000
@@ -32,7 +32,7 @@
32 ScopesOverview(Scopes* parent = 0);32 ScopesOverview(Scopes* parent = 0);
3333
34 void setSearchQuery(const QString& search_query) override;34 void setSearchQuery(const QString& search_query) override;
35 Q_INVOKABLE void activate(QVariant const& result) override;35 Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
3636
37 // This is implementation detail37 // This is implementation detail
38 void setFavorite(Scope *scope, bool favorite);38 void setFavorite(Scope *scope, bool favorite);

Subscribers

People subscribed via source and target branches