Add ability to show HBCI Online Account matches to 'Import Map Editor'

This commit is contained in:
Robert Fewell 2020-03-16 15:02:46 +00:00
parent 1fa5fd0a14
commit 6b55222ca9
4 changed files with 55 additions and 16 deletions

View File

@ -549,6 +549,9 @@ list_type_selected_cb (GtkToggleButton* button, ImapDialog *imap_dialog)
else else
type = ONLINE; 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 // Lets do this only on change of list type
if (type != imap_dialog->type) if (type != imap_dialog->type)
{ {
@ -736,24 +739,27 @@ get_account_info_online (ImapDialog *imap_dialog, GList *accts)
/* Go through list of accounts */ /* Go through list of accounts */
for (ptr = accts; ptr; ptr = g_list_next (ptr)) for (ptr = accts; ptr; ptr = g_list_next (ptr))
{ {
gchar *hbci_account_id = NULL;
gchar *hbci_bank_code = NULL;
gchar *text = NULL; gchar *text = NULL;
Account *acc = ptr->data; Account *acc = ptr->data;
// Save source account // Check for online_id
imapInfo.source_account = acc; text = gnc_account_get_map_entry (acc, "online_id", NULL);
imapInfo.head = "online_id";
imapInfo.category = " ";
text = gnc_account_get_map_entry (acc, imapInfo.head);
if (text != NULL) if (text != NULL)
{ {
// Save source account
imapInfo.source_account = acc;
imapInfo.head = "online_id";
imapInfo.category = " ";
if (g_strcmp0 (text, "") == 0) if (g_strcmp0 (text, "") == 0)
imapInfo.map_account = NULL; imapInfo.map_account = NULL;
else else
imapInfo.map_account = imapInfo.source_account; imapInfo.map_account = imapInfo.source_account;
imapInfo.match_string = text; imapInfo.match_string = text;
imapInfo.count = " "; imapInfo.count = " ";
// Add top level entry and pass iter to add_to_store // 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); add_to_store (imap_dialog, &toplevel, _("Online Id"), &imapInfo);
} }
g_free (text); 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);
} }
} }

View File

@ -156,7 +156,7 @@
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="radio-online"> <object class="GtkRadioButton" id="radio-online">
<property name="label" translatable="yes">Online ID</property> <property name="label" translatable="yes">Online</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
@ -288,8 +288,8 @@
<object class="GtkLabel" id="filter-label"> <object class="GtkLabel" id="filter-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_top">5</property> <property name="margin_top">3</property>
<property name="margin_bottom">5</property> <property name="margin_bottom">3</property>
<property name="label" translatable="yes">Filter will be applied to 'Match String' and 'Mapped to Account Name' fields, case sensitive.</property> <property name="label" translatable="yes">Filter will be applied to 'Match String' and 'Mapped to Account Name' fields, case sensitive.</property>
<style> <style>
<class name="gnc-class-highlight"/> <class name="gnc-class-highlight"/>
@ -320,6 +320,9 @@
<object class="GtkEntry" id="filter-text-entry"> <object class="GtkEntry" id="filter-text-entry">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="invisible_char">●</property> <property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property> <property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property>
@ -394,8 +397,8 @@
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_top">5</property> <property name="margin_top">3</property>
<property name="margin_bottom">5</property> <property name="margin_bottom">3</property>
<property name="label" translatable="yes">Multiple rows can be selected and then deleted by pressing the delete button.</property> <property name="label" translatable="yes">Multiple rows can be selected and then deleted by pressing the delete button.</property>
</object> </object>
<packing> <packing>

View File

@ -5802,11 +5802,13 @@ gnc_account_imap_get_info (Account *acc, const char *category)
/*******************************************************************************/ /*******************************************************************************/
gchar * gchar *
gnc_account_get_map_entry (Account *acc, const char *full_category) gnc_account_get_map_entry (Account *acc, const char *head, const char *category)
{ {
GValue v = G_VALUE_INIT; GValue v = G_VALUE_INIT;
gchar *text = NULL; gchar *text = NULL;
std::vector<std::string> path {full_category}; std::vector<std::string> path {head};
if (category)
path.emplace_back (category);
if (qof_instance_has_path_slot (QOF_INSTANCE (acc), path)) if (qof_instance_has_path_slot (QOF_INSTANCE (acc), path))
{ {
qof_instance_get_path_kvp (QOF_INSTANCE (acc), &v, path); qof_instance_get_path_kvp (QOF_INSTANCE (acc), &v, path);

View File

@ -1457,10 +1457,10 @@ GList *gnc_account_imap_get_info_bayes (Account *acc);
*/ */
GList *gnc_account_imap_get_info (Account *acc, const char *category); GList *gnc_account_imap_get_info (Account *acc, const char *category);
/** Returns the text string pointed to by full_category for the Account, free /** Returns the text string pointed to by head and category for the Account, free
* the returned text * the returned text
*/ */
gchar *gnc_account_get_map_entry (Account *acc, const char *full_category); gchar *gnc_account_get_map_entry (Account *acc, const char *head, const char *category);
/** Delete the entry for Account pointed to by head,category and match_string, /** Delete the entry for Account pointed to by head,category and match_string,
* if empty is TRUE then use delete if empty * if empty is TRUE then use delete if empty