[pim/korganizer] src/prefs: koprefsdialogmain - rewrite the Activities config

Allen Winter <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit e944d70596f48c9b11d831de0776f00bd6a5dfdd by Allen Winter.
Committed on 23/07/2026 at 14:27.
Pushed by winterz into branch 'master'.

koprefsdialogmain - rewrite the Activities config

use addWidBool() like the other boolean config options

M  +8    -8    src/prefs/koprefsdialogmain.cpp
M  +2    -4    src/prefs/koprefsdialogmain.h

https://invent.kde.org/pim/korganizer/-/commit/e944d70596f48c9b11d831de0776f00bd6a5dfdd

diff --git a/src/prefs/koprefsdialogmain.cpp b/src/prefs/koprefsdialogmain.cpp
index f0a910e05..f1b2216e8 100644
--- a/src/prefs/koprefsdialogmain.cpp
+++ b/src/prefs/koprefsdialogmain.cpp
@@ -7,7 +7,10 @@
   SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0
 */
 
+// clang-format off
+#include "config-korganizer.h"
 #include "koprefsdialogmain.h"
+// clang-format on
 
 #include "koprefs.h"
 #include <KPluginFactory>
@@ -107,15 +110,12 @@ KOPrefsDialogMain::KOPrefsDialogMain(QObject *parent, const KPluginMetaData &dat
 #if HAVE_ACTIVITY_SUPPORT
     auto activitiesFrame = new QFrame(widget());
     tabWidget->addTab(activitiesFrame, QIcon::fromTheme(QStringLiteral("activities")), i18nc("@title:tab activities settings", "Activities"));
+    auto activitiesLayout = new QVBoxLayout(activitiesFrame);
 
-    auto activitiesFrameLayout = new QVBoxLayout;
-    activitiesFrame->setLayout(activitiesFrameLayout);
+    Korganizer::KPrefsWidBool *activitiesItem = addWidBool(KOPrefs::instance()->enabledActivitiesItem(), activitiesFrame);
+    activitiesLayout->addWidget(activitiesItem->checkBox());
 
-    mActivities = new QCheckBox(i18nc("@option:check", "Enabled"), widget());
-    activitiesFrameLayout->addWidget(mActivities);
-    activitiesFrameLayout->addStretch(1);
-    mActivities->setChecked(KOPrefs::instance()->enabledActivities());
-    connect(mActivities, &QCheckBox::clicked, this, &KOPrefsDialogMain::slotWidChanged);
+    activitiesLayout->addStretch(1);
 #endif
     load();
 }
@@ -125,7 +125,7 @@ void KOPrefsDialogMain::usrWriteConfig()
     Korganizer::KPrefsModule::usrWriteConfig();
     IncidenceEditorNG::IncidenceEditorSettings::self()->save();
 #if HAVE_ACTIVITY_SUPPORT
-    KOPrefs::instance()->setEnabledActivities(mActivities->isChecked());
+    KOPrefs::instance()->setEnabledActivities(KOPrefs::instance()->enabledActivities());
 #endif
     CalendarSupport::KCalPrefs::instance()->save();
     setNeedsSave(false);
diff --git a/src/prefs/koprefsdialogmain.h b/src/prefs/koprefsdialogmain.h
index 669adb2a5..a1986c250 100644
--- a/src/prefs/koprefsdialogmain.h
+++ b/src/prefs/koprefsdialogmain.h
@@ -8,9 +8,10 @@
 */
 
 #pragma once
-#include "config-korganizer.h"
+
 #include "kprefsdialog.h"
 class QCheckBox;
+
 class KOPrefsDialogMain : public Korganizer::KPrefsModule
 {
     Q_OBJECT
@@ -23,7 +24,4 @@ protected:
 private:
     void toggleEmailSettings(bool on);
     QWidget *mUserEmailSettings = nullptr;
-#if HAVE_ACTIVITY_SUPPORT
-    QCheckBox *mActivities = nullptr;
-#endif
 };
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.