on xenial help sign in
make left swipe reset search string
61e488dhandsome_feng
plugins/Unity/DashCommunicator/dashcommunicator.cpp+9
@@ -39,6 +39,15 @@ void DashCommunicator::setCurrentScope(int index, bool animate, bool isSwipe)
39 m_mutex.unlock();
39 m_mutex.unlock();
40}
40}
41
41
42+void DashCommunicator::resetAll()
43+{
44+ m_mutex.lock();
45+ if(m_created) {
46+ QMetaObject::invokeMethod(m_dashConnection, "resetAll");
47+ }
48+ m_mutex.unlock();
49+}
50+
42void DashCommunicator::run()
51void DashCommunicator::run()
43{
52{
44 m_dashConnection = new DashConnection("com.canonical.UnityDash",
53 m_dashConnection = new DashConnection("com.canonical.UnityDash",
plugins/Unity/DashCommunicator/dashcommunicator.h+1
@@ -32,6 +32,7 @@ public:
32
32
33public Q_SLOTS:
33public Q_SLOTS:
34 void setCurrentScope(int index, bool animate, bool isSwipe);
34 void setCurrentScope(int index, bool animate, bool isSwipe);
35+ void resetAll();
35
36
36protected:
37protected:
37 void run() override;
38 void run() override;
plugins/Unity/DashCommunicator/dashcommunicatorservice.cpp+1
@@ -21,6 +21,7 @@ DashCommunicatorService::DashCommunicatorService(QObject *parent):
21 m_dbusService(new DBusDashCommunicatorService(this))
21 m_dbusService(new DBusDashCommunicatorService(this))
22{
22{
23 connect(m_dbusService, &DBusDashCommunicatorService::setCurrentScopeRequested, this, &DashCommunicatorService::setCurrentScopeRequested);
23 connect(m_dbusService, &DBusDashCommunicatorService::setCurrentScopeRequested, this, &DashCommunicatorService::setCurrentScopeRequested);
24+ connect(m_dbusService, &DBusDashCommunicatorService::resetAllRequested, this, &DashCommunicatorService::resetAllRequested);
24}
25}
25
26
26
27
plugins/Unity/DashCommunicator/dashcommunicatorservice.h+1
@@ -30,6 +30,7 @@ public:
30
30
31Q_SIGNALS:
31Q_SIGNALS:
32 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
32 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
33+ void resetAllRequested();
33
34
34private:
35private:
35 DBusDashCommunicatorService *m_dbusService;
36 DBusDashCommunicatorService *m_dbusService;
plugins/Unity/DashCommunicator/dashconnection.cpp+7
@@ -61,3 +61,10 @@ void DashConnection::setCurrentScope(int index, bool animate, bool isSwipe)
61 dbusInterface()->asyncCall("SetCurrentScope", index, animate, isSwipe);
61 dbusInterface()->asyncCall("SetCurrentScope", index, animate, isSwipe);
62 }
62 }
63}
63}
64+
65+void DashConnection::resetAll()
66+{
67+ if (dbusInterface()) {
68+ dbusInterface()->asyncCall("ResetAll");
69+ }
70+}
plugins/Unity/DashCommunicator/dashconnection.h+1
@@ -28,6 +28,7 @@ public:
28
28
29public Q_SLOTS:
29public Q_SLOTS:
30 void setCurrentScope(int index, bool animate, bool isSwipe);
30 void setCurrentScope(int index, bool animate, bool isSwipe);
31+ void resetAll();
31
32
32private:
33private:
33 QDBusAbstractInterface* createInterface(const QString &service, const QString &path,
34 QDBusAbstractInterface* createInterface(const QString &service, const QString &path,
plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.cpp+5
@@ -33,3 +33,8 @@ void DBusDashCommunicatorService::SetCurrentScope(int index, bool animate, bool
33{
33{
34 Q_EMIT setCurrentScopeRequested(index, animate, isSwipe);
34 Q_EMIT setCurrentScopeRequested(index, animate, isSwipe);
35}
35}
36+
37+void DBusDashCommunicatorService::ResetAll()
38+{
39+ Q_EMIT resetAllRequested();
40+}
plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.h+2
@@ -30,9 +30,11 @@ public:
30
30
31Q_SIGNALS:
31Q_SIGNALS:
32 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
32 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
33+ void resetAllRequested();
33
34
34public Q_SLOTS:
35public Q_SLOTS:
35 Q_SCRIPTABLE void SetCurrentScope(int index, bool animate, bool isSwipe);
36 Q_SCRIPTABLE void SetCurrentScope(int index, bool animate, bool isSwipe);
37+ Q_SCRIPTABLE void ResetAll();
36
38
37};
39};
38
40
qml/Dash/Dash.qml+3
@@ -49,6 +49,9 @@ Showable {
49 }
49 }
50 }
50 }
51 }
51 }
52+ onResetAllRequested:{
53+ dashContent.resetSearch();
54+ }
52 }
55 }
53
56
54 function setCurrentScope(scopeId, animate, reset) {
57 function setCurrentScope(scopeId, animate, reset) {
qml/Dash/DashContent.qml+6
@@ -40,6 +40,7 @@ Item {
40 signal gotoScope(string scopeId)
40 signal gotoScope(string scopeId)
41 signal openScope(var scope)
41 signal openScope(var scope)
42 signal closePreview()
42 signal closePreview()
43+ signal resetSearch()
43
44
44 // If we set the current scope index before the scopes have been added,
45 // If we set the current scope index before the scopes have been added,
45 // then we need to wait until the loaded signals gets emitted from the scopes
46 // then we need to wait until the loaded signals gets emitted from the scopes
@@ -211,6 +212,11 @@ Item {
211 onClosePreview: if (item) item.closePreview()
212 onClosePreview: if (item) item.closePreview()
212 }
213 }
213
214
215+ Connections {
216+ target: dashContent
217+ onResetSearch: if(item) item.resetSearch()
218+ }
219+
214 Component.onDestruction: active = false
220 Component.onDestruction: active = false
215 }
221 }
216 }
222 }
qml/Dash/GenericScopeView.qml+5
@@ -67,6 +67,11 @@ FocusScope {
67 subPageLoader.closeSubPage()
67 subPageLoader.closeSubPage()
68 }
68 }
69
69
70+ function resetSearch() {
71+ if(pageHeaderLoader.item && showPageHeader)
72+ pageHeaderLoader.item.resetSearch()
73+ }
74+
70 function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
75 function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
71 if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope") {
76 if (itemModel.uri.indexOf("scope://") === 0 || scope.id === "clickscope") {
72 // TODO Technically it is possible that calling activate() will make the scope emit
77 // TODO Technically it is possible that calling activate() will make the scope emit
qml/Shell.qml+1
@@ -784,6 +784,7 @@ Item {
784 onDashSwipeChanged: {
784 onDashSwipeChanged: {
785 if (dashSwipe) {
785 if (dashSwipe) {
786 dash.setCurrentScope(0, false, true)
786 dash.setCurrentScope(0, false, true)
787+ dash.resetAll()
787 }
788 }
788 }
789 }
789 onLauncherApplicationSelected: {
790 onLauncherApplicationSelected: {