-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1102e7f
commit 8e146da
Showing
7 changed files
with
1,843 additions
and
1,668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
libAppStreamQt5.so.3 | ||
libKF5Attica.so.5 | ||
libKF5ConfigCore.so.5 | ||
libKF5ConfigGui.so.5 | ||
libKF5CoreAddons.so.5 | ||
libKF5Crash.so.5 | ||
libKF5DBusAddons.so.5 | ||
libKF5I18n.so.5 | ||
libKF5IdleTime.so.5 | ||
libKF5JobWidgets.so.5 | ||
libKF5KCMUtils.so.5 | ||
libKF5KIOCore.so.5 | ||
libKF5KIOGui.so.5 | ||
libKF5NewStuffCore.so.5 | ||
libKF5Notifications.so.5 | ||
libKF5QuickAddons.so.5 | ||
libKF5Service.so.5 | ||
libKF5WidgetsAddons.so.5 | ||
libKF5WindowSystem.so.5 | ||
libQt5Core.so.5 | ||
libQt5DBus.so.5 | ||
libQt5Gui.so.5 | ||
libQt5Network.so.5 | ||
libQt5Qml.so.5 | ||
libQt5Quick.so.5 | ||
libQt5WebView.so.5 | ||
libQt5Widgets.so.5 | ||
UNKNOWN | ||
libAppStreamQt.so.3 | ||
libKF6Attica.so.6 | ||
libKF6ConfigCore.so.6 | ||
libKF6ConfigGui.so.6 | ||
libKF6CoreAddons.so.6 | ||
libKF6Crash.so.6 | ||
libKF6DBusAddons.so.6 | ||
libKF6I18n.so.6 | ||
libKF6IdleTime.so.6 | ||
libKF6JobWidgets.so.6 | ||
libKF6KCMUtilsCore.so.6 | ||
libKF6KCMUtilsQuick.so.6 | ||
libKF6KIOCore.so.6 | ||
libKF6KIOGui.so.6 | ||
libKF6NewStuffCore.so.6 | ||
libKF6Notifications.so.6 | ||
libKF6Service.so.6 | ||
libKF6StatusNotifierItem.so.6 | ||
libKF6WidgetsAddons.so.6 | ||
libKF6WindowSystem.so.6 | ||
libQt6Core.so.6 | ||
libQt6DBus.so.6 | ||
libQt6Gui.so.6 | ||
libQt6Network.so.6 | ||
libQt6Qml.so.6 | ||
libQt6Quick.so.6 | ||
libQt6WebView.so.6 | ||
libQt6Widgets.so.6 | ||
libc.so.6 | ||
libflatpak.so.0 | ||
libfwupd.so.2 | ||
libgio-2.0.so.0 | ||
libglib-2.0.so.0 | ||
libgobject-2.0.so.0 | ||
libm.so.6 | ||
libpackagekitqt5.so.1 | ||
libmarkdown.so.3 | ||
libpackagekitqt6.so.1 | ||
libstdc++.so.6 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,175 @@ | ||
From cc71ca40c556151cd3aa24a0182913789effc319 Mon Sep 17 00:00:00 2001 | ||
From: Fabio Forni <[email protected]> | ||
Date: Tue, 13 Feb 2024 11:32:28 +0100 | ||
Subject: [PATCH] PackageKitBackend: Add the "Drivers" menu, filtered by the | ||
"Drivers" Category | ||
commit 40b4924dad49dcf4d631a6e0dfe5ad03224eb121 | ||
Author: Fabio Forni <[email protected]> | ||
Date: Thu Apr 11 21:38:27 2024 +0200 | ||
|
||
--- | ||
.../AppPackageKitResource.cpp | 41 +++++++++++++++++-- | ||
.../PackageKitBackend/AppPackageKitResource.h | 2 + | ||
.../PackageKitBackend/PackageKitBackend.cpp | 15 ++++++- | ||
.../packagekit-backend-categories.xml | 20 +++++++++ | ||
4 files changed, 73 insertions(+), 5 deletions(-) | ||
Allow to install hardware drivers | ||
|
||
diff --git a/libdiscover/Category/Category.cpp b/libdiscover/Category/Category.cpp | ||
index 7e29659..3cd58ad 100644 | ||
--- a/libdiscover/Category/Category.cpp | ||
+++ b/libdiscover/Category/Category.cpp | ||
@@ -33,7 +33,8 @@ Category::Category(const QString &name, | ||
const CategoryFilter &filter, | ||
const QSet<QString> &pluginName, | ||
const QVector<Category *> &subCategories, | ||
- bool isAddons) | ||
+ bool isAddons, | ||
+ bool isDrivers) | ||
: QObject(nullptr) | ||
, m_name(name) | ||
, m_iconString(iconName) | ||
@@ -41,7 +42,8 @@ Category::Category(const QString &name, | ||
, m_subCategories(subCategories) | ||
, m_plugins(pluginName) | ||
, m_isAddons(isAddons) | ||
- , m_priority(isAddons ? 5 : 0) | ||
+ , m_isDrivers(isDrivers) | ||
+ , m_priority(isAddons || isDrivers ? 5 : 0) | ||
{ | ||
setObjectName(m_name); | ||
|
||
@@ -82,10 +84,13 @@ void Category::parseData(const QString &path, QXmlStreamReader *xml) | ||
m_isAddons = true; | ||
m_priority = 5; | ||
xml->readNext(); | ||
+ } else if (xml->name() == QLatin1String("Drivers")) { | ||
+ m_isDrivers = true; | ||
+ m_priority = 5; | ||
+ xml->readNext(); | ||
} else if (xml->name() == QLatin1String("Icon")) { | ||
m_iconString = xml->readElementText(); | ||
- } else if (xml->name() == QLatin1String("Include") | ||
- || xml->name() == QLatin1String("Categories")) { | ||
+ } else if (xml->name() == QLatin1String("Include") || xml->name() == QLatin1String("Categories")) { | ||
const QString opening = xml->name().toString(); | ||
while (!xml->atEnd() && !xml->hasError()) { | ||
xml->readNext(); | ||
diff --git a/libdiscover/Category/Category.h b/libdiscover/Category/Category.h | ||
index 7d4c99e..4593254 100644 | ||
--- a/libdiscover/Category/Category.h | ||
+++ b/libdiscover/Category/Category.h | ||
@@ -60,7 +60,8 @@ public: | ||
const CategoryFilter &filters, | ||
const QSet<QString> &pluginName, | ||
const QVector<Category *> &subCategories, | ||
- bool isAddons); | ||
+ bool isAddons, | ||
+ bool isDrivers); | ||
~Category() override; | ||
|
||
QString name() const; | ||
@@ -87,6 +88,10 @@ public: | ||
{ | ||
return m_isAddons; | ||
} | ||
+ bool isDrivers() const | ||
+ { | ||
+ return m_isDrivers; | ||
+ } | ||
qint8 priority() const | ||
{ | ||
return m_priority; | ||
@@ -119,6 +124,7 @@ private: | ||
CategoryFilter parseIncludes(QXmlStreamReader *xml); | ||
QSet<QString> m_plugins; | ||
bool m_isAddons = false; | ||
+ bool m_isDrivers = false; | ||
qint8 m_priority = 0; | ||
QTimer *m_subCategoriesChanged; | ||
}; | ||
diff --git a/libdiscover/appstream/AppStreamUtils.cpp b/libdiscover/appstream/AppStreamUtils.cpp | ||
index 8219369..052b288 100644 | ||
--- a/libdiscover/appstream/AppStreamUtils.cpp | ||
+++ b/libdiscover/appstream/AppStreamUtils.cpp | ||
@@ -7,6 +7,7 @@ | ||
#include "AppStreamUtils.h" | ||
|
||
#include "utils.h" | ||
+#include <AppStreamQt/component.h> | ||
#include <AppStreamQt/pool.h> | ||
#include <AppStreamQt/release.h> | ||
#include <AppStreamQt/screenshot.h> | ||
@@ -260,8 +261,12 @@ static void kRemoveDuplicates(AppStream::ComponentBox &input, AppStream::Bundle: | ||
AppStream::ComponentBox AppStreamUtils::componentsByCategories(AppStream::Pool *pool, Category *cat, AppStream::Bundle::Kind kind) | ||
{ | ||
AppStream::ComponentBox ret(AppStream::ComponentBox::FlagNoChecks); | ||
- for (const auto &categoryName : cat->involvedCategories()) { | ||
- ret += pool->componentsByCategories({categoryName}); | ||
+ if (cat->isDrivers()) { | ||
+ ret += pool->componentsByKind(AppStream::Component::KindDriver); | ||
+ } else { | ||
+ for (const auto &categoryName : cat->involvedCategories()) { | ||
+ ret += pool->componentsByCategories({categoryName}); | ||
+ } | ||
} | ||
kRemoveDuplicates(ret, kind); | ||
return ret; | ||
diff --git a/libdiscover/backends/KNSBackend/KNSBackend.cpp b/libdiscover/backends/KNSBackend/KNSBackend.cpp | ||
index 8beb0c0..110e4f2 100644 | ||
--- a/libdiscover/backends/KNSBackend/KNSBackend.cpp | ||
+++ b/libdiscover/backends/KNSBackend/KNSBackend.cpp | ||
@@ -188,9 +188,9 @@ KNSBackend::KNSBackend(QObject *parent, const QString &iconName, const QString & | ||
m_categories += cats; | ||
for (const auto &cat : cats) { | ||
if (m_hasApplications) | ||
- categories << new Category(cat, QStringLiteral("applications-other"), {CategoryFilter::CategoryNameFilter, cat}, backendName, {}, true); | ||
+ categories << new Category(cat, QStringLiteral("applications-other"), {CategoryFilter::CategoryNameFilter, cat}, backendName, {}, true, false); | ||
else | ||
- categories << new Category(cat, QStringLiteral("plasma"), {CategoryFilter::CategoryNameFilter, cat}, backendName, {}, true); | ||
+ categories << new Category(cat, QStringLiteral("plasma"), {CategoryFilter::CategoryNameFilter, cat}, backendName, {}, true, false); | ||
} | ||
} | ||
|
||
@@ -227,12 +227,13 @@ KNSBackend::KNSBackend(QObject *parent, const QString &iconName, const QString & | ||
m_engine->init(m_name); | ||
|
||
if (m_hasApplications) { | ||
- auto actualCategory = new Category(m_displayName, QStringLiteral("applications-other"), filter, backendName, topCategories, false); | ||
+ auto actualCategory = new Category(m_displayName, QStringLiteral("applications-other"), filter, backendName, topCategories, false, false); | ||
auto applicationCategory = new Category(i18n("Applications"), // | ||
QStringLiteral("applications-internet"), | ||
filter, | ||
backendName, | ||
{actualCategory}, | ||
+ false, | ||
false); | ||
const QVector<CategoryFilter> filters = {{CategoryFilter::CategoryNameFilter, QLatin1String("Application")}, filter}; | ||
applicationCategory->setFilter({CategoryFilter::AndFilter, filters}); | ||
@@ -271,11 +272,11 @@ KNSBackend::KNSBackend(QObject *parent, const QString &iconName, const QString & | ||
QStringLiteral("ksplash.knsrc"), QStringLiteral("window-decorations.knsrc"), | ||
}; | ||
const auto iconName = knsrcPlasma.contains(fileName) ? QStringLiteral("plasma") : QStringLiteral("applications-other"); | ||
- auto actualCategory = new Category(m_displayName, iconName, filter, backendName, categories, true); | ||
+ auto actualCategory = new Category(m_displayName, iconName, filter, backendName, categories, true, false); | ||
actualCategory->setParent(this); | ||
|
||
const auto topLevelName = knsrcPlasma.contains(fileName) ? i18n("Plasma Addons") : i18n("Application Addons"); | ||
- auto addonsCategory = new Category(topLevelName, iconName, filter, backendName, {actualCategory}, true); | ||
+ auto addonsCategory = new Category(topLevelName, iconName, filter, backendName, {actualCategory}, true, false); | ||
m_rootCategories = {addonsCategory}; | ||
} | ||
|
||
diff --git a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp | ||
index 2ea8362..4200802 100644 | ||
index a6f31b6..4241933 100644 | ||
--- a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp | ||
+++ b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp | ||
@@ -13,12 +13,14 @@ | ||
#include <AppStreamQt5/image.h> | ||
#include <AppStreamQt5/release.h> | ||
#include <AppStreamQt5/screenshot.h> | ||
+#include <AppStreamQt5/systeminfo.h> | ||
#include <AppStreamQt5/version.h> | ||
#else | ||
#include <AppStreamQt/icon.h> | ||
@@ -11,6 +11,7 @@ | ||
#include <AppStreamQt/image.h> | ||
#include <AppStreamQt/release.h> | ||
#include <AppStreamQt/screenshot.h> | ||
+#include <AppStreamQt/systeminfo.h> | ||
#include <AppStreamQt/version.h> | ||
#endif | ||
#include <KLocalizedString> | ||
#include <KService> | ||
@@ -22,6 +23,7 @@ | ||
#include <QStandardPaths> | ||
#include <QUrlQuery> | ||
#include <appstream/AppStreamUtils.h> | ||
+#include <qstringliteral.h> | ||
|
||
using namespace Qt::StringLiterals; | ||
|
||
@@ -113,14 +115,40 @@ QStringList AppPackageKitResource::mimetypes() const | ||
@@ -105,12 +107,37 @@ QStringList AppPackageKitResource::mimetypes() const | ||
|
||
static constexpr auto s_addonKinds = {AppStream::Component::KindAddon, AppStream::Component::KindCodec}; | ||
|
||
|
@@ -58,7 +197,7 @@ index 2ea8362..4200802 100644 | |
+ cats.reserve(2); | ||
+ cats.append(QStringLiteral("Drivers")); | ||
+ if (hasDeviceModaliases(m_appdata)) { | ||
+ cats.append(QStringLiteral("ThisDeviceDrivers")); | ||
+ cats.append(QStringLiteral("CompatibleDrivers")); | ||
+ } | ||
+ return cats; | ||
+ } | ||
|
@@ -71,71 +210,20 @@ index 2ea8362..4200802 100644 | |
+ } | ||
} | ||
|
||
+ | ||
QString AppPackageKitResource::comment() | ||
{ | ||
const auto summary = m_appdata.summary(); | ||
@@ -305,3 +333,8 @@ uint AppPackageKitResource::contentRatingMinimumAge() const | ||
{ | ||
return AppStreamUtils::contentRatingMinimumAge(m_appdata); | ||
} | ||
+ | ||
+AppStream::Component AppPackageKitResource::component() const | ||
+{ | ||
+ return m_appdata; | ||
+} | ||
\ No newline at end of file | ||
diff --git a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.h b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.h | ||
index d5bb808..986fde1 100644 | ||
--- a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.h | ||
+++ b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.h | ||
@@ -50,6 +50,8 @@ public: | ||
ContentIntensity contentRatingIntensity() const override; | ||
uint contentRatingMinimumAge() const override; | ||
|
||
+ AppStream::Component component() const; | ||
+ | ||
private: | ||
const AppStream::Component m_appdata; | ||
mutable QString m_name; | ||
diff --git a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp | ||
index 186cb30..0548d3e 100644 | ||
--- a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp | ||
+++ b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp | ||
@@ -735,7 +735,20 @@ ResultsStream *PackageKitBackend::search(const AbstractResourcesBackend::Filters | ||
#endif | ||
#if ASQ_CHECK_VERSION(0, 15, 6) | ||
} else if (filter.category) { | ||
- components = AppStreamUtils::componentsByCategories(m_appdata.get(), filter.category, AppStream::Bundle::KindUnknown); | ||
+ if (filter.category->involvedCategories()[0] == QStringLiteral("Drivers") | ||
+ || filter.category->involvedCategories()[0] == QStringLiteral("ThisDeviceDrivers")) { | ||
+ for (auto &resource : m_packages.packages) { | ||
+ auto resourceCast = qobject_cast<AppPackageKitResource *>(resource); | ||
+ if (resourceCast == nullptr) { | ||
+ continue; | ||
+ } | ||
+ if (resourceCast->categories().contains(filter.category->involvedCategories()[0])) { | ||
+ components.append(resourceCast->component()); | ||
+ } | ||
+ } | ||
+ } else { | ||
+ components = AppStreamUtils::componentsByCategories(m_appdata.get(), filter.category, AppStream::Bundle::KindUnknown); | ||
+ } | ||
#endif | ||
} else { | ||
#if ASQ_CHECK_VERSION(1, 0, 0) | ||
diff --git a/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml b/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml | ||
index ff1a922..7a20277 100644 | ||
index ff1a922..385d83c 100644 | ||
--- a/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml | ||
+++ b/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml | ||
@@ -548,6 +548,26 @@ | ||
@@ -548,6 +548,28 @@ | ||
</Or> | ||
</Include> | ||
</Menu> | ||
+ | ||
+ <Menu> | ||
+ <Name>Hardware Drivers</Name> | ||
+ <Icon>cpu</Icon> | ||
+ <Drivers /> | ||
+ <Include> | ||
+ <And> | ||
+ <Category>Drivers</Category> | ||
|
@@ -144,9 +232,10 @@ index ff1a922..7a20277 100644 | |
+ <Menu> | ||
+ <Name>Drivers For This Device</Name> | ||
+ <Icon>cpu</Icon> | ||
+ <Drivers /> | ||
+ <Include> | ||
+ <And> | ||
+ <Category>ThisDeviceDrivers</Category> | ||
+ <Category>CompatibleDrivers</Category> | ||
+ </And> | ||
+ </Include> | ||
+ </Menu> | ||
|
@@ -155,6 +244,3 @@ index ff1a922..7a20277 100644 | |
<Menu> | ||
<Name>Plasma Addons</Name> | ||
<Icon>plasma</Icon> | ||
-- | ||
2.43.0 | ||
|
Oops, something went wrong.