diff --git a/ChangeLog b/ChangeLog index 16ac7a24ba..6f5e43c90c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-07-28 Christian Stimming + + * src/import-export/hbci/druid-hbci-initial.c: Add button for + manual adding of HBCI accounts. Fixes #117760. Requires latest + OpenHBCI CVS -- next openhbci-0.9.13 will be out this weekend. + + * src/import-export/hbci/gnc-hbci-{getbalance,gettrans,transfer}.c: + Add saving of the HBCI_API so that bank's status changes will now + be remembered immediately. However this might save some + unnecessary information to disk, but hopefully we will have fixed + that in OpenHBCI soon. + 2003-07-28 Derek Atkins * src/gnome-utils/gnc-date-edit.c: hide the calendar popup diff --git a/configure.in b/configure.in index ee33bd0597..3fe2f78ba1 100644 --- a/configure.in +++ b/configure.in @@ -568,7 +568,7 @@ AC_ARG_ENABLE( hbci, fi) if test x${HBCI_DIR} = xhbci ; then - AM_PATH_OPENHBCI(0.9.11) + AM_PATH_OPENHBCI(0.9.12.11) HBCI_LIBS="${OPENHBCI_LIBS}" HBCI_CFLAGS="${OPENHBCI_CFLAGS}" diff --git a/src/import-export/hbci/druid-hbci-initial.c b/src/import-export/hbci/druid-hbci-initial.c index 20ce13b1e4..742937a5da 100644 --- a/src/import-export/hbci/druid-hbci-initial.c +++ b/src/import-export/hbci/druid-hbci-initial.c @@ -199,9 +199,9 @@ update_accountlist_acc_cb (const HBCI_Account *hacc, gpointer user_data) g_assert(info); row_text[2] = ""; - /* Account code, then Bank name, then Bank code in parentheses. */ row_text[0] = - g_strdup_printf("%s at %s (code %s)", + /* Translators: Strings are 1. Account code, 2. Bank name, 3. Bank code. */ + g_strdup_printf(_("%s at %s (code %s)"), HBCI_Account_accountId (hacc), HBCI_Bank_name (HBCI_Account_bank (hacc)), HBCI_Bank_bankCode (HBCI_Account_bank (hacc))); @@ -571,6 +571,79 @@ choose_hbciversion_dialog (GtkWindow *parent, HBCI_Bank *bank) } +/* -------------------------------------- */ +/* Copied from window-help.c */ +static void +goto_string_cb(char * string, gpointer data) +{ + if(!data) return; + if(!string) { + *(char **)data = NULL; + } + else { + *(char **)data = g_strdup(string); + } +} +static void gnc_hbci_addaccount(HBCIInitialInfo *info, + const HBCI_Customer *cust) +{ + HBCI_Bank *bank; + const HBCI_User *user; + HBCI_Account *acc; + + GtkWidget *dlg; + char *prompt; + char *accnr = NULL; + int retval = -1; + + g_assert(info); + user = HBCI_Customer_user (cust); + bank = (HBCI_Bank *) HBCI_User_bank (user); + + /* Ask for new account id by opening a request_dialog -- a druid + page would be better from GUI design, but I'm too lazy. */ + prompt = g_strdup_printf(_("Enter account id for new account \nat bank %s (bank code %s):"), + HBCI_Bank_name (bank), HBCI_Bank_bankCode (bank)); + + dlg = gnome_request_dialog(FALSE, prompt, "", 20, + &goto_string_cb, &accnr, GTK_WINDOW(info->window)); + retval = gnome_dialog_run_and_close(GNOME_DIALOG(dlg)); + + if ((retval == 0) && accnr && (strlen(accnr) > 0)) { + + /* Check if such an account already exists */ + if ( HBCI_Bank_findAccount (bank, accnr) ) + { + /* Yes, then don't create it again */ + gnc_error_dialog_parented + (GTK_WINDOW (info->window), + _("An account with this account id at this bank already exists.")); + } + else + { + /* No, then create it now */ + acc = HBCI_API_accountFactory(bank, accnr, ""); + /* Add it to the bank, and the bank will also own the newly + created object. */ + HBCI_Bank_addAccount(bank, acc, TRUE); + /* and add the given customer as first authorized + customer. This needs more work in case there are different + customers here. */ + HBCI_Account_addAuthorizedCustomer(acc, cust); + + /* Don't forget to update the account list, otherwise the new + accounts won't show up. */ + update_accountlist(info); + } + } + + g_free(prompt); + if (accnr) + g_free (accnr); +} +/* -------------------------------------- */ + + /************************************************************* * GUI callbacks */ @@ -1070,7 +1143,6 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage, HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE); } - /*update_accountlist(info->api);*/ return FALSE; } @@ -1466,18 +1538,9 @@ on_button_clicked (GtkButton *button, } else if (strcmp (name, "addaccount_button") == 0) { /* manually adding HBCI account is not yet implemented (should be rather easy, though) */ - gnc_error_dialog_parented - (GTK_WINDOW (info->window), - _("Unfortunately the manual adding of HBCI accounts to your OpenHBCI\n" - "configuration has not yet been implemented in GnuCash. Please use\n" - "other programs such as 'aqmoney' to manually add the HBCI accounts to\n" - "your OpenHBCI configuration (see aqmoney manual page).\n" - "\n" - "Note: Most banks automatically send the list of available HBCI\n" - "accounts to you when you press the button 'Update Account List'. The\n" - "manual adding of HBCI accounts is needed if and only if your bank does\n" - "not support this automatic updating of the account list. If in doubt,\n" - "contact your bank and/or the GnuCash and OpenHBCI developers.")); + info->newcustomer = choose_customer (info); + gnc_hbci_addaccount(info, info->newcustomer); + /* Nothing else to do. Stay at this druid page. */ } else if (strcmp (name, "serveryes_button") == 0) { druid_enable_next_button (info); } else if (strcmp (name, "serverno_button") == 0) { @@ -1503,6 +1566,9 @@ on_button_clicked (GtkButton *button, + + + void gnc_hbci_initial_druid (void) { HBCIInitialInfo *info; diff --git a/src/import-export/hbci/glade/hbci.glade b/src/import-export/hbci/glade/hbci.glade index 3ced9a233e..cb897eb4c1 100644 --- a/src/import-export/hbci/glade/hbci.glade +++ b/src/import-export/hbci/glade/hbci.glade @@ -1079,12 +1079,10 @@ progress of the HBCI connection in the HBCI connection window. - GtkScrolledWindow - scrolledwindow25 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS + GtkVBox + vbox157 + False + 0 0 True @@ -1092,62 +1090,94 @@ progress of the HBCI connection in the HBCI connection window. - GtkCList - account_page_list - True - 3 - 281,242,53 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN + GtkScrolledWindow + scrolledwindow25 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + - GtkLabel - CList:title - label834 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + GtkCList + account_page_list + True + 3 + 281,242,53 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN - - GtkLabel - CList:title - label835 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + CList:title + label834 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + - - GtkLabel - CList:title - label836 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + + GtkLabel + CList:title + label835 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label836 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + label828 + + GTK_JUSTIFY_LEFT + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + - GtkVBox - vbox144 - 5 - False - 5 + GtkFrame + frame72 + + 0 + GTK_SHADOW_ETCHED_IN 0 False @@ -1155,94 +1185,84 @@ progress of the HBCI connection in the HBCI connection window. - GtkButton - hbciversion_button - True - - - GtkButton - updatelist_button - True - - - GtkButton - addaccount_button - True - - - GtkButton - addbank_button - True - - - GtkButton - adduser_button - True - - - - GtkLabel - label828 - - GTK_JUSTIFY_LEFT - False - 0.5 - 0.5 - 0 - 0 - - 3 - False - False - - diff --git a/src/import-export/hbci/gnc-hbci-getbalance.c b/src/import-export/hbci/gnc-hbci-getbalance.c index affd06a9d7..dd3184b64a 100644 --- a/src/import-export/hbci/gnc-hbci-getbalance.c +++ b/src/import-export/hbci/gnc-hbci-getbalance.c @@ -117,6 +117,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc) /* Clean up after ourselves. */ HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); + gnc_hbci_api_save (api); GNCInteractor_hide (interactor); } } diff --git a/src/import-export/hbci/gnc-hbci-gettrans.c b/src/import-export/hbci/gnc-hbci-gettrans.c index c4d77feb12..6d7b97049f 100644 --- a/src/import-export/hbci/gnc-hbci-gettrans.c +++ b/src/import-export/hbci/gnc-hbci-gettrans.c @@ -136,6 +136,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc) /* Clean up behind ourself. */ HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); + gnc_hbci_api_save (api); GNCInteractor_hide (interactor); } } diff --git a/src/import-export/hbci/gnc-hbci-transfer.c b/src/import-export/hbci/gnc-hbci-transfer.c index e779f0acef..5bb81feea1 100644 --- a/src/import-export/hbci/gnc-hbci-transfer.c +++ b/src/import-export/hbci/gnc-hbci-transfer.c @@ -161,6 +161,7 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc, /* Just to be on the safe side, clear queue once again. */ HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); + gnc_hbci_api_save (api); gnc_hbci_dialog_delete(td); gnc_trans_templ_delete_glist (template_list);