diff --git a/import/abstractdelegate.cpp b/import/abstractdelegate.cpp index 5e399d6..8c35b89 100644 --- a/import/abstractdelegate.cpp +++ b/import/abstractdelegate.cpp @@ -281,7 +281,10 @@ bool AbstractDelegate::childMouseEventFilter(QQuickItem *item, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { forceActiveFocus(Qt::MouseFocusReason); - triggerGuiEvent(QStringLiteral("system.gui.user.interaction"), QVariantMap({{QStringLiteral("skillId"), m_skillId}})); + triggerGuiEvent(QStringLiteral("system.gui.user.interaction"), + QVariantMap({{QStringLiteral("skillId"), m_skillId}, + {QStringLiteral("skillPage"), m_qmlUrl}, + {QStringLiteral("skillTimeout"), m_timeout}})); emit userInteraction(); } return QQuickItem::childMouseEventFilter(item, event); @@ -290,13 +293,19 @@ bool AbstractDelegate::childMouseEventFilter(QQuickItem *item, QEvent *event) void AbstractDelegate::mousePressEvent(QMouseEvent *event) { forceActiveFocus(Qt::MouseFocusReason); - triggerGuiEvent(QStringLiteral("system.gui.user.interaction"), QVariantMap({{QStringLiteral("skillId"), m_skillId}})); + triggerGuiEvent(QStringLiteral("system.gui.user.interaction"), + QVariantMap({{QStringLiteral("skillId"), m_skillId}, + {QStringLiteral("skillPage"), m_qmlUrl}, + {QStringLiteral("skillTimeout"), m_timeout}})); emit userInteraction(); } void AbstractDelegate::keyReleaseEvent(QKeyEvent *event) { - triggerGuiEvent(QStringLiteral("system.gui.user.interaction"), QVariantMap({{QStringLiteral("skillId"), m_skillId}})); + triggerGuiEvent(QStringLiteral("system.gui.user.interaction"), + QVariantMap({{QStringLiteral("skillId"), m_skillId}, + {QStringLiteral("skillPage"), m_qmlUrl}, + {QStringLiteral("skillTimeout"), m_timeout}})); emit userInteraction(); } @@ -319,7 +328,11 @@ void AbstractDelegate::focusInEvent(QFocusEvent *event) int index = context->contextProperty(QStringLiteral("index")).toInt(); if (index >= 0) { - triggerGuiEvent(QStringLiteral("page_gained_focus"), QVariantMap({{QStringLiteral("number"), index}, {QStringLiteral("skillId"), m_skillId}})); + triggerGuiEvent(QStringLiteral("page_gained_focus"), + QVariantMap({{QStringLiteral("number"), index}, + {QStringLiteral("skillId"), m_skillId}, + {QStringLiteral("skillPage"), m_qmlUrl}, + {QStringLiteral("skillTimeout"), m_timeout}})); } } diff --git a/import/abstractdelegate.h b/import/abstractdelegate.h index cbbcddd..3ca92a8 100644 --- a/import/abstractdelegate.h +++ b/import/abstractdelegate.h @@ -172,7 +172,6 @@ class AbstractDelegate: public QQuickItem * @internal Url of the qml file that generated this instance */ void setQmlUrl(const QUrl &url); - QUrl qmlUrl() const; /** * @internal skill id this delegate belongs to @@ -186,6 +185,7 @@ public Q_SLOTS: */ void triggerGuiEvent(const QString &eventName, const QVariantMap ¶meters); QString skillId() const; + QUrl qmlUrl() const; protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; diff --git a/import/abstractskillview.cpp b/import/abstractskillview.cpp index cb3ad02..2b3ed99 100644 --- a/import/abstractskillview.cpp +++ b/import/abstractskillview.cpp @@ -189,9 +189,11 @@ void AbstractSkillView::deleteProperty(const QString &skillId, const QString &pr m_guiWebSocket->sendTextMessage(QString::fromUtf8(doc.toJson())); } -void AbstractSkillView::showHomeScreen() +void AbstractSkillView::showHomeScreen(const QString &skillId, const QString &skillPage) { - m_controller->sendRequest(QStringLiteral("mycroft.device.show.idle"), {}); + m_controller->sendRequest(QStringLiteral("mycroft.device.display.timeout"), + QVariantMap({{QStringLiteral("skillId"), skillId}, + {QStringLiteral("skillPage"), skillPage}})); } MycroftController::Status AbstractSkillView::status() const diff --git a/import/abstractskillview.h b/import/abstractskillview.h index e90dffa..ba9edd5 100644 --- a/import/abstractskillview.h +++ b/import/abstractskillview.h @@ -80,7 +80,7 @@ class AbstractSkillView: public QQuickItem void writeProperties(const QString &skillId, const QVariantMap &data); void deleteProperty(const QString &skillId, const QString &property); - Q_INVOKABLE void showHomeScreen(); + Q_INVOKABLE void showHomeScreen(const QString &skillId, const QString &skillPage); Q_SIGNALS: /** diff --git a/import/qml/SkillView.qml b/import/qml/SkillView.qml index 5000333..58fbd95 100644 --- a/import/qml/SkillView.qml +++ b/import/qml/SkillView.qml @@ -136,7 +136,7 @@ Mycroft.AbstractSkillView { running = false; } } - onTriggered: root.showHomeScreen(); + onTriggered: root.showHomeScreen(currentItem.contentItem.skillId(), currentItem.contentItem.qmlUrl()); } Item {