Commit a057edc7 authored by Eike Hein's avatar Eike Hein

Re-filter launcher when a window changes identity

Summary:
LibreOffice reuses the same main window for both its start center and
sub-apps like Writer launched from it, changing the window metadata on
the fly. This ensures we hide e.g. a launcher for Writer when picking
it in the LO start center.

Reviewers: broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15458
parent b15eaf38
......@@ -457,6 +457,28 @@ void TasksModel::Private::initModels()
if (roles.isEmpty() || roles.contains(AbstractTasksModel::IsDemandingAttention)) {
updateAnyTaskDemandsAttention();
}
if (roles.isEmpty() || roles.contains(AbstractTasksModel::AppId)) {
for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
const QModelIndex &sourceIndex = groupingProxyModel->index(i, 0);
// When a window task changes identity to one we have a launcher for, cause
// the launcher to be re-filtered.
if (sourceIndex.data(AbstractTasksModel::IsWindow).toBool()) {
for (int i = 0; i < filterProxyModel->rowCount(); ++i) {
const QModelIndex &filterIndex = filterProxyModel->index(i, 0);
if (!filterIndex.data(AbstractTasksModel::IsLauncher).toBool()) {
continue;
}
if (appsMatch(sourceIndex, filterIndex)) {
filterProxyModel->dataChanged(filterIndex, filterIndex);
}
}
}
}
}
}
);
......
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