[plasma/plasma-workspace] libtaskmanager: libtaskmanager: Use scheme handler to determine default email client

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

libtaskmanager: Use scheme handler to determine default email client

It's what practically matters, not what is in KEmailSettings

M  +3    -21   libtaskmanager/tasktools.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/ec95bb36703472be8829ca1069d38aa5bf0a8b67

diff --git a/libtaskmanager/tasktools.cpp b/libtaskmanager/tasktools.cpp
index 870f944272..81cbbee6a7 100644
--- a/libtaskmanager/tasktools.cpp
+++ b/libtaskmanager/tasktools.cpp
@@ -18,7 +18,6 @@
 #include <KProcessList>
 #include <KWindowSystem>
 #include <PlasmaActivities/ResourceInstance>
-#include <kemailsettings.h>
 
 #include <KIO/ApplicationLauncherJob>
 #include <KIO/OpenUrlJob>
@@ -487,27 +486,10 @@ QString defaultApplication(const QUrl &url)
     }
 
     if (application.compare(QLatin1String("mailer"), Qt::CaseInsensitive) == 0) {
-        KEMailSettings settings;
+        KService::Ptr service = KApplicationTrader::preferredService(QStringLiteral("x-scheme-handler/mailto"));
 
-        // In KToolInvocation, the default is kmail; but let's be friendlier.
-        QString command = settings.getSetting(KEMailSettings::ClientProgram);
-
-        if (command.isEmpty()) {
-            if (KService::Ptr kontact = KService::serviceByStorageId(QStringLiteral("kontact"))) {
-                return kontact->storageId();
-            } else if (KService::Ptr kmail = KService::serviceByStorageId(QStringLiteral("kmail"))) {
-                return kmail->storageId();
-            }
-        }
-
-        if (!command.isEmpty()) {
-            if (settings.getSetting(KEMailSettings::ClientTerminal) == QLatin1String("true")) {
-                KConfigGroup confGroup(KSharedConfig::openConfig(), u"General"_s);
-                const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", QStringLiteral("konsole"));
-                command = preferredTerminal + QLatin1String(" -e ") + command;
-            }
-
-            return command;
+        if (service) {
+            return service->storageId();
         }
     } else if (application.compare(QLatin1String("browser"), Qt::CaseInsensitive) == 0) {
         const auto service = DefaultService::browser();
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.