Commit fbcf4fa4 authored by Sebastian Kügler's avatar Sebastian Kügler

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
parent ab62a5cd
......@@ -30,6 +30,7 @@
#include <KService>
#include <KServiceGroup>
#include <KServiceTypeTrader>
#include <KSharedConfig>
#include <KSycoca>
#include <KSycocaEntry>
#include <QDebug>
......@@ -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<KService* >(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();
......
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