Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/xwindowtasksmodel.cpp
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 131 | if (changedResources.contains(QLatin1String("services")) | |||
---|---|---|---|---|---|
134 | sycocaChangeTimer.start(); | 134 | sycocaChangeTimer.start(); | ||
135 | } | 135 | } | ||
136 | } | 136 | } | ||
137 | ); | 137 | ); | ||
138 | 138 | | |||
139 | rulesConfig = KSharedConfig::openConfig(QStringLiteral("taskmanagerrulesrc")); | 139 | rulesConfig = KSharedConfig::openConfig(QStringLiteral("taskmanagerrulesrc")); | ||
140 | configWatcher = new KDirWatch(q); | 140 | configWatcher = new KDirWatch(q); | ||
141 | 141 | | |||
142 | foreach (const QString &location, QStandardPaths::standardLocations(QStandardPaths::ConfigLocation)) { | 142 | const auto locations = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation); | ||
143 | for (const QString &location : locations) { | ||||
143 | configWatcher->addFile(location + QLatin1String("/taskmanagerrulesrc")); | 144 | configWatcher->addFile(location + QLatin1String("/taskmanagerrulesrc")); | ||
144 | } | 145 | } | ||
145 | 146 | | |||
146 | auto rulesConfigChange = [this, clearCacheAndRefresh] { | 147 | auto rulesConfigChange = [this, clearCacheAndRefresh] { | ||
147 | rulesConfig->reparseConfiguration(); | 148 | rulesConfig->reparseConfiguration(); | ||
148 | clearCacheAndRefresh(); | 149 | clearCacheAndRefresh(); | ||
149 | }; | 150 | }; | ||
150 | 151 | | |||
Show All 39 Lines | 190 | if (row != -1) { | |||
190 | dataChanged(window, QVector<int>{IsActive}); | 191 | dataChanged(window, QVector<int>{IsActive}); | ||
191 | } | 192 | } | ||
192 | } | 193 | } | ||
193 | ); | 194 | ); | ||
194 | 195 | | |||
195 | activeWindow = KWindowSystem::activeWindow(); | 196 | activeWindow = KWindowSystem::activeWindow(); | ||
196 | 197 | | |||
197 | // Add existing windows. | 198 | // Add existing windows. | ||
198 | foreach(const WId window, KWindowSystem::windows()) { | 199 | const auto windows = KWindowSystem::windows(); | ||
200 | for (const WId window : windows) { | ||||
199 | addWindow(window); | 201 | addWindow(window); | ||
200 | } | 202 | } | ||
201 | } | 203 | } | ||
202 | 204 | | |||
203 | void XWindowTasksModel::Private::addWindow(WId window) | 205 | void XWindowTasksModel::Private::addWindow(WId window) | ||
204 | { | 206 | { | ||
205 | // Don't add window twice. | 207 | // Don't add window twice. | ||
206 | if (windows.contains(window)) { | 208 | if (windows.contains(window)) { | ||
▲ Show 20 Lines • Show All 470 Lines • ▼ Show 20 Line(s) | 678 | if (d->transientsDemandingAttention.contains(window)) { | |||
677 | window = d->transientsDemandingAttention.value(window); | 679 | window = d->transientsDemandingAttention.value(window); | ||
678 | // Quote from legacy libtaskmanager: | 680 | // Quote from legacy libtaskmanager: | ||
679 | // "this is a work around for (at least?) kwin where a shaded transient will prevent the main | 681 | // "this is a work around for (at least?) kwin where a shaded transient will prevent the main | ||
680 | // window from being brought forward unless the transient is actually pulled forward, most | 682 | // window from being brought forward unless the transient is actually pulled forward, most | ||
681 | // easily reproduced by opening a modal file open/save dialog on an app then shading the file | 683 | // easily reproduced by opening a modal file open/save dialog on an app then shading the file | ||
682 | // dialog and trying to bring the window forward by clicking on it in a tasks widget | 684 | // dialog and trying to bring the window forward by clicking on it in a tasks widget | ||
683 | // TODO: do we need to check all the transients for shaded?" | 685 | // TODO: do we need to check all the transients for shaded?" | ||
684 | } else if (!d->transients.isEmpty()) { | 686 | } else if (!d->transients.isEmpty()) { | ||
685 | foreach (const WId transient, d->transients) { | 687 | for (const WId transient : qAsConst(d->transients)) { | ||
686 | KWindowInfo info(transient, NET::WMState, NET::WM2TransientFor); | 688 | KWindowInfo info(transient, NET::WMState, NET::WM2TransientFor); | ||
687 | 689 | | |||
688 | if (info.valid(true) && info.hasState(NET::Shaded) && info.transientFor() == window) { | 690 | if (info.valid(true) && info.hasState(NET::Shaded) && info.transientFor() == window) { | ||
689 | window = transient; | 691 | window = transient; | ||
690 | break; | 692 | break; | ||
691 | } | 693 | } | ||
692 | } | 694 | } | ||
693 | } | 695 | } | ||
▲ Show 20 Lines • Show All 403 Lines • Show Last 20 Lines |