summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Čukić <[email protected]>2016-10-10 19:55:17 +0200
committerIvan Čukić <[email protected]>2016-10-10 19:55:17 +0200
commitb4a8f6c6454c63ecfcb8339aaffe94016eeb5825 (patch)
treebe3324d78bfdadd7f785f441c51f9ed1ff9c0a65
parentce5d187f4340320b47b89222fa5008cd5d87ec94 (diff)
Validating the list of activities specified for a launcher
-rw-r--r--libtaskmanager/launchertasksmodel.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libtaskmanager/launchertasksmodel.cpp b/libtaskmanager/launchertasksmodel.cpp
index f445850..a348f07 100644
--- a/libtaskmanager/launchertasksmodel.cpp
+++ b/libtaskmanager/launchertasksmodel.cpp
@@ -213,6 +213,25 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers)
// Is url is not valid, ignore it
if (!url.isValid()) continue;
+ // Filter invalid activities
+ if (!activities.isEmpty()) {
+ const auto allActivities = d->activities.activities();
+ QStringList validActivities;
+ for (const auto& activity: activities) {
+ if (allActivities.contains(activity)) {
+ validActivities << activity;
+ }
+ }
+
+ if (validActivities.isEmpty()) {
+ // If all activities that had this launcher are
+ // removed, we are killing the launcher as well
+ continue;
+ }
+
+ activities = validActivities;
+ }
+
// Is the url a duplicate?
const auto location =
std::find_if(newLaunchersOrder.begin(), newLaunchersOrder.end(),