Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/taskgroupingproxymodel.cpp
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | 362 | { | |||
---|---|---|---|---|---|
363 | // Check app id against blacklist. | 363 | // Check app id against blacklist. | ||
364 | if (blacklistedAppIds.count() | 364 | if (blacklistedAppIds.count() | ||
365 | && blacklistedAppIds.contains(sourceIndex.data(AbstractTasksModel::AppId).toString())) { | 365 | && blacklistedAppIds.contains(sourceIndex.data(AbstractTasksModel::AppId).toString())) { | ||
366 | return true; | 366 | return true; | ||
367 | } | 367 | } | ||
368 | 368 | | |||
369 | // Check launcher URL (sans query items) against blacklist. | 369 | // Check launcher URL (sans query items) against blacklist. | ||
370 | if (blacklistedLauncherUrls.count()) { | 370 | if (blacklistedLauncherUrls.count()) { | ||
371 | const QUrl &launcherUrl = sourceIndex.data(AbstractTasksModel::LauncherUrl).toUrl(); | 371 | const QUrl &launcherUrl = sourceIndex.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(); | ||
372 | const QString &launcherUrlString = launcherUrl.toString(QUrl::PrettyDecoded | QUrl::RemoveQuery); | 372 | const QString &launcherUrlString = launcherUrl.toString(QUrl::PrettyDecoded | QUrl::RemoveQuery); | ||
373 | 373 | | |||
374 | if (blacklistedLauncherUrls.contains(launcherUrlString)) { | 374 | if (blacklistedLauncherUrls.contains(launcherUrlString)) { | ||
375 | return true; | 375 | return true; | ||
376 | } | 376 | } | ||
377 | } | 377 | } | ||
378 | 378 | | |||
379 | return false; | 379 | return false; | ||
▲ Show 20 Lines • Show All 522 Lines • ▼ Show 20 Line(s) | 899 | if (d->blacklistedLauncherUrls != set) { | |||
902 | // checkGrouping() will gather and group up what's newly-allowed under the changed | 902 | // checkGrouping() will gather and group up what's newly-allowed under the changed | ||
903 | // blacklist. | 903 | // blacklist. | ||
904 | d->checkGrouping(); | 904 | d->checkGrouping(); | ||
905 | 905 | | |||
906 | // Now break apart what we need to. | 906 | // Now break apart what we need to. | ||
907 | for (int i = (d->rowMap.count() - 1); i >= 0; --i) { | 907 | for (int i = (d->rowMap.count() - 1); i >= 0; --i) { | ||
908 | if (d->isGroup(i)) { | 908 | if (d->isGroup(i)) { | ||
909 | const QModelIndex &groupRep = index(i, 0); | 909 | const QModelIndex &groupRep = index(i, 0); | ||
910 | const QUrl &launcherUrl = groupRep.data(AbstractTasksModel::LauncherUrl).toUrl(); | 910 | const QUrl &launcherUrl = groupRep.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(); | ||
911 | const QString &launcherUrlString = launcherUrl.toString(QUrl::RemoveQuery | QUrl::RemoveQuery); | 911 | const QString &launcherUrlString = launcherUrl.toString(QUrl::RemoveQuery | QUrl::RemoveQuery); | ||
912 | 912 | | |||
913 | if (set.contains(launcherUrlString)) { | 913 | if (set.contains(launcherUrlString)) { | ||
914 | d->breakGroupFor(groupRep); // Safe since we're iterating backwards. | 914 | d->breakGroupFor(groupRep); // Safe since we're iterating backwards. | ||
915 | } | 915 | } | ||
916 | } | 916 | } | ||
917 | } | 917 | } | ||
918 | 918 | | |||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Line(s) | 1173 | d->abstractTasksSourceModel->requestPublishDelegateGeometry(mapToSource(index.child(i, 0)), | |||
1174 | geometry, delegate); | 1174 | geometry, delegate); | ||
1175 | } | 1175 | } | ||
1176 | } | 1176 | } | ||
1177 | } | 1177 | } | ||
1178 | 1178 | | |||
1179 | void TaskGroupingProxyModel::requestToggleGrouping(const QModelIndex &index) | 1179 | void TaskGroupingProxyModel::requestToggleGrouping(const QModelIndex &index) | ||
1180 | { | 1180 | { | ||
1181 | const QString &appId = index.data(AbstractTasksModel::AppId).toString(); | 1181 | const QString &appId = index.data(AbstractTasksModel::AppId).toString(); | ||
1182 | const QUrl &launcherUrl = index.data(AbstractTasksModel::LauncherUrl).toUrl(); | 1182 | const QUrl &launcherUrl = index.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(); | ||
1183 | const QString &launcherUrlString = launcherUrl.toString(QUrl::RemoveQuery | QUrl::RemoveQuery); | 1183 | const QString &launcherUrlString = launcherUrl.toString(QUrl::RemoveQuery | QUrl::RemoveQuery); | ||
1184 | 1184 | | |||
1185 | if (d->blacklistedAppIds.contains(appId) || d->blacklistedLauncherUrls.contains(launcherUrlString)) { | 1185 | if (d->blacklistedAppIds.contains(appId) || d->blacklistedLauncherUrls.contains(launcherUrlString)) { | ||
1186 | d->blacklistedAppIds.remove(appId); | 1186 | d->blacklistedAppIds.remove(appId); | ||
1187 | d->blacklistedLauncherUrls.remove(launcherUrlString); | 1187 | d->blacklistedLauncherUrls.remove(launcherUrlString); | ||
1188 | 1188 | | |||
1189 | if (d->groupMode != TasksModel::GroupDisabled) { | 1189 | if (d->groupMode != TasksModel::GroupDisabled) { | ||
1190 | d->formGroupFor(index.parent().isValid() ? index.parent() : index); | 1190 | d->formGroupFor(index.parent().isValid() ? index.parent() : index); | ||
Show All 10 Lines | |||||
1201 | // Update IsGroupable data role for all relevant top-level items. We don't need to update | 1201 | // Update IsGroupable data role for all relevant top-level items. We don't need to update | ||
1202 | // for group members since they've just been inserted -- it's logically impossible to | 1202 | // for group members since they've just been inserted -- it's logically impossible to | ||
1203 | // toggle grouping _on_ from a group member. | 1203 | // toggle grouping _on_ from a group member. | ||
1204 | for (int i = 0; i < d->rowMap.count(); ++i) { | 1204 | for (int i = 0; i < d->rowMap.count(); ++i) { | ||
1205 | if (!d->isGroup(i)) { | 1205 | if (!d->isGroup(i)) { | ||
1206 | const QModelIndex &idx = TaskGroupingProxyModel::index(i, 0); | 1206 | const QModelIndex &idx = TaskGroupingProxyModel::index(i, 0); | ||
1207 | 1207 | | |||
1208 | if (idx.data(AbstractTasksModel::AppId).toString() == appId | 1208 | if (idx.data(AbstractTasksModel::AppId).toString() == appId | ||
1209 | || launcherUrlsMatch(idx.data(AbstractTasksModel::LauncherUrl).toUrl(), launcherUrl, | 1209 | || launcherUrlsMatch(idx.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(), launcherUrl, | ||
1210 | IgnoreQueryItems)) { | 1210 | IgnoreQueryItems)) { | ||
1211 | dataChanged(idx, idx, QVector<int>{AbstractTasksModel::IsGroupable}); | 1211 | dataChanged(idx, idx, QVector<int>{AbstractTasksModel::IsGroupable}); | ||
1212 | } | 1212 | } | ||
1213 | } | 1213 | } | ||
1214 | } | 1214 | } | ||
1215 | 1215 | | |||
1216 | emit blacklistedAppIdsChanged(); | 1216 | emit blacklistedAppIdsChanged(); | ||
1217 | emit blacklistedLauncherUrlsChanged(); | 1217 | emit blacklistedLauncherUrlsChanged(); | ||
1218 | } | 1218 | } | ||
1219 | 1219 | | |||
1220 | } | 1220 | } | ||
1221 | 1221 | | |||
1222 | #include "moc_taskgroupingproxymodel.cpp" | 1222 | #include "moc_taskgroupingproxymodel.cpp" |