Commit 5e7d26dc authored by Carson Black's avatar Carson Black 🍿

[libtaskmanager] Add ApplicationMenu{ObjectPath,ServiceName} roles to model

Summary:
The tasks model now exposes a window's application menu object path and service name.

No update signals set up for XOrg; not sure what to listen for.

Test Plan:
See that the model has more roles and see that they're wired to the application
menu obiect path and service name on Wayland and XOrg.

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27959
parent fab5b5e2
......@@ -96,6 +96,10 @@ public:
model contents due to the asynchronous nature of the windowing
system. */
LastActivated, /**< The timestamp of the last time a task was the active task. */
ApplicationMenuServiceName, /**< The DBus service name for the application's menu.
May be empty. @since 5.19 */
ApplicationMenuObjectPath,/**< The DBus object path for the application's menu.
May be empty. @since 5.19 */
};
Q_ENUM(AdditionalRoles)
......
......@@ -312,6 +312,12 @@ void WaylandTasksModel::Private::addWindow(KWayland::Client::PlasmaWindow *windo
QObject::connect(window, &KWayland::Client::PlasmaWindow::skipTaskbarChanged, q,
[window, this] { this->dataChanged(window, SkipTaskbar); }
);
QObject::connect(window, &KWayland::Client::PlasmaWindow::applicationMenuChanged, q,
[window, this] {
this->dataChanged(window, QVector<int>{ApplicationMenuServiceName, ApplicationMenuObjectPath});
}
);
}
AppData WaylandTasksModel::Private::appData(KWayland::Client::PlasmaWindow *window)
......@@ -461,6 +467,10 @@ QVariant WaylandTasksModel::data(const QModelIndex &index, int role) const
// FIXME Implement.
} else if (role == AppPid) {
return window->pid();
} else if (role == ApplicationMenuObjectPath) {
return window->applicationMenuObjectPath();
} else if (role == ApplicationMenuServiceName) {
return window->applicationMenuServiceName();
}
return QVariant();
......
......@@ -81,6 +81,8 @@ public:
KWindowInfo* windowInfo(WId window);
AppData appData(WId window);
QString appMenuServiceName(WId window);
QString appMenuObjectPath(WId window);
QIcon icon(WId window);
static QString mimeType();
......@@ -465,6 +467,18 @@ AppData XWindowTasksModel::Private::appData(WId window)
return data;
}
QString XWindowTasksModel::Private::appMenuServiceName(WId window)
{
const KWindowInfo *info = windowInfo(window);
return QString::fromUtf8(info->applicationMenuServiceName());
}
QString XWindowTasksModel::Private::appMenuObjectPath(WId window)
{
const KWindowInfo *info = windowInfo(window);
return QString::fromUtf8(info->applicationMenuServiceName());
}
QIcon XWindowTasksModel::Private::icon(WId window)
{
const AppData &app = appData(window);
......@@ -690,6 +704,10 @@ QVariant XWindowTasksModel::data(const QModelIndex &index, int role) const
if (d->lastActivated.contains(window)) {
return d->lastActivated.value(window);
}
} else if (role == ApplicationMenuObjectPath) {
return d->appMenuObjectPath(window);
} else if (role == ApplicationMenuServiceName) {
return d->appMenuServiceName(window);
}
return QVariant();
......
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