From 6b55222ca9c5f4a531c94dc11dce2a8a415fcf5e Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Mon, 16 Mar 2020 15:02:46 +0000 Subject: [PATCH] Add ability to show HBCI Online Account matches to 'Import Map Editor' --- gnucash/gnome/dialog-imap-editor.c | 48 ++++++++++++++++++--- gnucash/gtkbuilder/dialog-imap-editor.glade | 13 +++--- libgnucash/engine/Account.cpp | 6 ++- libgnucash/engine/Account.h | 4 +- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/gnucash/gnome/dialog-imap-editor.c b/gnucash/gnome/dialog-imap-editor.c index 4dc512127a0..a6721f2f9a2 100644 --- a/gnucash/gnome/dialog-imap-editor.c +++ b/gnucash/gnome/dialog-imap-editor.c @@ -549,6 +549,9 @@ list_type_selected_cb (GtkToggleButton* button, ImapDialog *imap_dialog) else type = ONLINE; + if (type != ONLINE) + gtk_widget_grab_focus (GTK_WIDGET(imap_dialog->filter_text_entry)); + // Lets do this only on change of list type if (type != imap_dialog->type) { @@ -736,24 +739,27 @@ get_account_info_online (ImapDialog *imap_dialog, GList *accts) /* Go through list of accounts */ for (ptr = accts; ptr; ptr = g_list_next (ptr)) { + gchar *hbci_account_id = NULL; + gchar *hbci_bank_code = NULL; gchar *text = NULL; Account *acc = ptr->data; - // Save source account - imapInfo.source_account = acc; - imapInfo.head = "online_id"; - imapInfo.category = " "; - - text = gnc_account_get_map_entry (acc, imapInfo.head); + // Check for online_id + text = gnc_account_get_map_entry (acc, "online_id", NULL); if (text != NULL) { + // Save source account + imapInfo.source_account = acc; + imapInfo.head = "online_id"; + imapInfo.category = " "; + if (g_strcmp0 (text, "") == 0) imapInfo.map_account = NULL; else imapInfo.map_account = imapInfo.source_account; - imapInfo.match_string = text; + imapInfo.match_string = text; imapInfo.count = " "; // Add top level entry and pass iter to add_to_store @@ -761,6 +767,34 @@ get_account_info_online (ImapDialog *imap_dialog, GList *accts) add_to_store (imap_dialog, &toplevel, _("Online Id"), &imapInfo); } g_free (text); + + // Check for aqbanking hbci + hbci_account_id = gnc_account_get_map_entry (acc, "hbci", "account-id"); + hbci_bank_code = gnc_account_get_map_entry (acc, "hbci", "bank-code"); + text = g_strconcat (hbci_bank_code, ",", hbci_account_id, NULL); + + if ((hbci_account_id != NULL) || (hbci_bank_code != NULL)) + { + // Save source account + imapInfo.source_account = acc; + imapInfo.head = "hbci"; + imapInfo.category = " "; + + if (g_strcmp0 (text, "") == 0) + imapInfo.map_account = NULL; + else + imapInfo.map_account = imapInfo.source_account; + + imapInfo.match_string = text; + imapInfo.count = " "; + + // Add top level entry and pass iter to add_to_store + gtk_tree_store_append (GTK_TREE_STORE(imap_dialog->model), &toplevel, NULL); + add_to_store (imap_dialog, &toplevel, _("Online HBCI"), &imapInfo); + } + g_free (hbci_account_id); + g_free (hbci_bank_code); + g_free (text); } } diff --git a/gnucash/gtkbuilder/dialog-imap-editor.glade b/gnucash/gtkbuilder/dialog-imap-editor.glade index c1e61c8cc76..b7d7658e398 100644 --- a/gnucash/gtkbuilder/dialog-imap-editor.glade +++ b/gnucash/gtkbuilder/dialog-imap-editor.glade @@ -156,7 +156,7 @@ - Online ID + Online True True False @@ -288,8 +288,8 @@ True False - 5 - 5 + 3 + 3 Filter will be applied to 'Match String' and 'Mapped to Account Name' fields, case sensitive.