From fbcf4fa4570e2347056265048fb98ce8bcff7d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Mon, 15 Jun 2015 20:08:12 -0700 Subject: [PATCH] Blacklist for applicationsmodel This allows hiding applications on the homescreen. It's useful because everybody and her dog puts .desktop files into /usr/share/applications, and many of them are not at all useful. We'll try to do some more elaborate filtering (watch the next commits), but this provides a baseline to really hide some things that we don't want to show. Reviewed-by: notmart --- containments/homescreen/applicationlistmodel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/containments/homescreen/applicationlistmodel.cpp b/containments/homescreen/applicationlistmodel.cpp index 09c104e9..81fcd8d9 100644 --- a/containments/homescreen/applicationlistmodel.cpp +++ b/containments/homescreen/applicationlistmodel.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,10 @@ bool appNameLessThan(const ApplicationData &a1, const ApplicationData &a2) void ApplicationListModel::loadApplications() { + auto cfg = KSharedConfig::openConfig("applications-blacklistrc"); + auto blgroup = KConfigGroup(cfg, QStringLiteral("Applications")); + QStringList blacklist = blgroup.readEntry("blacklist", QStringList()); + beginResetModel(); m_applicationList.clear(); @@ -103,7 +108,8 @@ void ApplicationListModel::loadApplications() if (entry->property("Exec").isValid()) { KService::Ptr service(static_cast(entry.data())); - if (service->isApplication()) { + if (service->isApplication() && + !blacklist.contains(service->desktopEntryName() + QStringLiteral(".desktop")) ) { data.name = service->name(); data.icon = service->icon(); data.storageId = service->storageId();