[plasma/plasma-workspace] libtaskmanager: libtaskmanager: Simplify appDataFromUrl() for absolute URLs

Nicolas Fella <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 86ff49c411b64a73f31ae18f74f198b8ef36430a by Nicolas Fella.
Committed on 10/08/2026 at 14:49.
Pushed by nicolasfella into branch 'master'.

libtaskmanager: Simplify appDataFromUrl() for absolute URLs

If we have an absolute path to a desktop file we can pass that directly to KService

M  +6    -6    libtaskmanager/tasktools.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/86ff49c411b64a73f31ae18f74f198b8ef36430a

diff --git a/libtaskmanager/tasktools.cpp b/libtaskmanager/tasktools.cpp
index 81cbbee6a7..c14a9d693a 100644
--- a/libtaskmanager/tasktools.cpp
+++ b/libtaskmanager/tasktools.cpp
@@ -104,14 +104,14 @@ AppData appDataFromUrl(const QUrl &url, const QIcon &fallbackIcon)
                     data.icon = QIcon::fromTheme(service->icon());
                 }
             } else {
-                KDesktopFile f(url.toLocalFile());
-                if (f.tryExec()) {
-                    data.name = f.readName();
-                    data.genericName = appropriateCaption(KService::serviceByDesktopPath(url.toLocalFile()));
-                    data.id = QUrl::fromLocalFile(f.fileName()).fileName();
+                KService::Ptr service(new KService(url.toLocalFile()));
+                if (service->isValid()) {
+                    data.name = service->name();
+                    data.genericName = appropriateCaption(service);
+                    data.id = service->storageId();
 
                     if (data.icon.isNull()) {
-                        const QString iconValue = f.readIcon();
+                        const QString iconValue = service->icon();
                         if (QIcon::hasThemeIcon(iconValue)) {
                             data.icon = QIcon::fromTheme(iconValue);
                         } else if (!iconValue.startsWith(QDir::separator())) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.