[office/kmymoney/5.2] kmymoney/views: Fix problem with reparenting accounts

Thomas Baumgart <[email protected]> Tue, 4 Aug 2026 13:50:13 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 9fdd2cc4d4dc72cc012da8599dd2ef4c3ab605d6 by Thomas Baumgart.
Committed on 04/08/2026 at 13:48.
Pushed by tbaumgart into branch '5.2'.

Fix problem with reparenting accounts

(cherry picked from commit c872554107d3539e0a1126f8954d0145c4e0d32b)

M  +5    -0    kmymoney/views/kaccountsview_p.h
M  +2    -0    kmymoney/views/kcategoriesview.cpp

https://invent.kde.org/office/kmymoney/-/commit/9fdd2cc4d4dc72cc012da8599dd2ef4c3ab605d6

diff --git a/kmymoney/views/kaccountsview_p.h b/kmymoney/views/kaccountsview_p.h
index 6d3fd3082..6aec23f30 100644
--- a/kmymoney/views/kaccountsview_p.h
+++ b/kmymoney/views/kaccountsview_p.h
@@ -134,6 +134,9 @@ public:
         if (file->isStandardAccount(m_currentAccount.id()))
             return;
 
+        // update our local copy with actual data
+        m_currentAccount = file->account(m_currentAccount.id());
+
         QPointer<KEditLoanWizard> wizard = new KEditLoanWizard(m_currentAccount);
         q->connect(wizard, &KEditLoanWizard::newCategory, q, &KAccountsView::slotNewCategory);
         q->connect(wizard, &KEditLoanWizard::createPayee, q, &KAccountsView::slotNewPayee);
@@ -184,6 +187,8 @@ public:
         if (file->isStandardAccount(m_currentAccount.id()))
             return;
 
+        // update our local copy with actual data
+        m_currentAccount = file->account(m_currentAccount.id());
 
         // set a status message so that the application can't be closed until the editing is done
         //        slotStatusMsg(caption);
diff --git a/kmymoney/views/kcategoriesview.cpp b/kmymoney/views/kcategoriesview.cpp
index 3ca5ecd07..a5825bacb 100644
--- a/kmymoney/views/kcategoriesview.cpp
+++ b/kmymoney/views/kcategoriesview.cpp
@@ -196,6 +196,8 @@ void KCategoriesView::slotEditCategory()
         return;
 
     const auto file = MyMoneyFile::instance();
+    // update our local copy with actual data
+    d->m_currentCategory = file->account(d->m_currentCategory.id());
     if (file->isStandardAccount(d->m_currentCategory.id()))
         return;