[office/kmymoney] kmymoney: Use KGuiUtils::keepDialogSize for settings dialog

Thomas Baumgart <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 174591efea1e1d10f98bbdde6eca3fea11e28d9a by Thomas Baumgart.
Committed on 28/07/2026 at 06:05.
Pushed by tbaumgart into branch 'master'.

Use KGuiUtils::keepDialogSize for settings dialog

M  +3    -13   kmymoney/dialogs/settings/ksettingskmymoney.cpp
M  +1    -7    kmymoney/dialogs/settings/ksettingskmymoney.h
M  +6    -0    kmymoney/settings/kmymoney.upd

https://invent.kde.org/office/kmymoney/-/commit/174591efea1e1d10f98bbdde6eca3fea11e28d9a

diff --git a/kmymoney/dialogs/settings/ksettingskmymoney.cpp b/kmymoney/dialogs/settings/ksettingskmymoney.cpp
index 0c711eeb0..92e027402 100644
--- a/kmymoney/dialogs/settings/ksettingskmymoney.cpp
+++ b/kmymoney/dialogs/settings/ksettingskmymoney.cpp
@@ -1,6 +1,7 @@
 /*
     SPDX-FileCopyrightText: 2014-2016 Christian Dávid <[email protected]>
     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <[email protected]>
+    SPDX-FileCopyrightText: 2026      Thomas Baumgart <[email protected]>
     SPDX-License-Identifier: GPL-2.0-or-later
 */
 
@@ -22,6 +23,7 @@
 // ----------------------------------------------------------------------------
 // Project Includes
 
+#include "kguiutils.h"
 #include "ksettingscolors.h"
 #include "ksettingsfonts.h"
 #include "ksettingsgeneral.h"
@@ -94,20 +96,8 @@ KSettingsKMyMoney::KSettingsKMyMoney(QWidget* parent, const QString& name, KCore
     // make sure both HideZeroBalanceAccountsHome checkboxes sync each other
     connect(generalPage, &KSettingsGeneral::hideZeroBalanceAccountsHomeChanged, homePage, &KSettingsHome::setHideZeroBalanceAccountsHome);
     connect(homePage, &KSettingsHome::hideZeroBalanceAccountsHomeChanged, generalPage, &KSettingsGeneral::setHideZeroBalanceAccountsHome);
-}
 
-void KSettingsKMyMoney::showEvent(QShowEvent* ev)
-{
-    auto grp = KSharedConfig::openConfig()->group("Last Use Settings");
-    restoreGeometry(grp.readEntry("KSettingsDialogGeometry", QByteArray()));
-    KConfigDialog::showEvent(ev);
-}
-
-void KSettingsKMyMoney::hideEvent(QHideEvent* ev)
-{
-    auto grp = KSharedConfig::openConfig()->group("Last Use Settings");
-    grp.writeEntry("KSettingsDialogGeometry", saveGeometry());
-    KConfigDialog::hideEvent(ev);
+    KGuiUtils::keepDialogSize(this);
 }
 
 void KSettingsKMyMoney::slotEnableFinishButton(bool enable)
diff --git a/kmymoney/dialogs/settings/ksettingskmymoney.h b/kmymoney/dialogs/settings/ksettingskmymoney.h
index 44a05a830..e4371889f 100644
--- a/kmymoney/dialogs/settings/ksettingskmymoney.h
+++ b/kmymoney/dialogs/settings/ksettingskmymoney.h
@@ -1,6 +1,7 @@
 /*
     SPDX-FileCopyrightText: 2014-2016 Christian Dávid <[email protected]>
     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <[email protected]>
+    SPDX-FileCopyrightText: 2026      Thomas Baumgart <[email protected]>
     SPDX-License-Identifier: GPL-2.0-or-later
 */
 
@@ -17,13 +18,6 @@ class KSettingsKMyMoney : public KConfigDialog
 public:
     explicit KSettingsKMyMoney(QWidget *parent, const QString &name, KCoreConfigSkeleton *config);
 
-protected:
-    /**
-     * @internal
-     */
-    void showEvent(QShowEvent* e) override;
-    void hideEvent(QHideEvent* e) override;
-
 Q_SIGNALS:
     void pluginsChanged();
 
diff --git a/kmymoney/settings/kmymoney.upd b/kmymoney/settings/kmymoney.upd
index 190135c99..5ac8d7412 100644
--- a/kmymoney/settings/kmymoney.upd
+++ b/kmymoney/settings/kmymoney.upd
@@ -53,3 +53,9 @@ RemoveGroup=StandardLedger
 Id=add-currency-column-2026
 File=kmymoney/kmymoneyrc
 RemoveGroup=KAccountsView
+
+Id=remove-KSettingsDialogGeometry
+File=kmymoney/kmymoneyrc
+Group=Last Use Settings
+RemoveKey=KSettingsDialogGeometry
+
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.