Commit 5d11c608 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Merge branch 'Plasma/5.10'

parents 4c2eb556 f00e4eb9
......@@ -75,17 +75,15 @@ Item {
Component.onCompleted: {
plasmoid.nativeInterface.buttonGrid = buttonGrid
}
Connections {
target: plasmoid.nativeInterface
onRequestActivateIndex: {
// using a Connections {} doesn't work for some reason in Qt >= 5.8
plasmoid.nativeInterface.requestActivateIndex.connect(function (index) {
var idx = Math.max(0, Math.min(buttonRepeater.count - 1, index))
var button = buttonRepeater.itemAt(index)
if (button) {
button.clicked()
}
}
});
}
Repeater {
......@@ -115,6 +113,7 @@ Item {
AppMenuPrivate.AppMenuModel {
id: appMenuModel
onRequestActivateIndex: plasmoid.nativeInterface.requestActivateIndex(index)
Component.onCompleted: {
plasmoid.nativeInterface.model = appMenuModel
}
......
......@@ -259,5 +259,13 @@ void AppMenuModel::updateApplicationMenu(const QString &serviceName, const QStri
setMenuAvailable(true);
emit modelNeedsUpdate();
});
connect(m_importer.data(), &DBusMenuImporter::actionActivationRequested, this, [this](QAction *action) {
// TODO submenus
auto it = std::find(m_activeActions.constBegin(), m_activeActions.constEnd(), action);
if (it != m_activeActions.constEnd()) {
requestActivateIndex(it - m_activeActions.constBegin());
}
});
}
......@@ -53,6 +53,9 @@ public:
bool menuAvailable() const;
void setMenuAvailable(bool set);
signals:
void requestActivateIndex(int index);
private Q_SLOTS:
void onActiveWindowChanged(WId id);
void update();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment