[office/kmymoney/5.1] /: Show reconciliation history in ledger view

Ralf Habacker null at kde.org
Sat Apr 10 13:41:10 BST 2021


Git commit 2c6a6b0acbea648b825981753a9cc8eace9437d8 by Ralf Habacker.
Committed on 10/04/2021 at 11:22.
Pushed by habacker into branch '5.1'.

Show reconciliation history in ledger view

Reconciliation history is displayed when the "Show Reconciled Balances"
option is enabled in the "View" menu.

A new configuration variable called "ShowReconciledBalances" has been
introduced for the permanent setting, which is enabled by default.

BUG: 433662
FIXED-IN:5.1.2

M  +14   -0    doc/reference.docbook
M  +3    -0    kmymoney/icons/icons.cpp
M  +1    -0    kmymoney/icons/icons.h
M  +11   -0    kmymoney/kmymoney.cpp
M  +5    -0    kmymoney/kmymoney.h
M  +2    -1    kmymoney/kmymoneyui.rc
M  +1    -1    kmymoney/menus/menuenums.h
M  +4    -0    kmymoney/settings/kmymoney.kcfg
M  +8    -0    kmymoney/widgets/register.cpp

https://invent.kde.org/office/kmymoney/commit/2c6a6b0acbea648b825981753a9cc8eace9437d8

diff --git a/doc/reference.docbook b/doc/reference.docbook
index f947fe52c..78bab33a5 100644
--- a/doc/reference.docbook
+++ b/doc/reference.docbook
@@ -258,6 +258,20 @@
     </listitem>
   </varlistentry>
 
+  <varlistentry>
+    <term><menuchoice>
+      <shortcut>
+        <keycombo>&Ctrl;<keycap>B</keycap></keycombo>
+      </shortcut>
+      <guimenu>View</guimenu>
+        <guimenuitem>Show reconciled balances</guimenuitem>
+      </menuchoice></term>
+    <listitem>
+      <para><action>Show reconciled balances and the last reconciliation
+        milestone on the register.</action></para>
+    </listitem>
+  </varlistentry>
+
   <varlistentry>
     <term><menuchoice>
       <shortcut>
diff --git a/kmymoney/icons/icons.cpp b/kmymoney/icons/icons.cpp
index 60f226184..3acc4beb7 100644
--- a/kmymoney/icons/icons.cpp
+++ b/kmymoney/icons/icons.cpp
@@ -153,6 +153,9 @@ const QHash<Icon, QHash<IconSet, QString> > iconMappings{
     {   Icon::HideReconciled,
         {{IconSet::Common, QStringLiteral("hide-reconciled")}}
     },
+    {   Icon::ShowReconciledBalances,
+        {{IconSet::Breeze, QStringLiteral("gnumeric-autosum")}}
+    },
     {Icon::KMyMoney, {{IconSet::Common, QStringLiteral("kmymoney")}}},
     {   Icon::KeyEnter,
         {   {IconSet::Common, QStringLiteral("input-keyboard")},
diff --git a/kmymoney/icons/icons.h b/kmymoney/icons/icons.h
index 3bf14ce8a..21431a777 100644
--- a/kmymoney/icons/icons.h
+++ b/kmymoney/icons/icons.h
@@ -31,6 +31,7 @@ enum class Icon { OpenDatabase, Merge, Reconcile, Split, Tip, PerformanceTest,
                   Pause, SeekForward,
                   SkipForward,
                   HideReconciled, HideCategories,
+                  ShowReconciledBalances,
                   Home, Institution, Institutions,
                   Accounts,
                   Schedule, Tags,
diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp
index 2f5e4f71c..080a2647e 100644
--- a/kmymoney/kmymoney.cpp
+++ b/kmymoney/kmymoney.cpp
@@ -1386,6 +1386,7 @@ QHash<Action, QAction *> KMyMoneyApp::initActions()
             // *************
             {Action::ViewTransactionDetail,         QStringLiteral("view_show_transaction_detail"),   i18n("Show Transaction Detail"),                    Icon::TransactionDetails},
             {Action::ViewHideReconciled,            QStringLiteral("view_hide_reconciled_transactions"), i18n("Hide reconciled transactions"),            Icon::HideReconciled},
+            {Action::ViewShowReconciledBalances,    QStringLiteral("view_show_reconciled_balances"),  i18n("Show reconciled balances"),                   Icon::ShowReconciledBalances},
             {Action::ViewHideCategories,            QStringLiteral("view_hide_unused_categories"),    i18n("Hide unused categories"),                     Icon::HideCategories},
             {Action::ViewShowAll,                   QStringLiteral("view_show_all_accounts"),         i18n("Show all accounts"),                          Icon::Empty},
             // *********************
@@ -1530,6 +1531,7 @@ QHash<Action, QAction *> KMyMoneyApp::initActions()
             // *************
             {Action::ViewTransactionDetail,         &KMyMoneyApp::slotShowTransactionDetail},
             {Action::ViewHideReconciled,            &KMyMoneyApp::slotHideReconciledTransactions},
+            {Action::ViewShowReconciledBalances,    &KMyMoneyApp::slotShowReconciledBalances},
             {Action::ViewHideCategories,            &KMyMoneyApp::slotHideUnusedCategories},
             {Action::ViewShowAll,                   &KMyMoneyApp::slotShowAllAccounts},
             // **************
@@ -1573,6 +1575,7 @@ QHash<Action, QAction *> KMyMoneyApp::initActions()
         // so set them here
         const QVector<Action> checkableActions {
             Action::ViewTransactionDetail, Action::ViewHideReconciled, Action::ViewHideCategories,
+            Action::ViewShowReconciledBalances, Action::ViewHideCategories,
 #ifdef KMM_DEBUG
             Action::DebugTraces,
             Action::DebugTimers,
@@ -1635,6 +1638,7 @@ QHash<Action, QAction *> KMyMoneyApp::initActions()
     // Setup transaction detail switch
     lutActions[Action::ViewTransactionDetail]->setChecked(KMyMoneySettings::showRegisterDetailed());
     lutActions[Action::ViewHideReconciled]->setChecked(KMyMoneySettings::hideReconciledTransactions());
+    lutActions[Action::ViewShowReconciledBalances]->setChecked(KMyMoneySettings::showReconciledBalances());
     lutActions[Action::ViewHideCategories]->setChecked(KMyMoneySettings::hideUnusedCategory());
     lutActions[Action::ViewShowAll]->setChecked(KMyMoneySettings::showAllAccounts());
 
@@ -1777,6 +1781,7 @@ void KMyMoneyApp::readOptions()
 
 
     pActions[Action::ViewHideReconciled]->setChecked(KMyMoneySettings::hideReconciledTransactions());
+    pActions[Action::ViewShowReconciledBalances]->setChecked(KMyMoneySettings::showReconciledBalances());
     pActions[Action::ViewHideCategories]->setChecked(KMyMoneySettings::hideUnusedCategory());
 
     d->m_recentFiles->loadEntries(d->m_config->group("Recent Files"));
@@ -2016,6 +2021,12 @@ void KMyMoneyApp::slotHideReconciledTransactions()
     d->m_myMoneyView->slotRefreshViews();
 }
 
+void KMyMoneyApp::slotShowReconciledBalances()
+{
+    KMyMoneySettings::setShowReconciledBalances(pActions[Action::ViewShowReconciledBalances]->isChecked());
+    d->m_myMoneyView->slotRefreshViews();
+}
+
 void KMyMoneyApp::slotHideUnusedCategories()
 {
     KMyMoneySettings::setHideUnusedCategory(pActions[Action::ViewHideCategories]->isChecked());
diff --git a/kmymoney/kmymoney.h b/kmymoney/kmymoney.h
index 21dbdd4c6..82e4f57b0 100644
--- a/kmymoney/kmymoney.h
+++ b/kmymoney/kmymoney.h
@@ -435,6 +435,11 @@ public Q_SLOTS:
       */
     void slotHideReconciledTransactions();
 
+    /**
+      * Toggles the show reconciled balances setting
+      */
+    void slotShowReconciledBalances();
+
     /**
       * Toggles the hide unused categories setting
       */
diff --git a/kmymoney/kmymoneyui.rc b/kmymoney/kmymoneyui.rc
index ca05e3ff0..fd957f794 100644
--- a/kmymoney/kmymoneyui.rc
+++ b/kmymoney/kmymoneyui.rc
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui version="46" name="kmymoney" >
+<kpartgui version="47" name="kmymoney" >
  <MenuBar>
   <Menu name="file" >
    <DefineGroup name="open_db_group" append="open_merge"/>
@@ -30,6 +30,7 @@
   <Menu name="view" >
    <Action name="view_show_transaction_detail" />
    <Action name="view_hide_reconciled_transactions" />
+   <Action name="view_show_reconciled_balances" />
    <Action name="view_hide_unused_categories" />
    <Action name="view_show_all_accounts" />
   </Menu>
diff --git a/kmymoney/menus/menuenums.h b/kmymoney/menus/menuenums.h
index 0d51d2220..f2cde8c6c 100644
--- a/kmymoney/menus/menuenums.h
+++ b/kmymoney/menus/menuenums.h
@@ -34,7 +34,7 @@ enum class Action {
     // *************
     // The view menu
     // *************
-    ViewTransactionDetail, ViewHideReconciled,
+    ViewTransactionDetail, ViewHideReconciled, ViewShowReconciledBalances,
     ViewHideCategories, ViewShowAll,
     // *************
     // The institution menu
diff --git a/kmymoney/settings/kmymoney.kcfg b/kmymoney/settings/kmymoney.kcfg
index 144e12579..e491187de 100644
--- a/kmymoney/settings/kmymoney.kcfg
+++ b/kmymoney/settings/kmymoney.kcfg
@@ -252,6 +252,10 @@
    <label>Hide reconciled transactions</label>
    <default>false</default>
   </entry>
+  <entry name="ShowReconciledBalances" type="Bool">
+   <label>Show reconciled balances</label>
+   <default>true</default>
+  </entry>
   <entry name="ShowRegisterDetailed" type="Bool">
    <label>Show all register entries in full detail</label>
    <default>false</default>
diff --git a/kmymoney/widgets/register.cpp b/kmymoney/widgets/register.cpp
index 5108bc21a..71e3a1ccd 100644
--- a/kmymoney/widgets/register.cpp
+++ b/kmymoney/widgets/register.cpp
@@ -1705,6 +1705,14 @@ void Register::addGroupMarkers()
 
         if (d->m_account.lastReconciliationDate().isValid())
             new KMyMoneyRegister::StatementGroupMarker(this, eRegister::CashFlowDirection::Deposit, d->m_account.lastReconciliationDate(), i18n("Last reconciliation"));
+
+        if (KMyMoneySettings::showReconciledBalances()) {
+            foreach(const QDate &date, d->m_account.reconciliationHistory().keys()) {
+                QString txt = i18n("Reconciled Balance: %1", d->m_account.reconciliationHistory()[date].formatMoney(d->m_account.fraction()));
+                new KMyMoneyRegister::StatementGroupMarker(this, eRegister::CashFlowDirection::Deposit, date, txt);
+            }
+        }
+
         if (KMyMoneySettings::showFancyMarker()) {
             if (!d->m_account.value("lastImportedTransactionDate").isEmpty()
                     && !d->m_account.value("lastStatementBalance").isEmpty()) {



More information about the kde-doc-english mailing list