From 7d32b2bf1feb204d723fc67d5dedba390b849705 Mon Sep 17 00:00:00 2001 From: Andreas Cord-Landwehr Date: Mon, 21 Jun 2021 23:06:34 +0200 Subject: [PATCH] Apply upstream patch for fixing duplicated launcher entries --- recipes-plasma/plasma-phone-components.inc | 5 +- .../0001-Simplify-apps-model.patch | 145 ++++++++++++++++++ 2 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 recipes-plasma/plasma-phone-components/0001-Simplify-apps-model.patch diff --git a/recipes-plasma/plasma-phone-components.inc b/recipes-plasma/plasma-phone-components.inc index 32f5006..8922983 100644 --- a/recipes-plasma/plasma-phone-components.inc +++ b/recipes-plasma/plasma-phone-components.inc @@ -27,7 +27,10 @@ DEPENDS = " \ gstreamer1.0 \ " -SRC_URI = "git://invent.kde.org/plasma/${BPN};nobranch=1;protocol=https" +SRC_URI = " \ + git://invent.kde.org/plasma/${BPN};nobranch=1;protocol=https \ + file://0001-Simplify-apps-model.patch \ +" S = "${WORKDIR}/git" inherit cmake_plasma diff --git a/recipes-plasma/plasma-phone-components/0001-Simplify-apps-model.patch b/recipes-plasma/plasma-phone-components/0001-Simplify-apps-model.patch new file mode 100644 index 0000000..a394609 --- /dev/null +++ b/recipes-plasma/plasma-phone-components/0001-Simplify-apps-model.patch @@ -0,0 +1,145 @@ +From 992950085df9762288955d8e4b5a76f4bc4b2f68 Mon Sep 17 00:00:00 2001 +From: Nicolas Fella +Date: Thu, 10 Jun 2021 23:17:52 +0200 +Subject: [PATCH] Simplify apps model + +The current code iterates over each service group separately and adds its apps. This leads to duplicate entries when an app is in multiple groups. + +Since we are not actually interested in the group info, only in a flat list of all apps with some filters, we can simplify this. +--- + .../applicationlistmodel.cpp | 97 ++++++++----------- + 1 file changed, 40 insertions(+), 57 deletions(-) + +diff --git a/components/mobilehomescreencomponents/applicationlistmodel.cpp b/components/mobilehomescreencomponents/applicationlistmodel.cpp +index 9e925da..00335d5 100644 +--- a/components/mobilehomescreencomponents/applicationlistmodel.cpp ++++ b/components/mobilehomescreencomponents/applicationlistmodel.cpp +@@ -16,13 +16,12 @@ + #include + + // KDE ++#include + #include + #include + #include +-#include + #include + #include +-#include + + #include + #include +@@ -158,71 +157,55 @@ void ApplicationListModel::loadApplications() + auto cfg = KSharedConfig::openConfig(QStringLiteral("applications-blacklistrc")); + auto blgroup = KConfigGroup(cfg, QStringLiteral("Applications")); + +- QStringList blacklist = blgroup.readEntry("blacklist", QStringList()); ++ const QStringList blacklist = blgroup.readEntry("blacklist", QStringList()); + + beginResetModel(); + + m_applicationList.clear(); + +- KServiceGroup::Ptr group = KServiceGroup::root(); +- if (!group || !group->isValid()) return; +- KServiceGroup::List subGroupList = group->entries(true); +- + QMap orderedList; + QList unorderedList; + QSet foundFavorites; + +- // Iterate over all entries in the group +- while (!subGroupList.isEmpty()) { +- KSycocaEntry::Ptr groupEntry = subGroupList.first(); +- subGroupList.pop_front(); +- +- if (groupEntry->isType(KST_KServiceGroup)) { +- KServiceGroup::Ptr serviceGroup(static_cast(groupEntry.data())); +- +- if (!serviceGroup->noDisplay()) { +- KServiceGroup::List entryGroupList = serviceGroup->entries(true); +- +- for(KServiceGroup::List::ConstIterator it = entryGroupList.constBegin(); it != entryGroupList.constEnd(); it++) { +- KSycocaEntry::Ptr entry = (*it); +- +- if (entry->isType(KST_KServiceGroup)) { +- KServiceGroup::Ptr serviceGroup(static_cast(entry.data())); +- subGroupList << serviceGroup; +- +- } else if (entry->property(QStringLiteral("Exec")).isValid()) { +- KService::Ptr service(static_cast(entry.data())); +- +- if (service->isApplication() && +- !blacklist.contains(service->desktopEntryName()) && +- service->showOnCurrentPlatform() && +- !service->property(QStringLiteral("Terminal"), QVariant::Bool).toBool()) { +- +- ApplicationData data; +- data.name = service->name(); +- data.icon = service->icon(); +- data.storageId = service->storageId(); +- data.uniqueId = service->storageId(); +- data.entryPath = service->exec(); +- data.startupNotify = service->property(QStringLiteral("StartupNotify")).toBool(); +- +- if (m_favorites.contains(data.uniqueId)) { +- data.location = Favorites; +- foundFavorites.insert(data.uniqueId); +- } else if (m_desktopItems.contains(data.uniqueId)) { +- data.location = Desktop; +- } ++ auto filter = [blacklist](const KService::Ptr &service) -> bool { ++ if (service->noDisplay()) { ++ return false; ++ } + +- auto it = m_appPositions.constFind(data.uniqueId); +- if (it != m_appPositions.constEnd()) { +- orderedList[*it] = data; +- } else { +- unorderedList << data; +- } +- } +- } +- } +- } ++ if (!service->showOnCurrentPlatform()) { ++ return false; ++ } ++ ++ if (blacklist.contains(service->desktopEntryName())) { ++ return false; ++ } ++ ++ return true; ++ }; ++ ++ const KService::List apps = KApplicationTrader::query(filter); ++ ++ for (const KService::Ptr &service : apps) { ++ ApplicationData data; ++ data.name = service->name(); ++ data.icon = service->icon(); ++ data.storageId = service->storageId(); ++ data.uniqueId = service->storageId(); ++ data.entryPath = service->exec(); ++ data.startupNotify = service->property(QStringLiteral("StartupNotify")).toBool(); ++ ++ if (m_favorites.contains(data.uniqueId)) { ++ data.location = Favorites; ++ foundFavorites.insert(data.uniqueId); ++ } else if (m_desktopItems.contains(data.uniqueId)) { ++ data.location = Desktop; ++ } ++ ++ auto it = m_appPositions.constFind(data.uniqueId); ++ if (it != m_appPositions.constEnd()) { ++ orderedList[*it] = data; ++ } else { ++ unorderedList << data; + } + } + +-- +2.30.2 +