[plasma/drkonqi] src: Move more settings to KConfigXT

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

Move more settings to KConfigXT

M  +1    -1    src/CMakeLists.txt
M  +0    -1    src/coredump/gui/main.cpp
M  +3    -1    src/coredump/launcher/CMakeLists.txt
M  +2    -1    src/coredump/launcher/main.cpp
M  +0    -2    src/debugger.cpp
M  +0    -2    src/debuggermanager.cpp
M  +2    -6    src/drkonqibackends.cpp
M  +2    -2    src/main.cpp
M  +16   -0    src/settings.kcfg
M  +4    -8    src/systeminformation.cpp

https://invent.kde.org/plasma/drkonqi/-/commit/df0cccd733bded3df241b4fa4a64c19ee17a17c6

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7c5c611af..a97ac300e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -166,7 +166,7 @@ target_compile_definitions(DrKonqiInternal PRIVATE SYSTEMD_AVAILABLE)
 
 add_executable(drkonqi main.cpp)
 ecm_mark_nongui_executable(drkonqi)
-target_link_libraries(drkonqi PRIVATE DrKonqiInternal Qt::Widgets Qt::DBus KF6::CoreAddons KF6::ConfigCore KF6::I18n)
+target_link_libraries(drkonqi PRIVATE DrKonqiInternal Qt::Widgets Qt::DBus KF6::CoreAddons KF6::ConfigGui KF6::I18n)
 
 target_link_libraries(drkonqi PRIVATE DrKonqiInternalplugin)
 
diff --git a/src/coredump/gui/main.cpp b/src/coredump/gui/main.cpp
index 54227a8a8..afda621ee 100644
--- a/src/coredump/gui/main.cpp
+++ b/src/coredump/gui/main.cpp
@@ -9,7 +9,6 @@
 #include <QQmlContext>
 
 #include <KAboutData>
-#include <KConfigGroup>
 #include <KLocalizedString>
 
 #include <config-drkonqi.h>
diff --git a/src/coredump/launcher/CMakeLists.txt b/src/coredump/launcher/CMakeLists.txt
index a5d322ec8..2e22ec403 100644
--- a/src/coredump/launcher/CMakeLists.txt
+++ b/src/coredump/launcher/CMakeLists.txt
@@ -5,13 +5,15 @@ add_executable(drkonqi-coredump-launcher main.cpp GlobalNotifierTruck.cpp DevNot
 target_link_libraries(drkonqi-coredump-launcher
     PRIVATE
         Qt::Core
-        KF6::ConfigCore
+        Qt::QmlIntegration
+        KF6::ConfigGui
         KF6::Notifications
         KF6::KIOGui
         KF6::I18n
         KF6::Crash
         drkonqi-core
         drkonqi-coredump
+        DrKonqiInternal
 )
 if(WITH_GLOBAL_NOTIFIER)
     target_compile_definitions(drkonqi-coredump-launcher PRIVATE -DWITH_GLOBAL_NOTIFIER)
diff --git a/src/coredump/launcher/main.cpp b/src/coredump/launcher/main.cpp
index c73af895e..78c033549 100644
--- a/src/coredump/launcher/main.cpp
+++ b/src/coredump/launcher/main.cpp
@@ -27,6 +27,7 @@
 #include <metadata.h>
 
 #include "../coredump.h"
+#include "../settings.h"
 #include "../socket.h"
 #include "DevNotifierTruck.h"
 #include "DumpTruckInterface.h"
@@ -123,7 +124,7 @@ QJsonObject jsonObjectFromKConfigGroup(const KConfigGroup &group)
         return metadata;
     }
 
-    if (!KConfig(QStringLiteral("drkonqirc")).group(u"General"_s).readEntry(QStringLiteral("IncludeAll"), false)) {
+    if (!Settings::includeAll()) {
         return metadata;
     }
 
diff --git a/src/debugger.cpp b/src/debugger.cpp
index 946bdd12e..c9852515d 100644
--- a/src/debugger.cpp
+++ b/src/debugger.cpp
@@ -6,8 +6,6 @@
 */
 #include "debugger.h"
 
-#include <KConfig>
-#include <KConfigGroup>
 #include <KFileUtils>
 #include <KLocalizedString>
 #include <KMacroExpander>
diff --git a/src/debuggermanager.cpp b/src/debuggermanager.cpp
index 01320b581..863a97a9b 100644
--- a/src/debuggermanager.cpp
+++ b/src/debuggermanager.cpp
@@ -6,8 +6,6 @@
 */
 #include "debuggermanager.h"
 
-#include <KConfigGroup>
-
 #include "backtracegenerator.h"
 #include "debugger.h"
 #include "drkonqibackends.h"
diff --git a/src/drkonqibackends.cpp b/src/drkonqibackends.cpp
index e7f8736a4..fd0cb8cb6 100644
--- a/src/drkonqibackends.cpp
+++ b/src/drkonqibackends.cpp
@@ -17,8 +17,6 @@
 #include <QTimer>
 
 #include "drkonqi_debug.h"
-#include <KConfig>
-#include <KConfigGroup>
 #include <KCrash>
 #include <QStandardPaths>
 
@@ -30,6 +28,7 @@
 #include "debuggermanager.h"
 #include "drkonqi.h"
 #include "linuxprocmapsparser.h"
+#include "settings.h"
 
 #ifdef Q_OS_MACOS
 #include <AvailabilityMacros.h>
@@ -182,12 +181,9 @@ CrashedApplication *KCrashBackend::constructCrashedApplication()
 
 DebuggerManager *KCrashBackend::constructDebuggerManager()
 {
-    KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("DrKonqi"));
-    QString defaultDebuggerName = config.readEntry("Debugger", QStringLiteral("gdb"));
-
     const QList<Debugger> internalDebuggers = Debugger::availableInternalDebuggers(QStringLiteral("KCrash"));
 
-    const Debugger preferredDebugger(Debugger::findDebugger(internalDebuggers, defaultDebuggerName));
+    const Debugger preferredDebugger(Debugger::findDebugger(internalDebuggers, Settings::debugger()));
     qCDebug(DRKONQI_LOG) << "Using debugger:" << preferredDebugger.codeName();
     return new DebuggerManager(preferredDebugger, this);
 }
diff --git a/src/main.cpp b/src/main.cpp
index 8071b3912..ae6465c98 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,7 +24,6 @@
 #include <QTimer>
 
 #include <KAboutData>
-#include <KConfigGroup>
 #include <KLocalizedString>
 #include <KSharedConfig>
 #include <KSignalHandler>
@@ -40,6 +39,7 @@
 #include "drkonqi.h"
 #include "drkonqidialog.h"
 #include "sentryscope.h"
+#include "settings.h"
 #include "statusnotifier.h"
 
 using namespace std::chrono_literals;
@@ -274,7 +274,7 @@ int main(int argc, char *argv[])
     const bool restarted = parser.isSet(restartedOption);
 
     // Whether the user should be encouraged to file a bug report
-    const bool interactionAllowed = KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("General")).readEntry("InteractionAllowed", true);
+    const bool interactionAllowed = Settings::interactionAllowed();
     const bool shuttingDown = isShuttingDown();
 
     if (forceDialog) {
diff --git a/src/settings.kcfg b/src/settings.kcfg
index 09b561c87..840b2708f 100644
--- a/src/settings.kcfg
+++ b/src/settings.kcfg
@@ -7,6 +7,14 @@
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
                           http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+  <group name="General">
+      <entry name="InteractionAllowed" type="Bool">
+          <default>true</default>
+      </entry>
+      <entry name="IncludeAll" type="Bool">
+          <default>false</default>
+      </entry>
+  </group>
   <group name="DrKonqi">
     <entry name="Sentry" type="Bool">
       <default>false</default>
@@ -14,5 +22,13 @@
     <entry name="DownloadSymbols" type="Bool">
       <default>false</default>
     </entry>
+    <entry name="Debugger" type="String">
+        <default>gdb</default>
+    </entry>
+  </group>
+  <group name="SystemInformation">
+      <entry name="CompiledSources" type="Bool">
+          <default>false</default>
+      </entry>
   </group>
 </kcfg>
diff --git a/src/systeminformation.cpp b/src/systeminformation.cpp
index b7f446595..5171ac978 100644
--- a/src/systeminformation.cpp
+++ b/src/systeminformation.cpp
@@ -10,6 +10,7 @@
 
 #include <config-drkonqi.h>
 
+#include "settings.h"
 #include "systeminformation.h"
 
 #if HAVE_UNAME
@@ -18,12 +19,9 @@
 #endif
 
 #include "drkonqi_debug.h"
-#include <KConfig>
-#include <KConfigGroup>
 #include <KCoreAddons>
 #include <KOSRelease>
 #include <KProcess>
-#include <KSharedConfig>
 #include <KWindowSystem>
 #include <QStandardPaths>
 #include <kcoreaddons_version.h>
@@ -85,15 +83,13 @@ SystemInformation::SystemInformation(Config infoConfig, QObject *parent)
     m_operatingSystem = fetchOSDetailInformation();
     tryToSetBugzillaPlatform();
 
-    KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("SystemInformation"));
-    m_compiledSources = config.readEntry("CompiledSources", false);
+    m_compiledSources = Settings::compiledSources();
 }
 
 SystemInformation::~SystemInformation()
 {
-    KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("SystemInformation"));
-    config.writeEntry("CompiledSources", m_compiledSources);
-    config.sync();
+    Settings::setCompiledSources(m_compiledSources);
+    Settings::self()->save();
 }
 
 void SystemInformation::tryToSetBugzillaPlatform()
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.