[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-desktop/Plasma/5.4] kcms/componentchooser: Save the default email client into the group [Def
From:       David Edmundson <kde () davidedmundson ! co ! uk>
Date:       2015-08-31 20:33:59
Message-ID: E1ZWVmB-0004Ex-IV () scm ! kde ! org
[Download RAW message or body]

Git commit 35c2dc0250d2b5dff52ba9b645eea0d0e2c38c0e by David Edmundson, on behalf of \
Luc Menut. Committed on 31/08/2015 at 20:31.
Pushed by davidedmundson into branch 'Plasma/5.4'.

Save the default email client into the group [Default Applications]

Save the default email client by writing x-scheme-handler/mailto into
the group [Default Applications] in the file mimeapps.list .
Nowadays, many applications look at user preferences for x-scheme-
handler/mailto to determine the default email client, so setting this
value would increase interoperability with these applications.

REVIEW: 120569

M  +13   -0    kcms/componentchooser/componentchooseremail.cpp
M  +1    -0    kcms/componentchooser/componentchooseremail.h

http://commits.kde.org/plasma-desktop/35c2dc0250d2b5dff52ba9b645eea0d0e2c38c0e

diff --git a/kcms/componentchooser/componentchooseremail.cpp \
b/kcms/componentchooser/componentchooseremail.cpp index 951c66b..d08c211 100644
--- a/kcms/componentchooser/componentchooseremail.cpp
+++ b/kcms/componentchooser/componentchooseremail.cpp
@@ -84,6 +84,7 @@ void CfgEmailClient::selectEmailClient()
     dlg.hideNoCloseOnExit();
     if (dlg.exec() != QDialog::Accepted) return;
     QString client = dlg.text();
+    m_emailClientService = dlg.service();
 
     // get the preferred Terminal Application
     KConfigGroup confGroup( KSharedConfig::openConfig(), QLatin1String("General") );
@@ -114,6 +115,18 @@ void CfgEmailClient::save(KConfig *)
         pSettings->setSetting(KEMailSettings::ClientTerminal, \
(chkRunTerminal->isChecked()) ? "true" : "false");  }
 
+    // Save the default email client in mimeapps.list into the group [Default \
Applications] +    KSharedConfig::Ptr profile = \
KSharedConfig::openConfig("mimeapps.list", KConfig::NoGlobals, \
QStandardPaths::GenericConfigLocation); +    if (profile->isConfigWritable(true)) {
+        KConfigGroup defaultApp(profile, "Default Applications");
+        if (kmailCB->isChecked()) {
+            defaultApp.writeXdgListEntry("x-scheme-handler/mailto", \
QStringList("org.kde.kmail.desktop")); +        } else if (m_emailClientService) {
+            defaultApp.writeXdgListEntry("x-scheme-handler/mailto", \
QStringList(m_emailClientService->storageId())); +        }
+        profile->sync();
+    }
+
     // insure proper permissions -- contains sensitive data
     QString cfgName(QStandardPaths::locate(QStandardPaths::ConfigLocation, \
"emails"));  if (!cfgName.isEmpty())
diff --git a/kcms/componentchooser/componentchooseremail.h \
b/kcms/componentchooser/componentchooseremail.h index e8d91a8..b856437 100644
--- a/kcms/componentchooser/componentchooseremail.h
+++ b/kcms/componentchooser/componentchooseremail.h
@@ -33,6 +33,7 @@ public:
 
 private:
     KEMailSettings *pSettings;
+    KService::Ptr m_emailClientService;
 
 protected Q_SLOTS:
     void selectEmailClient();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic