mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
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
This commit is contained in:
parent
ab62a5cdcd
commit
fbcf4fa457
1 changed files with 7 additions and 1 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
#include <KService>
|
#include <KService>
|
||||||
#include <KServiceGroup>
|
#include <KServiceGroup>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
|
#include <KSharedConfig>
|
||||||
#include <KSycoca>
|
#include <KSycoca>
|
||||||
#include <KSycocaEntry>
|
#include <KSycocaEntry>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -76,6 +77,10 @@ bool appNameLessThan(const ApplicationData &a1, const ApplicationData &a2)
|
||||||
|
|
||||||
void ApplicationListModel::loadApplications()
|
void ApplicationListModel::loadApplications()
|
||||||
{
|
{
|
||||||
|
auto cfg = KSharedConfig::openConfig("applications-blacklistrc");
|
||||||
|
auto blgroup = KConfigGroup(cfg, QStringLiteral("Applications"));
|
||||||
|
QStringList blacklist = blgroup.readEntry("blacklist", QStringList());
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
|
|
||||||
m_applicationList.clear();
|
m_applicationList.clear();
|
||||||
|
|
@ -103,7 +108,8 @@ void ApplicationListModel::loadApplications()
|
||||||
|
|
||||||
if (entry->property("Exec").isValid()) {
|
if (entry->property("Exec").isValid()) {
|
||||||
KService::Ptr service(static_cast<KService* >(entry.data()));
|
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.name = service->name();
|
||||||
data.icon = service->icon();
|
data.icon = service->icon();
|
||||||
data.storageId = service->storageId();
|
data.storageId = service->storageId();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue