aboutsummaryrefslogtreecommitdiffstats
path: root/sysui
diff options
context:
space:
mode:
authorEgor Nemtsev <enemtsev@luxoft.com>2019-12-05 17:30:43 +0300
committerEgor Nemtsev <enemtsev@luxoft.com>2019-12-06 08:24:34 +0000
commit17280bb0a705e818794fe854949bf2e1421c22a1 (patch)
tree102905d43cffd89354b932b07dc95169d97072e4 /sysui
parenta0ec9974642cbe704ab0e57a26be54da51811e22 (diff)
[intents] implement IntentServer's disambiguationRequest
- multiple apps might have same intent ("activate-app"). IntentServer provides a way to handle Intents without app id defined. In this commit we process situation when we want to activate app having only part of it's name (e.g. "music" from voice assistant). We pass it as Intent parameter "guess-app". On System UI side we iterate over all apps with given intent. First partial match of app id and guess-id gives us app id. Having app id we send intent to discovered app Task-number: AUTOSUITE-936 Change-Id: Ife22866385db5a9122bee7c2813f94a7ff5acd57 Reviewed-by: Grigorii Zimin <gzimin@luxoft.com>
Diffstat (limited to 'sysui')
-rw-r--r--sysui/stores/RootStore.qml33
1 files changed, 33 insertions, 0 deletions
diff --git a/sysui/stores/RootStore.qml b/sysui/stores/RootStore.qml
index 5c9b2c23..49ce5b06 100644
--- a/sysui/stores/RootStore.qml
+++ b/sysui/stores/RootStore.qml
@@ -186,6 +186,39 @@ Store {
readonly property bool runningOnSingleScreenEmbedded: !WindowManager.runningOnDesktop
&& (Qt.application.screens.length === 1)
+ readonly property Connections instentServerConnection: Connections {
+ target: IntentServer
+ onDisambiguationRequest: {
+ //process "activate-app" intent sent with part of app name (guess-app) as parameter
+ if (potentialIntents.length > 0 && potentialIntents[0].intentId === "activate-app") {
+ if (parameters["guess-app"] && parameters["guess-app"] !== "") {
+ var appId = "";
+
+ for (var i = 0; i < potentialIntents.length; i++) {
+ if (potentialIntents[i].applicationId.includes(parameters["guess-app"])) {
+ appId = potentialIntents[i].applicationId;
+ break;
+ }
+ }
+
+ //found app with "guess-app" part, send intent to this app
+ if (appId !== "") {
+ request = IntentClient.sendIntentRequest("activate-app", appId, { });
+ request.onReplyReceived.connect(function() {
+ if (request.succeeded) {
+ var result = request.result;
+ console.log(Logging.apps, "Intent result: " + result.done);
+ } else {
+ console.log(Logging.apps, "Intent request failed: ",
+ request.errorMessage);
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+
signal updateThemeRequested(var currentTheme)
signal accentColorChanged(var newAccentColor)
signal grabImageRequested(var screenshotCCPath, var screenshotICPath)