r15424 - gnucash/trunk/src/import-export/hbci - Enable user choice of format (profile) when importing data from a file
Christian Stimming
cstim at cvs.gnucash.org
Tue Jan 23 15:56:26 EST 2007
Author: cstim
Date: 2007-01-23 15:56:25 -0500 (Tue, 23 Jan 2007)
New Revision: 15424
Trac: http://svn.gnucash.org/trac/changeset/15424
Modified:
gnucash/trunk/src/import-export/hbci/gnc-file-aqb-import.h
gnucash/trunk/src/import-export/hbci/gnc-plugin-hbci.c
gnucash/trunk/src/import-export/hbci/hbci-interaction.h
gnucash/trunk/src/import-export/hbci/schemas/apps_gnucash_dialog_hbci.schemas.in
Log:
Enable user choice of format (profile) when importing data from a file
through aqbanking. Next step in eventually fixing #358942.
Modified: gnucash/trunk/src/import-export/hbci/gnc-file-aqb-import.h
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-file-aqb-import.h 2007-01-23 20:35:20 UTC (rev 15423)
+++ gnucash/trunk/src/import-export/hbci/gnc-file-aqb-import.h 2007-01-23 20:56:25 UTC (rev 15424)
@@ -34,9 +34,11 @@
* @param aqbanking_importername The aqbanking importer module that
* should be used. Possible values: "dtaus", "csv", "swift".
*
- * @param aqbanking_profilename In aqbanking, each importer has one or
- * more "profiles" that define the actual data fields that should be
- * used. Possible values for swift: "swift-mt940" or "swift-mt942",
+ * @param aqbanking_formatname In aqbanking, each importer has one or
+ * more possible data formats available that define the actual data
+ * fields that should be used. In aqbanking, such a different format
+ * is called a "profile".
+ * Possible values for swift: "swift-mt940" or "swift-mt942",
* but for all others: "default", or more precisely: Look into
* $datadir/aqbanking/imexporters and look into the "name" field of
* the foo.conf files.
@@ -46,6 +48,6 @@
* FALSE, simply import the transactions and that's it.
*/
void gnc_file_aqbanking_import (const gchar *aqbanking_importername,
- const gchar *aqbanking_profilename,
+ const gchar *aqbanking_formatname,
gboolean execute_transactions);
#endif
Modified: gnucash/trunk/src/import-export/hbci/gnc-plugin-hbci.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-plugin-hbci.c 2007-01-23 20:35:20 UTC (rev 15423)
+++ gnucash/trunk/src/import-export/hbci/gnc-plugin-hbci.c 2007-01-23 20:56:25 UTC (rev 15424)
@@ -39,6 +39,10 @@
#include "gnc-plugin-page-account-tree.h"
#include "gnc-plugin-page-register.h"
+/* for gnc_gconf_ */
+#include "gnc-gconf-utils.h"
+#include "hbci-interaction.h"
+
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = "gnucash-hbci";
@@ -543,38 +547,50 @@
gnc_plugin_hbci_cmd_dtaus_importsend (GtkAction *action,
GncMainWindowActionData *data)
{
- gnc_file_aqbanking_import ("dtaus", "default", TRUE);
+ char *format = gnc_gconf_get_string(GCONF_SECTION, KEY_FORMAT_DTAUS, NULL);
+ gnc_file_aqbanking_import ("dtaus", format ? format : "default", TRUE);
+ g_free (format);
}
static void
gnc_plugin_hbci_cmd_csv_importsend (GtkAction *action,
GncMainWindowActionData *data)
{
- gnc_file_aqbanking_import ("csv", "default", TRUE);
+ char *format = gnc_gconf_get_string(GCONF_SECTION, KEY_FORMAT_CSV, NULL);
+ gnc_file_aqbanking_import ("csv", format ? format : "default", TRUE);
+ g_free (format);
}
static void
gnc_plugin_hbci_cmd_mt940_import (GtkAction *action,
GncMainWindowActionData *data)
{
- gnc_file_aqbanking_import ("swift", "swift-mt940", FALSE);
+ char *format = gnc_gconf_get_string(GCONF_SECTION, KEY_FORMAT_SWIFT940, NULL);
+ gnc_file_aqbanking_import ("swift", format ? format : "swift-mt940", FALSE);
+ g_free (format);
}
static void
gnc_plugin_hbci_cmd_mt942_import (GtkAction *action,
GncMainWindowActionData *data)
{
- gnc_file_aqbanking_import ("swift", "swift-mt942", FALSE);
+ char *format = gnc_gconf_get_string(GCONF_SECTION, KEY_FORMAT_SWIFT942, NULL);
+ gnc_file_aqbanking_import ("swift", format ? format : "swift-mt942", FALSE);
+ g_free (format);
}
static void
gnc_plugin_hbci_cmd_dtaus_import (GtkAction *action,
GncMainWindowActionData *data)
{
- gnc_file_aqbanking_import ("dtaus", "default", FALSE);
+ char *format = gnc_gconf_get_string(GCONF_SECTION, KEY_FORMAT_DTAUS, NULL);
+ gnc_file_aqbanking_import ("dtaus", format ? format : "default", FALSE);
+ g_free (format);
}
static void
gnc_plugin_hbci_cmd_csv_import (GtkAction *action,
GncMainWindowActionData *data)
{
- gnc_file_aqbanking_import ("csv", "default", FALSE);
+ char *format = gnc_gconf_get_string(GCONF_SECTION, KEY_FORMAT_CSV, NULL);
+ gnc_file_aqbanking_import ("csv", format ? format : "default", FALSE);
+ g_free (format);
}
/************************************************************
* Plugin Bootstrapping *
Modified: gnucash/trunk/src/import-export/hbci/hbci-interaction.h
===================================================================
--- gnucash/trunk/src/import-export/hbci/hbci-interaction.h 2007-01-23 20:35:20 UTC (rev 15423)
+++ gnucash/trunk/src/import-export/hbci/hbci-interaction.h 2007-01-23 20:56:25 UTC (rev 15424)
@@ -29,6 +29,10 @@
#define KEY_CLOSE_ON_FINISH "close_on_finish"
#define KEY_REMEMBER_PIN "remember_pin"
#define KEY_VERBOSE_DEBUG "verbose_debug"
+#define KEY_FORMAT_DTAUS "format_dtaus"
+#define KEY_FORMAT_CSV "format_csv"
+#define KEY_FORMAT_SWIFT940 "format_swift_mt940"
+#define KEY_FORMAT_SWIFT942 "format_swift_mt942"
typedef struct _inter_data GNCInteractor;
Modified: gnucash/trunk/src/import-export/hbci/schemas/apps_gnucash_dialog_hbci.schemas.in
===================================================================
--- gnucash/trunk/src/import-export/hbci/schemas/apps_gnucash_dialog_hbci.schemas.in 2007-01-23 20:35:20 UTC (rev 15423)
+++ gnucash/trunk/src/import-export/hbci/schemas/apps_gnucash_dialog_hbci.schemas.in 2007-01-23 20:56:25 UTC (rev 15424)
@@ -75,5 +75,69 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gnucash/dialogs/import/hbci/format_dtaus</key>
+ <applyto>/apps/gnucash/dialogs/import/hbci/format_dtaus</applyto>
+ <owner>gnucash</owner>
+ <type>string</type>
+ <default>default</default>
+ <locale name="C">
+ <short>DTAUS import data format</short>
+ <long>
+ This setting specifies the data format when importing DTAUS
+ files. The AqBanking library offers various import formats
+ (called "profiles") of which you can choose one here.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnucash/dialogs/import/hbci/format_csv</key>
+ <applyto>/apps/gnucash/dialogs/import/hbci/format_csv</applyto>
+ <owner>gnucash</owner>
+ <type>string</type>
+ <default>default</default>
+ <locale name="C">
+ <short>CSV import data format</short>
+ <long>
+ This setting specifies the data format when importing CSV
+ files. The AqBanking library offers various import formats
+ (called "profiles") of which you can choose one here.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnucash/dialogs/import/hbci/format_swift_mt940</key>
+ <applyto>/apps/gnucash/dialogs/import/hbci/format_swift_mt940</applyto>
+ <owner>gnucash</owner>
+ <type>string</type>
+ <default>default</default>
+ <locale name="C">
+ <short>SWIFT MT940 import data format</short>
+ <long>
+ This setting specifies the data format when importing SWIFT
+ MT940 files. The AqBanking library offers various import
+ formats (called "profiles") of which you can choose one here.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnucash/dialogs/import/hbci/format_swift_mt942</key>
+ <applyto>/apps/gnucash/dialogs/import/hbci/format_swift_mt942</applyto>
+ <owner>gnucash</owner>
+ <type>string</type>
+ <default>default</default>
+ <locale name="C">
+ <short>SWIFT MT942 import data format</short>
+ <long>
+ This setting specifies the data format when importing SWIFT
+ MT942 files. The AqBanking library offers various import
+ formats (called "profiles") of which you can choose one here.
+ </long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
More information about the gnucash-changes
mailing list