Merge lp:~fboucault/unity-2d/dash_default_resuts_non_empty into lp:unity-2d

Proposed by Florian Boucault on 2011-09-12
Status: Merged
Approved by: Gerry Boland on 2011-09-12
Approved revision: 715
Merged at revision: 715
Proposed branch: lp:~fboucault/unity-2d/dash_default_resuts_non_empty
Merge into: lp:unity-2d
Diff against target: 82 lines (+33/-7)
2 files modified
libunity-2d-private/src/lens.cpp (+30/-7)
libunity-2d-private/src/lens.h (+3/-0)
To merge this branch: bzr merge lp:~fboucault/unity-2d/dash_default_resuts_non_empty
Reviewer Review Type Date Requested Status
Gerry Boland 2011-09-12 Pending
Review via email: mp+74996@code.launchpad.net

Description of the change

[dash] Fixed issue where no results are displayed by default in any lens.

Synchronized local states of lenses with their actual states when they become
connected.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/lens.cpp'
2--- libunity-2d-private/src/lens.cpp 2011-09-03 00:19:55 +0000
3+++ libunity-2d-private/src/lens.cpp 2011-09-12 13:47:52 +0000
4@@ -134,7 +134,12 @@
5
6 void Lens::setSearchQuery(const QString& search_query)
7 {
8- if (search_query != m_searchQuery) {
9+ /* Checking for m_searchQuery.isNull() which returns true only when the string
10+ has never been set is necessary because when search_query is the empty
11+ string ("") and m_searchQuery is the null string,
12+ search_query != m_searchQuery is still true.
13+ */
14+ if (m_searchQuery.isNull() || search_query != m_searchQuery) {
15 m_searchQuery = search_query;
16 m_unityLens->Search(search_query.toStdString());
17 Q_EMIT searchQueryChanged();
18@@ -143,7 +148,12 @@
19
20 void Lens::setGlobalSearchQuery(const QString& search_query)
21 {
22- if (search_query != m_globalSearchQuery) {
23+ /* Checking for m_globalSearchQuery.isNull() which returns true only when the string
24+ has never been set is necessary because when search_query is the empty
25+ string ("") and m_globalSearchQuery is the null string,
26+ search_query != m_globalSearchQuery is still true.
27+ */
28+ if (m_globalSearchQuery.isNull() || search_query != m_globalSearchQuery) {
29 m_globalSearchQuery = search_query;
30 m_unityLens->GlobalSearch(search_query.toStdString());
31 Q_EMIT globalSearchQueryChanged();
32@@ -210,8 +220,6 @@
33 delete m_filters;
34 }
35
36- // FIXME: should emit change notification signals for all properties
37-
38 m_unityLens = lens;
39
40 m_filters = new Filters(m_unityLens->filters, this);
41@@ -247,9 +255,24 @@
42 /* FIXME: signal should be forwarded instead of calling the handler directly */
43 m_unityLens->activated.connect(sigc::mem_fun(this, &Lens::onActivated));
44
45- /* Forward local states to newly set unityLens */
46- m_unityLens->Search(m_searchQuery.toStdString());
47- m_unityLens->GlobalSearch(m_globalSearchQuery.toStdString());
48+ /* Synchronize local states with m_unityLens right now and whenever
49+ m_unityLens becomes connected */
50+ /* FIXME: should emit change notification signals for all properties */
51+ connect(this, SIGNAL(connectedChanged(bool)), SLOT(synchronizeStates()));
52+ synchronizeStates();
53+}
54+
55+void Lens::synchronizeStates()
56+{
57+ if (connected()) {
58+ /* Forward local states to m_unityLens */
59+ if (!m_searchQuery.isNull()) {
60+ m_unityLens->Search(m_searchQuery.toStdString());
61+ }
62+ if (!m_globalSearchQuery.isNull()) {
63+ m_unityLens->GlobalSearch(m_globalSearchQuery.toStdString());
64+ }
65+ }
66 }
67
68 void Lens::onResultsSwarmNameChanged(std::string swarm_name)
69
70=== modified file 'libunity-2d-private/src/lens.h'
71--- libunity-2d-private/src/lens.h 2011-08-19 17:12:24 +0000
72+++ libunity-2d-private/src/lens.h 2011-09-12 13:47:52 +0000
73@@ -112,6 +112,9 @@
74 void searchQueryChanged();
75 void globalSearchQueryChanged();
76
77+private Q_SLOTS:
78+ void synchronizeStates();
79+
80 private:
81 void onResultsSwarmNameChanged(std::string);
82 void onResultsChanged(unity::dash::Results::Ptr);

Subscribers

People subscribed via source and target branches