on xenial help sign in
Support canned search queries returned by Home Scope.

Approved by Michał Sawicz, PS Jenkins bot.

commita4c2f97c88598c5586fd52b3682124a4afb19532 authorPawel Stolowski <pawel.stolowski@canonical.com> dateTue 24 Sep 2013, 16:47 (13 years ago) parent532f1a7bf6f7ec
2 files changed+19−1
Dash/GenericScopeView.qml+6 plugins/Unity/scope.cpp+13−1
Dash/GenericScopeView.qml+6
@@ -36,6 +36,12 @@ ScopeView {
3636 value: pageHeader.searchQuery
3737 }
3838
39+ Binding {
40+ target: pageHeader
41+ property: "searchQuery"
42+ value: scopeView.scope.searchQuery
43+ }
44+
3945 Connections {
4046 target: panel
4147 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
175175 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
176176{
177177 auto res = createLocalResult(uri, icon_hint, category, result_type, mimetype, title, comment, dnd_uri, metadata);
178− m_unityScope->Preview(res);
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 {
182+ m_unityScope->Preview(res);
183+ }
179184}
180185
181186void 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
199204 qWarning() << "Missing goto-uri hint for GOTO_DASH_URI activation reply";
200205 }
201206 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;
202214 default:
203215 qWarning() << "Unhandled activation response:" << type;
204216 }