Commit e10bde74 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use KFileUtils to list files

parent bf37558f
Pipeline #216739 passed with stage
in 5 minutes and 24 seconds
......@@ -14,6 +14,7 @@
#include <KConfigGroup>
#include <KDesktopFile>
#include <KDesktopFileActions>
#include <KFileUtils>
#include <KStringHandler>
#include <Solid/Battery>
......@@ -52,15 +53,16 @@ SolidActionData::SolidActionData(bool includeFiles)
if (includeFiles) {
// Fill the lists of possible device types / device values
const QString deviceDir = QStandardPaths::locate(QStandardPaths::GenericDataLocation, //
// List all the known device actions, then add their name and all values to the appropriate lists
QDirIterator it(deviceDir, QStringList() << QStringLiteral("*.desktop"));
while (it.hasNext()) {;
const QString desktop = it.filePath();
KDesktopFile deviceFile(desktop);
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, //
const QStringList files = KFileUtils::findAllUniqueFiles(dirs, {QStringLiteral("*.desktop")});
for (const QString &file : files) {
KDesktopFile deviceFile(file);
KConfigGroup deviceType = deviceFile.desktopGroup(); // Retrieve the configuration group where the user friendly name is
const QString ifaceName = deviceType.readEntry("X-KDE-Solid-Actions-Type");
Supports Markdown
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