on xenial help sign in
Support canned search queries returned by Home Scope.
a4c2f97Pawel Stolowski
Dash/GenericScopeView.qml+6
@@ -36,6 +36,12 @@ ScopeView {
36 value: pageHeader.searchQuery
36 value: pageHeader.searchQuery
37 }
37 }
38
38
39+ Binding {
40+ target: pageHeader
41+ property: "searchQuery"
42+ value: scopeView.scope.searchQuery
43+ }
44+
39 Connections {
45 Connections {
40 target: panel
46 target: panel
41 onSearchClicked: if (isCurrent) {
47 onSearchClicked: if (isCurrent) {
plugins/Unity/scope.cpp+13−1
@@ -175,7 +175,12 @@ void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVaria
175 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
175 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
176{
176{
177 auto res = createLocalResult(uri, icon_hint, category, result_type, mimetype, title, comment, dnd_uri, metadata);
177 auto res = createLocalResult(uri, icon_hint, category, result_type, mimetype, title, comment, dnd_uri, metadata);
178+ // canned queries don't have previews, must be activated
179+ if (uri.toString().startsWith("x-unity-no-preview-scopes-query://")) {
180+ m_unityScope->Activate(res);
181+ } else {
178− m_unityScope->Preview(res);
182+ m_unityScope->Preview(res);
183+ }
179}
184}
180
185
181void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const& hints)
186void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const& hints)
@@ -199,6 +204,13 @@ void Scope::onActivated(unity::dash::LocalResult const& result, unity::dash::Sco
199 qWarning() << "Missing goto-uri hint for GOTO_DASH_URI activation reply";
204 qWarning() << "Missing goto-uri hint for GOTO_DASH_URI activation reply";
200 }
205 }
201 break;
206 break;
207+ case unity::dash::PERFORM_SEARCH:
208+ if (hints.find("query") != hints.end()) {
209+ // note: this will emit searchQueryChanged, and shell will call setSearchQuery back with a new query,
210+ // but it will get ignored.
211+ setSearchQuery(QString::fromStdString(g_variant_get_string(hints.at("query"), nullptr)));
212+ }
213+ break;
202 default:
214 default:
203 qWarning() << "Unhandled activation response:" << type;
215 qWarning() << "Unhandled activation response:" << type;
204 }
216 }