[office/kmymoney] kmymoney: Improve UI behavior during reconciliation

Thomas Baumgart null at kde.org
Sun Feb 6 09:47:22 GMT 2022


Git commit 5510898346affb2a5340cb8d173109097370fcee by Thomas Baumgart.
Committed on 06/02/2022 at 09:47.
Pushed by tbaumgart into branch 'master'.

Improve UI behavior during reconciliation

Added reconciliation toolbar which will be shown when an account is
reconciled. Add the cancel reconciliation action to the UI.

GUI:

M  +32   -2    kmymoney/kmymoney.cpp
M  +7    -1    kmymoney/kmymoneyui.rc
M  +1    -0    kmymoney/views/kmymoneyview.cpp
M  +6    -4    kmymoney/views/simpleledgerview.cpp

https://invent.kde.org/office/kmymoney/commit/5510898346affb2a5340cb8d173109097370fcee

diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp
index 64f16533e..0b2de2344 100644
--- a/kmymoney/kmymoney.cpp
+++ b/kmymoney/kmymoney.cpp
@@ -1101,11 +1101,20 @@ public:
         aC->action(QString::fromLatin1(KStandardAction::name(KStandardAction::Close)))->setEnabled(m_storageInfo.isOpened);
         pActions[Action::UpdateAllAccounts]->setEnabled(m_storageInfo.isOpened && KMyMoneyUtils::canUpdateAllAccounts());
 
+        updateReconciliationTools(selections);
+
         // update actions in views and plugins
         m_myMoneyView->updateActions(selections);
         KMyMoneyPlugin::updateActions(pPlugins, selections);
     }
 
+    void updateReconciliationTools(const SelectedObjects& selections)
+    {
+        // update reconciliation toolbar
+        const bool inReconciliation = !selections.firstSelection(SelectedObjects::ReconciliationAccount).isEmpty();
+        q->toolBar("reconcileToolBar")->setVisible(inReconciliation);
+    }
+
     bool canFileSaveAs() const
     {
         return (m_storageInfo.isOpened
@@ -1688,8 +1697,8 @@ QHash<Action, QAction *> KMyMoneyApp::initActions()
             {Action::OpenAccount,                   QStringLiteral("account_open"),                   i18n("Open ledger"),                                Icon::Ledger},
             {Action::StartReconciliation,           QStringLiteral("account_reconcile"),              i18n("Reconcile..."),                               Icon::Reconcile},
             {Action::FinishReconciliation,          QStringLiteral("account_reconcile_finish"),       i18nc("Finish reconciliation", "Finish"),           Icon::Reconciled},
-            {Action::PostponeReconciliation,        QStringLiteral("account_reconcile_postpone"),     i18n("Postpone reconciliation"),                    Icon::Pause},
-            {Action::CancelReconciliation,          QStringLiteral("account_reconcile_cancel"),       i18n("Cancel reconciliation"),                      Icon::Empty},
+            {Action::PostponeReconciliation,        QStringLiteral("account_reconcile_postpone"),     i18nc("Postpone reconciliation", "Postpone"),       Icon::Pause},
+            {Action::CancelReconciliation,          QStringLiteral("account_reconcile_cancel"),       i18nc("Cancel reconciliation", "Cancel"),           Icon::DialogCancel},
             {Action::ReconciliationReport,          QStringLiteral("account_reconcile_report"),       i18n("Report reconciliation"),                      Icon::Empty},
             {Action::EditAccount,                   QStringLiteral("account_edit"),                   i18n("Edit account..."),                            Icon::AccountEdit},
             {Action::DeleteAccount,                 QStringLiteral("account_delete"),                 i18n("Delete account..."),                          Icon::AccountRemove},
@@ -1912,6 +1921,27 @@ QHash<Action, QAction *> KMyMoneyApp::initActions()
             connect(lutActions[connection.key()], &QAction::triggered, this, connection.value());
     }
 
+    {
+        // struct for adding tooltips to actions
+        struct actionInfo {
+            Action  action;
+            QString tip;
+        };
+
+        // clang-format off
+        const QVector<actionInfo> actionInfos {
+            {Action::StartReconciliation,        i18nc("@info:tooltip", "Start reconciling the currently selected account")},
+            {Action::PostponeReconciliation,     i18nc("@info:tooltip", "Postpone the current reconciliation")},
+            {Action::FinishReconciliation,       i18nc("@info:tooltip", "Finish the current reconciliation")},
+            {Action::CancelReconciliation,       i18nc("@info:tooltip", "Cancel the current reconciliation")},
+        };
+        // clang-format on
+
+        for (const auto& actionInfo : actionInfos) {
+            lutActions[actionInfo.action]->setToolTip(actionInfo.tip);
+        }
+    }
+
     // *************
     // Setting some of added actions checkable
     // *************
diff --git a/kmymoney/kmymoneyui.rc b/kmymoney/kmymoneyui.rc
index e301bf496..88cee4048 100644
--- a/kmymoney/kmymoneyui.rc
+++ b/kmymoney/kmymoneyui.rc
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui version="49" name="kmymoney" >
+<kpartgui version="50" name="kmymoney" >
  <MenuBar>
   <Menu name="file" >
    <DefineGroup name="open_db_group" append="open_merge"/>
@@ -52,6 +52,7 @@
    <Action name="account_reconcile" />
    <Action name="account_reconcile_postpone" />
    <Action name="account_reconcile_finish" />
+   <Action name="account_reconcile_cancel" />
    <Separator/>
    <Action name="account_transaction_report" />
    <Separator/>
@@ -252,4 +253,9 @@
   <Separator />
   <Action name="tools_kcalc" />
  </ToolBar>
+ <ToolBar name="reconcileToolBar" fullWidth="false" iconText="textundericon">
+  <Action name="account_reconcile_finish" />
+  <Action name="account_reconcile_postpone" />
+  <Action name="account_reconcile_cancel" />
+ </ToolBar>
 </kpartgui>
diff --git a/kmymoney/views/kmymoneyview.cpp b/kmymoney/views/kmymoneyview.cpp
index 947cad806..f121391d3 100644
--- a/kmymoney/views/kmymoneyview.cpp
+++ b/kmymoney/views/kmymoneyview.cpp
@@ -363,6 +363,7 @@ void KMyMoneyView::updateActions(const SelectedObjects& selections)
     pActions[eMenu::Action::StartReconciliation]->setEnabled(false);
     pActions[eMenu::Action::PostponeReconciliation]->setEnabled(false);
     pActions[eMenu::Action::FinishReconciliation]->setEnabled(false);
+    pActions[eMenu::Action::CancelReconciliation]->setEnabled(false);
 
     // update actions in all views. process the current last
     for (const auto& view : d->viewBases.keys()) {
diff --git a/kmymoney/views/simpleledgerview.cpp b/kmymoney/views/simpleledgerview.cpp
index 2243b50da..5545c4538 100644
--- a/kmymoney/views/simpleledgerview.cpp
+++ b/kmymoney/views/simpleledgerview.cpp
@@ -324,10 +324,11 @@ public:
             int newIdx = ui->ledgerTab->insertTab(newPos, reconciliationView, acc.name());
 
             // we don't allow closing the tab without using the action buttons
-            removeCloseButton(newIdx,
-                              i18nc("@info:tooltip",
-                                    "The close button for this account has been removed because you are reconciling it. Finish or postpone the reconciliation "
-                                    "to get it back."));
+            removeCloseButton(
+                newIdx,
+                i18nc("@info:tooltip",
+                      "The close button for this account has been removed because you are reconciling it. Finish, cancel or postpone the reconciliation "
+                      "to get it back."));
 
             q->connect(reconciliationView, &LedgerViewPage::requestSelectionChanged, q, &SimpleLedgerView::slotRequestSelectionChange);
             q->connect(reconciliationView, &LedgerViewPage::requestCustomContextMenu, q, &SimpleLedgerView::requestCustomContextMenu);
@@ -659,6 +660,7 @@ void SimpleLedgerView::updateActions(const SelectedObjects& selections)
                 pActions[eMenu::Action::PostponeReconciliation]->setEnabled(true);
                 pActions[eMenu::Action::FinishReconciliation]->setEnabled(true);
             }
+            pActions[eMenu::Action::CancelReconciliation]->setEnabled(true);
         }
     }
 }


More information about the kde-doc-english mailing list