Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1193971e authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Component Chooser] Update http(s) scheme handler when changing default browser

BUG: 332817
FIXED-IN: 5.11.0

Differential Revision: https://phabricator.kde.org/D6933
parent 027186f9
......@@ -18,6 +18,7 @@
#include <kglobalsettings.h>
#include <kconfiggroup.h>
#include <KBuildSycocaProgressDialog>
#include <KLocalizedString>
#include <KServiceTypeTrader>
......@@ -116,6 +117,23 @@ void CfgBrowser::save(KConfig *)
config.writePathEntry( QStringLiteral("BrowserApplication"), exec); // KConfig::Normal|KConfig::Global
config.sync();
// Save the default browser as scheme handler for http(s) in mimeapps.list
KSharedConfig::Ptr mimeAppList = KSharedConfig::openConfig(QStringLiteral("mimeapps.list"), KConfig::NoGlobals, QStandardPaths::GenericConfigLocation);
if (mimeAppList->isConfigWritable(true /*warn user if not writable*/)) {
KConfigGroup defaultApp(mimeAppList, "Default Applications");
if (m_browserService) {
defaultApp.writeXdgListEntry(QStringLiteral("x-scheme-handler/http"), QStringList(m_browserService->storageId()));
defaultApp.writeXdgListEntry(QStringLiteral("x-scheme-handler/https"), QStringList(m_browserService->storageId()));
} else {
defaultApp.deleteEntry(QStringLiteral("x-scheme-handler/http"));
defaultApp.deleteEntry(QStringLiteral("x-scheme-handler/https"));
}
mimeAppList->sync();
KBuildSycocaProgressDialog::rebuildKSycoca(this);
}
Kdelibs4SharedConfig::syncConfigGroup(QLatin1String("General"), "kdeglobals");
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged);
......
Markdown is supported
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