Merge lp:~stolowski/unity-scopes-shell/reset-user-data into lp:unity-scopes-shell

Proposed by Paweł Stołowski
Status: Merged
Approved by: Marcus Tomlinson
Approved revision: 210
Merged at revision: 210
Proposed branch: lp:~stolowski/unity-scopes-shell/reset-user-data
Merge into: lp:unity-scopes-shell
Prerequisite: lp:~stolowski/unity-scopes-shell/fix-1335761
Diff against target: 41 lines (+12/-1)
2 files modified
src/Unity/scope.cpp (+11/-1)
src/Unity/scope.h (+1/-0)
To merge this branch: bzr merge lp:~stolowski/unity-scopes-shell/reset-user-data
Reviewer Review Type Date Requested Status
Marcus Tomlinson (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+257739@code.launchpad.net

This proposal supersedes a proposal from 2015-04-29.

Commit message

Reset user data set with previously executed canned query when shell calls setSearchQuery() (i.e.user typed a new search).

Description of the change

Reset user data set with previously executed canned query when shell calls setSearchQuery() (i.e.user typed a new search). Keeping the previous value and sending it again with new search (which is a user input, so no side-channel data should exists) is a bug that can confuse scopes.

To post a comment you must log in.
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote : Posted in a previous version of this proposal

Indeed

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Re-approving

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Unity/scope.cpp'
2--- src/Unity/scope.cpp 2015-04-29 11:43:20 +0000
3+++ src/Unity/scope.cpp 2015-04-29 11:43:20 +0000
4@@ -267,7 +267,7 @@
5 {
6 m_queryUserData.reset(nullptr);
7 }
8- setSearchQuery(QString::fromStdString(query.query_string()));
9+ setSearchQueryString(QString::fromStdString(query.query_string()));
10 }
11
12 void Scope::executeCannedQuery(unity::scopes::CannedQuery const& query, bool allowDelayedActivation)
13@@ -1033,6 +1033,16 @@
14
15 void Scope::setSearchQuery(const QString& search_query)
16 {
17+ // this method is called by the shell when user types in search string,
18+ // it needs to reset canned query user data.
19+ if (m_searchQuery.isNull() || search_query != m_searchQuery) {
20+ m_queryUserData.reset(nullptr);
21+ }
22+ setSearchQueryString(search_query);
23+}
24+
25+void Scope::setSearchQueryString(const QString& search_query)
26+{
27 /* Checking for m_searchQuery.isNull() which returns true only when the string
28 has never been set is necessary because when search_query is the empty
29 string ("") and m_searchQuery is the null string,
30
31=== modified file 'src/Unity/scope.h'
32--- src/Unity/scope.h 2015-03-20 14:44:32 +0000
33+++ src/Unity/scope.h 2015-04-29 11:43:20 +0000
34@@ -171,6 +171,7 @@
35 Scope::Ptr findTempScope(QString const& id) const;
36
37 bool loginToAccount(QString const& scope_id, QString const& service_name, QString const& service_type, QString const& provider_name);
38+ void setSearchQueryString(const QString& search_query);
39
40 public Q_SLOTS:
41 void invalidateResults();

Subscribers

People subscribed via source and target branches

to all changes: