r17438 - gnucash/branches/gda-dev2 - Merge with trunk through 17437.

Phil Longstaff plongstaff at cvs.gnucash.org
Tue Jul 29 21:08:09 EDT 2008


Author: plongstaff
Date: 2008-07-29 21:08:07 -0400 (Tue, 29 Jul 2008)
New Revision: 17438
Trac: http://svn.gnucash.org/trac/changeset/17438

Added:
   gnucash/branches/gda-dev2/accounts/ru/
   gnucash/branches/gda-dev2/macros/ac_python_devel.m4
   gnucash/branches/gda-dev2/src/engine/engine-common.i
   gnucash/branches/gda-dev2/src/import-export/aqbanking/
   gnucash/branches/gda-dev2/src/optional/python-bindings/
Modified:
   gnucash/branches/gda-dev2/
   gnucash/branches/gda-dev2/.gitignore
   gnucash/branches/gda-dev2/AUTHORS
   gnucash/branches/gda-dev2/accounts/Makefile.am
   gnucash/branches/gda-dev2/accounts/de_DE/acctchrt_skr04.gnucash-xea
   gnucash/branches/gda-dev2/configure.in
   gnucash/branches/gda-dev2/doc/examples/downloaded.mt940
   gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.c
   gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.h
   gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.c
   gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.h
   gnucash/branches/gda-dev2/lib/libqof/qof/qofsession.c
   gnucash/branches/gda-dev2/macros/
   gnucash/branches/gda-dev2/macros/svn2cl.xsl
   gnucash/branches/gda-dev2/make-gnucash-potfiles.in
   gnucash/branches/gda-dev2/po/POTFILES.in
   gnucash/branches/gda-dev2/po/de.po
   gnucash/branches/gda-dev2/src/app-utils/date-utilities.scm
   gnucash/branches/gda-dev2/src/app-utils/gfec.c
   gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.c
   gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.h
   gnucash/branches/gda-dev2/src/app-utils/options.scm
   gnucash/branches/gda-dev2/src/backend/dbi/test/Makefile.am
   gnucash/branches/gda-dev2/src/backend/file/io-utils.c
   gnucash/branches/gda-dev2/src/backend/file/test/test-file-stuff.c
   gnucash/branches/gda-dev2/src/base-typemaps.i
   gnucash/branches/gda-dev2/src/bin/gnucash-bin.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-billterms.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-customer.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-employee.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-invoice.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-job.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-order.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-payment.c
   gnucash/branches/gda-dev2/src/business/business-gnome/dialog-vendor.c
   gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedger.c
   gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerControl.c
   gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerModel.c
   gnucash/branches/gda-dev2/src/business/business-reports/easy-invoice.scm
   gnucash/branches/gda-dev2/src/business/business-reports/fancy-invoice.scm
   gnucash/branches/gda-dev2/src/business/business-reports/invoice.scm
   gnucash/branches/gda-dev2/src/business/business-reports/owner-report.scm
   gnucash/branches/gda-dev2/src/business/dialog-tax-table/dialog-tax-table.c
   gnucash/branches/gda-dev2/src/core-utils/gnc-gconf-utils.h
   gnucash/branches/gda-dev2/src/core-utils/gnc-glib-utils.c
   gnucash/branches/gda-dev2/src/engine/Account.c
   gnucash/branches/gda-dev2/src/engine/Account.h
   gnucash/branches/gda-dev2/src/engine/engine.i
   gnucash/branches/gda-dev2/src/engine/gnc-pricedb.c
   gnucash/branches/gda-dev2/src/gnome-search/dialog-search.c
   gnucash/branches/gda-dev2/src/gnome-utils/account-quickfill.c
   gnucash/branches/gda-dev2/src/gnome-utils/dialog-account.c
   gnucash/branches/gda-dev2/src/gnome-utils/dialog-options.c
   gnucash/branches/gda-dev2/src/gnome-utils/dialog-transfer.c
   gnucash/branches/gda-dev2/src/gnome-utils/druid-gconf-setup.c
   gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c
   gnucash/branches/gda-dev2/src/gnome-utils/glade/preferences.glade
   gnucash/branches/gda-dev2/src/gnome-utils/gnc-date-edit.c
   gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c
   gnucash/branches/gda-dev2/src/gnome-utils/gnc-gnome-utils.c
   gnucash/branches/gda-dev2/src/gnome-utils/gnc-html.c
   gnucash/branches/gda-dev2/src/gnome-utils/gnc-tree-view-commodity.c
   gnucash/branches/gda-dev2/src/gnome/dialog-commodities.c
   gnucash/branches/gda-dev2/src/gnome/dialog-fincalc.c
   gnucash/branches/gda-dev2/src/gnome/dialog-price-editor.c
   gnucash/branches/gda-dev2/src/gnome/dialog-print-check.c
   gnucash/branches/gda-dev2/src/gnome/dialog-progress.c
   gnucash/branches/gda-dev2/src/gnome/dialog-progress.h
   gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c
   gnucash/branches/gda-dev2/src/gnome/druid-acct-period.c
   gnucash/branches/gda-dev2/src/gnome/druid-loan.c
   gnucash/branches/gda-dev2/src/gnome/druid-merge.c
   gnucash/branches/gda-dev2/src/gnome/druid-stock-split.c
   gnucash/branches/gda-dev2/src/gnome/glade/progress.glade
   gnucash/branches/gda-dev2/src/gnome/gnc-plugin-basic-commands.c
   gnucash/branches/gda-dev2/src/gnome/gnc-split-reg.c
   gnucash/branches/gda-dev2/src/gnome/schemas/apps_gnucash_general.schemas.in
   gnucash/branches/gda-dev2/src/gnome/window-reconcile.c
   gnucash/branches/gda-dev2/src/import-export/Makefile.am
   gnucash/branches/gda-dev2/src/import-export/aqbanking/schemas/
   gnucash/branches/gda-dev2/src/import-export/hbci/Makefile.am
   gnucash/branches/gda-dev2/src/import-export/hbci/hbci-interaction.c
   gnucash/branches/gda-dev2/src/import-export/log-replay/gnc-log-replay.c
   gnucash/branches/gda-dev2/src/import-export/qif-import/druid-qif-import.c
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-dialog-utils.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-file.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-import.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-merge-groups.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-parse.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-to-gnc.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif-utils.scm
   gnucash/branches/gda-dev2/src/import-export/qif-import/qif.glade
   gnucash/branches/gda-dev2/src/import-export/qif-import/schemas/
   gnucash/branches/gda-dev2/src/optional/Makefile.am
   gnucash/branches/gda-dev2/src/optional/python-bindings/tests/
   gnucash/branches/gda-dev2/src/register/ledger-core/split-register-control.c
   gnucash/branches/gda-dev2/src/register/ledger-core/split-register-model.c
   gnucash/branches/gda-dev2/src/register/ledger-core/split-register.c
   gnucash/branches/gda-dev2/src/report/report-gnome/gnc-plugin-page-report.c
   gnucash/branches/gda-dev2/src/report/report-gnome/window-report.c
   gnucash/branches/gda-dev2/src/report/report-system/commodity-utilities.scm
   gnucash/branches/gda-dev2/src/report/report-system/html-table.scm
   gnucash/branches/gda-dev2/src/report/report-system/options-utilities.scm
   gnucash/branches/gda-dev2/src/report/report-system/report-system.scm
   gnucash/branches/gda-dev2/src/report/report-system/report-utilities.scm
   gnucash/branches/gda-dev2/src/report/report-system/report.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/account-piecharts.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/account-summary.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/balance-sheet.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/budget.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/category-barchart.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/equity-statement.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/income-statement.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/net-barchart.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/portfolio.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/register.scm
   gnucash/branches/gda-dev2/src/report/standard-reports/trial-balance.scm
   gnucash/branches/gda-dev2/src/scm/string.scm
   gnucash/branches/gda-dev2/src/tax/us/txf-de_DE.scm
   gnucash/branches/gda-dev2/src/tax/us/txf-help-de_DE.scm
Log:
Merge with trunk through 17437.




Property changes on: gnucash/branches/gda-dev2
___________________________________________________________________
Name: svn:ignore
   - *.diff
*.diffs
*.log
*.patch
*.prj
*.prj.bak
*.pws
*.tar.gz
*.xac.*.xac
.DS_Store
.deps
.libs
.links
.tm_project.cache
ABOUT-NLS
COPYING
INSTALL
Makefile
Makefile.in
TAGS
TAGS
TAGS.stamp
aclocal.m4
autom4te-2.53.cache
autom4te.cache
autom4te.cache
compile
config.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
cscope.files
cscope.out
depcomp
etags.files
foo
gnucash-config
install-sh
install-stamp
intl
intltool-extract
intltool-extract.in
intltool-merge
intltool-merge.in
intltool-modules
intltool-update
intltool-update.in
libtool
ltconfig
ltmain.sh
make-gnucash-patch
make-gnucash-potfiles
missing
mkinstalldirs
mkinstalldirs
stamp-*
tags
tags
ChangeLog

   + *.diff
*.diffs
*.log
*.patch
*.prj
*.prj.bak
*.pws
*.tar.gz
*.xac.*.xac
.DS_Store
.deps
.libs
.links
.tm_project.cache
ABOUT-NLS
COPYING
INSTALL
Makefile
Makefile.in
TAGS
TAGS
TAGS.stamp
aclocal.m4
autom4te-2.53.cache
autom4te.cache
autom4te.cache
compile
config.cache
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
cscope.files
cscope.out
depcomp
etags.files
foo
gnucash-config
install-sh
install-stamp
intl
intltool-extract
intltool-extract.in
intltool-merge
intltool-merge.in
intltool-modules
intltool-update
intltool-update.in
libtool
ltconfig
ltmain.sh
make-gnucash-patch
make-gnucash-potfiles
missing
mkinstalldirs
mkinstalldirs
py-compile
stamp-*
tags
tags
ChangeLog


Modified: gnucash/branches/gda-dev2/.gitignore
===================================================================
--- gnucash/branches/gda-dev2/.gitignore	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/.gitignore	2008-07-30 01:08:07 UTC (rev 17438)
@@ -3,6 +3,8 @@
 *.la
 *.lo
 *.orig
+*.pyc
+*.pyo
 *.schemas
 COPYING
 ChangeLog
@@ -39,6 +41,12 @@
 lib/libqof/qof/qofla-dir.h
 libtool
 ltmain.sh
+macros/ltmain.sh
+macros/libtool.m4
+macros/ltoptions.m4
+macros/ltsugar.m4
+macros/ltversion.m4
+macros/lt~obsolete.m4
 make-gnucash-potfiles
 missing
 mkinstalldirs
@@ -49,6 +57,7 @@
 po/POTFILES.in
 po/gnucash.pot
 po/stamp-it
+py-compile
 src/app-utils/gnucash
 src/bin/gnucash
 src/bin/gnucash-bin
@@ -81,6 +90,12 @@
 src/gnome/gnucash.desktop.in
 src/import-export/qif-import/gnucash
 src/import-export/qif-import/qif-import
+src/pixmaps/16x16
+src/pixmaps/22x22
+src/pixmaps/24x24
+src/pixmaps/32x32
+src/pixmaps/48x48
+src/pixmaps/scalable
 src/quotes/gnc-fq-check
 src/quotes/gnc-fq-helper
 src/quotes/gnc-fq-update

Modified: gnucash/branches/gda-dev2/AUTHORS
===================================================================
--- gnucash/branches/gda-dev2/AUTHORS	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/AUTHORS	2008-07-30 01:08:07 UTC (rev 17438)
@@ -137,6 +137,7 @@
 Koen D'Hondt <ripley at xs4all.nl> for Solaris patches to XmHTML
 Bob Drzyzgula <bob at mostly.com> for budgeting design notes
 Volker Englisch <Volker at englisch.us> QA and testing
+Christoph Ernst <C.Ernst72 at googlemail.com> Small bugfixes and minor enhancements
 Jonathan Ernst <jonathan at ernstfamily.ch> Translations
 Stephen Evanchik <evanchsa at clarkson.edu> Logging improvements; gtk2 conversions
 Joshua Facemyer / Impressus Art <faceman at impressusart.com>: New artwork.
@@ -150,6 +151,7 @@
 Dave Freese <DFreese at osc.uscg.mil> for leap-year fix
 Todd T. Fries <todd at flare.fries.net> OpenBSD fix
 John Goerzen <jgoerzen at complete.org> file i/o fix for 64-bit architectures
+Jeff Green <jeff at parit.ca> Python bindings, with grant funding from Assiniboine Credit Union (http://assiniboine.mb.ca/)
 Hans de Graaff <hans at degraaff.org> XML patches
 Daniel Hagerty <hag at linnaean.org> patch to balance sheet report
 Mitsuo Hamada <mhamada at redhat.com> messages Japanese translations
@@ -160,12 +162,14 @@
 John Hasler <john at dhh.gt.org> engine patch
 Jon Kåre Hellan <hellan at acm.org> misc core dump fixes
 Hendrik-Jan Heins <hjh at passys.nl> Dutch translation
+Joachim Herb <joachim.herb at gmx.de> Data table option for barchart reports
 Claus Hindsgaul <claus_h at image.dk> messages Danish translation
 Ori Hoch <ori at uumpa.com> Hebrew translation
 Péter Hosszú <hosszu at web.de> Hungarian translation
 Edward J. Huff <ejhuff at huff20may77.us> Date handling in reports, quarterly option
 Tomokazu Iwashita <iwashita at center.nitech.ac.jp> Japanese translation of xea
 David Jafferian <david.jafferian at east.sun.com> Delete account query code.
+Mark Jenkins <mark at parit.ca> Python bindings, with grant funding from Assiniboine Credit Union (http://assiniboine.mb.ca/)
 Miquel Jordana Vilamitjana <jjvmjv at mundomail.net> Spanish translation of manual
 Prakash Kailasa <PrakashK at bigfoot.com> for gnome build fixes
 Alexey Kakunin <small at arcadia.spb.ru> quickfill patch for Cyrillic
@@ -181,6 +185,7 @@
 Rich Johnson <rich at dogstar-interactive.com> Mac OS X patch
 Nicholas Lee <nj.lee at plumtree.co.nz> scheme bug fix
 Graham Leggett <minfrin at sharp.fm> for fixing a hang
+Rolf Leggewie <foss at rolf.leggewie.biz> SKR04 and gnucash for german business
 Georg Lehner <Jorge.Lehner at gmx.net> Nicaraguan Spanish translation
 Ted Lemon <mellon at andare.fugue.com> for NetBSD port
 Yannick Le Ny <y-le-ny at ifrance.com> French translations
@@ -247,6 +252,7 @@
 Henning Spruth <spruth at bigfoot.com> for German text & euro date rework
 Ben Stanley <bds02 at uow.edu.au> test infrastructure
 Robby Stephenson <robby.stephenson at usa.net> register & file history patches
+Robert Stocks <robert.stocks at gmail.com> additional register report options
 Michael T. Garrison Stuber <garrisonstuber at bellsouth.net> report patch
 Bartek Szady <bszx at bszxdomain.edu.eu.org> engine and build system patches
 Herbert Thoma <tma at iis.fhg.de> gnome register & euro support patches

Modified: gnucash/branches/gda-dev2/accounts/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/accounts/Makefile.am	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/accounts/Makefile.am	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1,3 +1,3 @@
 
-SUBDIRS = C da de_AT de_CH de_DE el_GR en_GB es_ES es_MX fr_CH fr_CA fr_FR hu_HU it ja nb pt_BR pt_PT sk tr_TR zh_CN
+SUBDIRS = C da de_AT de_CH de_DE el_GR en_GB es_ES es_MX fr_CH fr_CA fr_FR hu_HU it ja nb pt_BR pt_PT ru sk tr_TR zh_CN
 

Modified: gnucash/branches/gda-dev2/accounts/de_DE/acctchrt_skr04.gnucash-xea
===================================================================
--- gnucash/branches/gda-dev2/accounts/de_DE/acctchrt_skr04.gnucash-xea	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/accounts/de_DE/acctchrt_skr04.gnucash-xea	2008-07-30 01:08:07 UTC (rev 17438)
@@ -38,7 +38,7 @@
     Standardkontenrahmen SKR04, Stand 2005
   </gnc-act:short-description>
   <gnc-act:long-description>
-    BETA-Version eines Kontenrahmes SKR04 für 2005.  Mehr Informationen unter http://linuxwiki.de/GnuCash/skr04
+    BETA-Version eines Kontenrahmes SKR04 für 2005.  Mehr Informationen unter http://wiki.gnucash.org/wiki/De/SKR04
   </gnc-act:long-description>
   <gnc-act:exclude-from-select-all>1</gnc-act:exclude-from-select-all>
   <gnc:account version="2.0.0">
@@ -66,6 +66,10 @@
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
+      <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
     </act:slots>
     <act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
   </gnc:account>
@@ -2223,6 +2227,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -2830,69 +2838,6 @@
     <act:parent type="new">f8a1595720a430d2d890c735ec280801</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Marmor</act:name>
-    <act:id type="new">87234e6891fac01304264bc8512448a0</act:id>
-    <act:type>ASSET</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">e1960c5433e5eb58cbd136d8c3d2fa0a</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
-    <act:name>Stein</act:name>
-    <act:id type="new">a99b2f31be2be1a074bc1c8b54825c7e</act:id>
-    <act:type>ASSET</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">e1960c5433e5eb58cbd136d8c3d2fa0a</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
-    <act:name>Eisen</act:name>
-    <act:id type="new">b94ac228e74d955127e50a16d82f7b21</act:id>
-    <act:type>ASSET</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">e1960c5433e5eb58cbd136d8c3d2fa0a</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>04. Geleistete Anzahlungen auf Vorräte</act:name>
     <act:id type="new">4b94caba6927babf0af628999af0e00d</act:id>
     <act:type>ASSET</act:type>
@@ -3070,7 +3015,7 @@
   <gnc:account version="2.0.0">
     <act:name>01. Forderungen aus Lieferungen und Leistungen</act:name>
     <act:id type="new">3db9920658f7630cee64902f9698ebb3</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3097,7 +3042,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus Lieferungen und Leistungen ohne Kontokorrent</act:name>
     <act:id type="new">76c54d31f188167d8a031d96045283fd</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3120,7 +3065,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus L+L allgem. Steuersatz oder eines Kleinunternehmers</act:name>
     <act:id type="new">6cefdcc3737a94cc580149e2d2cd97b9</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3143,7 +3088,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus L+L ermäßigt. Steuersatz</act:name>
     <act:id type="new">d060a1de8e5ca6ea1b954c42e8396755</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3169,7 +3114,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. aus steuerfreien oder nicht steuerbaren steuerbaren L+L</act:name>
     <act:id type="new">ab6ca9e6320b202c3fc84c367edfc366</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3189,9 +3134,9 @@
     <act:parent type="new">76c54d31f188167d8a031d96045283fd</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Forderungen aus L+L gemäß § 24 UStG</act:name>
+    <act:name>Forderungen aus L+L gemäß §24 UStG</act:name>
     <act:id type="new">7dc3830ac363a526ef101cf09a77b6ee</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3214,7 +3159,7 @@
   <gnc:account version="2.0.0">
     <act:name>Gegenkonto 1215 - 1218 bei Aufteilung der Forderungen nach Steuersätzen (EÜR)</act:name>
     <act:id type="new">ad25157eba24299560894cb650a9a5b9</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3234,9 +3179,9 @@
     <act:parent type="new">76c54d31f188167d8a031d96045283fd</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Forderungen nach § 11 Abs. 1 Satz 2 EStG für § 4/3</act:name>
+    <act:name>Forderungen nach §11 Abs. 1 Satz 2 EStG für §4/3</act:name>
     <act:id type="new">fd124dab720d156a374f1386a565d9d0</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3258,7 +3203,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg.a. Lieferungen/Leistungen &lt; 1 J</act:name>
     <act:id type="new">ef26d6e1057d2042cb9eea64e48187a0</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3280,7 +3225,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg.a. Lieferungen/Leistungen &gt; 1 J</act:name>
     <act:id type="new">7b2c1a17aabc3268fca1f751840c6a9d</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3390,7 +3335,7 @@
   <gnc:account version="2.0.0">
     <act:name>Zweifelhafte Forderungen</act:name>
     <act:id type="new">9c12aa23ce66851b83316b04a40c28e3</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3412,7 +3357,7 @@
   <gnc:account version="2.0.0">
     <act:name>Zweifelhafte Forderungen (bis 1 Jahr)</act:name>
     <act:id type="new">5e4e256cf81cdb6b18e5e2d587b94be8</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3434,7 +3379,7 @@
   <gnc:account version="2.0.0">
     <act:name>Zweifelhafte Forderungen (&gt; 1 Jahr)</act:name>
     <act:id type="new">aa3689c5e36ccc625d009b52be7710c9</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3456,7 +3401,7 @@
   <gnc:account version="2.0.0">
     <act:name>Einzelwertberichtigung Forderung (&lt; 1J)</act:name>
     <act:id type="new">91c0860c2c4d593316b6e1a20a94b502</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3478,7 +3423,7 @@
   <gnc:account version="2.0.0">
     <act:name>Einzelwertberichtigung Forderung (&gt; 1J)</act:name>
     <act:id type="new">a0f98fc2e44d10a5ecfd8da3c83a846c</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3500,7 +3445,7 @@
   <gnc:account version="2.0.0">
     <act:name>Pauschalwertberichtigung Forderg. &lt; 1J</act:name>
     <act:id type="new">c28569653345dc9953b419b6f1c47f06</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3522,7 +3467,7 @@
   <gnc:account version="2.0.0">
     <act:name>Pauschalwertberichtigung Forderg. &gt; 1J</act:name>
     <act:id type="new">2b029b521129173c6889beae2724f248</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3544,7 +3489,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus L+L gg. Gesellschafter</act:name>
     <act:id type="new">8f9b84b36d18f3c215e399fbaccd0a1b</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3566,7 +3511,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. aus L+L gg.Gesellschafter &lt; 1 J</act:name>
     <act:id type="new">9ed2e513a63541a65eefa53f48e62307</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3588,7 +3533,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. aus L+L gg.Gesellschafter &gt; 1 J</act:name>
     <act:id type="new">3a221b4090c2323acaca1f024acd3905</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3610,7 +3555,7 @@
   <gnc:account version="2.0.0">
     <act:name>Gegenkonto zu sonstigen Vermögensgegenständen bei Buchungen über Debitorenkonto</act:name>
     <act:id type="new">fe80110fa10de8c4f447a1a1c53e1157</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3632,7 +3577,7 @@
   <gnc:account version="2.0.0">
     <act:name>Gegenkonto 1221-1229, 1250-1257, 1270-1279, 1290-1297 bei Aufteilung Debitorenkonto</act:name>
     <act:id type="new">450ebcecfd06848c840c7cc8b0c85cd9</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3654,7 +3599,7 @@
   <gnc:account version="2.0.0">
     <act:name>02. Forderungen gegen verbundene Unternehmen</act:name>
     <act:id type="new">2206ddc60ecf97df41c9a90d71fdd94d</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3680,7 +3625,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. verbundene UN &lt; 1 J</act:name>
     <act:id type="new">747b5cd3365a7858a97b20068a6206a0</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3702,7 +3647,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. verbundene UN &gt; 1 J</act:name>
     <act:id type="new">fcb9c6bb6cbed4c2c533bfd9dd5ec900</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3812,7 +3757,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus L+L gg. verbundene UN</act:name>
     <act:id type="new">7fa441383b425d01688d980afa0e2159</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3834,7 +3779,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus L+L gg. verbund. UN &lt; 1J</act:name>
     <act:id type="new">a4efa9234842fcb2f6189d91fa9ef54e</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3856,7 +3801,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen aus L+L gg. verbund. UN &gt; 1J</act:name>
     <act:id type="new">e845e5c2387c8e4a555b4b5148fefebc</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3878,7 +3823,7 @@
   <gnc:account version="2.0.0">
     <act:name>WB Forderungen gg. verbundene UN &lt; 1 J</act:name>
     <act:id type="new">64f813bff556c59e4a450b1917b8502e</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3900,7 +3845,7 @@
   <gnc:account version="2.0.0">
     <act:name>WB Forderungen gg. verbundene UN &gt; 1J</act:name>
     <act:id type="new">0167cc972e237540235d314740348107</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3922,7 +3867,7 @@
   <gnc:account version="2.0.0">
     <act:name>03. Forderungen gegen Unternehmen, mit denen ein Beteiligungsverhältnis besteht</act:name>
     <act:id type="new">8025095dc946bd68be8762fc42e31fc6</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3948,7 +3893,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. gg. UN mit Beteiligg.verh. &lt; 1 J.</act:name>
     <act:id type="new">35488b898db7a562b086bb500b12c682</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -3970,7 +3915,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. gg. UN mit Beteiligg.verh. &gt; 1 J</act:name>
     <act:id type="new">89760a5f09f7259f905f7e788e6c0d0f</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4080,7 +4025,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. L+L gg.UN m. Beteiligungsverh.</act:name>
     <act:id type="new">d2b31319d77dff392a7d723099c32c4e</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4102,7 +4047,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. L+L gg.UN m.Beteiligg.verh. &lt; 1 J</act:name>
     <act:id type="new">7317fdc156e222b74887182651c71966</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4124,7 +4069,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderg. L+L gg.UN m.Beteiligg.verh. &gt; 1 J</act:name>
     <act:id type="new">5beb4af25c67d01128ce0e448a680da4</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4146,7 +4091,7 @@
   <gnc:account version="2.0.0">
     <act:name>WB Forderg.gg.UN m.Beteiligg.verh. b.1J</act:name>
     <act:id type="new">33568526db0bd952b65ebdb063542528</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4168,7 +4113,7 @@
   <gnc:account version="2.0.0">
     <act:name>WB Forderg.gg.UN m.Beteiligg.verh. g.1J</act:name>
     <act:id type="new">5ad37b32f5d6a461fb25e18c0745ce59</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4196,7 +4141,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1298 </act:code>
+    <act:code>1298</act:code>
     <act:description>Forderungen, nicht eingeforderte ausstehende Einlagen s. Konto 2910</act:description>
     <act:slots>
       <slot>
@@ -4328,7 +4273,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gegen Vorstandsmitglieder und Geschäftsführer</act:name>
     <act:id type="new">f389699a21fa73f290aab9183d2f5c65</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4350,7 +4295,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. Geschäftsf.(b.1J)</act:name>
     <act:id type="new">fd6ed5e511300dd4649b82d908c45c1c</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4372,7 +4317,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. Geschäftsf.(g.1J)</act:name>
     <act:id type="new">cf8fec4e205c4679dedc5b017ad10308</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4394,7 +4339,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gegen Aufsichtsrats- und Beirats-Mitglieder</act:name>
     <act:id type="new">8fa4caf4bfbf52ca8f41c6d3856d7ab3</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4416,7 +4361,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. Aufsichtsratsm. (b.1 J)</act:name>
     <act:id type="new">6046d3a0953c4bcafeffa562972afb3f</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4438,7 +4383,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. Aufsichtsratsm. (g.1 J)</act:name>
     <act:id type="new">230923a406e6ed245809b01e01236260</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4460,7 +4405,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gegen Gesellschafter</act:name>
     <act:id type="new">f68f9fd560ad2d91a8c7e8b74423d676</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4482,7 +4427,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. Gesellschafter (b.1J)</act:name>
     <act:id type="new">d48f1bbe9d77a812520b79aa5e1475bf</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4504,7 +4449,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gg. Gesellschafter (g.1J)</act:name>
     <act:id type="new">86ce422efda3992e920607271933520c</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4526,7 +4471,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gegen Personal aus Lohn- und Gehaltsabrechnung</act:name>
     <act:id type="new">4517b3561a7ff696c0662a257ed40cdd</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4548,7 +4493,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gegen Personal (bis 1Jahr)</act:name>
     <act:id type="new">5e6b56d8bc5622c3ce68115d8c3cef02</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4570,7 +4515,7 @@
   <gnc:account version="2.0.0">
     <act:name>Forderungen gegen Personal (g. 1Jahr)</act:name>
     <act:id type="new">a27c13b57de63e57699efbe6b26e6bce</act:id>
-    <act:type>ASSET</act:type>
+    <act:type>RECEIVABLE</act:type>
     <act:commodity>
       <cmdty:space>ISO4217</cmdty:space>
       <cmdty:id>EUR</cmdty:id>
@@ -4856,7 +4801,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Nachträglich abziehbare Vorsteuer, § 15a UStG, bewegliche Wirtschaftsgüter</act:name>
+    <act:name>Nachträglich abziehbare Vorsteuer, §15a UStG, bewegliche Wirtschaftsgüter</act:name>
     <act:id type="new">641b00dd407adba480bf1d15a86d9d05</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -4878,7 +4823,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zurückzuzahlende Vorsteuer, § 15a UStG, bewegliche Wirtschaftsgüter</act:name>
+    <act:name>Zurückzuzahlende Vorsteuer, §15a UStG, bewegliche Wirtschaftsgüter</act:name>
     <act:id type="new">e91c35cfe1b485412a871fe71f944a3c</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -4900,7 +4845,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Nachträglich abziehbare Vorsteuer, § 15a UStG, unbewegliche Wirtschaftsgüter</act:name>
+    <act:name>Nachträglich abziehbare Vorsteuer, §15a UStG, unbewegliche Wirtschaftsgüter</act:name>
     <act:id type="new">b96f86315d7eaf9afa781af6f7986327</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -4922,7 +4867,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zurückzuzahlende Vorsteuer, § 15a UStG, unbewegliche Wirtschaftsgüter</act:name>
+    <act:name>Zurückzuzahlende Vorsteuer, §15a UStG, unbewegliche Wirtschaftsgüter</act:name>
     <act:id type="new">6025deffab1a31abbcbd91c8a6039cf6</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -4952,7 +4897,6 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1400</act:code>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -4974,6 +4918,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
+    <act:code>1400</act:code>
     <act:description>UstVa Zl. 55, Kz. 66</act:description>
     <act:slots>
       <slot>
@@ -5010,6 +4955,7 @@
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
     <act:code>1401</act:code>
+    <act:description>UstVa Zl. 55, Kz. 66</act:description>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -5019,6 +4965,19 @@
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
+      <slot>
+	<slot:key>tax-related</slot:key>
+	<slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+	<slot:key>tax-US</slot:key>
+	<slot:value type="frame">
+	  <slot>
+	    <slot:key>code</slot:key>
+	    <slot:value type="string">K66</slot:value>
+	  </slot>
+	</slot:value>
+      </slot>
     </act:slots>
     <act:parent type="new">d4ac4ec9e7c83bcbb6ac389be1821f0c</act:parent>
   </gnc:account>
@@ -5031,9 +4990,46 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
+    <act:description>UstVa Zl. 55, Kz. 66</act:description>
     <act:code>1405</act:code>
     <act:slots>
       <slot>
+        <slot:key>placeholder</slot:key>
+        <slot:value type="string">false</slot:value>
+      </slot>
+      <slot>
+        <slot:key>notes</slot:key>
+        <slot:value type="string"></slot:value>
+      </slot>
+      <slot>
+        <slot:key>tax-related</slot:key>
+        <slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+        <slot:key>tax-US</slot:key>
+        <slot:value type="frame">
+          <slot>
+            <slot:key>code</slot:key>
+            <slot:value type="string">K66</slot:value>
+          </slot>
+        </slot:value>
+      </slot>
+    </act:slots>
+    <act:parent type="new">d4ac4ec9e7c83bcbb6ac389be1821f0c</act:parent>
+  </gnc:account>
+  <gnc:account version="2.0.0">
+    <act:name>Abziehbare Vorsteuer 19%</act:name>
+    <act:id type="new">f5e12dd9ee63444b35271eb0cc29ca27</act:id>
+    <act:type>ASSET</act:type>
+    <act:commodity>
+      <cmdty:space>ISO4217</cmdty:space>
+      <cmdty:id>EUR</cmdty:id>
+    </act:commodity>
+    <act:commodity-scu>100</act:commodity-scu>
+    <act:description>UstVa Zl. 55, Kz. 66</act:description>
+    <act:code>1406</act:code>
+    <act:slots>
+      <slot>
 	<slot:key>placeholder</slot:key>
 	<slot:value type="string">false</slot:value>
       </slot>
@@ -5041,6 +5037,19 @@
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
+      <slot>
+        <slot:key>tax-related</slot:key>
+        <slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+        <slot:key>tax-US</slot:key>
+        <slot:value type="frame">
+          <slot>
+            <slot:key>code</slot:key>
+            <slot:value type="string">K66</slot:value>
+          </slot>
+        </slot:value>
+      </slot>
     </act:slots>
     <act:parent type="new">d4ac4ec9e7c83bcbb6ac389be1821f0c</act:parent>
   </gnc:account>
@@ -5090,6 +5099,7 @@
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
     <act:code>1403</act:code>
+    <act:description>UstVa Zl. 56, Kz. 61</act:description>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -5099,10 +5109,59 @@
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
+      <slot>
+        <slot:key>tax-related</slot:key>
+        <slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+        <slot:key>tax-US</slot:key>
+        <slot:value type="frame">
+          <slot>
+            <slot:key>code</slot:key>
+            <slot:value type="string">K61</slot:value>
+          </slot>
+        </slot:value>
+      </slot>
     </act:slots>
     <act:parent type="new">922006b4e0d3a0e5deb659ab7da9b42a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
+    <act:name>Abziehbare Vorsteuer aus innergemeinschaftlichem Erwerb 19%</act:name>
+    <act:id type="new">fb1eb58315969d65581a6e4f313f43c4</act:id>
+    <act:type>ASSET</act:type>
+    <act:commodity>
+      <cmdty:space>ISO4217</cmdty:space>
+      <cmdty:id>EUR</cmdty:id>
+    </act:commodity>
+    <act:commodity-scu>100</act:commodity-scu>
+    <act:code>1404</act:code>
+    <act:description>UstVa Zl. 56, Kz. 61</act:description>
+    <act:slots>
+      <slot>
+        <slot:key>placeholder</slot:key>
+        <slot:value type="string">false</slot:value>
+      </slot>
+      <slot>
+        <slot:key>notes</slot:key>
+        <slot:value type="string"></slot:value>
+      </slot>
+      <slot>
+        <slot:key>tax-related</slot:key>
+        <slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+        <slot:key>tax-US</slot:key>
+        <slot:value type="frame">
+          <slot>
+            <slot:key>code</slot:key>
+            <slot:value type="string">K61</slot:value>
+          </slot>
+        </slot:value>
+      </slot>
+    </act:slots>
+    <act:parent type="new">922006b4e0d3a0e5deb659ab7da9b42a</act:parent>
+  </gnc:account>
+  <gnc:account version="2.0.0">
     <act:name>Vorsteuer nach allgemeinen Durchschnittsätzen</act:name>
     <act:id type="new">9fad1c867ee4596ace2ce97c441903fc</act:id>
     <act:type>ASSET</act:type>
@@ -5139,7 +5198,7 @@
     <act:parent type="new">24224918f644a964fef3d4afdc48933f</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Abziehbare Vorsteuer nach § 13b UStG</act:name>
+    <act:name>Abziehbare Vorsteuer nach §13b UStG</act:name>
     <act:id type="new">97c89eba49fa0e1419ca3753a66d260e</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5175,7 +5234,7 @@
     <act:parent type="new">24224918f644a964fef3d4afdc48933f</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Abziehbare Vorsteuer nach § 13b UStG 16%</act:name>
+    <act:name>Abziehbare Vorsteuer nach §13b UStG 16%</act:name>
     <act:id type="new">eb6e059c85e0833a7715864b3ad75343</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5308,7 +5367,7 @@
     <act:parent type="new">186a44919607662c803018c7279ce2ff</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Aufzuteilende Vorsteuer nach §§ 13a/13b UStG</act:name>
+    <act:name>Aufzuteilende Vorsteuer nach §§13a/13b UStG</act:name>
     <act:id type="new">0a2ec441e8cb70acb3c6c4fa9c5bf170</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5330,7 +5389,7 @@
     <act:parent type="new">186a44919607662c803018c7279ce2ff</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Aufzuteilende Vorsteuer nach §§ 13a/13b UStG 16 %</act:name>
+    <act:name>Aufzuteilende Vorsteuer nach §§13a/13b UStG 16 %</act:name>
     <act:id type="new">fa7eaf95d7cbf4b2e8f7e0e6dc4e43e9</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5689,7 +5748,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gegenkonto Vorsteuer § 4/3 EStG</act:name>
+    <act:name>Gegenkonto Vorsteuer §4/3 EStG</act:name>
     <act:id type="new">d8cbb3ed1bbb250b0b9fb83890e6f41d</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5711,7 +5770,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Auflösung Vorsteuer aus Vorjahr § 4/3 EStG</act:name>
+    <act:name>Auflösung Vorsteuer aus Vorjahr §4/3 EStG</act:name>
     <act:id type="new">0517452e941c1acfaeed70871bb203b7</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5733,7 +5792,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Vorsteuer aus Investitionen § 4/3 EStG</act:name>
+    <act:name>Vorsteuer aus Investitionen §4/3 EStG</act:name>
     <act:id type="new">2069db98a8126e51c56002bcca5af58a</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5755,7 +5814,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gegenkonto für Vorsteuer nach Durchschnittssätzen für § 4 Abs. 3 EStG</act:name>
+    <act:name>Gegenkonto für Vorsteuer nach Durchschnittssätzen für §4 Abs. 3 EStG</act:name>
     <act:id type="new">829a214c506d8d13b828f5583a4dda34</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -5777,7 +5836,7 @@
     <act:parent type="new">c36cd806a8bad4266ed2395be7f90d0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Verrechnungskonto Gewinnermittlung § 4/3 EStG, ergebniswirksam</act:name>
+    <act:name>Verrechnungskonto Gewinnermittlung §4/3 EStG, ergebniswirksam</act:name>
     <act:id type="new">157a6372cb0e06f29ffccccf44fd9ca8</act:id>
     <act:type>ASSET</act:type>
     <act:commodity>
@@ -6131,77 +6190,7 @@
     <act:parent type="new">3be1aa86d6868b006741b9af6777cf5f</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Schecks</act:name>
-    <act:id type="new">e0712c0ad9d6bfbc9b18a65832d73fcb</act:id>
-    <act:type>ASSET</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1550</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">true</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">9743059255b8318a7eb5ba07b2dd3e0e</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
-    <act:name>Traveler Cheque USD</act:name>
-    <act:id type="new">3c9d85636c36303679cab0eebb461765</act:id>
-    <act:type>CURRENCY</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>USD</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1551</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>old-price-source</slot:key>
-	<slot:value type="string">CURRENCY</slot:value>
-      </slot>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">e0712c0ad9d6bfbc9b18a65832d73fcb</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
-    <act:name>Traveler Cheque EUR</act:name>
-    <act:id type="new">108c962952448650dc56bda358586a10</act:id>
-    <act:type>CURRENCY</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1552</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">e0712c0ad9d6bfbc9b18a65832d73fcb</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
-    <act:name>Kassenbestand</act:name>
+    <act:name>Kasse</act:name>
     <act:id type="new">9245a7abb3a1df7c26c1b189cceb84b1</act:id>
     <act:type>CASH</act:type>
     <act:commodity>
@@ -6231,28 +6220,6 @@
     <act:parent type="new">9743059255b8318a7eb5ba07b2dd3e0e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Kasse</act:name>
-    <act:id type="new">a73604541838ee1eff060ae018db8bb3</act:id>
-    <act:type>CASH</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1600</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">9245a7abb3a1df7c26c1b189cceb84b1</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>Postbank</act:name>
     <act:id type="new">e6f2ce6d2586345f309cf8bc699ee51c</act:id>
     <act:type>BANK</act:type>
@@ -6275,29 +6242,6 @@
     <act:parent type="new">9743059255b8318a7eb5ba07b2dd3e0e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Postbank Dortmund</act:name>
-    <act:id type="new">2c4aa9c6df24e5b1644814fc2248e9ba</act:id>
-    <act:type>BANK</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>1710</act:code>
-    <act:description>Geschäftsgirokonto 759296467</act:description>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">e6f2ce6d2586345f309cf8bc699ee51c</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>LZB-Guthaben</act:name>
     <act:id type="new">00fcc4a0a593fde6d2e69fa0a43457c7</act:id>
     <act:type>BANK</act:type>
@@ -6427,6 +6371,10 @@
 	<slot:value type="frame"/>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string">1900-1999</slot:value>
       </slot>
@@ -6531,13 +6479,17 @@
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
     <act:code>1950</act:code>
-    <act:description>§ 274 HGB</act:description>
+    <act:description>§274 HGB</act:description>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string">WertaufholungsGEBOT in Handelsbilanz - WertaufholungsVERBOT in Steuerbilanz</slot:value>
       </slot>
@@ -6705,28 +6657,6 @@
     <act:parent type="new">19972a0e65d1f25f0878a3b9fba9343f</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>(zur freien Verfügung)</act:name>
-    <act:id type="new">10b4991f5c62b1c3c746026424163cdc</act:id>
-    <act:type>LIABILITY</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>2030</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">19972a0e65d1f25f0878a3b9fba9343f</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>II. Kapital / Teilhafter</act:name>
     <act:id type="new">9caf6e580a978dba2f91d63e21422abd</act:id>
     <act:type>LIABILITY</act:type>
@@ -6815,28 +6745,6 @@
     <act:parent type="new">9caf6e580a978dba2f91d63e21422abd</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>(zur freien Verfügung)</act:name>
-    <act:id type="new">b83e9a3526079b1df0858b2efacc95ee</act:id>
-    <act:type>LIABILITY</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>2080</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">9caf6e580a978dba2f91d63e21422abd</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>III. Privat Vollhafter/Einzelunternehmer</act:name>
     <act:id type="new">223774b3d08279ba3dde4eed5aadd74d</act:id>
     <act:type>LIABILITY</act:type>
@@ -8182,7 +8090,7 @@
     <act:parent type="new">ef029fd872a653c6ae662719cb3d2e2d</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklagenanteil nach § 6b EStG</act:name>
+    <act:name>Sonderposten mit Rücklagenanteil nach §6b EStG</act:name>
     <act:id type="new">e7e84679e809c1d26761b5d7b1a691db</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8226,7 +8134,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklagenanteil nach § 6d EStG</act:name>
+    <act:name>Sonderposten mit Rücklagenanteil nach §6d EStG</act:name>
     <act:id type="new">a292c1725a4abda97635cc6ce2956e4f</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8248,7 +8156,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklagenanteil nach § 1 EntwLStG</act:name>
+    <act:name>Sonderposten mit Rücklagenanteil nach §1 EntwLStG</act:name>
     <act:id type="new">1fa3f1ab77fdd0c514be4f187cd77855</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8292,7 +8200,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 7d EStG</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §7d EStG</act:name>
     <act:id type="new">66e8a8172c5438bed865da6f420d3f35</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8314,7 +8222,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 79 EStDV</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §79 EStDV</act:name>
     <act:id type="new">5d2b6f8763a17cf26d9806d392740fe1</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8336,7 +8244,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 80 EStDV</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §80 EStDV</act:name>
     <act:id type="new">ecd339d39cfd7a333b92425bc1161f6f</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8358,7 +8266,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 81 EStDV</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §81 EStDV</act:name>
     <act:id type="new">da36edba147b36f1008190e47a7585f0</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8403,7 +8311,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 82a EStDV</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §82a EStDV</act:name>
     <act:id type="new">afcdc2d61ac5eef73cdb49b9ccd90ca7</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8425,7 +8333,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 82d EStDV</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §82d EStDV</act:name>
     <act:id type="new">34e1223c887777d92b3f9511705c3d0e</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8447,7 +8355,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 82e EStDV</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §82e EStDV</act:name>
     <act:id type="new">5d850f9bd4faf5dbe0f24c9f345c8844</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8469,7 +8377,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 14 BerlinFG</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §14 BerlinFG</act:name>
     <act:id type="new">57a18e7b712d35bfd9d0f329859eaaa2</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8491,7 +8399,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil für Förderung nach § 3 ZonenRFG/§ 4-6 FördergebietsG</act:name>
+    <act:name>Sonderposten mit Rücklageanteil für Förderung nach §3 ZonenRFG/§4-6 FördergebietsG</act:name>
     <act:id type="new">3e1e0e9e7c3be5aa3e739b47a0be9d4b</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8513,7 +8421,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 4d EStG</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §4d EStG</act:name>
     <act:id type="new">60a04819244c9d1b3ae6701afc44c8c4</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8535,7 +8443,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 7g Abs. 1 EStG</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §7g Abs. 1 EStG</act:name>
     <act:id type="new">763e8cefaa12fa61c16439ee2c4c3e19</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8557,7 +8465,7 @@
     <act:parent type="new">6033548eda9d17974781c8d9b2770f0c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonderposten mit Rücklageanteil nach § 7g Abs. 3, 7 EStG</act:name>
+    <act:name>Sonderposten mit Rücklageanteil nach §7g Abs. 3, 7 EStG</act:name>
     <act:id type="new">1bf1de3344d26076aa3e91238ce18d9b</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -8644,6 +8552,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -8994,7 +8906,7 @@
     <act:parent type="new">984e3a4bbeb1a32db7dd6df9437e6ee1</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Aufwandsrückstellungen gemäß § 249 Abs. 2 HGB</act:name>
+    <act:name>Aufwandsrückstellungen gemäß §249 Abs. 2 HGB</act:name>
     <act:id type="new">a6dd348289269e4b609ed06123b2a4cd</act:id>
     <act:type>LIABILITY</act:type>
     <act:commodity>
@@ -9039,27 +8951,6 @@
   </gnc:account>
   <gnc:account version="2.0.0">
     <act:name>C. Verbindlichkeiten</act:name>
-    <act:id type="new">cbdc8c08e95339f0eb311c9f280ff6ad</act:id>
-    <act:type>LIABILITY</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">true</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">67e3afb8f6e39be571749da7aa113b2e</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
-    <act:name>Verbindlichkeiten</act:name>
     <act:id type="new">8755bf4081c942798c5ac5f34c5b1aac</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -9067,7 +8958,6 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>3000</act:code>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -9082,7 +8972,7 @@
 	<slot:value type="frame"/>
       </slot>
     </act:slots>
-    <act:parent type="new">cbdc8c08e95339f0eb311c9f280ff6ad</act:parent>
+    <act:parent type="new">67e3afb8f6e39be571749da7aa113b2e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
     <act:name>01. Anleihen</act:name>
@@ -9894,7 +9784,7 @@
     <act:parent type="new">a3d3131caad56df23167362ec6ab406a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Verbindlichkeiten aus Lieferungen und Leistungen für Investitionen für § 4/3 EStG</act:name>
+    <act:name>Verbindlichkeiten aus Lieferungen und Leistungen für Investitionen für §4/3 EStG</act:name>
     <act:id type="new">a1fd22bd69200bb7bdd1ea485a0758e5</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -10654,7 +10544,7 @@
     <act:parent type="new">ecd88b09ea57fbcb6c1371597d818f2c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Sonstige Verbindlichkeiten z.B. nach § 11 Abs. 2 Satz 2 EStG für § 4/3 EStG</act:name>
+    <act:name>Sonstige Verbindlichkeiten z.B. nach §11 Abs. 2 Satz 2 EStG für §4/3 EStG</act:name>
     <act:id type="new">d8096c61e103f7399bc4b89b9e296d74</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -11050,7 +10940,7 @@
     <act:parent type="new">040967754f9301f1256ae5b221fc765c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erhalten Kautionen</act:name>
+    <act:name>Erhaltene Kautionen</act:name>
     <act:id type="new">57a400aeb55463d303ce9dd7b76a9433</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -11226,28 +11116,6 @@
     <act:parent type="new">934e168b36770e076b9d2eeaad400912</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gegenkonto Aufteilung der Darlehen</act:name>
-    <act:id type="new">d542fba3d1dd39fcdf4d5c721a6b43cd</act:id>
-    <act:type>PAYABLE</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>3599</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">934e168b36770e076b9d2eeaad400912</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>(frei, in Bilanz kein Restlaufzeitvermerk)</act:name>
     <act:id type="new">948b824b332b6b86f53a3b5dd6f56e3a</act:id>
     <act:type>PAYABLE</act:type>
@@ -11833,7 +11701,7 @@
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
     <act:code>3796</act:code>
-    <act:description>für § 4/3 EStG</act:description>
+    <act:description>für §4/3 EStG</act:description>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -11869,7 +11737,7 @@
     <act:parent type="new">8755bf4081c942798c5ac5f34c5b1aac</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Mehrwertsteuer 7%</act:name>
+    <act:name>Umsatzsteuer 7%</act:name>
     <act:id type="new">c76f946f844d0afc674013ca97731f3a</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -11941,7 +11809,7 @@
     <act:parent type="new">e726cf1027d9589c65f0681a73fbc8c8</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Mehrwertsteuer 16%</act:name>
+    <act:name>Umsatzsteuer 16%</act:name>
     <act:id type="new">ea57995749ee6b3af394f62ff181e502</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -12291,7 +12159,7 @@
     <act:parent type="new">b0b8449ed3962e5c8932ad6ca1e29792</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Umsatzsteuer nach § 13b UStG 16%</act:name>
+    <act:name>Umsatzsteuer nach §13b UStG 16%</act:name>
     <act:id type="new">6dc1d68bf6a196c6b51e5f5e3d50de3d</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -12336,7 +12204,7 @@
     <act:parent type="new">b0b8449ed3962e5c8932ad6ca1e29792</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Umsatzsteuer nach § 13b UStG</act:name>
+    <act:name>Umsatzsteuer nach §13b UStG</act:name>
     <act:id type="new">6cf2599b1f60ced718c520f313ee100b</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -12358,7 +12226,7 @@
     <act:parent type="new">b0b8449ed3962e5c8932ad6ca1e29792</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Umsatzsteuer nach § 13b UStG 16%</act:name>
+    <act:name>Umsatzsteuer nach §13b UStG 16%</act:name>
     <act:id type="new">a2046307bda04804b5e6277e01baef5a</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -12380,7 +12248,7 @@
     <act:parent type="new">6cf2599b1f60ced718c520f313ee100b</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Umsatzsteuer nach § 13a UStG</act:name>
+    <act:name>Umsatzsteuer nach §13a UStG</act:name>
     <act:id type="new">32b9678b389940f682903a025aaa11e9</act:id>
     <act:type>PAYABLE</act:type>
     <act:commodity>
@@ -12567,6 +12435,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -12747,7 +12619,7 @@
     <act:parent type="new">3d14d5d5d3001e01974df06bf3752d3a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Steuerfreie Umsätze § 4 Nr. 1a UStG</act:name>
+    <act:name>Steuerfreie Umsätze §4 Nr. 1a UStG</act:name>
     <act:id type="new">c5c101e72cf95f40abdf0f511675f54e</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -12783,7 +12655,7 @@
     <act:parent type="new">3d14d5d5d3001e01974df06bf3752d3a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Steuerfreie EG-Lieferungen, §4,1b UStG</act:name>
+    <act:name>Steuerfreie EG-Lieferungen (§4,1b UStG) an Abnehmer mit UStID</act:name>
     <act:id type="new">498dcac4132faa3052bfb2af19a7b6fa</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -12819,7 +12691,7 @@
     <act:parent type="new">3d14d5d5d3001e01974df06bf3752d3a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Innergemeinschaftl. Dreiecksgeschäft</act:name>
+    <act:name>Innergemeinschaftl. Dreiecksgeschäft, Lieferung des ersten Abnehmers (§25b Abs. 2 UStG)</act:name>
     <act:id type="new">17fb01aec55ddc4c737783ea99564e66</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -12927,7 +12799,7 @@
     <act:parent type="new">3d14d5d5d3001e01974df06bf3752d3a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Steuerfreie Umsätze § 4 Nr. 2-7 UStG</act:name>
+    <act:name>Steuerfreie Umsätze §4 Nr. 2-7 UStG</act:name>
     <act:id type="new">5577d4805c75e241bf0df3d2cb97924b</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -12986,7 +12858,7 @@
     <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse die mit den Durchschnittssätzen des § 24 UStG versteuert werden</act:name>
+    <act:name>Erlöse die mit den Durchschnittssätzen des §24 UStG versteuert werden</act:name>
     <act:id type="new">d458b83b14466d59de3db27b48ab7182</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -13022,7 +12894,7 @@
     <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse Kleinunternehmer § 19 UStG</act:name>
+    <act:name>Erlöse Kleinunternehmer §19 UStG</act:name>
     <act:id type="new">4620b03acccf52c62cbb7367c5c5db5b</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -13169,7 +13041,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>4315</act:code>
+    <act:code>4330</act:code>
     <act:description>UstVa Zl. 35, Kz. 97</act:description>
     <act:slots>
       <slot>
@@ -13197,6 +13069,42 @@
     <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
+    <act:name>Erlöse aus im Inland steuerpflichtigen EG Lieferungen 19% USt</act:name>
+    <act:id type="new">7fb425afaf83ab27a04c4665b18f3598</act:id>
+    <act:type>INCOME</act:type>
+    <act:commodity>
+      <cmdty:space>ISO4217</cmdty:space>
+      <cmdty:id>EUR</cmdty:id>
+    </act:commodity>
+    <act:commodity-scu>100</act:commodity-scu>
+    <act:code>4315</act:code>
+    <act:description>UstVa Zl. 35, Kz. 89</act:description>
+    <act:slots>
+      <slot>
+	<slot:key>placeholder</slot:key>
+	<slot:value type="string">false</slot:value>
+      </slot>
+      <slot>
+	<slot:key>notes</slot:key>
+	<slot:value type="string"></slot:value>
+      </slot>
+      <slot>
+	<slot:key>tax-related</slot:key>
+	<slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+	<slot:key>tax-US</slot:key>
+	<slot:value type="frame">
+	  <slot>
+	    <slot:key>code</slot:key>
+	    <slot:value type="string">K89</slot:value>
+	  </slot>
+	</slot:value>
+      </slot>
+    </act:slots>
+    <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
+  </gnc:account>
+  <gnc:account version="2.0.0">
     <act:name>Erlöse aus im anderen EG-Land steuerpflichtigen Lieferungen</act:name>
     <act:id type="new">baa97706a92a388670d4b65554feb84a</act:id>
     <act:type>INCOME</act:type>
@@ -13219,7 +13127,7 @@
     <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse aus Leistungen, für die der Leistungsempfänger die Steuer nach § 13b UStG schuldet.</act:name>
+    <act:name>Erlöse aus Leistungen, für die der Leistungsempfänger die Steuer nach §13b UStG schuldet.</act:name>
     <act:id type="new">36b8db0579cb00c7b10e0fb28966aa57</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -13335,7 +13243,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>4400</act:code>
+    <act:code>4340</act:code>
     <act:description>UstVa Zl. 27, Kz. 51</act:description>
     <act:slots>
       <slot>
@@ -13367,6 +13275,46 @@
     <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
+    <act:name>Umsatzerlöse 19% USt</act:name>
+    <act:id type="new">ecf894d93ba331ecafc6e4084b83ebe1</act:id>
+    <act:type>INCOME</act:type>
+    <act:commodity>
+      <cmdty:space>ISO4217</cmdty:space>
+      <cmdty:id>EUR</cmdty:id>
+    </act:commodity>
+    <act:commodity-scu>100</act:commodity-scu>
+    <act:code>4400</act:code>
+    <act:description>UstVa Zl. 27, Kz. 81</act:description>
+    <act:slots>
+      <slot>
+	<slot:key>placeholder</slot:key>
+	<slot:value type="string">false</slot:value>
+      </slot>
+      <slot>
+	<slot:key>notes</slot:key>
+	<slot:value type="string"></slot:value>
+      </slot>
+      <slot>
+	<slot:key>hbci</slot:key>
+	<slot:value type="frame"/>
+      </slot>
+      <slot>
+	<slot:key>tax-related</slot:key>
+	<slot:value type="integer">1</slot:value>
+      </slot>
+      <slot>
+	<slot:key>tax-US</slot:key>
+	<slot:value type="frame">
+	  <slot>
+	    <slot:key>code</slot:key>
+	    <slot:value type="string">K81</slot:value>
+	  </slot>
+	</slot:value>
+      </slot>
+    </act:slots>
+    <act:parent type="new">0be35cece133442ae9f967be1626bc57</act:parent>
+  </gnc:account>
+  <gnc:account version="2.0.0">
     <act:name>Provisionserlöse</act:name>
     <act:id type="new">4cc96976e01bee25735c73178ffdea87</act:id>
     <act:type>INCOME</act:type>
@@ -13412,7 +13360,7 @@
     <act:parent type="new">4cc96976e01bee25735c73178ffdea87</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Provisionserlöse, steuerfrei § 4 Nr.5</act:name>
+    <act:name>Provisionserlöse, steuerfrei §4 Nr.5</act:name>
     <act:id type="new">d3801c0ca8cc4f691ce84e5bd50a2a57</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -14495,6 +14443,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -14630,6 +14582,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -14838,7 +14794,7 @@
     <act:parent type="new">e42b6d2cd19cd5d85b01f2f91ae15a61</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse Sachanlageverkäufe steuerfrei § 4 Nr. 1a</act:name>
+    <act:name>Erlöse Sachanlageverkäufe steuerfrei §4 Nr. 1a</act:name>
     <act:id type="new">d41a3c99a6ce8d5fdc749e10c0e012b4</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -14888,7 +14844,7 @@
     <act:parent type="new">4c0c1557fe54e71d7ed717587a0c0b4d</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse Sachanlageverkäufe steuerfrei § 4 Nr. 1b</act:name>
+    <act:name>Erlöse Sachanlageverkäufe steuerfrei §4 Nr. 1b</act:name>
     <act:id type="new">d16fb532f016b5b97efc2905071370ef</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -15787,6 +15743,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -15924,6 +15884,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -16046,7 +16010,7 @@
     <act:parent type="new">c5c52fce955f17d7e01b282e32ca1cb5</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gewinne aus Anteilen an nicht steuerbefreiten inländischen Kapitalgesellschaften § 9 Nr. 2a GewStG</act:name>
+    <act:name>Gewinne aus Anteilen an nicht steuerbefreiten inländischen Kapitalgesellschaften §9 Nr. 2a GewStG</act:name>
     <act:id type="new">f9e5c4d024367f304aea7341720bfc91</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -16068,7 +16032,7 @@
     <act:parent type="new">c5c52fce955f17d7e01b282e32ca1cb5</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gewinnanteile aus Mitunternehmerschaften § 9 GewStG</act:name>
+    <act:name>Gewinnanteile aus Mitunternehmerschaften §9 GewStG</act:name>
     <act:id type="new">1017a6b287a4bf3b90c53664437e3681</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -16108,6 +16072,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -16270,6 +16238,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -16427,6 +16399,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -16545,7 +16521,7 @@
     <act:parent type="new">094e09462e1b0d687aa5beeb3e52e6af</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zinserträge § 233a AO</act:name>
+    <act:name>Zinserträge §233a AO</act:name>
     <act:id type="new">b4c535754373cb533897ef30985453b5</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -16567,7 +16543,7 @@
     <act:parent type="new">094e09462e1b0d687aa5beeb3e52e6af</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zinserträge § 233a AO Sonderfall Anlage A KSt</act:name>
+    <act:name>Zinserträge §233a AO Sonderfall Anlage A KSt</act:name>
     <act:id type="new">048c7297f319b8c96f968b78b5fca06b</act:id>
     <act:type>INCOME</act:type>
     <act:commodity>
@@ -16699,6 +16675,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -16795,6 +16775,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -18665,28 +18649,6 @@
     <act:parent type="new">2906a27180c72875652cef912c773d4e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Pauschale Steuer für Versicherungen</act:name>
-    <act:id type="new">da3a1376f6f6240594701514868a0465</act:id>
-    <act:type>EXPENSE</act:type>
-    <act:commodity>
-      <cmdty:space>ISO4217</cmdty:space>
-      <cmdty:id>EUR</cmdty:id>
-    </act:commodity>
-    <act:commodity-scu>100</act:commodity-scu>
-    <act:code>6147</act:code>
-    <act:slots>
-      <slot>
-	<slot:key>placeholder</slot:key>
-	<slot:value type="string">false</slot:value>
-      </slot>
-      <slot>
-	<slot:key>notes</slot:key>
-	<slot:value type="string"></slot:value>
-      </slot>
-    </act:slots>
-    <act:parent type="new">2906a27180c72875652cef912c773d4e</act:parent>
-  </gnc:account>
-  <gnc:account version="2.0.0">
     <act:name>Aufwendungen für Altersversorgung für Mitunternehmer  15 EStG</act:name>
     <act:id type="new">e781f4fa8558d4a1c924f9f54be61a92</act:id>
     <act:type>EXPENSE</act:type>
@@ -19374,6 +19336,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -19466,6 +19432,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -19646,7 +19616,7 @@
     <act:parent type="new">70f081631b2bf13005c3453c6d235c6a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gewerbesteuerlich zu berücksichtigende Miete § 8 GewStG </act:name>
+    <act:name>Gewerbesteuerlich zu berücksichtigende Miete §8 GewStG </act:name>
     <act:id type="new">01f2a8be03958de5b907d173c34bec28</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -19668,7 +19638,7 @@
     <act:parent type="new">1ba24952187bcf28b0d93b19a593754e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Vergütungen an Mitunternehmer für die mietweise Überlassung ihrer Wirtschaftsgüter § 16 EStG</act:name>
+    <act:name>Vergütungen an Mitunternehmer für die mietweise Überlassung ihrer Wirtschaftsgüter §16 EStG</act:name>
     <act:id type="new">d20bde1edb79b7c83b28ba54c57246c3</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -19734,7 +19704,7 @@
     <act:parent type="new">36fbb1b1ad375d67b895a61dcbe13264</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Vergütungen an Mitunternehmer für die pachtweise Überlassung ihrer Wirtschaftsgüter § 15 EStG</act:name>
+    <act:name>Vergütungen an Mitunternehmer für die pachtweise Überlassung ihrer Wirtschaftsgüter §15 EStG</act:name>
     <act:id type="new">e122ae549e19b01d85240c7dc0c765ac</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -20410,7 +20380,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>6458 </act:code>
+    <act:code>6458</act:code>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -20568,7 +20538,7 @@
     <act:parent type="new">5925fef34d2d43bd1a1fbe06d7cf5515</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gewerbesteuerlich zu berücksichtigendes Mietleasing § 8 GewStG</act:name>
+    <act:name>Gewerbesteuerlich zu berücksichtigendes Mietleasing §8 GewStG</act:name>
     <act:id type="new">4e2ffa4719c68aecc33759447db520fb</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -20922,7 +20892,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>6660 </act:code>
+    <act:code>6660</act:code>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -21124,7 +21094,7 @@
       <cmdty:id>EUR</cmdty:id>
     </act:commodity>
     <act:commodity-scu>100</act:commodity-scu>
-    <act:code>6689 </act:code>
+    <act:code>6689</act:code>
     <act:slots>
       <slot>
 	<slot:key>placeholder</slot:key>
@@ -21374,7 +21344,7 @@
     <act:parent type="new">34be7b6c3246314364ef3ad2c6aead4c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Haftungsvergütung an Mitunternehmer § 15 EStG</act:name>
+    <act:name>Haftungsvergütung an Mitunternehmer §15 EStG</act:name>
     <act:id type="new">2b14079ef17c0b9aab0bb80aa9eb4702</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -21500,7 +21470,7 @@
     <act:parent type="new">34be7b6c3246314364ef3ad2c6aead4c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gewerbesteuerlich zu berücksichtigende Miete für Einrichtungen § 8 GewStG</act:name>
+    <act:name>Gewerbesteuerlich zu berücksichtigende Miete für Einrichtungen §8 GewStG</act:name>
     <act:id type="new">acc87728d36607261557e9daaa426b83</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -21545,7 +21515,7 @@
     <act:parent type="new">34be7b6c3246314364ef3ad2c6aead4c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Gewerbesteuerlich zu berücksichtigendes Mietleasing § 8 GewStG</act:name>
+    <act:name>Gewerbesteuerlich zu berücksichtigendes Mietleasing §8 GewStG</act:name>
     <act:id type="new">8e559eae0ee39e2c548f4e6c7146123f</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -22386,7 +22356,7 @@
     <act:parent type="new">cf7f94dcdeb53cd3d602ea87d83aba4e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse aus Verkäufen Sachanlagevermögen steuerfrei § 4 Nr. 1a UStG</act:name>
+    <act:name>Erlöse aus Verkäufen Sachanlagevermögen steuerfrei §4 Nr. 1a UStG</act:name>
     <act:id type="new">3ed8139edb0209b9ecccfc8b2e60e90a</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -22432,7 +22402,7 @@
     <act:parent type="new">47767b5fa390ff8a4dbb0fdf05a3ee3b</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Erlöse aus Verkäufen Sachanlagevermögen steuerfrei § 4 Nr. 1b UStG</act:name>
+    <act:name>Erlöse aus Verkäufen Sachanlagevermögen steuerfrei §4 Nr. 1b UStG</act:name>
     <act:id type="new">982804cfea02b767b7c1c8ef7f93ca77</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -22840,7 +22810,7 @@
     <act:parent type="new">d8494e8b7d4b2f51d181e5a3cb3b7b4a</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Aufwendugnen aus der Zuschreibung von steuerlich niedriger bewerteten Rückstellungen</act:name>
+    <act:name>Aufwendungen aus der Zuschreibung von steuerlich niedriger bewerteten Rückstellungen</act:name>
     <act:id type="new">4fd7ecf98b836a356fd25b36ac0c30af</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -23015,7 +22985,7 @@
     <act:parent type="new">1c9b01f1444a088f0922b24a8c1a4ba9</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zuwendungen, Spenden an Stiftungen für gemeinnützige Zwecke i.S.d. § 52 Abs. 2 Nr. 1-3 AO</act:name>
+    <act:name>Zuwendungen, Spenden an Stiftungen für gemeinnützige Zwecke i.S.d. §52 Abs. 2 Nr. 1-3 AO</act:name>
     <act:id type="new">865103769caad0200af84b6a2b0449eb</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -23037,7 +23007,7 @@
     <act:parent type="new">1c9b01f1444a088f0922b24a8c1a4ba9</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zuwendungen, Spenden an Stiftungen für gemeinnützige Zwecke i.S.d. § 52 Abs. 2 Nr. 4 AO</act:name>
+    <act:name>Zuwendungen, Spenden an Stiftungen für gemeinnützige Zwecke i.S.d. §52 Abs. 2 Nr. 4 AO</act:name>
     <act:id type="new">7488fcc28c27087b0481310220281ca7</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -23117,6 +23087,10 @@
 	<slot:value type="string">true</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -23610,7 +23584,7 @@
     <act:parent type="new">cf7f94dcdeb53cd3d602ea87d83aba4e</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Einstellungen in Sonderposten mit Rücklageanteil (§ 52 Abs. 16 EStG)</act:name>
+    <act:name>Einstellungen in Sonderposten mit Rücklageanteil (§52 Abs. 16 EStG)</act:name>
     <act:id type="new">77d002bae022921736161cb5f75a114c</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -23648,6 +23622,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -23832,6 +23810,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -23901,6 +23883,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -23953,7 +23939,7 @@
     <act:parent type="new">330db1de3813d4b598b2646016d5bab4</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Abschreibungen aufgrund von Verlustanteilen an Mitunternehmerschaften § 8 GewStG</act:name>
+    <act:name>Abschreibungen aufgrund von Verlustanteilen an Mitunternehmerschaften §8 GewStG</act:name>
     <act:id type="new">bd99edea1955d7a98773772ab91332f4</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24284,6 +24270,10 @@
 	<slot:value type="string">true</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -24357,7 +24347,7 @@
     <act:parent type="new">61f884f026b5cec86f75f7b9b25ea945</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Abgeführte Gewinnanteile an stille Gesellschafter § 8 GewStG</act:name>
+    <act:name>Abgeführte Gewinnanteile an stille Gesellschafter §8 GewStG</act:name>
     <act:id type="new">da217e4cc01d7e715df599db374c19bb</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24445,7 +24435,7 @@
     <act:parent type="new">8077a61128333def2454214ea7b6df5c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zinsaufwendungen § 233a AO betriebliche Steuern</act:name>
+    <act:name>Zinsaufwendungen §233a AO betriebliche Steuern</act:name>
     <act:id type="new">175898858541f5e2e9076eced4e27fb7</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24467,7 +24457,7 @@
     <act:parent type="new">8077a61128333def2454214ea7b6df5c</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zinsaufwendungen §§ 233a bis 237 AO</act:name>
+    <act:name>Zinsaufwendungen §§233a bis 237 AO</act:name>
     <act:id type="new">b38f82c5de3a784f2e9eab49d678d655</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24512,7 +24502,7 @@
     <act:parent type="new">1848323dfe915f8ed2a24bc00fef1e16</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Nicht abzugsfähige Schuldzinsen (langfristig) gemäß § 4 Abs. 4a EStG</act:name>
+    <act:name>Nicht abzugsfähige Schuldzinsen (langfristig) gemäß §4 Abs. 4a EStG</act:name>
     <act:id type="new">94d77d7d8bc10d776c6bd03774e8294a</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24535,7 +24525,7 @@
     <act:parent type="new">71a9174e0b5d1b37537fbaae957435e9</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Nicht abzugsfähige Schuldzinsen (kurzfristig) gemäß § 4 Abs. 4a EStG</act:name>
+    <act:name>Nicht abzugsfähige Schuldzinsen (kurzfristig) gemäß §4 Abs. 4a EStG</act:name>
     <act:id type="new">d84388a7f7fcea4151c1b93a677dcfdb</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24647,7 +24637,7 @@
     <act:parent type="new">40bbf2cc46016fd17529264fd27c534d</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Renten und dauernde Lasten aus Gründung/Erwerb § 8 GewStG</act:name>
+    <act:name>Renten und dauernde Lasten aus Gründung/Erwerb §8 GewStG</act:name>
     <act:id type="new">62aa443abf3cad9e8c7408d27870333d</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24669,7 +24659,7 @@
     <act:parent type="new">40bbf2cc46016fd17529264fd27c534d</act:parent>
   </gnc:account>
   <gnc:account version="2.0.0">
-    <act:name>Zinsaufwendungen an Mitunternehmer für die Hingabe von Kapital § 15 EStG</act:name>
+    <act:name>Zinsaufwendungen an Mitunternehmer für die Hingabe von Kapital §15 EStG</act:name>
     <act:id type="new">a4d96f9f3cf84a6f9d356bb79305d1c3</act:id>
     <act:type>EXPENSE</act:type>
     <act:commodity>
@@ -24776,6 +24766,10 @@
 	<slot:value type="string"></slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>hbci</slot:key>
 	<slot:value type="frame"/>
       </slot>
@@ -24893,6 +24887,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -24915,6 +24913,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -24937,6 +24939,10 @@
 	<slot:value type="string">false</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>
@@ -25491,6 +25497,10 @@
 	<slot:value type="string">true</slot:value>
       </slot>
       <slot>
+	<slot:key>hidden</slot:key>
+	<slot:value type="string">true</slot:value>
+      </slot>
+      <slot>
 	<slot:key>notes</slot:key>
 	<slot:value type="string"></slot:value>
       </slot>

Copied: gnucash/branches/gda-dev2/accounts/ru (from rev 17437, gnucash/trunk/accounts/ru)


Property changes on: gnucash/branches/gda-dev2/accounts/ru
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in


Modified: gnucash/branches/gda-dev2/configure.in
===================================================================
--- gnucash/branches/gda-dev2/configure.in	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/configure.in	2008-07-30 01:08:07 UTC (rev 17438)
@@ -181,9 +181,9 @@
 if test $? = 0 ; then
   BUILDING_FROM_SVN=yes
 
-  # We need at least version 1.3.28 of SWIG because
-  # that's when SWIG added %delobject
-  AC_PROG_SWIG(1.3.28)
+  # We need at least version 1.3.31 of SWIG because
+  # that's when SWIG doesn't barf on the "inline" keyword in C headers anymore
+  AC_PROG_SWIG(1.3.31)
 else
   BUILDING_FROM_SVN=no
   # Make sure we've got swig-runtime.h and gnc-svninfo.h
@@ -792,38 +792,46 @@
 ### --------------------------------------------------------------------------
 ### MT940
 AC_ARG_ENABLE( mt940,
-  [  --enable-mt940               Obsolete, included in --enable-hbci],
+  [  --enable-mt940               obsolete, included in --enable-aqbanking],
   if test "x$enableval" != "xno" ; then
-    AC_MSG_ERROR([--enable-mt940 is obsolete -- all functionality is already included in --enable-hbci])
+    AC_MSG_ERROR([--enable-mt940 is obsolete -- all functionality is already included in --enable-aqbanking])
   fi)
 
 ### --------------------------------------------------------------------------
-### HBCI
+### AqBanking
+
+AC_ARG_ENABLE( aqbanking,
+  [  --enable-aqbanking           compile with AqBanking support],
+  if test "x$enableval" != "xno" ; then
+    want_aqbanking=yes
+  fi)
 AC_ARG_ENABLE( hbci,
-  [  --enable-hbci                compile with HBCI support (needs AqBanking)],
+  [  --enable-hbci                an alias for --enable-aqbanking],
   if test "x$enableval" != "xno" ; then
-    HBCI_DIR=hbci
+    want_aqbanking=yes
   fi)
-if test x${HBCI_DIR} = xhbci ;
+if test x${want_aqbanking} = xyes ;
 then
-    # Check for Aqbanking library
-    # aqbanking-1.6.1 was released on 2005-11-04; aqbanking ships with
-    # a pkg-config file since 1.6.1.
-    PKG_CHECK_MODULES(HBCI, aqbanking >= 1.6.1 aqbanking < 2.9.0 gwenhywfar, [], [
-      AC_MSG_ERROR([Could not find aqbanking > 1.6.0 and < 2.9.0. If you use --enable-hbci, you *have* to have aqbanking installed. Note that gnucash requires aqbanking2 and not (yet) aqbanking3!])
+  # Check for Aqbanking library
+  # aqbanking-1.6.1 was released on 2005-11-04; aqbanking ships with
+  # a pkg-config file since 1.6.1.
+  PKG_CHECK_MODULES(AQBANKING, aqbanking >= 3.0.0 gwenhywfar, [AQBANKING_DIR=aqbanking], [
+    PKG_CHECK_MODULES(AQBANKING, aqbanking >= 1.6.1 aqbanking < 2.9.0 gwenhywfar, [AQBANKING_DIR=hbci], [
+      AC_MSG_ERROR([Could not find aqbanking > 1.6.0. If you use --enable-aqbanking or --enable-hbci, you *have* to have aqbanking installed!])
     ])
+  ])
 
-    # also check for ktoblzcheck
-    AC_CHECK_HEADERS(ktoblzcheck.h)
-    if test "x$ac_cv_header_ktoblzcheck_h" != xno; then
-	HBCI_LIBS="${HBCI_LIBS} -lktoblzcheck"  
-    fi
+  # also check for ktoblzcheck
+  AC_CHECK_HEADERS(ktoblzcheck.h)
+  if test "x$ac_cv_header_ktoblzcheck_h" != xno; then
+    AQBANKING_LIBS="${AQBANKING_LIBS} -lktoblzcheck"
+  fi
 
-    AS_SCRUB_INCLUDE(HBCI_CFLAGS)
-    AC_SUBST(HBCI_LIBS)
-    AC_SUBST(HBCI_CFLAGS)
+  AS_SCRUB_INCLUDE(AQBANKING_CFLAGS)
+  AC_SUBST(AQBANKING_LIBS)
+  AC_SUBST(AQBANKING_CFLAGS)
 fi
-AC_SUBST(HBCI_DIR)
+AC_SUBST(AQBANKING_DIR)
 
 ### --------------------------------------------------------------------------
 ### i18n
@@ -1290,6 +1298,28 @@
 fi
 AC_SUBST(LC_MESSAGES_ENUM)
 
+###--------------------------------------------------------
+### Make Python bindings optional
+###--------------------------------------------------------
+enable_python=false
+
+AC_ARG_ENABLE(python-bindings,
+  [  --enable-python-bindings     enable python bindings],
+  [case "${enableval}" in
+        yes) enable_python=true ;;
+        no) enable_python=false ;;
+        *) enable_python=true ;;
+        esac]
+  )
+if test x${enable_python} = "xtrue"
+then
+  PYTHON_DIR=python-bindings
+  AM_PATH_PYTHON(2.4)
+  AC_PYTHON_DEVEL(>= '2.4')
+  SWIG_PYTHON
+fi
+AC_SUBST(PYTHON_DIR)
+
 ###-------------------------------------------------------------------------
 ### Additional compiler warnings (or not) if we're running GCC
 ###-------------------------------------------------------------------------
@@ -1403,6 +1433,7 @@
           accounts/nb/Makefile
           accounts/pt_BR/Makefile
           accounts/pt_PT/Makefile
+          accounts/ru/Makefile
           accounts/sk/Makefile
           accounts/tr_TR/Makefile
           accounts/zh_CN/Makefile
@@ -1482,11 +1513,15 @@
           src/import-export/ofx/test/Makefile
           src/import-export/csv/Makefile
           src/import-export/log-replay/Makefile
+          src/import-export/aqbanking/Makefile
+          src/import-export/aqbanking/schemas/Makefile
           src/import-export/hbci/Makefile
           src/import-export/hbci/glade/Makefile
           src/import-export/hbci/schemas/Makefile
           src/import-export/hbci/test/Makefile
           src/optional/Makefile
+          src/optional/python-bindings/Makefile
+          src/optional/python-bindings/tests/Makefile
           src/optional/xsl/Makefile
           src/pixmaps/Makefile
           src/quotes/Makefile
@@ -1553,9 +1588,12 @@
 if test x${OFX_DIR} != x; then
 components="$components ofx"
 fi
-if test x${HBCI_DIR} != x; then
-components="$components hbci"
+if test x${AQBANKING_DIR} != x; then
+components="$components $AQBANKING_DIR"
 fi
+if test x${PYTHON_DIR} != x; then
+components="$components python-bindings"
+fi
 
 AC_MSG_RESULT([
   Options detected/selected

Modified: gnucash/branches/gda-dev2/doc/examples/downloaded.mt940
===================================================================
--- gnucash/branches/gda-dev2/doc/examples/downloaded.mt940	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/doc/examples/downloaded.mt940	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1,4 +1,3 @@
-
 :20:STARTUMS  
 :25:80007777/2602272001
 :28C:0

Modified: gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -41,6 +41,7 @@
 #include <time.h>
 
 #include <glib.h>
+#include <glib/gi18n.h>
 
 #include "gnc-date-p.h"
 #include "qof.h"
@@ -68,6 +69,15 @@
 #  define GNC_T_FMT "%r" 
 #endif
 
+/* The default date format for use with strftime. */
+const char *gnc_default_strftime_date_format =
+#ifdef G_OS_WIN32
+ N_("%B %#d, %Y")
+#else
+ N_("%B %e, %Y")
+#endif
+ ;
+
 /* This is now user configured through the gnome options system() */
 static QofDateFormat dateFormat = QOF_DATE_FORMAT_LOCALE;
 static QofDateFormat prevQofDateFormat = QOF_DATE_FORMAT_LOCALE;

Modified: gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.h
===================================================================
--- gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.h	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/lib/libqof/qof/gnc-date.h	2008-07-30 01:08:07 UTC (rev 17438)
@@ -69,6 +69,9 @@
 
 #include <time.h>
 
+/** The default date format for use with strftime. */
+extern const char *gnc_default_strftime_date_format;
+
 /** The maximum length of a string created by the date printers */
 #define MAX_DATE_LENGTH 31
 
@@ -380,7 +383,7 @@
 size_t qof_print_date_buff (char * buff, size_t buflen, time_t secs);
 
 /** Convenience; calls through to qof_print_date_dmy_buff(). **/
-size_t qof_print_gdate( char *buf, size_t bufflen, const GDate *gd );
+size_t qof_print_gdate(char *buf, size_t bufflen, const GDate *gd);
 
 /** Convenience; calls through to qof_print_date_dmy_buff(). 
  *  Return: string, which should be freed when no longer needed.

Modified: gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.c
===================================================================
--- gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1019,7 +1019,83 @@
   return out;
 }
 
+
 /* *******************************************************************
+ * gnc_numeric_to_decimal
+ *
+ * Attempt to convert the denominator to an exact power of ten without
+ * rounding. TRUE is returned if 'a' has been converted or was already
+ * decimal. Otherwise, FALSE is returned and 'a' remains unchanged.
+ * The 'max_decimal_places' parameter may be NULL.
+ ********************************************************************/
+
+gboolean
+gnc_numeric_to_decimal(gnc_numeric *a, guint8 *max_decimal_places)
+{
+  guint8 decimal_places = 0;
+  gnc_numeric converted_val;
+  gint64 fraction;
+
+  g_return_val_if_fail(a, FALSE);
+
+  if (gnc_numeric_check(*a) != GNC_ERROR_OK) 
+    return FALSE;
+
+  converted_val = *a;
+  fraction = converted_val.denom;
+  if (fraction <= 0)
+    return FALSE;
+
+  while (fraction != 1)
+  {
+    switch (fraction % 10)
+    {
+      case 0:
+        fraction = fraction / 10;
+        break;
+
+      case 5:
+        converted_val = gnc_numeric_mul(converted_val,
+                                        gnc_numeric_create(2, 2),
+                                        GNC_DENOM_AUTO,
+                                        GNC_HOW_DENOM_EXACT |
+                                        GNC_HOW_RND_NEVER);
+        if (gnc_numeric_check(converted_val) != GNC_ERROR_OK)
+          return FALSE;
+        fraction = fraction / 5;
+        break;
+
+      case 2:
+      case 4:
+      case 6:
+      case 8:
+        converted_val = gnc_numeric_mul(converted_val,
+                                        gnc_numeric_create(5, 5),
+                                        GNC_DENOM_AUTO,
+                                        GNC_HOW_DENOM_EXACT |
+                                        GNC_HOW_RND_NEVER);
+        if (gnc_numeric_check(converted_val) != GNC_ERROR_OK)
+          return FALSE;
+        fraction = fraction / 2;
+        break;
+
+      default:
+        return FALSE;
+    }
+
+    decimal_places += 1;
+  }
+
+  if (max_decimal_places)
+    *max_decimal_places = decimal_places;
+
+  *a = converted_val;
+
+  return TRUE;
+}
+
+
+/* *******************************************************************
  *  double_to_gnc_numeric
  ********************************************************************/
 

Modified: gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.h
===================================================================
--- gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.h	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/lib/libqof/qof/gnc-numeric.h	2008-07-30 01:08:07 UTC (rev 17438)
@@ -445,6 +445,21 @@
 /** Return input after reducing it by Greated Common Factor (GCF) 
  *  elimination */
 gnc_numeric gnc_numeric_reduce(gnc_numeric in);
+
+/** Attempt to convert the denominator to an exact power of ten without
+ *  rounding.
+ *
+ *  @param a the ::gnc_numeric value to convert
+ *
+ *  @param max_decimal_places the number of decimal places of the
+ *  converted value. This parameter may be @c NULL.
+ *
+ *  @return @c TRUE if @a a has been converted or was already decimal.
+ *  Otherwise, @c FALSE is returned and @a a and @a max_decimal_places
+ *  remain unchanged.
+ ********************************************************************/
+gboolean gnc_numeric_to_decimal(gnc_numeric * a,
+                                guint8 * max_decimal_places);
 /** @} */
 
 /** @name GValue 

Modified: gnucash/branches/gda-dev2/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/branches/gda-dev2/lib/libqof/qof/qofsession.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/lib/libqof/qof/qofsession.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1225,7 +1225,8 @@
 	QofBook *book, *abook;
 	int err;
 	gint num;
-	char *msg, *book_id;
+	char *msg = NULL;
+	char *book_id;
 
 	if (!session) return;
 	if (!g_atomic_int_dec_and_test(&session->lock))


Property changes on: gnucash/branches/gda-dev2/macros
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
Makefile
macros.dep
gnome-macros.dep
intltool.m4
   + Makefile.in
Makefile
macros.dep
gnome-macros.dep
intltool.m4
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4


Copied: gnucash/branches/gda-dev2/macros/ac_python_devel.m4 (from rev 17437, gnucash/trunk/macros/ac_python_devel.m4)
===================================================================
--- gnucash/branches/gda-dev2/macros/ac_python_devel.m4	                        (rev 0)
+++ gnucash/branches/gda-dev2/macros/ac_python_devel.m4	2008-07-30 01:08:07 UTC (rev 17438)
@@ -0,0 +1,64 @@
+dnl @synopsis AC_PYTHON_DEVEL
+dnl
+dnl Checks for Python and tries to get the include path to 'Python.h'.
+dnl It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output
+dnl variable.
+dnl
+dnl @category InstalledPackages
+dnl @author Sebastian Huber <sebastian-huber at web.de>
+dnl @author Alan W. Irwin <irwin at beluga.phys.uvic.ca>
+dnl @author Rafael Laboissiere <laboissiere at psy.mpg.de>
+dnl @author Andrew Collier <colliera at nu.ac.za>
+dnl @version 2004-07-14
+dnl @license GPLWithACException
+
+AC_DEFUN([AC_PYTHON_DEVEL],[
+	#
+	# should allow for checking of python version here...
+	#
+	AC_REQUIRE([AM_PATH_PYTHON])
+
+	# Check for Python include path
+	AC_MSG_CHECKING([for Python include path])
+	python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
+	for i in "$python_path/include/python$PYTHON_VERSION/" "$python_path/include/python/" "$python_path/" ; do
+		python_path=`find $i -type f -name Python.h -print | sed "1q"`
+		if test -n "$python_path" ; then
+			break
+		fi
+	done
+	python_path=`echo $python_path | sed "s,/Python.h$,,"`
+	AC_MSG_RESULT([$python_path])
+	if test -z "$python_path" ; then
+		AC_MSG_ERROR([cannot find Python include path])
+	fi
+	AC_SUBST([PYTHON_CPPFLAGS],[-I$python_path])
+
+	# Check for Python library path
+	AC_MSG_CHECKING([for Python library path])
+	python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
+	for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
+		python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
+		if test -n "$python_path" ; then
+			break
+		fi
+	done
+	python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+	AC_MSG_RESULT([$python_path])
+	if test -z "$python_path" ; then
+		AC_MSG_ERROR([cannot find Python library path])
+	fi
+	AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
+	#
+	python_site=`echo $python_path | sed "s/config/site-packages/"`
+	AC_SUBST([PYTHON_SITE_PKG],[$python_site])
+	#
+	# libraries which must be linked in when embedding
+	#
+	AC_MSG_CHECKING(python extra libraries)
+	PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+                conf = distutils.sysconfig.get_config_var; \
+                print conf('LOCALMODLIBS')+' '+conf('LIBS')"
+	AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
+	AC_SUBST(PYTHON_EXTRA_LIBS)
+])

Modified: gnucash/branches/gda-dev2/macros/svn2cl.xsl
===================================================================
--- gnucash/branches/gda-dev2/macros/svn2cl.xsl	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/macros/svn2cl.xsl	2008-07-30 01:08:07 UTC (rev 17438)
@@ -102,6 +102,9 @@
  </xsl:variable>
  <xsl:variable name="branches">
   <branch>
+   <prefix>gnucash/branches/aqbanking3</prefix>
+  </branch>
+  <branch>
    <prefix>gnucash/branches/csv-import</prefix>
   </branch>
   <branch>

Modified: gnucash/branches/gda-dev2/make-gnucash-potfiles.in
===================================================================
--- gnucash/branches/gda-dev2/make-gnucash-potfiles.in	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/make-gnucash-potfiles.in	2008-07-30 01:08:07 UTC (rev 17438)
@@ -51,5 +51,6 @@
 
 # These are also added, even though they are outside of src/
 print "lib/libqof/backend/file/qsf-backend.c\n";
+print "lib/libqof/qof/gnc-date.c\n";
 print "intl-scm/guile-strings.c\n";
 print "doc/tip_of_the_day.list.in\n"

Modified: gnucash/branches/gda-dev2/po/POTFILES.in
===================================================================
--- gnucash/branches/gda-dev2/po/POTFILES.in	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/po/POTFILES.in	2008-07-30 01:08:07 UTC (rev 17438)
@@ -337,6 +337,21 @@
 src/gnome-utils/search-param.c
 src/gnome-utils/window-main-summarybar.c
 src/gnome/window-reconcile.c
+src/import-export/aqbanking/aqbanking.glade
+src/import-export/aqbanking/dialog-ab-trans.c
+src/import-export/aqbanking/dialog-daterange.c
+src/import-export/aqbanking/druid-ab-initial.c
+src/import-export/aqbanking/gnc-ab-getbalance.c
+src/import-export/aqbanking/gnc-ab-gettrans.c
+src/import-export/aqbanking/gnc-ab-kvp.c
+src/import-export/aqbanking/gnc-ab-transfer.c
+src/import-export/aqbanking/gnc-ab-trans-templ.c
+src/import-export/aqbanking/gnc-ab-utils.c
+src/import-export/aqbanking/gnc-file-aqb-import.c
+src/import-export/aqbanking/gnc-gwen-gui.c
+src/import-export/aqbanking/gncmod-aqbanking.c
+src/import-export/aqbanking/gnc-plugin-aqbanking.c
+src/import-export/aqbanking/schemas/apps_gnucash_dialog_hbci.schemas.in
 src/import-export/csv/gnc-csv-gnumeric-popup.c
 src/import-export/csv/gnc-csv-import.c
 src/import-export/csv/gnc-csv-model.c
@@ -454,5 +469,6 @@
 src/report/utility-reports/gncmod-utility-reports.c
 src/tax/us/gncmod-tax-us.c
 lib/libqof/backend/file/qsf-backend.c
+lib/libqof/qof/gnc-date.c
 intl-scm/guile-strings.c
 doc/tip_of_the_day.list.in

Modified: gnucash/branches/gda-dev2/po/de.po
===================================================================
--- gnucash/branches/gda-dev2/po/de.po	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/po/de.po	2008-07-30 01:08:07 UTC (rev 17438)
@@ -6875,11 +6875,11 @@
 
 #: ../src/gnome/gnc-plugin-account-tree.c:57
 msgid "New Accounts _Page"
-msgstr "Neue Konto-_Hierarchie"
+msgstr "Neue Ansicht"
 
 #: ../src/gnome/gnc-plugin-account-tree.c:58
 msgid "Open a new Account Tree page"
-msgstr "Neue Konto-Hierarchie Ansicht öffnen"
+msgstr "Neue Ansicht des Kontenbaums öffnen"
 
 #. File menu
 #: ../src/gnome/gnc-plugin-basic-commands.c:95
@@ -7066,11 +7066,11 @@
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:153
 msgid "New Account _Hierarchy..."
-msgstr "Neue Konten_hierarchie..."
+msgstr "Kontenhierarchie _hinzufügen"
 
 #: ../src/gnome/gnc-plugin-page-account-tree.c:154
 msgid "Extend the current book by merging with new account type categories"
-msgstr "Im aktuellen Kontobuch neue Kontenhierarchien hinzufügen."
+msgstr "Im aktuellen Kontenbuch neue Kontenhierarchien hinzufügen."
 
 #. File menu
 #: ../src/gnome/gnc-plugin-page-account-tree.c:156

Modified: gnucash/branches/gda-dev2/src/app-utils/date-utilities.scm
===================================================================
--- gnucash/branches/gda-dev2/src/app-utils/date-utilities.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/app-utils/date-utilities.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -20,6 +20,8 @@
 ;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
 ;; Boston, MA  02110-1301,  USA       gnu at gnu.org
 
+(use-modules (gnucash core-utils))
+
 (define gnc:reldate-list '())
 
 (define (gnc:timepair->secs tp)
@@ -79,7 +81,7 @@
   (gnc:date-get-year-day (gnc:timepair->date tp)))
 
 (define (gnc:date-get-year-string datevec)
-  (strftime "%Y" datevec))
+  (gnc-locale-to-utf8 (strftime "%Y" datevec)))
 
 (define (gnc:date-get-quarter-string datevec)
   (sprintf #f "Q%d" (gnc:date-get-quarter datevec)))
@@ -91,10 +93,10 @@
    (gnc:date-get-year-string datevec)))
 
 (define (gnc:date-get-month-string datevec)
-  (strftime "%B" datevec))
+  (gnc-locale-to-utf8 (strftime "%B" datevec)))
 
 (define (gnc:date-get-month-year-string datevec)
-  (strftime "%B %Y" datevec))
+  (gnc-locale-to-utf8 (strftime "%B %Y" datevec)))
 
 (define (gnc:date-get-week-year-string datevec)
   (let ((begin-string (gnc-print-date

Modified: gnucash/branches/gda-dev2/src/app-utils/gfec.c
===================================================================
--- gnucash/branches/gda-dev2/src/app-utils/gfec.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/app-utils/gfec.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -169,7 +169,7 @@
 static void
 error_handler(const char *msg)
 {
-    g_warning(msg);
+    g_warning("%s", msg);
     error_in_scm_eval = TRUE;
 }
 

Modified: gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -212,6 +212,33 @@
   return gnc_book_get_commodity_table (gnc_get_current_book ());
 }
 
+gchar *
+gnc_get_account_name_for_register(const Account *account)
+{
+  gboolean show_leaf_accounts;
+  show_leaf_accounts = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
+					  KEY_SHOW_LEAF_ACCOUNT_NAMES, NULL);
+
+  if (show_leaf_accounts)
+    return g_strdup (xaccAccountGetName (account));
+  else
+    return xaccAccountGetFullName (account);
+}
+
+Account *
+gnc_account_lookup_for_register(const Account *base_account, const char *name)
+{
+  gboolean show_leaf_accounts;
+  show_leaf_accounts = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
+					  KEY_SHOW_LEAF_ACCOUNT_NAMES, NULL);
+
+  if (show_leaf_accounts)
+    return gnc_account_lookup_by_name (base_account, name);
+  else
+    return gnc_account_lookup_by_full_name (base_account, name);
+}
+
+
 /*
  * This is a wrapper routine around an xaccGetBalanceInCurrency
  * function that handles additional needs of the gui.
@@ -1356,7 +1383,7 @@
   /* at this point, buf contains the whole part of the number */
 
   /* If it's not decimal, print the fraction as an expression */
-  if (!is_decimal_fraction (val.denom, NULL))
+  if (!gnc_numeric_to_decimal(&val, NULL))
   {
     if (!gnc_numeric_zero_p (val))
     {

Modified: gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.h
===================================================================
--- gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.h	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/app-utils/gnc-ui-util.h	2008-07-30 01:08:07 UTC (rev 17438)
@@ -57,6 +57,29 @@
 Account * gnc_get_current_root_account (void);
 gnc_commodity_table * gnc_get_current_commodities (void);
 
+/**
+ * Get either the full name of the account or the simple name, depending on the
+ * configuration parameter general/register/show_leaf_account_names.
+ *
+ * @param account The account to retrieve the name for.
+ * @return A newly allocated string.
+*/
+gchar *gnc_get_account_name_for_register(const Account *account);
+
+/**
+ * Retrieve the account matching the given name starting from the descandants of
+ * base_account.
+ * @a name is either considered to be the name of the leaf in the account tree
+ * or to be the full account path, depending on the configuration parameter
+ * general/register/show_leaf_account_names.
+ *
+ * @param base_account The account to start the search at.
+ * @param name The name to search for.
+ * @return A pointer to the account, or NULL if the account was not found.
+*/
+Account *gnc_account_lookup_for_register(const Account *base_account, const
+					 gchar *name);
+
 /*
  * This is a wrapper routine around an xaccGetBalanceInCurrency
  * function that handles additional needs of the gui.

Modified: gnucash/branches/gda-dev2/src/app-utils/options.scm
===================================================================
--- gnucash/branches/gda-dev2/src/app-utils/options.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/app-utils/options.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -312,9 +312,9 @@
          documentation-string)
 
   (define (budget->guid budget)
-    (if (string? budget)
-        budget
-        (gncBudgetGetGUID budget)))
+    (cond ((eq? budget #f) #f)
+          ((string? budget) budget)
+          (t (gncBudgetGetGUID budget))))
 
   (define (guid->budget budget)
     (if (string? budget)
@@ -1534,7 +1534,7 @@
     pagename optname 
     sort-tag info
     (lambda () 
-      (cons 'relative 'today))
+      (cons 'relative 'end-accounting-period))
     #f 'both 
     '(
       today 
@@ -1554,7 +1554,7 @@
    (gnc:make-date-option
     pagename name-from
     (string-append sort-tag "a") info-from
-    (lambda () (cons 'relative 'start-cal-year))
+    (lambda () (cons 'relative 'start-accounting-period))
     #f 'both 
     '(
       today

Modified: gnucash/branches/gda-dev2/src/backend/dbi/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/backend/dbi/test/Makefile.am	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/backend/dbi/test/Makefile.am	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1,7 +1,8 @@
 SUBDIRS = .
 
 TESTS = \
-  test-load-backend
+  test-load-backend \
+  test-dbi-account
 
 GNC_TEST_DEPS := \
   --gnc-module-dir ${top_builddir}/src/engine \
@@ -18,7 +19,8 @@
   $(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
 
 check_PROGRAMS = \
-  test-load-backend
+  test-load-backend \
+  test-dbi-account
 
 #noinst_HEADERS = test-file-stuff.h
 
@@ -45,4 +47,4 @@
   ${GUILE_INCS} \
   ${GCONF_CFLAGS}
 
-INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.gda\"
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.dbi\"

Modified: gnucash/branches/gda-dev2/src/backend/file/io-utils.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/file/io-utils.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/backend/file/io-utils.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -48,7 +48,7 @@
 void
 write_emacs_trailer(FILE *out)
 {
-    fprintf(out, emacs_trailer);
+    fprintf(out, "%s", emacs_trailer);
 }
 
 static void

Modified: gnucash/branches/gda-dev2/src/backend/file/test/test-file-stuff.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/file/test/test-file-stuff.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/backend/file/test/test-file-stuff.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -46,7 +46,7 @@
 static int
 files_return(int ret, const char* msg)
 {
-    printf(msg);
+    printf("%s", msg);
     return ret;
 }
 

Modified: gnucash/branches/gda-dev2/src/base-typemaps.i
===================================================================
--- gnucash/branches/gda-dev2/src/base-typemaps.i	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/base-typemaps.i	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1,30 +1,17 @@
-%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
-%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
-
-%typemap(in) Timespec "$1 = gnc_timepair2timespec($input);"
-%typemap(out) Timespec "$result = gnc_timespec2timepair($1);"
-
-%typemap(in) GUID "$1 = gnc_scm2guid($input);"
-%typemap(out) GUID "$result = gnc_guid2scm($1);"
-%typemap(in) GUID * (GUID g) " g = gnc_scm2guid($input); $1 = &g; "
-%typemap(out) GUID * " $result = ($1) ? gnc_guid2scm(*($1)): SCM_UNDEFINED; "
-
-%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
-%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
-
-%typemap(in) gint64 " $1 = gnc_scm_to_gint64($input); "
-%typemap(out) gint64 " $result = gnc_gint64_to_scm($1); "
-
 /* Not sure why SWIG doesn't figure this out. */
-typedef void * gpointer;
 typedef int gint;
 typedef int time_t;
 typedef unsigned int guint;
 typedef double gdouble;
+typedef float gfloat;
 typedef char * URLType;
+typedef void * gpointer;
+
+%typemap(newfree) gchar * "g_free($1);"
+
+#if defined(SWIGGUILE)
 typedef char gchar;
 
-%typemap(newfree) gchar * "g_free($1);"
 %typemap (out) char * {
   $result = scm_makfrom0str((const char *)$1);
   if (!SCM_NFALSEP($result)) {
@@ -34,7 +21,23 @@
 %typemap(in) GNCPrintAmountInfo "$1 = gnc_scm2printinfo($input);"
 %typemap(out) GNCPrintAmountInfo "$result = gnc_printinfo2scm($1);"
 
+%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
+%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
 
+%typemap(in) Timespec "$1 = gnc_timepair2timespec($input);"
+%typemap(out) Timespec "$result = gnc_timespec2timepair($1);"
+
+%typemap(in) GUID "$1 = gnc_scm2guid($input);"
+%typemap(out) GUID "$result = gnc_guid2scm($1);"
+%typemap(in) GUID * (GUID g) " g = gnc_scm2guid($input); $1 = &g; "
+%typemap(out) GUID * " $result = ($1) ? gnc_guid2scm(*($1)): SCM_UNDEFINED; "
+
+%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
+%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
+
+%typemap(in) gint64 " $1 = gnc_scm_to_gint64($input); "
+%typemap(out) gint64 " $result = gnc_gint64_to_scm($1); "
+
 %define GLIST_HELPER_INOUT(ListType, ElemSwigType)
 %typemap(in) ListType * {
   SCM list = $input;
@@ -66,5 +69,87 @@
   $result = scm_reverse(list);
 }
 %enddef
+#elif defined(SWIGPYTHON) /* Typemaps for Python */
+%typemap(in) gint8, gint16, gint32, gint64, gshort, glong {
+    $1 = ($1_type)PyInt_AsLong($input);
+}
 
+%typemap(out) gint8, gint16, gint32, gint64, gshort, glong {
+    $result = PyInt_FromLong($1);
+}
 
+%typemap(in) guint8, guint16, guint32, guint64, gushort, gulong {
+    $1 = ($1_type)PyLong_AsUnsignedLong($input);
+}
+
+%typemap(out) guint8, guint16, guint32, guint64, gushort, gulong {
+    $result = PyLong_FromUnsignedLong($1);
+}
+
+%typemap(in) gchar * {
+    $1 = ($1_type)PyString_AsString($input);
+}
+
+%typemap(out) gchar * {
+    $result = PyString_FromString($1);
+}
+
+%typemap(in) gboolean {
+    if ($input == Py_True)
+        $1 = TRUE;
+    else if ($input == Py_False)
+        $1 = FALSE;
+    else
+    {
+        PyErr_SetString(
+            PyExc_ValueError,
+            "Python object passed to a gboolean argument was not True "
+            "or False" );
+        return NULL;
+    }
+}
+
+%typemap(out) gboolean {
+    if ($1 == TRUE)
+    {
+        Py_INCREF(Py_True);
+        $result = Py_True;
+    }
+    else if ($1 == FALSE)
+    {
+        Py_INCREF(Py_False);
+        $result = Py_False;
+    }
+    else
+    {
+        PyErr_SetString(
+            PyExc_ValueError,
+            "function returning gboolean returned a value that wasn't "
+            "TRUE or FALSE.");
+        return NULL;        
+    }
+}
+
+%typemap(out) GList *, CommodityList *, SplitList *, AccountList *, LotList * {
+    guint i;
+    gpointer data;
+    PyObject *list = PyList_New(0);
+    for (i = 0; i < g_list_length($1); i++)
+    {
+        data = g_list_nth_data($1, i);        
+        if (GNC_IS_ACCOUNT(data))
+            PyList_Append(list, SWIG_NewPointerObj(data, SWIGTYPE_p_Account, 0)); 
+        else if (GNC_IS_SPLIT(data))
+            PyList_Append(list, SWIG_NewPointerObj(data, SWIGTYPE_p_Split, 0)); 
+        else if (GNC_IS_TRANSACTION(data))
+            PyList_Append(list, SWIG_NewPointerObj(data, SWIGTYPE_p_Transaction, 0)); 
+        else if (GNC_IS_COMMODITY(data))
+            PyList_Append(list, SWIG_NewPointerObj(data, SWIGTYPE_p_gnc_commodity, 0)); 
+        else if (GNC_IS_LOT(data))
+            PyList_Append(list, SWIG_NewPointerObj(data, SWIGTYPE_p_GNCLot, 0)); 
+        else
+            PyList_Append(list, SWIG_NewPointerObj(data, SWIGTYPE_p_void, 0)); 
+    }
+    $result = list;
+}
+#endif

Modified: gnucash/branches/gda-dev2/src/bin/gnucash-bin.c
===================================================================
--- gnucash/branches/gda-dev2/src/bin/gnucash-bin.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/bin/gnucash-bin.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -141,7 +141,7 @@
 update_message(const gchar *msg)
 {
     gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
-    g_message(msg);
+    g_message("%s", msg);
 }
 
 static void
@@ -340,6 +340,7 @@
         { "gnucash/import-export/ofx", 0, TRUE },
         { "gnucash/import-export/csv", 0, TRUE },
         { "gnucash/import-export/log-replay", 0, TRUE },
+        { "gnucash/import-export/aqbanking", 0, TRUE },
         { "gnucash/import-export/hbci", 0, TRUE },
         { "gnucash/report/report-system", 0, FALSE },
         { "gnucash/report/stylesheets", 0, FALSE },

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-billterms.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-billterms.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-billterms.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -260,12 +260,12 @@
   num = gnc_numeric_zero ();
   if (gnc_numeric_negative_p (num)) {
     message = _("Negative amounts are not allowed.");
-    gnc_error_dialog (nbt->dialog, message);
+    gnc_error_dialog (nbt->dialog, "%s", message);
     return FALSE;
   }
   if (gnc_numeric_compare (num, gnc_numeric_create (100, 1)) > 0) {
     message = _("Percentage amount must be between 0 and 100.");
-    gnc_error_dialog (nbt->dialog, message);
+    gnc_error_dialog (nbt->dialog, "%s", message);
     return FALSE;
   }
   return TRUE;
@@ -288,7 +288,7 @@
     name = gtk_entry_get_text (GTK_ENTRY (nbt->name_entry));
     if (name == NULL || *name == '\0') {
       message = _("You must provide a name for this Billing Term.");
-      gnc_error_dialog (nbt->dialog, message);
+      gnc_error_dialog (nbt->dialog, "%s", message);
       return FALSE;
     }
     if (gncBillTermLookupByName (btw->book, name)) {

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-customer.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-customer.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-customer.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -277,7 +277,7 @@
       check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
       check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL)) {
     const char *msg = _("You must enter a billing address.");
-    gnc_error_dialog (cw->dialog, msg);
+    gnc_error_dialog (cw->dialog, "%s", msg);
     return;
   }
 

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-employee.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-employee.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-employee.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -227,7 +227,7 @@
       check_entry_nonempty (ew->dialog, ew->addr3_entry, NULL) &&
       check_entry_nonempty (ew->dialog, ew->addr4_entry, NULL)) {
     const char *msg = _("You must enter an address.");
-    gnc_error_dialog (ew->dialog, msg);
+    gnc_error_dialog (ew->dialog, "%s", msg);
     return;
   }
 

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-invoice.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-invoice.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -519,7 +519,7 @@
     else
       msg = g_strdup (message);
 
-    result = gnc_verify_dialog (iw_get_window(iw), FALSE, msg);
+    result = gnc_verify_dialog (iw_get_window(iw), FALSE, "%s", msg);
     g_free (msg);
 
     if (!result)

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-job.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-job.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-job.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -128,7 +128,7 @@
   res = gtk_entry_get_text (GTK_ENTRY (jw->name_entry));
   if (safe_strcmp (res, "") == 0) {
     const char *message = _("The Job must be given a name.");
-    gnc_error_dialog(jw->dialog, message);
+    gnc_error_dialog(jw->dialog, "%s", message);
     return FALSE;
   }
 
@@ -137,7 +137,7 @@
   res = gncOwnerGetName (&(jw->owner));
   if (res == NULL || safe_strcmp (res, "") == 0) {
     const char *message = _("You must choose an owner for this job.");
-    gnc_error_dialog(jw->dialog, message);
+    gnc_error_dialog(jw->dialog, "%s", message);
     return FALSE;
   }
 

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-order.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-order.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-order.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -288,7 +288,7 @@
 		"Are you sure you want to close it out before "
 		"you invoice all the entries?");
 
-    if (gnc_verify_dialog (ow->dialog, FALSE, message) == FALSE)
+    if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
       return;
   }
 

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-payment.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-payment.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -227,7 +227,7 @@
   if (gnc_numeric_check (amount) || !gnc_numeric_positive_p (amount)) {
     text = _("You must enter the amount of the payment.  "
 	     "The payment amount must be greater than zero.");
-    gnc_error_dialog (pw->dialog, text);
+    gnc_error_dialog (pw->dialog, "%s", text);
     return;
   }
 
@@ -235,7 +235,7 @@
   gnc_owner_get_owner (pw->owner_choice, &(pw->owner));
   if (pw->owner.owner.undefined == NULL) {
     text = _("You must select a company for payment processing.");
-    gnc_error_dialog (pw->dialog, text);
+    gnc_error_dialog (pw->dialog, "%s", text);
     return;
   }
 
@@ -243,7 +243,7 @@
   acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(pw->acct_tree));
   if (!acc) {
     text = _("You must select a transfer account from the account tree.");
-    gnc_error_dialog (pw->dialog, text);
+    gnc_error_dialog (pw->dialog, "%s", text);
     return;
   }
 
@@ -251,7 +251,7 @@
   text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
   if (!text || safe_strcmp (text, "") == 0) {
     text = _("You must enter an account name for posting.");
-    gnc_error_dialog (pw->dialog, text);
+    gnc_error_dialog (pw->dialog, "%s", text);
     return;
   }
 

Modified: gnucash/branches/gda-dev2/src/business/business-gnome/dialog-vendor.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/dialog-vendor.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/dialog-vendor.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -214,7 +214,7 @@
       check_entry_nonempty (vw->dialog, vw->addr3_entry, NULL) &&
       check_entry_nonempty (vw->dialog, vw->addr4_entry, NULL)) {
     const char *msg = _("You must enter a payment address.");
-    gnc_error_dialog (vw->dialog, msg);
+    gnc_error_dialog (vw->dialog, "%s", msg);
     return;
   }
 

Modified: gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedger.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedger.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedger.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -81,12 +81,12 @@
   const char *placeholder = _("The account %s does not allow transactions.");
   const char *missing = _("The account %s does not exist. "
 			  "Would you like to create it?");
-  char *fullname;
+  char *account_name;
   ComboCell *cell = (ComboCell *) bcell;
   Account *account;
 
   /* Find the account */
-  account = gnc_account_lookup_by_full_name (gnc_get_current_root_account (), name);
+  account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
 
   if (!account) {
     /* Ask if they want to create a new one. */
@@ -103,10 +103,10 @@
     *new = TRUE;
 
     /* Now have a new account. Update the cell with the name as created. */
-    fullname = xaccAccountGetFullName (account);
-    gnc_combo_cell_set_value (cell, fullname);
+    account_name = gnc_get_account_name_for_register (account);
+    gnc_combo_cell_set_value (cell, account_name);
     gnc_basic_cell_set_changed (&cell->cell, TRUE);
-    g_free (fullname);
+    g_free (account_name);
   }
 
   /* See if the account (either old or new) is a placeholder. */

Modified: gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerControl.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerControl.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerControl.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -599,7 +599,7 @@
   if (!gnc_entry_ledger_verify_can_save (ledger))
     return FALSE;
 
-  if (dontask || gnc_verify_dialog (parent, TRUE, message))
+  if (dontask || gnc_verify_dialog (parent, TRUE, "%s", message))
     gnc_entry_ledger_save (ledger, TRUE);
   else
     gnc_entry_ledger_cancel_cursor_changes (ledger);

Modified: gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerModel.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerModel.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-ledger/gncEntryLedgerModel.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -155,7 +155,7 @@
   entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
   g_free (name);
-  name = xaccAccountGetFullName (gncEntryGetInvAccount (entry));
+  name = gnc_get_account_name_for_register (gncEntryGetInvAccount (entry));
   return name;
 }
 
@@ -172,7 +172,7 @@
   entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
   g_free (name);
-  name = xaccAccountGetFullName (gncEntryGetBillAccount (entry));
+  name = gnc_get_account_name_for_register (gncEntryGetBillAccount (entry));
   return name;
 }
 

Modified: gnucash/branches/gda-dev2/src/business/business-reports/easy-invoice.scm
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-reports/easy-invoice.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-reports/easy-invoice.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -361,7 +361,7 @@
    (gnc:make-string-option
     (N_ "Text") (N_ "Today Date Format")
     "x" (N_ "The format for the date->string conversion for today's date.")
-    "%B %e, %Y"))
+    (gnc-default-strftime-date-format)))
 
 
   (gnc:options-set-default-section gnc:*report-options* "General")

Modified: gnucash/branches/gda-dev2/src/business/business-reports/fancy-invoice.scm
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-reports/fancy-invoice.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-reports/fancy-invoice.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -375,7 +375,7 @@
 ;   (gnc:make-string-option
 ;    (N_ "Display") (N_ "Today Date Format")
 ;    "v" (N_ "The format for the date->string conversion for today's date.")
-;    "%B %e, %Y"))
+;    (gnc-default-strftime-date-format)))
 
   (gnc:options-set-default-section gnc:*report-options* "General")
 
@@ -647,7 +647,9 @@
     ;; oli-custom - modified to display a custom format
     ;; for the invoice date/due date fields
     ;; I could have taken the format from the report options, but... ;)
-    (string-expand (strftime "%B %e, %Y" (localtime (car date))) #\space "&nbsp;")
+    (string-expand (strftime (gnc-default-strftime-date-format)
+                             (localtime (car date)))
+                   #\space "&nbsp;")
     ;;(string-expand (gnc-print-date date) #\space "&nbsp;")
     )))
 

Modified: gnucash/branches/gda-dev2/src/business/business-reports/invoice.scm
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-reports/invoice.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-reports/invoice.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -328,7 +328,7 @@
    (gnc:make-string-option
     (N_ "Display") (N_ "Today Date Format")
     "v" (N_ "The format for the date->string conversion for today's date.")
-    "%B %e, %Y"))
+    (gnc-default-strftime-date-format)))
 
   (gnc:options-set-default-section gnc:*report-options* "General")
 

Modified: gnucash/branches/gda-dev2/src/business/business-reports/owner-report.scm
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-reports/owner-report.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/business-reports/owner-report.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -418,7 +418,7 @@
    (gnc:make-string-option
     gnc:pagename-general (N_ "Today Date Format")
     "p" (N_ "The format for the date->string conversion for today's date.")
-    "%B %e, %Y"))
+    (gnc-default-strftime-date-format)))
 
   (gnc:options-set-default-section gnc:*report-options* "General")
 

Modified: gnucash/branches/gda-dev2/src/business/dialog-tax-table/dialog-tax-table.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/dialog-tax-table/dialog-tax-table.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/business/dialog-tax-table/dialog-tax-table.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -110,7 +110,7 @@
     name = gtk_entry_get_text (GTK_ENTRY (ntt->name_entry));
     if (name == NULL || *name == '\0') {
       message = _("You must provide a name for this Tax Table.");
-      gnc_error_dialog (ntt->dialog, message);
+      gnc_error_dialog (ntt->dialog, "%s", message);
       return FALSE;
     }
     if (gncTaxTableLookupByName (ttw->book, name)) {
@@ -127,14 +127,14 @@
   amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (ntt->amount_entry));
   if (gnc_numeric_negative_p (amount)) {
     message = _("Negative amounts are not allowed.");
-    gnc_error_dialog (ntt->dialog, message);
+    gnc_error_dialog (ntt->dialog, "%s", message);
     return FALSE;
   }
   if (ntt->type == GNC_AMT_TYPE_PERCENT &&
       gnc_numeric_compare (amount,
 			   gnc_numeric_create (100, 1)) > 0) {
     message = _("Percentage amount must be between 0 and 100.");
-    gnc_error_dialog (ntt->dialog, message);
+    gnc_error_dialog (ntt->dialog, "%s", message);
     return FALSE;
   }							   
 
@@ -142,7 +142,7 @@
   acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(ntt->acct_tree));
   if (acc == NULL) {
     message = _("You must choose a Tax Account.");
-    gnc_error_dialog (ntt->dialog, message);
+    gnc_error_dialog (ntt->dialog, "%s", message);
     return FALSE;
   }
 
@@ -579,7 +579,7 @@
   if (g_list_length (gncTaxTableGetEntries (ttw->current_table)) <= 1) {
     char *message = _("You cannot remove the last entry from the tax table. "
 		      "Try deleting the tax table if you want to do that.");
-    gnc_error_dialog (ttw->dialog, message);
+    gnc_error_dialog (ttw->dialog, "%s", message);
     return;
   }
 

Modified: gnucash/branches/gda-dev2/src/core-utils/gnc-gconf-utils.h
===================================================================
--- gnucash/branches/gda-dev2/src/core-utils/gnc-gconf-utils.h	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/core-utils/gnc-gconf-utils.h	2008-07-30 01:08:07 UTC (rev 17438)
@@ -67,6 +67,7 @@
 #define KEY_NUMBER_OF_ROWS	"number_of_rows"
 #define KEY_ENABLE_EURO		"enable_euro"
 #define KEY_DATE_FORMAT 	"date_format"
+#define KEY_SHOW_LEAF_ACCOUNT_NAMES "show_leaf_account_names"
 
 typedef void (*GncGconfGeneralCb)    (GConfEntry *entry, gpointer user_data);
 typedef void (*GncGconfGeneralAnyCb) (gpointer user_data);

Modified: gnucash/branches/gda-dev2/src/core-utils/gnc-glib-utils.c
===================================================================
--- gnucash/branches/gda-dev2/src/core-utils/gnc-glib-utils.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/core-utils/gnc-glib-utils.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -186,6 +186,8 @@
   gchar *end;
   gint len;
 
+  g_return_if_fail(str);
+
   if (gnc_utf8_validate(str, -1, (const gchar **)&end))
     return;
 

Modified: gnucash/branches/gda-dev2/src/engine/Account.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/Account.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/engine/Account.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -2519,6 +2519,39 @@
   return NULL;
 }
 
+Account *
+gnc_account_lookup_by_code (const Account *parent, const char * code)
+{
+  AccountPrivate *cpriv, *ppriv;
+  Account *child, *result;
+  GList *node;
+
+  g_return_val_if_fail(GNC_IS_ACCOUNT(parent), NULL);
+  g_return_val_if_fail(code, NULL);
+
+  /* first, look for accounts hanging off the current node */
+  ppriv = GET_PRIVATE(parent);
+  for (node = ppriv->children; node; node = node->next)
+  {
+    child = node->data;
+    cpriv = GET_PRIVATE(child);
+    if (safe_strcmp(cpriv->accountCode, code) == 0)
+      return child;
+  }
+
+  /* if we are still here, then we haven't found the account yet.
+   * Recursively search each of the child accounts next */
+  for (node = ppriv->children; node; node = node->next)
+  {
+    child = node->data;
+    result = gnc_account_lookup_by_code (child, code);
+    if (result)
+      return result;
+  }
+
+  return NULL;
+}
+
 /********************************************************************\
  * Fetch an account, given its full name                            *
 \********************************************************************/

Modified: gnucash/branches/gda-dev2/src/engine/Account.h
===================================================================
--- gnucash/branches/gda-dev2/src/engine/Account.h	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/engine/Account.h	2008-07-30 01:08:07 UTC (rev 17438)
@@ -878,7 +878,7 @@
 
 /** @} */
 
-/** @name Getting Accounts and Subaccounts by Name
+/** @name Lookup Accounts and Subaccounts by name or code
  @{
 */
 /** The gnc_account_lookup_by_name() subroutine fetches the account by
@@ -899,6 +899,12 @@
 Account *gnc_account_lookup_by_full_name (const Account *any_account,
 					  const gchar *name);
 
+/** The gnc_account_lookup_full_name() subroutine works like
+ *  gnc_account_lookup_by_name, but uses the account code.
+ */
+Account *gnc_account_lookup_by_code (const Account *parent,
+                                     const char *code);
+
 /** @} */
 
 /* ------------------ */

Copied: gnucash/branches/gda-dev2/src/engine/engine-common.i (from rev 17437, gnucash/trunk/src/engine/engine-common.i)
===================================================================
--- gnucash/branches/gda-dev2/src/engine/engine-common.i	                        (rev 0)
+++ gnucash/branches/gda-dev2/src/engine/engine-common.i	2008-07-30 01:08:07 UTC (rev 17438)
@@ -0,0 +1,31 @@
+%inline %{
+static const GUID * gncSplitGetGUID(Split *x)
+{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
+static const GUID * gncTransGetGUID(Transaction *x)
+{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
+static const GUID * gncAccountGetGUID(Account *x)
+{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
+%}
+
+%typemap(newfree) AccountList * "g_list_free($1);"
+%typemap(newfree) SplitList * "g_list_free($1);"
+%typemap(newfree) TransList * "g_list_free($1);"
+%typemap(newfree) PriceList * "g_list_free($1);"
+%typemap(newfree) LotList * "g_list_free($1);"
+%typemap(newfree) CommodityList * "g_list_free($1);"
+
+%include <Split.h>
+
+AccountList * gnc_account_get_children (const Account *account);
+AccountList * gnc_account_get_children_sorted (const Account *account);
+AccountList * gnc_account_get_descendants (const Account *account);
+AccountList * gnc_account_get_descendants_sorted (const Account *account);
+%ignore gnc_account_get_children;
+%ignore gnc_account_get_children_sorted;
+%ignore gnc_account_get_descendants;
+%ignore gnc_account_get_descendants_sorted;
+%include <Account.h>
+
+%include <Transaction.h>
+
+%include <gnc-lot.h>

Modified: gnucash/branches/gda-dev2/src/engine/engine.i
===================================================================
--- gnucash/branches/gda-dev2/src/engine/engine.i	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/engine/engine.i	2008-07-30 01:08:07 UTC (rev 17438)
@@ -23,7 +23,6 @@
 
 %import "base-typemaps.i"
 
-
 GLIST_HELPER_INOUT(SplitList, SWIGTYPE_p_Split);
 GLIST_HELPER_INOUT(TransList, SWIGTYPE_p_Transaction);
 GLIST_HELPER_INOUT(LotList, SWIGTYPE_p_GNCLot);
@@ -32,29 +31,17 @@
 // TODO: free PriceList?
 GLIST_HELPER_INOUT(CommodityList, SWIGTYPE_p_gnc_commodity);
 
+%typemap(newfree) gchar * "g_free($1);"
 
+%include "engine-common.i"
+
 %inline %{
-static const GUID * gncSplitGetGUID(Split *x)
-{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
-static const GUID * gncTransGetGUID(Transaction *x)
-{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
-static const GUID * gncAccountGetGUID(Account *x)
-{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
 static const GUID * gncPriceGetGUID(GNCPrice *x)
 { return qof_instance_get_guid(QOF_INSTANCE(x)); }
 static const GUID * gncBudgetGetGUID(GncBudget *x)
 { return qof_instance_get_guid(QOF_INSTANCE(x)); }
 %}
 
-%typemap(newfree) AccountList * "g_list_free($1);"
-%typemap(newfree) SplitList * "g_list_free($1);"
-%typemap(newfree) TransList * "g_list_free($1);"
-%typemap(newfree) PriceList * "g_list_free($1);"
-%typemap(newfree) LotList * "g_list_free($1);"
-%typemap(newfree) CommodityList * "g_list_free($1);"
-
-%typemap(newfree) gchar * "g_free($1);"
-
 /* NB: The object ownership annotations should already cover all the
 functions currently used in guile, but not all the functions that are
 wrapped.  So, we should contract the interface to wrap only the used
@@ -83,18 +70,7 @@
   static QofIdType QOF_ID_BOOK_SCM (void) { return QOF_ID_BOOK; }
 }
 
-%include <Split.h>
 %include <engine-helpers.h>
-AccountList * gnc_account_get_children (const Account *account);
-AccountList * gnc_account_get_children_sorted (const Account *account);
-AccountList * gnc_account_get_descendants (const Account *account);
-AccountList * gnc_account_get_descendants_sorted (const Account *account);
-%ignore gnc_account_get_children;
-%ignore gnc_account_get_children_sorted;
-%ignore gnc_account_get_descendants;
-%ignore gnc_account_get_descendants_sorted;
-%include <Account.h>
-%include <Transaction.h>
 %include <gnc-pricedb.h>
 
 QofSession * qof_session_new (void);
@@ -106,6 +82,7 @@
 // TODO: Unroll/remove
 const char *qof_session_get_url (QofSession *session);
 
+extern const char *gnc_default_strftime_date_format;
 const char *gnc_print_date (Timespec ts);
 
 GUID guid_new_return(void);
@@ -192,7 +169,6 @@
 %ignore gnc_quote_source_set_fq_installed;
 %include <gnc-commodity.h>
 
-%include <gnc-lot.h>
 %include <gnc-session-scm.h>
 void gnc_hook_add_scm_dangler (const gchar *name, SCM proc);
 void gnc_hook_run (const gchar *name, gpointer data);

Modified: gnucash/branches/gda-dev2/src/engine/gnc-pricedb.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/gnc-pricedb.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/engine/gnc-pricedb.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1883,8 +1883,8 @@
           (!gnc_numeric_zero_p(currency_price_value)));
 
   balance = gnc_numeric_mul (balance, currency_price_value,
-                             gnc_commodity_get_fraction (new_currency),
-                             GNC_HOW_RND_ROUND);
+                             GNC_DENOM_AUTO,
+                             GNC_HOW_DENOM_EXACT | GNC_HOW_RND_NEVER);
   balance = gnc_numeric_mul (balance, gnc_price_get_value (price),
                              gnc_commodity_get_fraction (new_currency),
                              GNC_HOW_RND_ROUND);

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-commodities.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-commodities.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-commodities.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -136,7 +136,7 @@
                             "at least one of your accounts. You may "
                             "not delete it.");
 
-    gnc_warning_dialog (cd->dialog, message);
+    gnc_warning_dialog (cd->dialog, "%s", message);
     g_list_free (accounts);
     return;
   }

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-fincalc.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-fincalc.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-fincalc.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -394,7 +394,7 @@
   {
     GtkWidget *entry;
 
-    gnc_error_dialog(fcd->dialog, string);
+    gnc_error_dialog(fcd->dialog, "%s", string);
     if (error_item == 0)
       entry = fcd->amounts[0];
     else

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-price-editor.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-price-editor.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-price-editor.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -229,7 +229,7 @@
   if (response == GTK_RESPONSE_OK) {
     error_str = gui_to_price (pedit_dialog);
     if (error_str) {
-      gnc_warning_dialog (pedit_dialog->dialog, error_str);
+      gnc_warning_dialog (pedit_dialog->dialog, "%s", error_str);
       return;
     }
 
@@ -367,7 +367,6 @@
   gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (w), TRUE);
   print_info = gnc_default_price_print_info ();
   gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (w), print_info);
-  gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (w), 1000000);
   gtk_entry_set_activates_default(GTK_ENTRY(w), TRUE);
   gtk_widget_show (w);
   label = glade_xml_get_widget (xml, "price_label");

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-print-check.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-print-check.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -550,7 +550,7 @@
                                         GTK_BUTTONS_CLOSE,
                                         _("Cannot save check format file."));
         gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                                                 error->message);
+                                                 "%s", error->message);
         gtk_dialog_run(GTK_DIALOG(dialog));
         gtk_widget_destroy(dialog);
         g_error_free(error);

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-progress.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-progress.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-progress.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -36,12 +36,24 @@
 {
   GtkWidget *dialog;
 
-  GtkWidget *heading_label;
+  GtkWidget *primary_label;
+  GtkWidget *secondary_label;
   GtkWidget *progress_bar;
+  GtkWidget *sub_label;
+  GtkWidget *log;
 
   GtkWidget *ok_button;
   GtkWidget *cancel_button;
 
+  /* The stack of virtual progress bars. */
+  GList     *bars;
+  /* The fraction of the current bar that is filled. */
+  gdouble    bar_value;
+  /* The value of the real (top-level) bar before the last push. */
+  gdouble    total_offset;
+  /* The product of all weights in the stack. */
+  gdouble    total_weight;
+
   GNCProgressCancelFunc cancel_func;
   gpointer user_data;
 
@@ -54,32 +66,47 @@
   gboolean title_set;
 };
 
+typedef struct
+{
+  gdouble offset;
+  gdouble weight;
+} VirtualBar;
 
 static void
-gnc_progress_maybe_destroy (GNCProgressDialog *progress)
+gnc_progress_maybe_destroy(GNCProgressDialog *progress)
 {
+  g_return_if_fail(progress);
+
   if (!(progress->closed && progress->destroyed))
     return;
 
-  gtk_widget_destroy(progress->dialog);
+  if (progress->dialog != NULL)
+    gtk_widget_destroy(progress->dialog);
 }
 
+
 static void
 ok_cb(GtkWidget * widget, gpointer data)
 {
-  GNCProgressDialog *progress = data; 
+  GNCProgressDialog *progress = data;
 
-  gtk_widget_hide(progress->dialog);
+  g_return_if_fail(progress);
+
+  if (progress->dialog != NULL)
+    gtk_widget_hide(progress->dialog);
   progress->closed = TRUE;
-  gnc_progress_maybe_destroy (progress);
+  gnc_progress_maybe_destroy(progress);
 }
 
+
 static void
 cancel_cb(GtkWidget * widget, gpointer data)
 {
-  GNCProgressDialog *progress = data; 
+  GNCProgressDialog *progress = data;
 
-  if (progress->cancel_func && !progress->cancel_func (progress->user_data))
+  g_return_if_fail(progress);
+
+  if (progress->cancel_func && !progress->cancel_func(progress->user_data))
     return;
 
   if (progress->cancel_scm_func != SCM_UNDEFINED)
@@ -88,35 +115,41 @@
 
     result = scm_call_0(progress->cancel_scm_func);
 
-    if (!SCM_NFALSEP (result))
+    if (!SCM_NFALSEP(result))
       return;
   }
 
-  gtk_widget_hide(progress->dialog);
+  if (progress->dialog != NULL)
+    gtk_widget_hide(progress->dialog);
   progress->closed = TRUE;
-  gnc_progress_maybe_destroy (progress);
+  gnc_progress_maybe_destroy(progress);
 }
 
+
 static gboolean
 delete_cb(GtkWidget *widget, GdkEvent  *event, gpointer data)
 {
-  GNCProgressDialog *progress = data; 
+  GNCProgressDialog *progress = data;
 
+  g_return_val_if_fail(progress, TRUE);
+
   if (progress->finished)
   {
-    gtk_widget_hide(progress->dialog);
+    if (progress->dialog != NULL)
+      gtk_widget_hide(progress->dialog);
     progress->closed = TRUE;
-    gnc_progress_maybe_destroy (progress);
+    gnc_progress_maybe_destroy(progress);
     return TRUE;
   }
 
   if (progress->cancel_func)
   {
-    if (progress->cancel_func (progress->user_data))
+    if (progress->cancel_func(progress->user_data))
     {
-      gtk_widget_hide(progress->dialog);
+      if (progress->dialog != NULL)
+        gtk_widget_hide(progress->dialog);
       progress->closed = TRUE;
-      gnc_progress_maybe_destroy (progress);
+      gnc_progress_maybe_destroy(progress);
       return TRUE;
     }
   }
@@ -127,11 +160,12 @@
 
     result = scm_call_0(progress->cancel_scm_func);
 
-    if (SCM_NFALSEP (result))
+    if (SCM_NFALSEP(result))
     {
-      gtk_widget_hide(progress->dialog);
+      if (progress->dialog != NULL)
+        gtk_widget_hide(progress->dialog);
       progress->closed = TRUE;
-      gnc_progress_maybe_destroy (progress);
+      gnc_progress_maybe_destroy(progress);
       return TRUE;
     }
   }
@@ -140,20 +174,24 @@
   return TRUE;
 }
 
+
 static void
 destroy_cb(GtkObject *object, gpointer data)
 {
   GNCProgressDialog *progress = data;
 
+  g_return_if_fail(progress);
+
   /* Make sure the callbacks aren't invoked */
   progress->cancel_func = NULL;
   if (progress->cancel_scm_func != SCM_UNDEFINED)
-    scm_gc_unprotect_object (progress->cancel_scm_func);
+    scm_gc_unprotect_object(progress->cancel_scm_func);
   progress->cancel_scm_func = SCM_UNDEFINED;
 
   g_free(progress);
 }
 
+
 static void
 gnc_progress_dialog_create(GtkWidget * parent, GNCProgressDialog *progress)
 {
@@ -161,38 +199,51 @@
   GtkObject *tdo;
   GladeXML  *xml;
 
-  xml = gnc_glade_xml_new ("progress.glade", "Progress Dialog");
+  g_return_if_fail(progress);
 
-  dialog = glade_xml_get_widget (xml, "Progress Dialog");
+  xml = gnc_glade_xml_new("progress.glade", "Progress Dialog");
+
+  dialog = glade_xml_get_widget(xml, "Progress Dialog");
   progress->dialog = dialog;
-  tdo = GTK_OBJECT (dialog);
+  tdo = GTK_OBJECT(dialog);
 
   /* parent */
   if (parent != NULL)
     gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
 
-  g_signal_connect (tdo, "delete_event",
-		    G_CALLBACK (delete_cb), progress);
+  g_signal_connect(tdo, "delete_event", G_CALLBACK(delete_cb), progress);
 
-  g_signal_connect (tdo, "destroy", G_CALLBACK (destroy_cb), progress);
+  g_signal_connect(tdo, "destroy", G_CALLBACK(destroy_cb), progress);
 
-  progress->heading_label = glade_xml_get_widget (xml, "heading_label");
-  gtk_widget_hide(progress->heading_label);
+  progress->primary_label = glade_xml_get_widget(xml, "primary_label");
+  gtk_widget_hide(progress->primary_label);
 
-  progress->progress_bar = glade_xml_get_widget (xml, "progress_bar");
+  progress->secondary_label = glade_xml_get_widget(xml, "secondary_label");
+  gtk_widget_hide(progress->secondary_label);
 
-  progress->ok_button = glade_xml_get_widget (xml, "ok_button");
+  progress->progress_bar = glade_xml_get_widget(xml, "progress_bar");
+  progress->total_offset = 0;
+  progress->total_weight = 1;
+  progress->bar_value = 0;
 
+  progress->sub_label = glade_xml_get_widget(xml, "sub_label");
+  gtk_widget_hide(progress->sub_label);
+
+  progress->log = glade_xml_get_widget(xml, "progress_log");
+  gtk_widget_hide(glade_xml_get_widget(xml, "progress_log_window"));
+
+  progress->ok_button = glade_xml_get_widget(xml, "ok_button");
+
   g_signal_connect(progress->ok_button, "clicked",
-		   G_CALLBACK(ok_cb), progress);
+                   G_CALLBACK(ok_cb), progress);
 
   if (!progress->use_ok_button)
-    gtk_widget_hide (progress->ok_button);
+    gtk_widget_hide(progress->ok_button);
 
-  progress->cancel_button = glade_xml_get_widget (xml, "cancel_button");
+  progress->cancel_button = glade_xml_get_widget(xml, "cancel_button");
 
   g_signal_connect(progress->cancel_button, "clicked",
-		   G_CALLBACK(cancel_cb), progress);
+                   G_CALLBACK(cancel_cb), progress);
 
   progress->cancel_func = NULL;
   progress->user_data = NULL;
@@ -205,8 +256,9 @@
   progress->title_set = FALSE;
 }
 
+
 GNCProgressDialog *
-gnc_progress_dialog_new (GtkWidget * parent, gboolean use_ok_button)
+gnc_progress_dialog_new(GtkWidget * parent, gboolean use_ok_button)
 {
   GNCProgressDialog *progress;
 
@@ -218,147 +270,527 @@
 
   gtk_widget_show(progress->dialog);
 
-  gnc_progress_dialog_update (progress);
+  gnc_progress_dialog_update(progress);
 
   return progress;
 }
 
+
+GNCProgressDialog *
+gnc_progress_dialog_custom(GtkLabel       *primary,
+                           GtkLabel       *secondary,
+                           GtkProgressBar *bar,
+                           GtkLabel       *suboperation,
+                           GtkTextView    *log)
+{
+  GNCProgressDialog *progress;
+
+  progress = g_new0(GNCProgressDialog, 1);
+
+  /* Set up widgets. */
+  progress->dialog = NULL;
+  progress->primary_label = GTK_WIDGET(primary);
+  progress->secondary_label = GTK_WIDGET(secondary);
+  progress->progress_bar = GTK_WIDGET(bar);
+  progress->sub_label = GTK_WIDGET(suboperation);
+  progress->log = GTK_WIDGET(log);
+  progress->ok_button = NULL;
+  progress->cancel_button = NULL;
+
+  /* Initialize all other items. */
+  progress->total_offset = 0;
+  progress->total_weight = 1;
+  progress->bar_value = 0;
+  progress->cancel_func = NULL;
+  progress->user_data = NULL;
+  progress->cancel_scm_func = SCM_UNDEFINED;
+  progress->use_ok_button = FALSE;
+  progress->closed = FALSE;
+  progress->finished = FALSE;
+  progress->destroyed = FALSE;
+  progress->title_set = FALSE;
+
+  return progress;
+}
+
+
 void
-gnc_progress_dialog_set_title (GNCProgressDialog *progress, const char *title)
+gnc_progress_dialog_set_title(GNCProgressDialog *progress, const char *title)
 {
-  if (progress == NULL)
+  g_return_if_fail(progress);
+
+  if (!progress->dialog)
     return;
 
   if (title == NULL)
     title = "";
 
-  gtk_window_set_title (GTK_WINDOW (progress->dialog), title);
+  gtk_window_set_title(GTK_WINDOW(progress->dialog), title);
 
   progress->title_set = TRUE;
 
-  gnc_progress_dialog_update (progress);
+  gnc_progress_dialog_update(progress);
 }
 
+
 void
-gnc_progress_dialog_set_heading (GNCProgressDialog *progress,
+gnc_progress_dialog_set_primary(GNCProgressDialog *progress,
+                                const gchar *str)
+{
+  g_return_if_fail(progress);
+
+  if (progress->primary_label == NULL)
+    return;
+
+  if (str == NULL || *str == '\0')
+    gtk_widget_hide(progress->primary_label);
+  else
+  {
+    /* Display the primary text with the HIG-recommended style. */
+    char *markup = g_markup_printf_escaped("<span weight=\"bold\" size=\"larger\">%s</span>", str);
+
+    gtk_label_set_markup(GTK_LABEL(progress->primary_label), markup);
+    g_free(markup);
+    gtk_widget_show(progress->primary_label);
+  }
+
+  gnc_progress_dialog_update(progress);
+}
+
+
+void
+gnc_progress_dialog_set_heading(GNCProgressDialog *progress,
                                  const char *heading)
 {
-  if (progress == NULL)
+  g_return_if_fail(progress);
+
+  if (progress->primary_label == NULL)
     return;
 
   if (heading == NULL || *heading == '\0')
-    gtk_widget_hide (progress->heading_label);
+    gtk_widget_hide(progress->primary_label);
   else
   {
-    gtk_label_set_text (GTK_LABEL (progress->heading_label), heading);
-    gtk_widget_show (progress->heading_label);
+    gtk_label_set_text(GTK_LABEL(progress->primary_label), heading);
+    gtk_widget_show(progress->primary_label);
   }
 
-  gnc_progress_dialog_update (progress);
+  gnc_progress_dialog_update(progress);
 }
 
+
 void
-gnc_progress_dialog_set_cancel_func (GNCProgressDialog *progress,
-                                     GNCProgressCancelFunc cancel_func,
-                                     gpointer user_data)
+gnc_progress_dialog_set_secondary(GNCProgressDialog *progress,
+                                  const gchar *str)
 {
-  if (progress == NULL)
+  g_return_if_fail(progress);
+
+  if (progress->secondary_label == NULL)
     return;
 
+  if (str == NULL || *str == '\0')
+    gtk_widget_hide(progress->secondary_label);
+  else
+  {
+    gtk_label_set_text(GTK_LABEL(progress->secondary_label), str);
+    gtk_widget_show(progress->secondary_label);
+  }
+
+  gnc_progress_dialog_update(progress);
+}
+
+
+void
+gnc_progress_dialog_set_sub(GNCProgressDialog *progress,
+                            const gchar *str)
+{
+  g_return_if_fail(progress);
+
+  if (progress->sub_label == NULL)
+    return;
+
+  if (str == NULL || *str == '\0')
+    gtk_widget_hide(progress->sub_label);
+  else
+  {
+    /* Display the suboperation text with the HIG-recommended style. */
+    char *markup = g_markup_printf_escaped("<span style=\"italic\">%s</span>", str);
+
+    gtk_label_set_markup(GTK_LABEL(progress->sub_label), markup);
+    g_free(markup);
+    gtk_widget_show(progress->sub_label);
+  }
+
+  gnc_progress_dialog_update(progress);
+}
+
+
+void
+gnc_progress_dialog_reset_log(GNCProgressDialog *progress)
+{
+  GtkTextBuffer *buf;
+
+  g_return_if_fail(progress);
+
+  if (progress->log == NULL)
+    return;
+
+  /* Reset the text buffer. */
+  buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(progress->log));
+  gtk_text_buffer_set_text(buf, "", -1);
+  gtk_text_buffer_set_modified(buf, FALSE);
+
+  /* Show the log and its parent (in case it is in a scrolled window). */
+  gtk_widget_show(progress->log);
+  gtk_widget_show(gtk_widget_get_parent(progress->log));
+
+  gnc_progress_dialog_update(progress);
+}
+
+
+void
+gnc_progress_dialog_append_log(GNCProgressDialog *progress, const gchar *str)
+{
+  GtkTextBuffer *buf;
+  GtkTextIter    iter;
+
+  g_return_if_fail(progress);
+
+  if (progress->log == NULL || !str || !*str)
+    return;
+
+  /* Append to the text buffer. */
+  buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(progress->log));
+  gtk_text_buffer_get_end_iter(buf, &iter);
+  gtk_text_buffer_insert(buf, &iter, str, -1);
+
+  gnc_progress_dialog_update(progress);
+}
+
+
+void
+gnc_progress_dialog_pause(GNCProgressDialog *progress)
+{
+  gchar *suffix;
+
+  g_return_if_fail(progress);
+
+  suffix = g_strconcat(" ", _("(paused)"), NULL);
+
+  if (progress->sub_label && GTK_WIDGET_VISIBLE(progress->sub_label))
+  {
+    const gchar *txt = gtk_label_get_text(GTK_LABEL(progress->sub_label));
+
+    if (txt && !g_str_has_suffix(txt, suffix))
+    {
+      gchar *newtxt = g_strconcat(txt, suffix, NULL);
+      gnc_progress_dialog_set_sub(progress, newtxt);
+      g_free(newtxt);
+    }
+  }
+  else if (progress->dialog)
+  {
+    const gchar *txt = gtk_window_get_title(GTK_WINDOW(progress->dialog));
+
+    if (txt && !g_str_has_suffix(txt, suffix))
+    {
+      gchar *newtxt = g_strconcat(txt, suffix, NULL);
+      gtk_window_set_title(GTK_WINDOW(progress->dialog), newtxt);
+      g_free(newtxt);
+    }
+  }
+  else if (progress->primary_label &&
+           GTK_WIDGET_VISIBLE(progress->primary_label))
+  {
+    const gchar *txt = gtk_label_get_text(GTK_LABEL(progress->primary_label));
+
+    if (txt && !g_str_has_suffix(txt, suffix))
+    {
+      gchar *newtxt = g_strconcat(txt, suffix, NULL);
+      gnc_progress_dialog_set_primary(progress, newtxt);
+      g_free(newtxt);
+    }
+  }
+
+  g_free(suffix);
+
+  gnc_progress_dialog_update(progress);
+}
+
+void
+gnc_progress_dialog_resume(GNCProgressDialog *progress)
+{
+  gchar *suffix;
+
+  g_return_if_fail(progress);
+
+  suffix = g_strconcat(" ", _("(paused)"), NULL);
+
+  /* Remove any pause indication from the suboperation label. */
+  if (progress->sub_label)
+  {
+    const gchar *txt = gtk_label_get_text(GTK_LABEL(progress->sub_label));
+
+    if (txt && g_str_has_suffix(txt, suffix))
+    {
+      gchar *newtxt = g_strndup(txt, strlen(txt) - strlen(suffix));
+      gnc_progress_dialog_set_sub(progress, newtxt);
+      g_free(newtxt);
+    }
+  }
+
+  /* Remove any pause indication from the window title. */
+  if (progress->dialog)
+  {
+    const gchar *txt = gtk_window_get_title(GTK_WINDOW(progress->dialog));
+
+    if (txt && g_str_has_suffix(txt, suffix))
+    {
+      gchar *newtxt = g_strndup(txt, strlen(txt) - strlen(suffix));
+      gtk_window_set_title(GTK_WINDOW(progress->dialog), newtxt);
+      g_free(newtxt);
+    }
+  }
+
+  /* Remove any pause indication from the primary text. */
+  if (progress->primary_label)
+  {
+    const gchar *txt = gtk_label_get_text(GTK_LABEL(progress->primary_label));
+
+    if (txt && g_str_has_suffix(txt, suffix))
+    {
+      gchar *newtxt = g_strndup(txt, strlen(txt) - strlen(suffix));
+      gnc_progress_dialog_set_primary(progress, newtxt);
+      g_free(newtxt);
+    }
+  }
+
+  g_free(suffix);
+
+  gnc_progress_dialog_update(progress);
+}
+
+
+void
+gnc_progress_dialog_set_cancel_func(GNCProgressDialog *progress,
+                                    GNCProgressCancelFunc cancel_func,
+                                    gpointer user_data)
+{
+  g_return_if_fail(progress);
+
+  if (progress->cancel_button == NULL)
+    return;
+
   progress->cancel_func = cancel_func;
   progress->user_data = user_data;
 
   if (cancel_func)
-    gtk_widget_show (progress->cancel_button);
+    gtk_widget_show(progress->cancel_button);
 }
 
+
 void
-gnc_progress_dialog_set_cancel_scm_func (GNCProgressDialog *progress,
-                                         SCM cancel_scm_func)
+gnc_progress_dialog_set_cancel_scm_func(GNCProgressDialog *progress,
+                                        SCM cancel_scm_func)
 {
-  if (progress == NULL)
+  g_return_if_fail(progress);
+
+  if (progress->cancel_button == NULL)
     return;
 
   if (progress->cancel_scm_func != SCM_UNDEFINED)
-    scm_gc_unprotect_object (progress->cancel_scm_func);
+    scm_gc_unprotect_object(progress->cancel_scm_func);
 
   if (SCM_PROCEDUREP(cancel_scm_func))
   {
     progress->cancel_scm_func = cancel_scm_func;
-    scm_gc_protect_object (cancel_scm_func);
-    gtk_widget_show (progress->cancel_button);
+    scm_gc_protect_object(cancel_scm_func);
+    gtk_widget_show(progress->cancel_button);
   }
   else
     progress->cancel_scm_func = SCM_UNDEFINED;
 }
 
+
 void
-gnc_progress_dialog_set_value (GNCProgressDialog *progress, gdouble value)
+gnc_progress_dialog_set_value(GNCProgressDialog *progress, gdouble value)
 {
-  if (progress == NULL)
+  GtkProgressBar *bar;
+
+  g_return_if_fail(progress);
+
+  /* Get the progress bar widget. */
+  bar = GTK_PROGRESS_BAR(progress->progress_bar);
+  if (bar == NULL)
     return;
 
-  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress->progress_bar), value);
+  /* Update the progress bar. If value is over 1,
+   * the bar will pulse instead of fill. */
+  if (value > 1)
+      gtk_progress_bar_pulse(bar);
+  else
+  {
+    progress->bar_value = value > 0 ? value : 0;
+    gtk_progress_bar_set_fraction(bar,
+      progress->total_offset + progress->bar_value * progress->total_weight);
+  }
 
-  gnc_progress_dialog_update (progress);
+  gnc_progress_dialog_update(progress);
 }
 
+
+guint
+gnc_progress_dialog_push(GNCProgressDialog *progress, gdouble weight)
+{
+  GtkProgressBar *bar;
+  VirtualBar     *newbar;
+
+  g_return_val_if_fail(progress, 0);
+  g_return_val_if_fail(weight > 0, 0);
+
+  /* Get the progress bar widget. */
+  bar = GTK_PROGRESS_BAR(progress->progress_bar);
+  if (bar == NULL)
+    return 0;
+
+  /* Create the new virtual progress bar. */
+  newbar = g_new0(VirtualBar, 1);
+  newbar->offset = progress->bar_value;
+  if (newbar->offset + weight > 1)
+    /* The requested weight is more than the unfilled portion of the bar. */
+    newbar->weight = 1 - newbar->offset;
+  else
+    newbar->weight = weight;
+  progress->bars = g_list_prepend(progress->bars, newbar);
+
+  /* Set the total effective offset and weight */
+  progress->total_offset = gtk_progress_bar_get_fraction(bar);
+  progress->total_weight *= newbar->weight;
+
+  /* Set the new bar as unfilled. */
+  progress->bar_value = 0;
+
+  return g_list_length(progress->bars);
+}
+
+
+guint
+gnc_progress_dialog_pop(GNCProgressDialog *progress)
+{
+  VirtualBar     *bar;
+
+  g_return_val_if_fail(progress, 0);
+
+  /* Get the progress bar widget. */
+  if (progress->progress_bar == NULL || progress->bars == NULL)
+    return 0;
+
+  /* Pop the bar off the bar stack. */
+  bar = progress->bars->data;
+  progress->bars = g_list_delete_link(progress->bars, progress->bars);
+
+  /* Determine the value of the current bar. */
+  progress->bar_value = bar->offset + bar->weight * progress->bar_value;
+
+  /* Set the total effective offset and weight. */
+  if (progress->bars == NULL)
+  {
+    progress->total_offset = 0;
+    progress->total_weight = 1;
+  }
+  else
+  {
+    progress->total_offset -= bar->offset *
+                              ((VirtualBar *) progress->bars->data)->weight;
+    progress->total_weight /= bar->weight;
+  }
+  g_free(bar);
+
+  if (progress->bars == NULL)
+    return 0;
+  return g_list_length(progress->bars);
+}
+
+
+guint
+gnc_progress_dialog_pop_full(GNCProgressDialog *progress)
+{
+  gnc_progress_dialog_set_value(progress, 1);
+  return gnc_progress_dialog_pop(progress);
+}
+
+
 void
-gnc_progress_dialog_update (GNCProgressDialog *progress)
+gnc_progress_dialog_reset_value(GNCProgressDialog *progress)
 {
+  g_return_if_fail(progress);
+
+  /* Return to the top level. */
+  while (gnc_progress_dialog_pop(progress));
+
+  /* Reset the bar to empty. */
+  gnc_progress_dialog_set_value(progress, 0);
+}
+
+
+void
+gnc_progress_dialog_update(GNCProgressDialog *progress)
+{
   while (gtk_events_pending())
     gtk_main_iteration();
 }
 
+
 void
-gnc_progress_dialog_finish (GNCProgressDialog *progress)
+gnc_progress_dialog_finish(GNCProgressDialog *progress)
 {
-  if (progress == NULL)
-    return;
+  g_return_if_fail(progress);
 
   if (!progress->use_ok_button)
   {
-    gtk_widget_hide (progress->dialog);
+    if (progress->dialog != NULL)
+      gtk_widget_hide(progress->dialog);
     progress->closed = TRUE;
   }
 
-  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress->progress_bar), 1.0);
+  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress->progress_bar), 1.0);
 
-  gtk_widget_set_sensitive (progress->ok_button, TRUE);
-  gtk_widget_set_sensitive (progress->cancel_button, FALSE);
+  gtk_widget_set_sensitive(progress->ok_button, TRUE);
+  gtk_widget_set_sensitive(progress->cancel_button, FALSE);
 
-  if (GTK_WIDGET_VISIBLE(progress->heading_label))
-    gnc_progress_dialog_set_heading (progress, _("Complete"));
+  if (GTK_WIDGET_VISIBLE(progress->primary_label))
+    gnc_progress_dialog_set_heading(progress, _("Complete"));
 
   if (!progress->title_set)
-    gtk_window_set_title (GTK_WINDOW (progress->dialog), _("Complete"));
+    gtk_window_set_title(GTK_WINDOW(progress->dialog), _("Complete"));
 
-  gtk_window_set_modal (GTK_WINDOW (progress->dialog), FALSE);
+  gtk_window_set_modal(GTK_WINDOW(progress->dialog), FALSE);
 
   progress->finished = TRUE;
 
-  gnc_progress_dialog_update (progress);
+  gnc_progress_dialog_update(progress);
 }
 
+
 void
-gnc_progress_dialog_destroy (GNCProgressDialog *progress)
+gnc_progress_dialog_destroy(GNCProgressDialog *progress)
 {
-  if (progress == NULL)
-    return;
+  g_return_if_fail(progress);
 
   /* Make sure the callbacks aren't invoked */
   progress->cancel_func = NULL;
   if (progress->cancel_scm_func != SCM_UNDEFINED)
-    scm_gc_unprotect_object (progress->cancel_scm_func);
+    scm_gc_unprotect_object(progress->cancel_scm_func);
   progress->cancel_scm_func = SCM_UNDEFINED;
 
   if (!progress->finished)
   {
-    gtk_widget_hide (progress->dialog);
+    if (progress->dialog != NULL)
+      gtk_widget_hide(progress->dialog);
     progress->closed = TRUE;
   }
 
   progress->destroyed = TRUE;
 
-  gnc_progress_maybe_destroy (progress);
+  gnc_progress_maybe_destroy(progress);
 }

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-progress.h
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-progress.h	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-progress.h	2008-07-30 01:08:07 UTC (rev 17438)
@@ -21,6 +21,30 @@
  *                                                                  *
 \********************************************************************/
 
+/** @addtogroup Dialogs
+    @{ */
+/** @addtogroup ProgDialog Progress Dialog
+    @{ */
+/** @file dialog-progress.h
+    @brief Dialog for displaying progress of long-running operations.
+    @author Copyright (C) 2000 Dave Peticolas
+    @author Copyright (C) 2008 Charles Day
+
+    These functions constitute an API for streamlining the creation
+    and management of progress dialogs. Once registered with the API,
+    the dialog's display and behavior can be controlled via simple API
+    calls that prevent the caller from needing to know anything about
+    the underlying GUI.
+
+    A pop-up progress dialog can be created, displayed, and registered
+    with the API by calling gnc_progress_dialog_new().  Alternatively,
+    existing widgets can be registered with the API by calling
+    gnc_progress_dialog_custom(). This method allows custom-made dialogs
+    to hand off the management of typical progress-related widgets, and
+    allows long-running operations report progress in a standard way.
+*/
+
+
 #ifndef DIALOG_PROGRESS_H
 #define DIALOG_PROGRESS_H
 
@@ -32,51 +56,230 @@
 typedef gboolean (*GNCProgressCancelFunc) (gpointer user_data);
 
 
-/* Create and return a dialog for displaying the progress of
- * an activity. Useful for long-running operations. */
-GNCProgressDialog * gnc_progress_dialog_new (GtkWidget *parent,
-                                             gboolean use_ok_button);
+/** Displays a pop-up dialog for showing the progress of a
+ *  long-running activity.
+ *
+ *  By default only a title and progress bar are shown, but
+ *  additional visual elements such as a Cancel button, text
+ *  log, and additional labels can be activated by following
+ *  with calls to some of the other API functions.
+ *  
+ *  @param parent The parent window for which the progress dialog
+ *  becomes modal.
+ *  
+ *  @param use_ok_button If @c TRUE, an OK button is shown and must be
+ *  clicked when progress is completed.
+ *
+ *  @return A ::GNCProgressDialog that identifies the dialog and
+ *  is needed when making subsequent API calls. */
+GNCProgressDialog * gnc_progress_dialog_new(GtkWidget *parent,
+                                            gboolean use_ok_button);
 
-/* Set the title of the progress dialog. */
-void gnc_progress_dialog_set_title (GNCProgressDialog *progress,
-                                    const char *title);
+/** Creates a dialog for displaying the progress of an activity using
+ *  existing widgets. This allows long-running operations to update the
+ *  progress in a custom dialog instead of a new pop-up.
+ *
+ *  @param primary a @c GtkLabel widget to use for primary text
+ *
+ *  @param secondary a @c GtkLabel widget to use for secondary text
+ *
+ *  @param bar a @c GtkProgressBar widget for filling or pulsing
+ *
+ *  @param suboperation a @c GtkLabel widget to use for suboperation text
+ *
+ *  @param log a @c GtkTextView widget for logging progress textually
+ *
+ *  Any of the parameters may be passed as @c NULL if management of
+ *  that visual element is not desired.
+ *
+ *  @return A ::GNCProgressDialog that identifies the dialog and
+ *  is needed when making subsequent API calls. */
+GNCProgressDialog * gnc_progress_dialog_custom(GtkLabel       *primary,
+                                               GtkLabel       *secondary,
+                                               GtkProgressBar *bar,
+                                               GtkLabel       *suboperation,
+                                               GtkTextView    *log);
 
-/* Set the heading (the text above the progress meter) of
- * the progress dialog. If it is NULL or blank, the heading
- * is hidden (this is the default state). */
-void gnc_progress_dialog_set_heading (GNCProgressDialog *progress,
-                                      const char *heading);
+/** Set the title of a pop-up progress dialog. This function has no effect
+ *  on dialogs registered using gnc_progress_dialog_custom().
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param title the window title to display */
+void gnc_progress_dialog_set_title(GNCProgressDialog *progress,
+                                   const char *title);
 
-/* Set the C function which will be called if the user hits the
- * 'cancel' button. The cancel function returns a boolean value.
- * If the value is TRUE, the window is hidden. */
-void gnc_progress_dialog_set_cancel_func (GNCProgressDialog *progress,
-                                          GNCProgressCancelFunc cancel_func,
-                                          gpointer user_data);
+/** Set the primary text of the progress dialog. The text will
+ *  be displayed using the HIG-recommended style. If @a str is @c NULL
+ *  or blank, the label is hidden (this is the default state).
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param str the text to be displayed */
+void gnc_progress_dialog_set_primary(GNCProgressDialog *progress,
+                                     const gchar *str);
 
-/* Set a guile function which will be called if the user hits cancel.
- * Will be called after the C function, if any. The function should
- * return #t if the dialog should be hidden. If there is no C or guile
- * cancel callback (the default state), the cancel button is inactive. */
-void gnc_progress_dialog_set_cancel_scm_func (GNCProgressDialog *progress,
-                                              SCM cancel_scm_func);
+/** Set the primary text of the progress dialog. If @a str is @c NULL
+ *  or blank, the label is hidden (this is the default state).
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param str the text to be displayed
+ *
+ * NOTE: For HIG-compliant dialogs, use gnc_progress_dialog_set_primary()
+ * instead. */
+void gnc_progress_dialog_set_heading(GNCProgressDialog *progress,
+                                     const char *heading);
 
-/* Set the value of the progress dialog. */
-void gnc_progress_dialog_set_value (GNCProgressDialog *progress, gdouble value);
+/** Set the secondary text of the progress dialog. The text will
+ *  be displayed using the HIG-recommended style. If @a str is @c NULL
+ *  or blank, the label is hidden (this is the default state).
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param str the text to be displayed */
+void gnc_progress_dialog_set_secondary(GNCProgressDialog *progress,
+                                       const gchar *str);
 
-/* Update the GUI of the progress dialog, and call any pending cancel
- * callbacks. This function will be called automatically by the other
- * functions, including gnc_progress_dialog_set_value. */
-void gnc_progress_dialog_update (GNCProgressDialog *progress);
+/** Set the suboperation text of the progress dialog. The text will
+ *  be displayed using the HIG-recommended style. If @a str is @c NULL
+ *  or blank, the label is hidden (this is the default state).
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param str the text to be displayed */
+void gnc_progress_dialog_set_sub(GNCProgressDialog *progress,
+                                 const gchar *str);
 
-/* Set the progress meter to fully complete, change the heading, if
- * any, to "Complete", enable the 'OK' button, and make the dialog
- * non-modal. */
-void gnc_progress_dialog_finish (GNCProgressDialog *progress);
+/** Show the progress log and delete any existing text. If the dialog was
+ *  created via gnc_progress_dialog_new(), the log is not shown by default.
+ *  Calling this function will make it appear.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_reset_log(GNCProgressDialog *progress);
 
-/* Destroy the dialog. If gnc_progress_dialog_finish has been called,
- * the dialog will not be destroyed until the user dismisses the window.
- * This function must be called in order to reclaim the dialog's memory. */
-void gnc_progress_dialog_destroy (GNCProgressDialog *progress);
+/** Append @a str to the progress log.
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param str the text to be appended */
+void gnc_progress_dialog_append_log(GNCProgressDialog *progress,
+                                    const gchar *str);
 
+/** Show that progress has been paused by appending "(paused)" to the
+ *  suboperation text, the window title, or the primary text. The first
+ *  that is both known and currently shown will be the one used.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_pause(GNCProgressDialog *progress);
+
+/** Remove any indication that progress has paused by removing any existing
+ *  "(paused)" suffix from the suboperation text, the window title, and the
+ *  primary text.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_resume(GNCProgressDialog *progress);
+
+/** Show a Cancel button and set the C function which will be called when it
+ *  is pressed by the user. The cancel function must return a boolean value.
+ *  If the value is @c TRUE, the window is hidden.
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param cancel_func the callback function
+ *
+ *  @param user_data user data to be passed to @a cancel_func */
+void gnc_progress_dialog_set_cancel_func(GNCProgressDialog *progress,
+                                         GNCProgressCancelFunc cancel_func,
+                                         gpointer user_data);
+
+/** Show a Cancel button and set the Guile procedure that will be called
+ *  when it is pressed by the user. It will be called after any C function
+ *  registered with gnc_progress_dialog_set_cancel_func(). The procedure
+ *  must return @c #t if the dialog should be hidden. If there is no C or Guile
+ *  cancel callback (the default state), the Cancel button is hidden.
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param cancel_scm_func the Guile callback procedure */
+void gnc_progress_dialog_set_cancel_scm_func(GNCProgressDialog *progress,
+                                             SCM cancel_scm_func);
+
+/** Set the fraction of the progress bar to fill, where 0 is empty and
+ *  1 is full. If @a value is over 1, the bar will pulse instead of fill.
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param value the fraction of the bar to fill */
+void gnc_progress_dialog_set_value(GNCProgressDialog *progress, gdouble value);
+
+/** Create a new "virtual" progress bar that, as it becomes full, will fill
+ *  the current bar by the fraction specified by @a weight. All calls to 
+ *  gnc_progress_dialog_set_value() will operate on the new bar until
+ *  gnc_progress_dialog_pop() is called.
+ *
+ *  This can be used to split an operation into weighted sub-operations. For
+ *  example, if a particular suboperation should fill 30% of the bar, call
+ *  gnc_progress_dialog_push() with a @a weight of 0.3. Calls to
+ *  gnc_progress_dialog_set_value() will fill the virtual bar, which
+ *  in turn trickles up at the 0.3 rate.
+ *
+ *  Multiple calls to gnc_progress_dialog_push() can be used to create a
+ *  stack of virtual bars, each subordinate to the last. This allows a task
+ *  to be split into any number of levels of sub-tasks.
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @param weight the requested fraction of the current bar that the new bar
+ *  will represent (The fraction actually assigned will be the lesser of the
+ *  requested amount and the amount of the bar that is unfilled.) 
+ *
+ *  @return the number of times that gnc_progress_dialog_pop() would have to
+ *  be called to return to the top level. */
+guint gnc_progress_dialog_push(GNCProgressDialog *progress, gdouble weight);
+
+/** Moves up one level in the stack of virtual bars. See
+ *  gnc_progress_dialog_push() for an explanation of virtual bars.
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @return the number of times that gnc_progress_dialog_pop() would have to
+ *  be called again to return to the top level. */
+guint gnc_progress_dialog_pop(GNCProgressDialog *progress);
+
+/** Fills the current progress bar, then calls gnc_progress_dialog_pop().
+ *
+ *  @param progress a ::GNCProgressDialog
+ *
+ *  @return the value returned by gnc_progress_dialog_pop() */
+guint gnc_progress_dialog_pop_full(GNCProgressDialog *progress);
+
+/** Pop up to the top level and clear the progress bar.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_reset_value(GNCProgressDialog *progress);
+
+/** Update the GUI of the progress dialog, and call any pending cancel
+ *  callbacks. This function will be called automatically by the other
+ *  functions, including gnc_progress_dialog_set_value.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_update(GNCProgressDialog *progress);
+
+/** Set the progress meter to fully complete, change the heading, if
+ *  any, to "Complete", enable the 'OK' button, and make the dialog
+ *  non-modal.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_finish(GNCProgressDialog *progress);
+
+/** Destroy the dialog. If gnc_progress_dialog_finish has been called,
+ *  the dialog will not be destroyed until the user dismisses the window.
+ *  This function must be called in order to reclaim the dialog's memory.
+ *
+ *  @param progress a ::GNCProgressDialog */
+void gnc_progress_dialog_destroy(GNCProgressDialog *progress);
+
 #endif
+/** @} */
+/** @} */

Modified: gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -217,7 +217,7 @@
         const char *sx_changed_msg =
             _( "This SX has changed; are you "
                "sure you want to cancel?" );
-        if (!gnc_verify_dialog(sxed->dialog, FALSE, sx_changed_msg)) {
+        if (!gnc_verify_dialog(sxed->dialog, FALSE, "%s", sx_changed_msg)) {
             return FALSE;
         }
     }
@@ -635,7 +635,7 @@
                                          _( "Couldn't parse credit formula for "
                                             "split \"%s\"." ),
                                          xaccSplitGetMemo( s ) );
-                        gnc_error_dialog( GTK_WIDGET(sxed->dialog),
+                        gnc_error_dialog( GTK_WIDGET(sxed->dialog), "%s",
                                           errStr->str );
                         g_string_free( errStr, TRUE );
 
@@ -661,7 +661,7 @@
                                          _( "Couldn't parse debit formula for "
                                             "split \"%s\"." ),
                                          xaccSplitGetMemo( s ) );
-                        gnc_error_dialog( GTK_WIDGET(sxed->dialog),
+                        gnc_error_dialog( GTK_WIDGET(sxed->dialog), "%s",
                                           (gchar*)errStr->str );
                         g_string_free( errStr, TRUE );
 
@@ -712,7 +712,7 @@
         if ( strlen(name) == 0 ) {
             const char *sx_has_no_name_msg =
                 _( "Please name the Scheduled Transaction." );
-            gnc_error_dialog( sxed->dialog, sx_has_no_name_msg );
+            gnc_error_dialog( sxed->dialog, "%s", sx_has_no_name_msg );
             g_free( name );
             return FALSE;
                         
@@ -790,7 +790,7 @@
              && !gtk_toggle_button_get_active(sxed->optEndNone) ) {
             const char *sx_end_spec_msg =
                 _( "Please provide a valid end selection." );
-            gnc_error_dialog( sxed->dialog, sx_end_spec_msg );
+            gnc_error_dialog( sxed->dialog, "%s", sx_end_spec_msg );
             return FALSE;
         }
 
@@ -806,7 +806,7 @@
             if ( occur == 0 ) {
                 const char *sx_occur_count_zero_msg =
                     _( "There must be some number of occurrences." );
-                gnc_error_dialog( sxed->dialog,
+                gnc_error_dialog( sxed->dialog, "%s",
                                   sx_occur_count_zero_msg );
                 return FALSE;
             }
@@ -847,7 +847,8 @@
                 _("You have attempted to create a Scheduled "
                   "Transaction which will never run. Do you "
                   "really want to do this?");
-            if (!gnc_verify_dialog(sxed->dialog, FALSE, invalid_sx_check_msg))
+            if (!gnc_verify_dialog(sxed->dialog, FALSE,
+                                   "%s", invalid_sx_check_msg))
                 return FALSE;
         }
     }
@@ -1497,7 +1498,7 @@
         return;
     }
 
-    if (gnc_verify_dialog(sxed->dialog, TRUE, message)) {
+    if (gnc_verify_dialog(sxed->dialog, TRUE, "%s", message)) {
         Transaction *trans;
         trans = gnc_split_register_get_current_trans( reg );
         if ( !gnc_split_register_save( reg, TRUE ) )

Modified: gnucash/branches/gda-dev2/src/gnome/druid-acct-period.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/druid-acct-period.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/druid-acct-period.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -361,7 +361,7 @@
     const char *msg = _("You must select closing date that "
                         "is greater than the closing date "
                         "of the previous book.");
-    gnc_error_dialog (info->window, msg);
+    gnc_error_dialog (info->window, "%s", msg);
     return TRUE;
   }
 
@@ -371,7 +371,7 @@
   {
     const char *msg = _("You must select closing date "
                         "that is not in the future.");
-    gnc_error_dialog (info->window, msg);
+    gnc_error_dialog (info->window, "%s", msg);
     return TRUE;
   }
   return FALSE;

Modified: gnucash/branches/gda-dev2/src/gnome/druid-loan.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/druid-loan.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/druid-loan.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1043,7 +1043,7 @@
 {
         const char *cancelMsg = _( "Are you sure you want to cancel "
                                    "the Mortgage/Loan Setup Druid?" );
-        if ( gnc_verify_dialog( ldd->dialog, FALSE, cancelMsg ) ) {
+        if ( gnc_verify_dialog( ldd->dialog, FALSE, "%s", cancelMsg ) ) {
                 gnc_close_gui_component_by_data( DIALOG_LOAN_DRUID_CM_CLASS,
                                                  ldd );
         }

Modified: gnucash/branches/gda-dev2/src/gnome/druid-merge.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/druid-merge.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/druid-merge.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -170,7 +170,7 @@
 		message = g_strdup_printf(_("Error: Please resolve all %d "
 			"conflicts before trying to commit the data."), count);
 		top = gtk_widget_get_toplevel (GTK_WIDGET (gnomedruidpage));
-		gnc_error_dialog(top, message);
+		gnc_error_dialog(top, "%s", message);
 		g_free(message);
 		return TRUE;
 	}
@@ -224,7 +224,7 @@
 	if(result != 0) {
 		message = g_strdup_printf(_("Error: the Commit operation failed, error code %d."), result);
 		top = gtk_widget_get_toplevel (GTK_WIDGET (gnomedruidpage));
-		gnc_error_dialog(top, message);
+		gnc_error_dialog(top, "%s", message);
 	}
 	g_return_if_fail(result == 0);
 	delete_merge_window ();

Modified: gnucash/branches/gda-dev2/src/gnome/druid-stock-split.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/druid-stock-split.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/druid-stock-split.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -306,7 +306,7 @@
   if (gnc_numeric_zero_p (amount))
   {
     const char *message = _("You must enter a distribution amount.");
-    gnc_error_dialog (info->window, message);
+    gnc_error_dialog (info->window, "%s", message);
     return TRUE;
   }
 
@@ -323,7 +323,7 @@
   if (gnc_numeric_negative_p (amount))
   {
     const char *message = _("The price must be positive.");
-    gnc_error_dialog (info->window, message);
+    gnc_error_dialog (info->window, "%s", message);
     return TRUE;
   }
 
@@ -370,7 +370,7 @@
   if (gnc_numeric_negative_p (amount))
   {
     const char *message = _("The cash distribution must be positive.");
-    gnc_error_dialog (info->window, message);
+    gnc_error_dialog (info->window, "%s", message);
     return TRUE;
   }
 
@@ -383,7 +383,7 @@
     {
       const char *message = _("You must select an income account "
                               "for the cash distribution.");
-      gnc_error_dialog (info->window, message);
+      gnc_error_dialog (info->window, "%s", message);
       return TRUE;
     }
 
@@ -392,7 +392,7 @@
     {
       const char *message = _("You must select an asset account "
                               "for the cash distribution.");
-      gnc_error_dialog (info->window, message);
+      gnc_error_dialog (info->window, "%s", message);
       return TRUE;
     }
   }

Modified: gnucash/branches/gda-dev2/src/gnome/glade/progress.glade
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/glade/progress.glade	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/glade/progress.glade	2008-07-30 01:08:07 UTC (rev 17438)
@@ -25,18 +25,18 @@
       <property name="border_width">5</property>
       <property name="visible">True</property>
       <property name="homogeneous">False</property>
-      <property name="spacing">6</property>
+      <property name="spacing">12</property>
 
       <child>
-	<widget class="GtkLabel" id="heading_label">
+	<widget class="GtkLabel" id="primary_label">
 	  <property name="visible">True</property>
-	  <property name="label" translatable="yes">Heading</property>
+	  <property name="label" translatable="no">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Primary text&lt;/span&gt;</property>
 	  <property name="use_underline">False</property>
-	  <property name="use_markup">False</property>
-	  <property name="justify">GTK_JUSTIFY_CENTER</property>
-	  <property name="wrap">False</property>
+	  <property name="use_markup">True</property>
+	  <property name="justify">GTK_JUSTIFY_LEFT</property>
+	  <property name="wrap">True</property>
 	  <property name="selectable">False</property>
-	  <property name="xalign">0.5</property>
+	  <property name="xalign">0</property>
 	  <property name="yalign">0.5</property>
 	  <property name="xpad">0</property>
 	  <property name="ypad">0</property>
@@ -53,12 +53,22 @@
       </child>
 
       <child>
-	<widget class="GtkProgressBar" id="progress_bar">
+	<widget class="GtkLabel" id="secondary_label">
 	  <property name="visible">True</property>
-	  <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
-	  <property name="fraction">0</property>
-	  <property name="pulse_step">0.10000000149</property>
+	  <property name="label" translatable="no">Secondary text.</property>
+	  <property name="use_underline">False</property>
+	  <property name="use_markup">False</property>
+	  <property name="justify">GTK_JUSTIFY_LEFT</property>
+	  <property name="wrap">True</property>
+	  <property name="selectable">False</property>
+	  <property name="xalign">0</property>
+	  <property name="yalign">0.5</property>
+	  <property name="xpad">0</property>
+	  <property name="ypad">0</property>
 	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	  <property name="width_chars">-1</property>
+	  <property name="single_line_mode">False</property>
+	  <property name="angle">0</property>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
@@ -68,6 +78,90 @@
       </child>
 
       <child>
+	<widget class="GtkVBox" id="progress_vbox1">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkProgressBar" id="progress_bar">
+	      <property name="visible">True</property>
+	      <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
+	      <property name="fraction">0</property>
+	      <property name="pulse_step">0.10000000149</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="sub_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="no">Sub-operation text</property>
+	      <property name="label" translatable="no">&lt;span style=&quot;italic&quot;&gt;Sub-operation text&lt;/span&gt;</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">True</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">6</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+
+      <child>
+        <widget class="GtkScrolledWindow" id="progress_log_window">
+          <property name="visible">True</property>
+          <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+          <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+          <property name="shadow_type">GTK_SHADOW_IN</property>
+          <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+          <child>
+	    <widget class="GtkTextView" id="progress_log">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">False</property>
+	      <property name="overwrite">False</property>
+	      <property name="accepts_tab">False</property>
+	      <property name="justification">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap_mode">GTK_WRAP_WORD</property>
+	      <property name="cursor_visible">False</property>
+	      <property name="pixels_above_lines">0</property>
+	      <property name="pixels_below_lines">0</property>
+	      <property name="pixels_inside_wrap">0</property>
+	      <property name="left_margin">0</property>
+	      <property name="right_margin">0</property>
+	      <property name="indent">0</property>
+	      <property name="text" translatable="no">1234567890123456789012345678901234567890</property>
+	    </widget>
+          </child>
+        </widget>
+      </child>
+
+      <child>
 	<widget class="GtkHButtonBox" id="hbuttonbox3">
 	  <property name="visible">True</property>
 	  <property name="layout_style">GTK_BUTTONBOX_END</property>

Modified: gnucash/branches/gda-dev2/src/gnome/gnc-plugin-basic-commands.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/gnc-plugin-basic-commands.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/gnc-plugin-basic-commands.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -404,7 +404,7 @@
     PERR("%s", message);
     qof_session_destroy(qsf_session);
     qof_event_resume();
-    gnc_error_dialog(gnc_ui_get_toplevel(), message);
+    gnc_error_dialog(gnc_ui_get_toplevel(), "%s", message);
     LEAVE (" ");
     return;
   }
@@ -496,7 +496,7 @@
   {
     if (summary.num_auto_create_no_notify_instances == 0)
     {
-      gnc_info_dialog(GTK_WIDGET(&window->gtk_window), nothing_to_do_msg);
+      gnc_info_dialog(GTK_WIDGET(&window->gtk_window), "%s", nothing_to_do_msg);
     }
     else
     {

Modified: gnucash/branches/gda-dev2/src/gnome/gnc-split-reg.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/gnc-split-reg.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/gnc-split-reg.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1057,7 +1057,7 @@
 				    | GTK_DIALOG_DESTROY_WITH_PARENT,
 				    GTK_MESSAGE_QUESTION,
 				    GTK_BUTTONS_NONE,
-				    buf);
+				    "%s", buf);
     g_free(buf);
     recn = xaccSplitGetReconcile (split);
     if (recn == YREC || recn == FREC)

Modified: gnucash/branches/gda-dev2/src/gnome/schemas/apps_gnucash_general.schemas.in
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/schemas/apps_gnucash_general.schemas.in	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/schemas/apps_gnucash_general.schemas.in	2008-07-30 01:08:07 UTC (rev 17438)
@@ -452,6 +452,23 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnucash/general/register/show_leaf_account_names</key>
+      <applyto>/apps/gnucash/general/register/show_leaf_account_names</applyto>
+      <owner>gnucash</owner>
+      <type>bool</type>
+      <default>FALSE</default>
+      <locale name="C">
+        <short>Only display leaf account names.</short>
+        <long>
+          Show only the names of the leaf accounts in the register and in the
+          account selection popup. The default behaviour is to display the full
+          name, including the path in the account tree. Activating this option
+          implies that you use unique leaf names.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnucash/general/register/number_of_rows</key>
       <applyto>/apps/gnucash/general/register/number_of_rows</applyto>
       <owner>gnucash</owner>

Modified: gnucash/branches/gda-dev2/src/gnome/window-reconcile.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/window-reconcile.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome/window-reconcile.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1136,7 +1136,7 @@
                             "transaction?");
     gboolean result;
 
-    result = gnc_verify_dialog(recnData->window, FALSE, message);
+    result = gnc_verify_dialog(recnData->window, FALSE, "%s", message);
 
     if (!result)
       return;
@@ -1825,7 +1825,7 @@
   {
     const char *message = _("You have made changes to this reconcile "
                             "window. Are you sure you want to cancel?");
-    if (!gnc_verify_dialog(recnData->window, FALSE, message))
+    if (!gnc_verify_dialog(recnData->window, FALSE, "%s", message))
       return;
   }
 
@@ -1937,7 +1937,7 @@
   {
     const char *message = _("The account is not balanced. "
                             "Are you sure you want to finish?");
-    if (!gnc_verify_dialog (recnData->window, FALSE, message))
+    if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
       return;
   }
 
@@ -1994,7 +1994,7 @@
   {
     const char *message = _("Do you want to postpone this reconciliation "
                             "and finish it later?");
-    if (!gnc_verify_dialog (recnData->window, FALSE, message))
+    if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
       return;
   }
 

Modified: gnucash/branches/gda-dev2/src/gnome-search/dialog-search.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-search/dialog-search.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-search/dialog-search.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -153,7 +153,7 @@
 
   if (sw->selected_item == NULL && sw->allow_clear == FALSE) {
     char *msg = _("You must select an item from the list");
-    gnc_error_dialog (sw->dialog, msg);
+    gnc_error_dialog (sw->dialog, "%s", msg);
     return;
   }
 

Modified: gnucash/branches/gda-dev2/src/gnome-utils/account-quickfill.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/account-quickfill.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/account-quickfill.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -40,7 +40,7 @@
 #define NUM_ACCOUNT_COLUMNS 2
 
 /* ===================================================================== */
-/* In order to speed up register starts for registers htat have a huge
+/* In order to speed up register starts for registers that have a huge
  * number of accounts in them (where 'huge' is >500) we build a quickfill
  * cache of account names.  This cache is needed because some users on 
  * some machines experience register open times in the tens of seconds
@@ -67,6 +67,9 @@
   gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
 			      shared_quickfill_gconf_changed,
 			      qfb);
+  gnc_gconf_general_remove_cb(KEY_SHOW_LEAF_ACCOUNT_NAMES,
+			      shared_quickfill_gconf_changed,
+			      qfb);
   gnc_quickfill_destroy (qfb->qf);
   g_object_unref(qfb->list_store);
   qof_event_unregister_handler (qfb->listener);
@@ -118,7 +121,7 @@
      if (skip) return;
   }
 
-  name = xaccAccountGetFullName (account);
+  name = gnc_get_account_name_for_register (account);
   if (NULL == name) return;
   gnc_quickfill_insert (qfb->qf, name, QUICKFILL_ALPHA);
   if (qfb->load_list_store) {
@@ -169,6 +172,10 @@
 				shared_quickfill_gconf_changed,
 				qfb);
 
+  gnc_gconf_general_register_cb(KEY_SHOW_LEAF_ACCOUNT_NAMES,
+				shared_quickfill_gconf_changed,
+				qfb);
+
   gnc_account_foreach_descendant(root, load_shared_qf_cb, qfb);
   qfb->load_list_store = FALSE;
 
@@ -248,7 +255,7 @@
     return;
   }
 
-  name = xaccAccountGetFullName (account);
+  name = gnc_get_account_name_for_register(account);
   if (NULL == name) {
     LEAVE("account has no name");
     return;
@@ -285,9 +292,11 @@
 	    qfb->dont_add_cb(account, qfb->dont_add_data)) {
 	  gtk_list_store_remove(qfb->list_store, &iter);
 	} else {
+	  gchar *aname = gnc_get_account_name_for_register(account);
 	  gtk_list_store_set(qfb->list_store, &iter,
-			     ACCOUNT_NAME, xaccAccountGetFullName(account),
+			     ACCOUNT_NAME, aname,
 			     -1);
+	  g_free(aname);
 	}
       }
 

Modified: gnucash/branches/gda-dev2/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/dialog-account.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/dialog-account.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -415,7 +415,7 @@
     if (!gnc_account_create_opening_balance (account, balance, date, aw->book))
     {
       const char *message = _("Could not create opening balance.");
-      gnc_error_dialog(aw->dialog, message);
+      gnc_error_dialog(aw->dialog, "%s", message);
     }
   }
   else
@@ -707,7 +707,7 @@
   name = gtk_entry_get_text(GTK_ENTRY(aw->name_entry));
   if (safe_strcmp(name, "") == 0) {
     const char *message = _("The account must be given a name.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE("bad name");
     return FALSE;
   }
@@ -729,7 +729,7 @@
   if ((account != NULL) &&
       !guid_equal(&aw->account, xaccAccountGetGUID (account))) {
     const char *message = _("There is already an account with that name.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE("duplicate name");
     return FALSE;
   }
@@ -737,7 +737,7 @@
   /* Parent check, probably not needed, but be safe */
   if (!gnc_filter_parent_accounts(parent, aw)) {
     const char *message = _("You must choose a valid parent account.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE("invalid parent");
     return FALSE;
   }
@@ -745,7 +745,7 @@
   /* check for valid type */
   if (aw->type == ACCT_TYPE_INVALID) {
     const char *message = _("You must select an account type.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE("invalid type");
     return FALSE;
   }
@@ -754,7 +754,7 @@
   if (!xaccAccountTypesCompatible (aw->type, xaccAccountGetType (parent))) {
     const char *message = _("The selected account type is incompatible with "
                             "the one of the selected parent.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE("incompatible types");
     return FALSE;
   }
@@ -764,7 +764,7 @@
     gnc_general_select_get_selected (GNC_GENERAL_SELECT (aw->commodity_edit));
   if (!commodity) {
     const char *message = _("You must choose a commodity.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE("invalid commodity");
     return FALSE;
   }
@@ -817,7 +817,7 @@
   {
     const char *message = _("You must enter a valid opening balance "
                             "or leave it blank.");
-    gnc_error_dialog(aw->dialog, message);
+    gnc_error_dialog(aw->dialog, "%s", message);
     LEAVE(" ");
     return;
   }
@@ -841,7 +841,7 @@
       {
         const char *message = _("You must select a transfer account or choose"
                                 " the opening balances equity account.");
-        gnc_error_dialog(aw->dialog, message);
+        gnc_error_dialog(aw->dialog, "%s", message);
 	LEAVE(" ");
         return;
       }

Modified: gnucash/branches/gda-dev2/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/dialog-options.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/dialog-options.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1142,6 +1142,7 @@
 
   /* Build this options page */
   page_content_box = gtk_vbox_new(FALSE, 2);
+  gtk_container_set_border_width(GTK_CONTAINER(page_content_box), 12);
 
   /* Build space for the content - the options box */
   options_box = gtk_vbox_new(FALSE, 5);

Modified: gnucash/branches/gda-dev2/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/dialog-transfer.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/dialog-transfer.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1252,7 +1252,7 @@
       const char *message = _("You must specify an account to transfer from, "
 			      "or to, or both, for this transaction. "
 			      "Otherwise, it will not be recorded.");
-      gnc_error_dialog(xferData->dialog, message);
+      gnc_error_dialog(xferData->dialog, "%s", message);
       LEAVE("bad account");
       return;
     }
@@ -1261,7 +1261,7 @@
     {
       const char *message = _("You can't transfer from and to the same "
 			      "account!");
-      gnc_error_dialog(xferData->dialog, message);
+      gnc_error_dialog(xferData->dialog, "%s", message);
       LEAVE("same account");
       return;
     }
@@ -1288,7 +1288,7 @@
       const char *message = _("You can't transfer from a non-currency account.  "
 			      "Try reversing the \"from\" and \"to\" accounts "
 			      "and making the \"amount\" negative.");
-      gnc_error_dialog(xferData->dialog, message);
+      gnc_error_dialog(xferData->dialog, "%s", message);
       LEAVE("non-currency");
       return;
     }
@@ -1311,7 +1311,7 @@
   if (gnc_numeric_zero_p (amount))
   {
     const char *message = _("You must enter an amount to transfer.");
-    gnc_error_dialog(xferData->dialog, message);
+    gnc_error_dialog(xferData->dialog, "%s", message);
     LEAVE("invalid from amount");
     return;
   }

Modified: gnucash/branches/gda-dev2/src/gnome-utils/druid-gconf-setup.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/druid-gconf-setup.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/druid-gconf-setup.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -505,7 +505,7 @@
       case HOW_INSTALL:
 	if (!druid_gconf_install_keys(&error)) {
 	  keep_going = FALSE;
-	  gnc_error_dialog(NULL, error->message);
+	  gnc_error_dialog(NULL, "%s", error->message);
 	  g_error_free(error);
 	}
 	break;
@@ -513,7 +513,7 @@
       default:
 	if (!druid_gconf_update_path(&error)) {
 	  keep_going = FALSE;
-	  gnc_error_dialog(NULL, error->message);
+	  gnc_error_dialog(NULL, "%s", error->message);
 	  g_error_free(error);
 	}
 	break;
@@ -587,7 +587,7 @@
   /* Kill the backend daemon. When it restarts it will find our changes */
   if (!g_spawn_command_line_sync("gconftool-2 --shutdown", NULL, NULL,
 				 NULL, &error)) {
-    gnc_warning_dialog(NULL, error->message);
+    gnc_warning_dialog(NULL, "%s", error->message);
     g_error_free(error);
   }
 }

Modified: gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -738,7 +738,7 @@
     data->subst = NULL;
   }
   if (message) {
-    gnc_error_dialog (data->dialog, message);
+    gnc_error_dialog (data->dialog, "%s", message);
   }
   if (!success)
     gxi_session_destroy (data);
@@ -1033,7 +1033,7 @@
                           (GCompareFunc) file_filename_cmp)) {
     const gchar *message = _(
       "That GnuCash XML file is already loaded. Please select another file.");
-    gnc_error_dialog (data->dialog, message);
+    gnc_error_dialog (data->dialog, "%s", message);
     g_free (filename);
     return;
   }
@@ -1335,7 +1335,7 @@
 
   if (g_list_find (data->encodings, encoding_ptr)) {
     message = _("This encoding has been added to the list already.");
-    gnc_error_dialog (data->encodings_dialog, message);
+    gnc_error_dialog (data->encodings_dialog, "%s", message);
     return;
   }
 
@@ -1345,7 +1345,7 @@
     g_iconv_close (iconv);
     g_free (enc_string);
     message = _("This is an invalid encoding.");
-    gnc_error_dialog (data->encodings_dialog, message);
+    gnc_error_dialog (data->encodings_dialog, "%s", message);
     return;
   }
   g_iconv_close (iconv);
@@ -1480,7 +1480,7 @@
   if (!g_list_first (data->files)) {
     const gchar *message = _(
       "No files to merge. Please add ones by clicking on 'Load another file'.");
-    gnc_error_dialog (data->dialog, message);
+    gnc_error_dialog (data->dialog, "%s", message);
     return TRUE;
   }
 

Modified: gnucash/branches/gda-dev2/src/gnome-utils/glade/preferences.glade
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/glade/preferences.glade	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/glade/preferences.glade	2008-07-30 01:08:07 UTC (rev 17438)
@@ -3116,8 +3116,8 @@
 		<packing>
 		  <property name="left_attach">0</property>
 		  <property name="right_attach">1</property>
-		  <property name="top_attach">9</property>
-		  <property name="bottom_attach">10</property>
+		  <property name="top_attach">10</property>
+		  <property name="bottom_attach">11</property>
 		  <property name="x_padding">12</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options"></property>
@@ -3146,8 +3146,8 @@
 		<packing>
 		  <property name="left_attach">0</property>
 		  <property name="right_attach">1</property>
-		  <property name="top_attach">8</property>
-		  <property name="bottom_attach">9</property>
+		  <property name="top_attach">9</property>
+		  <property name="bottom_attach">10</property>
 		  <property name="x_padding">12</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options"></property>
@@ -3170,8 +3170,8 @@
 		<packing>
 		  <property name="left_attach">1</property>
 		  <property name="right_attach">2</property>
-		  <property name="top_attach">8</property>
-		  <property name="bottom_attach">9</property>
+		  <property name="top_attach">9</property>
+		  <property name="bottom_attach">10</property>
 		  <property name="x_options"></property>
 		  <property name="y_options"></property>
 		</packing>
@@ -3226,6 +3226,30 @@
 	      </child>
 
 	      <child>
+		<widget class="GtkCheckButton" id="gconf/general/register/show_leaf_account_names">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">If checked, only the names of the leaf accounts are displayed in the register and in the account selection popup. The default behaviour is to display the full name, including the path in the account tree. Cecking this option implies that you use unique leaf names.</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">_Only display leaf account names</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">4</property>
+		  <property name="top_attach">8</property>
+		  <property name="bottom_attach">9</property>
+		  <property name="x_padding">12</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
 		<widget class="GtkSpinButton" id="gconf/general/register/number_of_rows">
 		  <property name="visible">True</property>
 		  <property name="tooltip" translatable="yes">Display this many rows when a register is created.</property>
@@ -3241,8 +3265,8 @@
 		<packing>
 		  <property name="left_attach">1</property>
 		  <property name="right_attach">2</property>
-		  <property name="top_attach">9</property>
-		  <property name="bottom_attach">10</property>
+		  <property name="top_attach">10</property>
+		  <property name="bottom_attach">11</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options"></property>
 		</packing>

Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-date-edit.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-date-edit.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-date-edit.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -266,7 +266,7 @@
 		mtm.tm_year -= 1900;
 
 	gnc_tm_set_day_start(&mtm);
-        if (mktime (&mtm) == -1)
+        if (mktime (&mtm) == (time_t) -1)
         {
 		gnc_tm_get_today_start (&mtm);
                 gnc_date_edit_set_time (gde, mktime (&mtm));
@@ -282,7 +282,6 @@
 	gtk_widget_show (gde->cal_popup);
 	gtk_widget_grab_focus (gde->cal_popup);
 	gtk_grab_add (gde->cal_popup);
-
 }
 
 typedef struct {
@@ -494,21 +493,29 @@
 static void
 gnc_date_edit_set_time_tm (GNCDateEdit *gde, struct tm *mytm) 
 {
-	char buffer [40];
+        char buffer [40];
 
-	/* Set the date */
-	qof_print_date_dmy_buff (buffer, 40,
-                   mytm->tm_mday,
-                   mytm->tm_mon + 1,
-                   1900 + mytm->tm_year);
-	gtk_entry_set_text (GTK_ENTRY (gde->date_entry), buffer);
+        g_return_if_fail(mytm != NULL);
 
-	/* Set the time */
-	if (gde->flags & GNC_DATE_EDIT_24_HR)
-		qof_strftime (buffer, sizeof (buffer), "%H:%M", mytm);
-	else
-		qof_strftime (buffer, sizeof (buffer), "%I:%M %p", mytm);
-	gtk_entry_set_text (GTK_ENTRY (gde->time_entry), buffer);
+        /* Update the date text. */
+        qof_print_date_dmy_buff(buffer, 40,
+                                mytm->tm_mday,
+                                mytm->tm_mon + 1,
+                                1900 + mytm->tm_year);
+        gtk_entry_set_text(GTK_ENTRY(gde->date_entry), buffer);
+
+        /* Update the calendar. */
+        gtk_calendar_select_day(GTK_CALENDAR (gde->calendar), 1);
+        gtk_calendar_select_month(GTK_CALENDAR (gde->calendar),
+                                  mytm->tm_mon, 1900 + mytm->tm_year);
+        gtk_calendar_select_day(GTK_CALENDAR (gde->calendar), mytm->tm_mday);
+
+        /* Set the time of day. */
+        if (gde->flags & GNC_DATE_EDIT_24_HR)
+          qof_strftime (buffer, sizeof (buffer), "%H:%M", mytm);
+        else
+          qof_strftime (buffer, sizeof (buffer), "%I:%M %p", mytm);
+        gtk_entry_set_text(GTK_ENTRY(gde->time_entry), buffer);
 }
 
 /**
@@ -527,9 +534,16 @@
 	g_return_if_fail (gde != NULL);
         g_return_if_fail (GNC_IS_DATE_EDIT (gde));
 
-	if (the_time == 0)
-		the_time = time (NULL);
-	gde->initial_time = the_time;
+        /* If the_time is invalid, use the last valid time
+         * seen (or as a last resort, the current date). */
+        if (the_time == (time_t) -1)
+        {
+          if (gde->initial_time == (time_t) -1)
+            gde->initial_time = gnc_timet_get_today_start();
+          the_time = gde->initial_time;
+        }
+        else
+          gde->initial_time = the_time;
 
 	mytm = localtime (&the_time);
 	gnc_date_edit_set_time_tm(gde, mytm);
@@ -591,15 +605,8 @@
         if (!gnc_handle_date_accelerator (event, &tm, string))
                 return FALSE;
 
-        if (mktime (&tm) == -1)
-		gnc_tm_get_today_start (&tm);
         gnc_date_edit_set_time (gde, mktime (&tm));
 
-        gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), 1);
-	gtk_calendar_select_month (GTK_CALENDAR (gde->calendar), tm.tm_mon,
-                                   1900 + tm.tm_year);
-        gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), tm.tm_mday);
-
 	g_signal_emit (G_OBJECT (gde), date_edit_signals [TIME_CHANGED], 0);
         return TRUE;
 }
@@ -620,12 +627,12 @@
 	GNCDateEdit *gde = data;
         struct tm tm;
 
+        /* Get the date entered and attempt to use it. */
         tm = gnc_date_edit_get_date_internal (gde);
         gnc_date_edit_set_time (gde, mktime (&tm));
 
-	gtk_calendar_select_month (GTK_CALENDAR (gde->calendar), tm.tm_mon,
-                                   1900 + tm.tm_year);
-        gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), tm.tm_mday);
+        /* Get the date again in case it was invalid the first time. */
+        tm = gnc_date_edit_get_date_internal (gde);
 
 	g_signal_emit (gde, date_edit_signals [DATE_CHANGED], 0);
 	g_signal_emit (gde, date_edit_signals [TIME_CHANGED], 0);
@@ -792,6 +799,7 @@
 	gde = g_object_new (GNC_TYPE_DATE_EDIT, NULL, NULL);
 
 	gde->flags = flags;
+	gde->initial_time = -1;
 	create_children (gde);
 	gnc_date_edit_set_time (gde, the_time);
 
@@ -880,8 +888,13 @@
         tm = gnc_date_edit_get_date_internal (gde);
 
         retval = mktime (&tm);
-        if (retval == -1)
-                return gnc_timet_get_today_start ();
+        if (retval == (time_t) -1)
+        {
+          if (gde->initial_time == (time_t) -1)
+            return gnc_timet_get_today_start ();
+          else
+            return gde->initial_time;
+        }
         return retval;
 }
 
@@ -925,8 +938,13 @@
         tm = gnc_date_edit_get_date_internal (gde);
 	gnc_tm_set_day_end(&tm);
 
-        if (mktime (&tm) == -1)
-		return gnc_timet_get_today_end();
+        if (mktime (&tm) == (time_t) -1)
+        {
+          if (gde->initial_time == (time_t) -1)
+            return gnc_timet_get_today_end();
+          else
+            return gnc_timet_get_day_end(gde->initial_time);
+        }
 	return mktime (&tm);
 }
 

Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -230,7 +230,7 @@
       fmt = _("This file/URL appears to be from a newer version "
               "of GnuCash. You must upgrade your version of GnuCash "
               "to work with this data.");
-      gnc_error_dialog (parent, fmt);
+      gnc_error_dialog (parent, "%s", fmt);
       break;
 
     case ERR_BACKEND_NO_SUCH_DB:
@@ -395,7 +395,7 @@
     case ERR_FILEIO_FILE_BAD_READ:
       fmt = _("There was an error reading the file. "
               "Do you want to continue?");
-      if (gnc_verify_dialog (parent, TRUE, fmt)) { uh_oh = FALSE; }
+      if (gnc_verify_dialog (parent, TRUE, "%s", fmt)) { uh_oh = FALSE; }
       break;
 
     case ERR_FILEIO_PARSE_ERROR:
@@ -420,7 +420,7 @@
     case ERR_FILEIO_FILE_TOO_OLD:
       fmt = _("This file is from an older version of GnuCash. "
               "Do you want to continue?");
-      if (gnc_verify_dialog (parent, TRUE, fmt)) { uh_oh = FALSE; }
+      if (gnc_verify_dialog (parent, TRUE, "%s", fmt)) { uh_oh = FALSE; }
       break;
 
     case ERR_FILEIO_UNKNOWN_FILE_TYPE:
@@ -449,7 +449,7 @@
       fmt = _("This database is from an older version of GnuCash. "
               "Do you want to want to upgrade the database "
               "to the current version?");
-      if (gnc_verify_dialog (parent, TRUE, fmt)) { uh_oh = FALSE; }
+      if (gnc_verify_dialog (parent, TRUE, "%s", fmt)) { uh_oh = FALSE; }
       break;
 
     case ERR_SQL_DB_BUSY:
@@ -458,7 +458,7 @@
               "If there are currently no other users, consult the  "
               "documentation to learn how to clear out dangling login "
               "sessions.");
-      gnc_error_dialog (parent, fmt);
+      gnc_error_dialog (parent, "%s", fmt);
       break;
 
     default:

Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-gnome-utils.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-gnome-utils.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-gnome-utils.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -279,7 +279,7 @@
     const gchar *message =
       _("GnuCash could not find the files for the help documentation.  "
 	"This is likely because the 'gnucash-docs' package is not installed.");
-    gnc_error_dialog(NULL, message);
+    gnc_error_dialog(NULL, "%s", message);
   }
   PERR ("%s", error->message);
   g_error_free(error);

Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-html.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-html.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-html.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -898,7 +898,7 @@
     if (!ok)
     {
       if (result.error_message)
-        gnc_error_dialog( html->window, result.error_message);
+        gnc_error_dialog( html->window, "%s", result.error_message);
       else
 	/* %s is a URL (some location somewhere). */
         gnc_error_dialog( html->window, _("There was an error accessing %s."), location);

Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-tree-view-commodity.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-tree-view-commodity.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-tree-view-commodity.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -823,7 +823,8 @@
     model = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(f_model));
     commodity = gnc_tree_model_commodity_get_commodity (GNC_TREE_MODEL_COMMODITY(model),
 							&iter);
-    LEAVE("commodity %p (%s)", commodity, gnc_commodity_get_mnemonic (commodity));
+    LEAVE("commodity %p (%s)", commodity,
+          commodity? gnc_commodity_get_mnemonic(commodity) : "");
     return commodity;
 }
 

Modified: gnucash/branches/gda-dev2/src/import-export/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/Makefile.am	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/Makefile.am	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1,7 +1,7 @@
 SUBDIRS = . schemas qif qif-import \
-	${OFX_DIR} ${HBCI_DIR} log-replay test csv
+	${OFX_DIR} ${AQBANKING_DIR} log-replay test csv
 DIST_SUBDIRS = schemas qif qif-import qif-io-core \
-	ofx hbci log-replay test csv
+	ofx aqbanking hbci log-replay test csv
 
 pkglib_LTLIBRARIES=libgncmod-generic-import.la
 

Copied: gnucash/branches/gda-dev2/src/import-export/aqbanking (from rev 17437, gnucash/trunk/src/import-export/aqbanking)


Property changes on: gnucash/branches/gda-dev2/src/import-export/aqbanking
___________________________________________________________________
Name: svn:ignore
   + .deps
.libs
.scm-links
*.gladep
*.la
*.lo
Makefile
Makefile.in
semantic.cache


Modified: gnucash/branches/gda-dev2/src/import-export/hbci/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/hbci/Makefile.am	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/hbci/Makefile.am	2008-07-30 01:08:07 UTC (rev 17438)
@@ -56,7 +56,7 @@
   ${GLADE_LIBS} \
   ${QOF_LIBS} \
   ${GLIB_LIBS} \
-  ${HBCI_LIBS}
+  ${AQBANKING_LIBS}
 
 AM_CFLAGS = \
   -I${top_srcdir}/src \
@@ -77,7 +77,7 @@
   ${GLADE_CFLAGS} \
   ${QOF_CFLAGS} \
   ${GLIB_CFLAGS} \
-  ${HBCI_CFLAGS}
+  ${AQBANKING_CFLAGS}
 
 #gladedir = $(GNC_GLADE_DIR)
 #glade_DATA = 

Modified: gnucash/branches/gda-dev2/src/import-export/hbci/hbci-interaction.c
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/hbci/hbci-interaction.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/hbci/hbci-interaction.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -403,7 +403,7 @@
 			   minsize);
       retval = gnc_verify_dialog (GTK_WIDGET (data->parent), 
 					   TRUE,
-					   msg);
+					   "%s", msg);
       g_free (msg);
       if (!retval)
 	break;
@@ -417,7 +417,7 @@
 			   (long)strlen(passwd), maxLen);
       retval = gnc_verify_dialog (GTK_WIDGET (data->parent), 
 					   TRUE,
-					   msg);
+					   "%s", msg);
       g_free (msg);
       if (!retval)
 	break;
@@ -484,7 +484,7 @@
 			   minsize);
       retval = gnc_verify_dialog (GTK_WIDGET (data->parent), 
 					   TRUE,
-					   msg);
+					   "%s", msg);
       g_free (msg);
       if (!retval)
 	break;
@@ -498,7 +498,7 @@
 			   (long)strlen(passwd), maxLen);
       retval = gnc_verify_dialog (GTK_WIDGET (data->parent), 
 					   TRUE,
-					   msg);
+					   "%s", msg);
       g_free (msg);
       if (!retval)
 	break;

Modified: gnucash/branches/gda-dev2/src/import-export/log-replay/gnc-log-replay.c
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/log-replay/gnc-log-replay.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/log-replay/gnc-log-replay.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -509,7 +509,7 @@
 
   /* Use g_strdup_printf so we don't get accidental tab -> space conversion */
   if (!expected_header)
-    expected_header = g_strdup_printf(expected_header_orig);
+    expected_header = g_strdup(expected_header_orig);
 
   qof_log_set_level(GNC_MOD_IMPORT, QOF_LOG_DEBUG);
   ENTER(" ");

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/druid-qif-import.c
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/druid-qif-import.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/druid-qif-import.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -38,6 +38,7 @@
 #include "Transaction.h"
 #include "dialog-account-picker.h"
 #include "dialog-commodity.h"
+#include "dialog-progress.h"
 #include "dialog-utils.h"
 #include "druid-qif-import.h"
 #include "druid-utils.h"
@@ -72,6 +73,7 @@
   ACCOUNT_COL_QIF_NAME,
   ACCOUNT_COL_GNC_NAME,
   ACCOUNT_COL_NEW,
+  ACCOUNT_COL_ELLIPSIZE,
   NUM_ACCOUNT_COLS
 };
 
@@ -87,9 +89,22 @@
 struct _qifimportwindow {
   GtkWidget * window;
   GtkWidget * druid;
+
+  /* Widgets on the file selection page. */
   GtkWidget * filename_entry;
+
+  /* File loading progress page. */
+  GtkWidget * load_pause;
+  GtkWidget * load_log;
+  GNCProgressDialog *load_progress;
+
+  /* Widgets on the default account page. */
   GtkWidget * acct_entry;
+
+  /* Widgets on the date format page. */
   GtkWidget * date_format_combo;
+
+  /* Widgets on the files loaded page. */
   GtkWidget * selected_file_view;
 
   /* Widgets on the account matching page. */
@@ -107,7 +122,15 @@
   GtkWidget * memo_view_count;
   GtkWidget * memo_view_btn;
 
+  /* Widgets on the currency page. */
   GtkWidget * currency_picker;
+
+  /* Conversion progress page. */
+  GtkWidget * convert_pause;
+  GtkWidget * convert_log;
+  GNCProgressDialog *convert_progress;
+
+  /* Widgets on the duplicates page. */
   GtkWidget * new_transaction_view;
   GtkWidget * old_transaction_view;
 
@@ -117,6 +140,8 @@
   GList     * doc_pages;
 
   gboolean  show_doc_pages;
+  gboolean  ask_date_format;
+  gboolean  busy;
 
   SCM       imported_files;
   SCM       selected_file;
@@ -144,9 +169,9 @@
 
 struct _qifdruidpage {
   GtkWidget     *page;
-  GtkWidget     *new_type_combo;
-  GtkWidget     *new_name_entry;
-  GtkWidget     *new_mnemonic_entry;
+  GtkWidget     *namespace_combo;
+  GtkWidget     *name_entry;
+  GtkWidget     *mnemonic_entry;
   gnc_commodity *commodity;
   SCM            hash_key;
 };
@@ -157,8 +182,8 @@
 static GdkColor std_logo_bg_color = { 0, 65535, 65535, 65535 };
 static GdkColor std_title_color =  { 0, 65535, 65535, 65535 };
 
-#define NUM_PRE_PAGES 13
-#define NUM_POST_PAGES 3
+#define NUM_PRE_PAGES 14
+#define NUM_POST_PAGES 4
 #define NUM_DOC_PAGES  6
 
 static GnomeDruidPage *
@@ -218,10 +243,11 @@
 
     gtk_list_store_append(store, &iter);
     gtk_list_store_set(store, &iter,
-                       ACCOUNT_COL_INDEX,    row++,
-                       ACCOUNT_COL_QIF_NAME, qif_name,
-                       ACCOUNT_COL_GNC_NAME, gnc_name,
-                       ACCOUNT_COL_NEW,      checked,
+                       ACCOUNT_COL_INDEX,     row++,
+                       ACCOUNT_COL_QIF_NAME,  qif_name,
+                       ACCOUNT_COL_GNC_NAME,  gnc_name,
+                       ACCOUNT_COL_NEW,       checked,
+                       ACCOUNT_COL_ELLIPSIZE, PANGO_ELLIPSIZE_START,
                        -1);
     accts_left = SCM_CDR(accts_left);
   }
@@ -309,12 +335,6 @@
 
     /* Free the memory allocated for the page's struct. */
     g_free(page);
-
-    /*
-     * FIXME -- Do we need to call gtk_widget_destroy() for anything?
-     *          Or will they all get destroyed when the druid gets destroyed?
-     *          Any other cleanup?
-     */
   }
 
   /* Free the list of pages. */
@@ -329,35 +349,38 @@
 \********************************************************************/
 
 void
-gnc_ui_qif_import_druid_destroy(QIFImportWindow * window)
+gnc_ui_qif_import_druid_destroy(QIFImportWindow * wind)
 {
-  if (!window)
+  if (!wind)
     return;
 
+  /* Destroy the progress dialog helpers. */
+  gnc_progress_dialog_destroy(wind->load_progress);
+
   /* Destroy any commodity pages. */
-  gnc_ui_qif_import_commodity_destroy(window);
+  gnc_ui_qif_import_commodity_destroy(wind);
 
-  gnc_unregister_gui_component_by_data(DRUID_QIF_IMPORT_CM_CLASS, window);
+  gnc_unregister_gui_component_by_data(DRUID_QIF_IMPORT_CM_CLASS, wind);
 
-  gtk_widget_destroy(window->window);
+  gtk_widget_destroy(wind->window);
 
-  scm_gc_unprotect_object(window->imported_files);
-  scm_gc_unprotect_object(window->selected_file);
-  scm_gc_unprotect_object(window->gnc_acct_info);
-  scm_gc_unprotect_object(window->cat_display_info);
-  scm_gc_unprotect_object(window->cat_map_info);
-  scm_gc_unprotect_object(window->memo_display_info);
-  scm_gc_unprotect_object(window->memo_map_info);
-  scm_gc_unprotect_object(window->acct_display_info);
-  scm_gc_unprotect_object(window->acct_map_info);
-  scm_gc_unprotect_object(window->security_hash);
-  scm_gc_unprotect_object(window->security_prefs);
-  scm_gc_unprotect_object(window->new_securities);
-  scm_gc_unprotect_object(window->ticker_map);
-  scm_gc_unprotect_object(window->imported_account_tree);
-  scm_gc_unprotect_object(window->match_transactions);
+  scm_gc_unprotect_object(wind->imported_files);
+  scm_gc_unprotect_object(wind->selected_file);
+  scm_gc_unprotect_object(wind->gnc_acct_info);
+  scm_gc_unprotect_object(wind->cat_display_info);
+  scm_gc_unprotect_object(wind->cat_map_info);
+  scm_gc_unprotect_object(wind->memo_display_info);
+  scm_gc_unprotect_object(wind->memo_map_info);
+  scm_gc_unprotect_object(wind->acct_display_info);
+  scm_gc_unprotect_object(wind->acct_map_info);
+  scm_gc_unprotect_object(wind->security_hash);
+  scm_gc_unprotect_object(wind->security_prefs);
+  scm_gc_unprotect_object(wind->new_securities);
+  scm_gc_unprotect_object(wind->ticker_map);
+  scm_gc_unprotect_object(wind->imported_account_tree);
+  scm_gc_unprotect_object(wind->match_transactions);
 
-  g_free(window);
+  g_free(wind);
 }
 
 
@@ -377,9 +400,9 @@
   int       where = 0;
 
   /* Figure out which stage of the druid we're in. */
-  if((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
-    if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
-      if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
+  if ((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
+    if ((current = g_list_find(wind->commodity_pages, page)) == NULL) {
+      if ((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
         /* Where are we? */
         g_critical("QIF import: BUG DETECTED in get_next_druid_page! I'm lost!");
         return FALSE;
@@ -401,7 +424,7 @@
          (!wind->show_doc_pages && g_list_find(wind->doc_pages, next->data)) ||
          (wind->new_securities == SCM_BOOL_F &&
           GNOME_DRUID_PAGE(next->data) == get_named_page(wind, "commodity_doc_page"))) {
-    if(next && next->next) {
+    if (next && next->next) {
       next = next->next;
     }
     else {
@@ -446,9 +469,9 @@
   int       where = 0;
 
   /* Figure out which stage of the druid we're in. */
-  if((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
-    if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
-      if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
+  if ((current = g_list_find(wind->pre_comm_pages, page)) == NULL) {
+    if ((current = g_list_find(wind->commodity_pages, page)) == NULL) {
+      if ((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
         /* Where are we? */
         g_critical("QIF import: BUG DETECTED in get_prev_druid_page! I'm lost!");
         return NULL;
@@ -482,7 +505,7 @@
     /* We're either out of pages for this stage, or we've reached
      * an optional doc page that shouldn't be shown. */
 
-    if(prev && prev->prev) {
+    if (prev && prev->prev) {
       /* Go back another page within the same stage. */
       prev = prev->prev;
     }
@@ -494,7 +517,7 @@
         prev = g_list_last(wind->pre_comm_pages);
         break;
       case 2:
-        if(wind->new_securities != SCM_BOOL_F) {
+        if (wind->new_securities != SCM_BOOL_F) {
           prev = g_list_last(wind->commodity_pages);
         }
         else {
@@ -512,7 +535,7 @@
     }
   }
 
-  if(prev)
+  if (prev)
     return (GtkWidget *)prev->data;
 
   return NULL;
@@ -532,7 +555,7 @@
   QIFImportWindow * wind = user_data;
   GtkWidget * next_page = get_next_druid_page(wind, page);
 
-  if(next_page)
+  if (next_page)
   {
     gnome_druid_set_page(GNOME_DRUID(wind->druid),
                          GNOME_DRUID_PAGE(next_page));
@@ -556,7 +579,7 @@
   QIFImportWindow * wind = user_data;
   GtkWidget * back_page = get_prev_druid_page(wind, page);
 
-  if(back_page)
+  if (back_page)
   {
     gnome_druid_set_page(GNOME_DRUID(wind->druid),
                          GNOME_DRUID_PAGE(back_page));
@@ -653,209 +676,461 @@
                                     gpointer user_data)
 {
   QIFImportWindow * wind = user_data;
+  const gchar * path_to_load;
 
+  /* Get the file name. */
+  path_to_load = gtk_entry_get_text(GTK_ENTRY(wind->filename_entry));
+
+  /* Validate the chosen filename. */
+  if (strlen(path_to_load) == 0)
+    gnc_error_dialog(wind->window, _("Please select a file to load."));
+  else if (g_access(path_to_load, R_OK) < 0)
+    gnc_error_dialog(wind->window,
+                     _("File not found or read permission denied. "
+                       "Please select another file."));
+  else
+  {
+    SCM qif_file_loaded = scm_c_eval_string("qif-dialog:qif-file-loaded?");
+
+    /* See if the file is already loaded. */
+    if (scm_call_2(qif_file_loaded,
+                   scm_makfrom0str(path_to_load),
+                   wind->imported_files) == SCM_BOOL_T)
+      gnc_error_dialog(wind->window,
+                       _("That QIF file is already loaded. "
+                         "Please select another file."));
+    else
+    {
+      /* Passed all checks; proceed to the next page. */
+      return gnc_ui_qif_import_generic_next_cb(page, arg1, wind);
+    }
+  }
+
+  /* Stay on this page. */
+  return TRUE;
+}
+
+
+/********************************************************************
+ * gnc_ui_qif_import_load_progress_prepare_cb
+ *
+ * Prepare the file loading progress page for display.
+ ********************************************************************/
+
+static void
+gnc_ui_qif_import_load_progress_prepare_cb(GnomeDruidPage * page,
+                                           gpointer arg1,
+                                           gpointer user_data)
+{
+  QIFImportWindow   *wind = user_data;
+
+  /* Reset the progress display. */
+  gnc_progress_dialog_set_primary(wind->load_progress, "");
+  gnc_progress_dialog_set_secondary(wind->load_progress,
+    _("GnuCash will now load your QIF file. If there are no errors or warnings, you will automatically proceed to the next step. Otherwise, the details will be shown below for your review."));
+  gnc_progress_dialog_set_sub(wind->load_progress, " ");
+  gnc_progress_dialog_reset_value(wind->load_progress);
+  gnc_progress_dialog_reset_log(wind->load_progress);
+
+  /* Disable the "Forward" button for now.
+   *
+   * NOTE: Due to bug 91001 in GnomeDruid, gnome_druid_set_buttons_sensitive()
+   *       will not work in prepare callbacks unless they are run AFTER the
+   *       standard one. Make sure the Glade line has the callback set up with
+   *       after=yes. For example:
+   *         <signal name="prepare" handler="my_prepare_cb" after="yes"/>   */
+  gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
+                                    TRUE, FALSE, TRUE, TRUE);
+
+  /* Generate a show signal once the page is displayed. This
+   * will kick off our (potentially) long-running operations. */
+  gtk_widget_hide(GTK_WIDGET(page));
+  gtk_widget_set_sensitive(GTK_WIDGET(page), TRUE);
+  gtk_widget_show(GTK_WIDGET(page));
+}
+
+
+/********************************************************************
+ * gnc_ui_qif_import_load_progress_show_cb
+ *
+ * Start the long-running operation.
+ ********************************************************************/
+
+static void
+gnc_ui_qif_import_load_progress_show_cb(GtkWidget *widget,
+                                        gpointer user_data)
+{
+  QIFImportWindow   *wind = user_data;
   const gchar * path_to_load;
-  const gchar * default_acctname = NULL;
 
   SCM make_qif_file   = scm_c_eval_string("make-qif-file");
   SCM qif_file_load   = scm_c_eval_string("qif-file:read-file");
   SCM qif_file_parse  = scm_c_eval_string("qif-file:parse-fields");
-  SCM qif_file_loaded = scm_c_eval_string("qif-dialog:qif-file-loaded?");
   SCM unload_qif_file = scm_c_eval_string("qif-dialog:unload-qif-file");
-  SCM check_from_acct = scm_c_eval_string("qif-file:check-from-acct");
-  SCM default_acct    = scm_c_eval_string("qif-file:path-to-accountname");
   SCM parse_results   = scm_c_eval_string("qif-file:parse-fields-results");
-  SCM date_formats;
-  SCM scm_filename;
   SCM scm_qiffile;
   SCM imported_files = SCM_EOL;
   SCM load_return, parse_return;
-  SCM window;
-  int ask_date_format = FALSE;
+  SCM progress;
 
-  /* get the file name */
+  /* Raise the busy flag so the druid can't be canceled unexpectedly. */
+  wind->busy = TRUE;
+  gtk_widget_set_sensitive(wind->load_pause, TRUE);
+
+  /* Get the file name. */
   path_to_load = gtk_entry_get_text(GTK_ENTRY(wind->filename_entry));
-  window = SWIG_NewPointerObj(wind->window, SWIG_TypeQuery("_p_GtkWidget"), 0);
 
-  /* check a few error conditions before we get started */
-  if(strlen(path_to_load) == 0) {
-    /* stay here if no file specified */
-    gnc_error_dialog(wind->window, _("Please select a file to load."));
-    return TRUE;
-  }
-  else if (g_access(path_to_load, R_OK) < 0) {
-    /* stay here if bad file */
-    gnc_error_dialog(wind->window,
-                     _("File not found or read permission denied. "
-                       "Please select another file."));
-    return TRUE;
-  }
-  else {
-    /* convert filename to scm */
-    scm_filename   = scm_makfrom0str(path_to_load);
-    imported_files = wind->imported_files;
+  /* Create the <qif-file> object. */
+  scm_qiffile          = scm_call_0(make_qif_file);
+  scm_gc_unprotect_object(wind->selected_file);
+  wind->selected_file  = scm_qiffile;
+  scm_gc_protect_object(wind->selected_file);
+  imported_files       = scm_cons(scm_qiffile, wind->imported_files);
 
-    if(scm_call_2(qif_file_loaded, scm_filename, wind->imported_files)
-       == SCM_BOOL_T) {
-      gnc_error_dialog(wind->window,
-                                _("That QIF file is already loaded. "
-                                  "Please select another file."));
-      return TRUE;
-    }
+  /* Create SCM for the progress helper. */
+  progress = SWIG_NewPointerObj(wind->load_progress,
+                                SWIG_TypeQuery("_p__GNCProgressDialog"),
+                                0);
 
-    /* turn on the busy cursor */
-    gnc_set_busy_cursor(NULL, TRUE);
+  /* Clear any previous pause or cancel state. */
+  scm_c_eval_string("(qif-import:reset-cancel-pause)");
 
-    /* create the <qif-file> object */
-    scm_qiffile          = scm_call_0(make_qif_file);
-    imported_files       = scm_cons(scm_qiffile, imported_files);
 
-    scm_gc_unprotect_object(wind->selected_file);
-    wind->selected_file  = scm_qiffile;
-    scm_gc_protect_object(wind->selected_file);
+  /*
+   * Load the file.
+   *
+   * The loader returns:
+   *  success:   ()
+   *  failure:   (#f error-message)
+   *  warning:   (#t error-message)
+   *  cancel:    #t
+   *  exception: #f
+   */
 
-    /* load the file */
-    load_return = scm_call_4(qif_file_load, SCM_CAR(imported_files),
-                             scm_filename, wind->ticker_map, window);
+  /* This step will fill 70% of the bar. */
+  gnc_progress_dialog_push(wind->load_progress, 0.7);
+  load_return = scm_call_4(qif_file_load,
+                           SCM_CAR(imported_files),
+                           scm_makfrom0str(path_to_load),
+                           wind->ticker_map,
+                           progress);
+  gnc_progress_dialog_pop(wind->load_progress);
+  if (load_return == SCM_BOOL_T)
+  {
+    /* Canceled by the user. */
 
-    /* turn back the cursor */
-    gnc_unset_busy_cursor(NULL);
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->load_pause, FALSE);
 
-    /* a list returned is (#f error-message) for an error,
-     * (#t error-message) for a warning, or just #f for an
-     * exception. */
-    if(SCM_LISTP(load_return) &&
-       (SCM_CAR(load_return) == SCM_BOOL_T)) {
-      const gchar *warn_str = SCM_STRING_CHARS(SCM_CADR(load_return));
-      gnc_warning_dialog(GTK_WIDGET(wind->window),
-                         _("QIF file load warning: %s"),
-                         warn_str ? warn_str : "(null)");
-    }
+    /* Inform the user. */
+    gnc_progress_dialog_set_sub(wind->load_progress, _("Canceled"));
 
-    /* check success of the file load */
-    if(load_return == SCM_BOOL_F) {
-      gnc_error_dialog(wind->window,
-                       _( "An error occurred while loading the QIF file."));
-      return TRUE;
-    }
-    else if ((load_return != SCM_BOOL_T) &&
-             (!SCM_LISTP(load_return) ||
-              (SCM_CAR(load_return) != SCM_BOOL_T))) {
-      const gchar *warn_str = SCM_STRING_CHARS(SCM_CADR(load_return));
-      gnc_error_dialog(wind->window,
-                       _("QIF file load failed: %s"),
-                       warn_str ? warn_str : "(null)");
+    wind->busy = FALSE;
+    return;
+  }
+  else if (load_return == SCM_BOOL_F || !SCM_LISTP(load_return))
+  {
+    /* A bug was detected. */
 
-      imported_files =
-        scm_call_2(unload_qif_file, scm_qiffile, imported_files);
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->load_pause, FALSE);
 
+    /* Inform the user. */
+    gnc_progress_dialog_append_log(wind->load_progress,
+                     _( "A bug was detected while reading the QIF file."));
+    gnc_progress_dialog_set_sub(wind->load_progress, _("Failed"));
+    gnc_progress_dialog_reset_value(wind->load_progress);
+    gnc_error_dialog(wind->window,
+                     _( "A bug was detected while reading the QIF file."));
+    /* FIXME: How should we request that the user report this problem? */
+
+    wind->busy = FALSE;
+    return;
+  }
+  else if (!SCM_NULLP(load_return))
+  {
+    const gchar *str = SCM_STRING_CHARS(SCM_CADR(load_return));
+
+    if (SCM_CAR(load_return) == SCM_BOOL_F)
+    {
+      imported_files = scm_call_2(unload_qif_file, scm_qiffile, imported_files);
       scm_gc_unprotect_object(wind->imported_files);
       wind->imported_files = imported_files;
       scm_gc_protect_object(wind->imported_files);
 
-      return TRUE;
+      gnc_progress_dialog_set_sub(wind->load_progress, _("Failed"));
+      gnc_progress_dialog_reset_value(wind->load_progress);
+
+      gtk_widget_set_sensitive(wind->load_pause, FALSE);
+      wind->busy = FALSE;
+      return;
     }
-    else {
-      /* turn on the busy cursor */
-      gnc_set_busy_cursor(NULL, TRUE);
+  }
 
-      /* call the field parser */
-      parse_return = scm_call_1(qif_file_parse, SCM_CAR(imported_files));
 
-      /* parser returns:
-       *   success: #t
-       *   failure: (#f . ((type . errror) ...))
-       *   warning: (#t . ((type . error) ...))
-       *
-       * warning means that (potentially) the date format is
+  /*
+   * Parse the fields.
+   *
+   * The parser returns:
+   *   success:   ()
+   *   failure:   (#f . ((type . error) ...))
+   *   warning:   (#t . ((type . error) ...))
+   *   cancel:    #t
+   *   exception: #f
+   */
+
+  /* This step will fill the remainder of the bar. */
+  gnc_progress_dialog_push(wind->load_progress, 1);
+  parse_return = scm_call_2(qif_file_parse, SCM_CAR(imported_files), progress);
+  gnc_progress_dialog_pop(wind->load_progress);
+  wind->ask_date_format = FALSE;
+  if (parse_return == SCM_BOOL_T)
+  {
+    /* Canceled by the user. */
+
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->load_pause, FALSE);
+
+    /* Unload the file. */
+    gnc_progress_dialog_set_sub(wind->load_progress, _("Cleaning up"));
+    imported_files = scm_call_2(unload_qif_file, scm_qiffile, imported_files);
+
+    /* Inform the user. */
+    gnc_progress_dialog_set_sub(wind->load_progress, _("Canceled"));
+
+    wind->busy = FALSE;
+    return;
+  }
+  else if (parse_return == SCM_BOOL_F || !SCM_LISTP(parse_return))
+  {
+    /* A bug was detected. */
+
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->load_pause, FALSE);
+
+    /* Unload the file. */
+    gnc_progress_dialog_set_sub(wind->load_progress, _("Cleaning up"));
+    imported_files = scm_call_2(unload_qif_file, scm_qiffile, imported_files);
+
+    /* Inform the user. */
+    gnc_progress_dialog_append_log(wind->load_progress,
+                     _( "A bug was detected while parsing the QIF file."));
+    gnc_progress_dialog_set_sub(wind->load_progress, _("Failed"));
+    gnc_progress_dialog_reset_value(wind->load_progress);
+    gnc_error_dialog(wind->window,
+                     _( "A bug was detected while parsing the QIF file."));
+    /* FIXME: How should we request that the user report this problem? */
+
+    wind->busy = FALSE;
+    return;
+  }
+  else if (!SCM_NULLP(parse_return))
+  {
+    /* Are there only warnings? */
+    if (SCM_CAR(parse_return) == SCM_BOOL_T)
+    {
+      SCM date_formats;
+
+      /* A warning means that (potentially) the date format is
        * ambiguous.  So search the results for the "date" type and if
-       * it's found, set up the format selector page.
-       */
-      if(SCM_LISTP(parse_return) &&
-         (SCM_CAR(parse_return) == SCM_BOOL_T)) {
+       * it's found, set up the format selector page. */
+      if ((date_formats = scm_call_2(parse_results,
+                                     SCM_CDR(parse_return),
+                                     scm_str2symbol("date"))) != SCM_BOOL_F)
+      {
         gint n_items;
 
-        /* clear the combo box */
+        /* Clear the date format combo box. */
         gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), -1);
         n_items = gtk_tree_model_iter_n_children(
-          gtk_combo_box_get_model(GTK_COMBO_BOX(wind->date_format_combo)), NULL);
+          gtk_combo_box_get_model(GTK_COMBO_BOX(wind->date_format_combo)),
+                                  NULL);
         while (n_items-- > 0)
           gtk_combo_box_remove_text(GTK_COMBO_BOX(wind->date_format_combo), 0);
 
-        if ((date_formats = scm_call_2(parse_results,
-                                       SCM_CDR(parse_return),
-                                       scm_str2symbol("date"))) != SCM_BOOL_F) {
-          while(SCM_LISTP(date_formats) && !SCM_NULLP(date_formats)) {
-            gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo),
-                                      SCM_SYMBOL_CHARS(SCM_CAR(date_formats)));
-            date_formats = SCM_CDR(date_formats);
-          }
+        /* Add the formats for the user to select from. */
+        while(SCM_LISTP(date_formats) && !SCM_NULLP(date_formats))
+        {
+          gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo),
+                                    SCM_SYMBOL_CHARS(SCM_CAR(date_formats)));
+          date_formats = SCM_CDR(date_formats);
+        }
         gtk_combo_box_set_active(GTK_COMBO_BOX(wind->date_format_combo), 0);
 
-          ask_date_format = TRUE;
-
-        } else {
-          /* FIXME: we've got a "warning" but it's not the date! */
-          ;
-        }
+        wind->ask_date_format = TRUE;
       }
+    }
+    else
+    {
+      /* Parsing failed. */
+      imported_files = scm_call_2(unload_qif_file, scm_qiffile, imported_files);
+      gnc_progress_dialog_set_sub(wind->load_progress, _("Failed"));
+      gnc_progress_dialog_reset_value(wind->load_progress);
 
-      /* turn back the cursor */
-      gnc_unset_busy_cursor(NULL);
+      gtk_widget_set_sensitive(wind->load_pause, FALSE);
+      wind->busy = FALSE;
+      return;
+    }
+  }
 
-      /* Can this ever happen??? */
-      if(parse_return == SCM_BOOL_F) {
-        gnc_error_dialog(wind->window,
-                         _("An error occurred while parsing the QIF file."));
-        imported_files =
-          scm_call_2(unload_qif_file, scm_qiffile, imported_files);
-        return TRUE;
-      }
-      else if((parse_return != SCM_BOOL_T) &&
-         (!SCM_LISTP(parse_return) ||
-          (SCM_CAR(parse_return) != SCM_BOOL_T))) {
-        const gchar *warn_str = SCM_STRING_CHARS(SCM_CDADR(parse_return));
-        gnc_error_dialog(wind->window,
-                         _("QIF file parse failed: %s"),
-                         warn_str ? warn_str : "(null)");
+  /* The file was loaded successfully. */
+  gnc_progress_dialog_set_sub(wind->load_progress, _("Loading completed"));
+  gnc_progress_dialog_set_value(wind->load_progress, 1);
 
-        imported_files =
-          scm_call_2(unload_qif_file, scm_qiffile, imported_files);
+  scm_gc_unprotect_object(wind->imported_files);
+  wind->imported_files = imported_files;
+  scm_gc_protect_object(wind->imported_files);
 
-        return TRUE;
-      }
-    }
+  /* Enable all buttons. */
+  gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
+                                    TRUE, TRUE, TRUE, TRUE);
 
-    scm_gc_unprotect_object(wind->imported_files);
-    wind->imported_files = imported_files;
-    scm_gc_protect_object(wind->imported_files);
+  /* If the log is empty, move on to the next page automatically. */
+  if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(wind->load_log))) == 0)
+    gnome_druid_page_next(GNOME_DRUID_PAGE(widget));
 
-    if(ask_date_format) {
-      /* we need to get a date format, so go to the next page */
-      return gnc_ui_qif_import_generic_next_cb(page, arg1, wind);
-    }
-    else if(scm_call_1(check_from_acct, SCM_CAR(imported_files)) != SCM_BOOL_T) {
-      /* skip to the "ask account name" page */
-      default_acctname =
-        SCM_STRING_CHARS(scm_call_1(default_acct, SCM_CAR(imported_files)));
-      gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname);
+  gtk_widget_set_sensitive(wind->load_pause, FALSE);
+  wind->busy = FALSE;
+  return;
+}
 
-      gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                           get_named_page(wind, "account_name_page"));
-      return TRUE;
-    }
-    else {
-      /* skip ahead to the "loaded files" page */
-      gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                           get_named_page(wind, "loaded_files_page"));
-      return TRUE;
-    }
+
+/********************************************************************
+ * gnc_ui_qif_import_load_progress_pause_cb
+ *
+ * Invoked when the "Pause" button is clicked.
+ ********************************************************************/
+
+static void
+gnc_ui_qif_import_load_progress_pause_cb(GtkButton * button,
+                                         gpointer user_data)
+{
+  QIFImportWindow *wind = user_data;
+  SCM toggle_pause      = scm_c_eval_string("qif-import:toggle-pause");
+  SCM progress;
+
+  if (!wind->busy)
+    return;
+
+  /* Create SCM for the progress helper. */
+  progress = SWIG_NewPointerObj(wind->load_progress,
+                                SWIG_TypeQuery("_p__GNCProgressDialog"),
+                                0);
+
+  /* Pause (or resume) the currently running operation. */
+  scm_call_1(toggle_pause, progress);
+
+  /* Swap the button label between pause and resume. */
+  if (strcmp(gtk_button_get_label(button), _("_Resume")))
+  {
+    gtk_button_set_use_stock(button, FALSE);
+    gtk_button_set_use_underline(button, TRUE);
+    gtk_button_set_label(button, _("_Resume"));
   }
+  else
+  {
+    gtk_button_set_use_stock(button, TRUE);
+    gtk_button_set_use_underline(button, FALSE);
+    gtk_button_set_label(button, "gtk-media-pause");
+  }
+}
 
+
+/********************************************************************
+ * gnc_ui_qif_import_load_progress_next_cb
+ *
+ * Determine the next page after loading a file successfully.
+ ********************************************************************/
+
+static gboolean
+gnc_ui_qif_import_load_progress_next_cb(GnomeDruidPage * page,
+                                        gpointer arg1,
+                                        gpointer user_data)
+{
+  QIFImportWindow *wind = user_data;
+  SCM check_from_acct   = scm_c_eval_string("qif-file:check-from-acct");
+
+  if (wind->ask_date_format)
+  {
+    /* We need to get a date format, so go to the next page. */
+    return gnc_ui_qif_import_generic_next_cb(page, arg1, user_data);
+  }
+  else if (scm_call_1(check_from_acct, wind->selected_file) != SCM_BOOL_T)
+  {
+    SCM default_acct = scm_c_eval_string("qif-file:path-to-accountname");
+    const gchar * default_acctname;
+
+    /* Go to the "ask account name" page. */
+    default_acctname = SCM_STRING_CHARS(scm_call_1(default_acct,
+                                                   wind->selected_file));
+    gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname);
+
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                         get_named_page(wind, "account_name_page"));
+    return TRUE;
+  }
+
+  /* Skip ahead to the "loaded files" page. */
+  gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                       get_named_page(wind, "loaded_files_page"));
+
+  return TRUE;
+}
+
+
+/****************************************************************
+ * load_progress_back_timeout_cb
+ *
+ * This timer callback function waits until the busy flag
+ * has been cleared before going back to the previous page.
+ ****************************************************************/
+
+static gboolean
+load_progress_back_timeout_cb(gpointer data)
+{
+  QIFImportWindow *wind = data;
+
+  if (wind->busy)
+    /* Wait for timer to go off again. */
+    return TRUE;
+
+  /* The busy flag was lowered. Go back to the previous page. */
+  gnome_druid_page_back(get_named_page(wind, "load_progress_page"));
+
+  /* Cancel the timer. */
   return FALSE;
 }
 
+
+/********************************************************************
+ * gnc_ui_qif_import_load_progress_back_cb
+ *
+ * Return to the previous page, waiting if necessary.
+ ********************************************************************/
+
 static gboolean
+gnc_ui_qif_import_load_progress_back_cb(GnomeDruidPage * page,
+                                        gpointer arg1,
+                                        gpointer user_data)
+{
+  QIFImportWindow *wind = user_data;
+
+  if (wind->busy)
+  {
+    /* Cancel any long-running Scheme operation. */
+    scm_c_eval_string("(qif-import:cancel)");
+
+    /* Wait for the busy flag to be lowered. */
+    g_timeout_add(200, load_progress_back_timeout_cb, user_data);
+
+    return TRUE;
+  }
+
+  return gnc_ui_qif_import_generic_back_cb(page, arg1, user_data);
+}
+
+
+static gboolean
 gnc_ui_qif_import_date_format_next_cb(GnomeDruidPage * page,
                                       gpointer arg1,
                                       gpointer user_data)
@@ -867,23 +1142,35 @@
   SCM  format_sym;
   gchar *text;
 
+  /* Get the selected date format. */
   text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->date_format_combo));
+  if (!text)
+  {
+    g_critical("QIF import: BUG DETECTED in gnc_ui_qif_import_date_format_next_cb. Format is NULL.");
+    return TRUE;
+  }
   format_sym = scm_str2symbol(text);
   g_free(text);
+
+  /* Reparse the dates using the selected format. */
   scm_call_2(reparse_dates, wind->selected_file, format_sym);
 
-  if(scm_call_1(check_from_acct, wind->selected_file) != SCM_BOOL_T) {
-    SCM default_acct    = scm_c_eval_string("qif-file:path-to-accountname");
+  /* Determine the next page to display. */
+  if (scm_call_1(check_from_acct, wind->selected_file) != SCM_BOOL_T)
+  {
+    /* There is an account name missing. Ask the user to provide one. */
+    SCM default_acct = scm_c_eval_string("qif-file:path-to-accountname");
     const gchar * default_acctname;
 
     default_acctname = SCM_STRING_CHARS(scm_call_1(default_acct,
-                                                    wind->selected_file));
+                                                   wind->selected_file));
     gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname);
 
     return FALSE;
   }
-  else {
-    /* skip ahead to the "loaded files" page */
+  else
+  {
+    /* Skip ahead to the "loaded files" page. */
     gnome_druid_set_page(GNOME_DRUID(wind->druid),
                          get_named_page(wind, "loaded_files_page"));
 
@@ -928,7 +1215,7 @@
                        FILENAME_COL_INDEX, row++,
                        FILENAME_COL_NAME, row_text,
                        -1);
-    if(scm_qiffile == wind->selected_file) {
+    if (scm_qiffile == wind->selected_file) {
       path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
       reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
       gtk_tree_path_free(path);
@@ -967,7 +1254,7 @@
   button = gnc_glade_lookup_widget(wind->window, "unload_file_button");
   if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
     gtk_tree_model_get(model, &iter, FILENAME_COL_INDEX, &row, -1);
-    if(SCM_LISTP(wind->imported_files) &&
+    if (SCM_LISTP(wind->imported_files) &&
        (scm_ilength(wind->imported_files) > row)) {
       scm_gc_unprotect_object(wind->selected_file);
       wind->selected_file = scm_list_ref(wind->imported_files,
@@ -1041,7 +1328,7 @@
   SCM unload_qif_file = scm_c_eval_string("qif-dialog:unload-qif-file");
   SCM imported_files;
 
-  if(wind->selected_file != SCM_BOOL_F) {
+  if (wind->selected_file != SCM_BOOL_F) {
     imported_files =
       scm_call_2(unload_qif_file, wind->selected_file, wind->imported_files);
 
@@ -1099,7 +1386,7 @@
   SCM    scm_name;
 
   g_return_val_if_fail(wind->selected_file != SCM_BOOL_F, FALSE);
-  if(!acct_name || acct_name[0] == 0) {
+  if (!acct_name || acct_name[0] == 0) {
     gnc_warning_dialog(wind->window, _("You must enter an account name."));
     return TRUE;
   }
@@ -1161,7 +1448,8 @@
   GtkTreeViewColumn *column;
 
   store = gtk_list_store_new(NUM_ACCOUNT_COLS, G_TYPE_INT, G_TYPE_STRING,
-                             G_TYPE_STRING, G_TYPE_BOOLEAN);
+                             G_TYPE_STRING, G_TYPE_BOOLEAN,
+                             PANGO_TYPE_ELLIPSIZE_MODE);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
   g_object_unref(store);
 
@@ -1170,8 +1458,11 @@
                                                     renderer,
                                                     "text",
                                                     ACCOUNT_COL_QIF_NAME,
+                                                    "ellipsize",
+                                                    ACCOUNT_COL_ELLIPSIZE,
                                                     NULL);
   g_object_set(column, "expand", TRUE, NULL);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_text_new();
@@ -1179,8 +1470,11 @@
                                                     renderer,
                                                     "text",
                                                     ACCOUNT_COL_GNC_NAME,
+                                                    "ellipsize",
+                                                    ACCOUNT_COL_ELLIPSIZE,
                                                     NULL);
   g_object_set(column, "expand", TRUE, NULL);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_toggle_new();
@@ -1652,268 +1946,6 @@
 
 
 /****************************************************************
- * gnc_ui_qif_import_commodity_update
- *
- * This function updates the commodities based on the values for
- * mnemonic, namespace, and name approved by the user.
- ****************************************************************/
-
-static void
-gnc_ui_qif_import_commodity_update(QIFImportWindow * wind)
-{
-  GList          *pageptr;
-  GnomeDruidPage *gtkpage;
-  QIFDruidPage   *page;
-  const gchar    *mnemonic = NULL;
-  gchar          *namespace = NULL;
-  const gchar    *fullname = NULL;
-  gnc_commodity  *tab_commodity;
-
-  for (pageptr = wind->commodity_pages; pageptr; pageptr=pageptr->next)
-  {
-    gtkpage   = GNOME_DRUID_PAGE(pageptr->data);
-    page      = g_object_get_data(G_OBJECT(gtkpage), "page_struct");
-
-    /* Get any changes from the commodity page. */
-    mnemonic  = gtk_entry_get_text(GTK_ENTRY(page->new_mnemonic_entry));
-    namespace = gnc_ui_namespace_picker_ns(page->new_type_combo);
-    fullname  = gtk_entry_get_text(GTK_ENTRY(page->new_name_entry));
-
-    /* Update the commodity with the new values. */
-    gnc_commodity_set_namespace(page->commodity, namespace);
-    gnc_commodity_set_fullname(page->commodity, fullname);
-    gnc_commodity_set_mnemonic(page->commodity, mnemonic);
-
-    /* Add the commodity to the commodity table (if it isn't a duplicate). */
-    tab_commodity = gnc_commodity_table_lookup(gnc_get_current_commodities(),
-                                               namespace, mnemonic);
-    if (!tab_commodity || tab_commodity == page->commodity)
-      tab_commodity = gnc_commodity_table_insert(gnc_get_current_commodities(),
-                                                 page->commodity);
-
-    /* Update the security hash table. */
-    scm_hash_set_x(wind->security_hash,
-                   page->hash_key,
-                   SWIG_NewPointerObj(tab_commodity,
-                                      SWIG_TypeQuery("_p_gnc_commodity"), 0));
-
-    g_free(namespace);
-  }
-}
-
-
-/****************************************************************
- * gnc_ui_qif_import_prepare_duplicates
- *
- * This function prepares the duplicates checking page.
- ****************************************************************/
-
-static void
-gnc_ui_qif_import_prepare_duplicates(QIFImportWindow * wind)
-{
-  GtkTreeView      *view;
-  GtkListStore     *store;
-  SCM               duplicates;
-  SCM               current_xtn;
-  Transaction      *gnc_xtn;
-  Split            *gnc_split;
-  GtkTreeIter       iter;
-  GtkTreeSelection *selection;
-  GtkTreePath      *path;
-  const gchar      *amount_str;
-  int               rownum = 0;
-
-  view = GTK_TREE_VIEW(wind->new_transaction_view);
-  store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
-  gtk_list_store_clear(store);
-
-  /* Loop through the list of new, potentially duplicate transactions. */
-  duplicates = wind->match_transactions;
-  while (!SCM_NULLP(duplicates))
-  {
-    current_xtn = SCM_CAAR(duplicates);
-    #define FUNC_NAME "xaccTransCountSplits"
-    gnc_xtn     = SWIG_MustGetPtr(current_xtn,
-                                  SWIG_TypeQuery("_p_Transaction"), 1, 0);
-    #undef FUNC_NAME
-    if (xaccTransCountSplits(gnc_xtn) > 2)
-      amount_str = _("(split)");
-    else
-    {
-      gnc_split = xaccTransGetSplit(gnc_xtn, 0);
-      amount_str =
-        xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
-                        gnc_account_print_info
-                        (xaccSplitGetAccount(gnc_split), TRUE));
-    }
-
-    gtk_list_store_append(store, &iter);
-    gtk_list_store_set
-      (store, &iter,
-       QIF_TRANS_COL_INDEX, rownum++,
-       QIF_TRANS_COL_DATE,
-       gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
-       QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
-       QIF_TRANS_COL_AMOUNT, amount_str,
-       -1);
-
-    duplicates = SCM_CDR(duplicates);
-  }
-
-  selection = gtk_tree_view_get_selection(view);
-  path = gtk_tree_path_new_from_indices(0, -1);
-  gtk_tree_selection_select_path(selection, path);
-  gtk_tree_path_free(path);
-}
-
-
-/****************************************************************
- * gnc_ui_qif_import_convert_undo
- *
- * This function launches the Scheme procedure that un-imports
- * any imported accounts and transactions.
- ****************************************************************/
-
-static void
-gnc_ui_qif_import_convert_undo(QIFImportWindow * wind)
-{
-  SCM undo = scm_c_eval_string("qif-import:qif-to-gnc-undo");
-
-  /* Undo the conversion. */
-  scm_call_1(undo, wind->imported_account_tree);
-
-  /* There's no imported account tree any more. */
-  scm_gc_unprotect_object(wind->imported_account_tree);
-  wind->imported_account_tree = SCM_BOOL_F;
-  scm_gc_protect_object(wind->imported_account_tree);
-
-
-  /* Get rid of the list of matched transactions. */
-  scm_gc_unprotect_object(wind->match_transactions);
-  wind->match_transactions = SCM_BOOL_F;
-  scm_gc_protect_object(wind->match_transactions);
-}
-
-
-/****************************************************************
- * gnc_ui_qif_import_convert
- *
- * This function launches the Scheme procedures that actually do
- * the work of (a) converting the QIF data into GnuCash accounts
- * transactions, and (b) checking for possible duplication. Then
- * the next druid page is prepared and displayed.
- ****************************************************************/
-
-static gboolean
-gnc_ui_qif_import_convert(QIFImportWindow * wind)
-{
-  SCM   qif_to_gnc      = scm_c_eval_string("qif-import:qif-to-gnc");
-  SCM   find_duplicates = scm_c_eval_string("gnc:account-tree-find-duplicates");
-  SCM   retval;
-  SCM   window;
-
-  /* Get the default currency. */
-  gchar *currname =
-    gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->currency_picker));
-
-  /* Let the user know we're busy. */
-  gnc_suspend_gui_refresh();
-  gnc_set_busy_cursor(NULL, TRUE);
-
-  /* Update the commodities. */
-  gnc_ui_qif_import_commodity_update(wind);
-
-  /* Call a Scheme function to do the work.  The return value is the
-   * root account of an account tree containing all the new accounts
-   * and transactions */
-  window = SWIG_NewPointerObj(wind->window, SWIG_TypeQuery("_p_GtkWidget"), 0);
-  retval = scm_apply(qif_to_gnc,
-                     SCM_LIST7(wind->imported_files,
-                               wind->acct_map_info,
-                               wind->cat_map_info,
-                               wind->memo_map_info,
-                               wind->security_hash,
-                               scm_makfrom0str(currname),
-                               window),
-                     SCM_EOL);
-  g_free(currname);
-  gnc_unset_busy_cursor(NULL);
-
-  if (retval == SCM_BOOL_F)
-  {
-    /* An error occurred during conversion. */
-
-    /* Remove any converted data. */
-    gnc_ui_qif_import_convert_undo(wind);
-
-    /* We don't know what data structures may have become corrupted,
-     * so we shouldn't allow further action. Display the failure
-     * page next, and only allow the user to cancel. */
-    gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                         get_named_page(wind, "failed_page"));
-    gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
-                                      FALSE, FALSE, TRUE, TRUE);
-  }
-  else
-  {
-    /* Save the imported account tree. */
-    scm_gc_unprotect_object(wind->imported_account_tree);
-    wind->imported_account_tree = retval;
-    scm_gc_protect_object(wind->imported_account_tree);
-
-    /* Detect duplicate transactions. */
-    gnc_set_busy_cursor(NULL, TRUE);
-    retval = scm_call_3(find_duplicates,
-                        scm_c_eval_string("(gnc-get-current-root-account)"),
-                        wind->imported_account_tree, window);
-    gnc_unset_busy_cursor(NULL);
-
-    /* Save the results. */
-    scm_gc_unprotect_object(wind->match_transactions);
-    wind->match_transactions = retval;
-    scm_gc_protect_object(wind->match_transactions);
-
-    /* Were any potential duplicates found? */
-    if (retval == SCM_BOOL_F)
-    {
-      /* An error occurred during duplicate checking. */
-
-      /* Remove any converted data. */
-      gnc_ui_qif_import_convert_undo(wind);
-
-      /* Display the failure page. */
-      gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                           get_named_page(wind, "failed_page"));
-      gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
-                                        FALSE, FALSE, TRUE, TRUE);
-    }
-    else if (SCM_NULLP(retval))
-    {
-      /* No potential duplicates, so skip to the last page. */
-      gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                           get_named_page(wind, "end_page"));
-    }
-    else
-    {
-      /* Prepare the duplicates page. */
-      gnc_ui_qif_import_prepare_duplicates(wind);
-
-      /* Display the next page. */
-      if (wind->show_doc_pages)
-        gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                             get_named_page(wind, "match_doc_page"));
-      else
-        gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                             get_named_page(wind, "match_duplicates_page"));
-    }
-  }
-
-  gnc_resume_gui_refresh();
-  return TRUE;
-}
-
-
-/****************************************************************
  * gnc_ui_qif_import_new_securities
  *
  * This function creates or updates the list of QIF securities
@@ -2003,16 +2035,16 @@
   gchar           *ns;
 
   /* Get any entered namespace. */
-  ns = gtk_combo_box_get_active_text(GTK_COMBO_BOX(qpage->new_type_combo));
+  ns = gtk_combo_box_get_active_text(GTK_COMBO_BOX(qpage->namespace_combo));
 
   /* Update the namespaces available to select. */
   if (!ns || !ns[0])
     gnc_ui_update_namespace_picker(
-      qpage->new_type_combo,
+      qpage->namespace_combo,
       gnc_commodity_get_namespace(qpage->commodity),
       DIAG_COMM_ALL);
   else
-    gnc_ui_update_namespace_picker(qpage->new_type_combo, ns, DIAG_COMM_ALL);
+    gnc_ui_update_namespace_picker(qpage->namespace_combo, ns, DIAG_COMM_ALL);
 
   g_free(ns);
 }
@@ -2030,29 +2062,34 @@
   gnc_commodity_table     *table;
   gnc_commodity_namespace *newns;
 
-  gchar       *namespace = gnc_ui_namespace_picker_ns(qpage->new_type_combo);
-  const gchar *name      = gtk_entry_get_text(GTK_ENTRY(qpage->new_name_entry));
-  const gchar *mnemonic  = gtk_entry_get_text(GTK_ENTRY(qpage->new_mnemonic_entry));
+  gchar       *namespace = gnc_ui_namespace_picker_ns(qpage->namespace_combo);
+  const gchar *name      = gtk_entry_get_text(GTK_ENTRY(qpage->name_entry));
+  const gchar *mnemonic  = gtk_entry_get_text(GTK_ENTRY(qpage->mnemonic_entry));
 
-  if(!namespace || (namespace[0] == 0)) {
+  if (!name || (name[0] == 0)) {
     gnc_warning_dialog(wind->window,
-                       _("You must enter a Type for the commodity."));
-    if (namespace)
-      g_free(namespace);
+     _("Enter a name or short description, such as \"Red Hat Stock\"."));
+    g_free(namespace);
     return TRUE;
   }
-  else if(!name || (name[0] == 0)) {
+  else if (!mnemonic || (mnemonic[0] == 0)) {
     gnc_warning_dialog(wind->window,
-                       _("You must enter a name for the commodity."));
+     _("Enter the ticker symbol or other well known abbreviation, such as"
+       " \"RHT\". If there isn't one, or you don't know it, create your own."));
     g_free(namespace);
     return TRUE;
   }
-  else if(!mnemonic || (mnemonic[0] == 0)) {
-    gnc_warning_dialog
-      (wind->window, _("You must enter an abbreviation for the commodity."));
-    g_free(namespace);
+  else if (!namespace || (namespace[0] == 0)) {
+    gnc_warning_dialog(wind->window,
+     _("Select the exchange on which the symbol is traded, or select the"
+       " type of investment (such as FUND for mutual funds.) If you don't"
+       " see your exchange or an appropriate investment type, you can"
+       " enter a new one."));
+    if (namespace)
+      g_free(namespace);
     return TRUE;
   }
+
   /* FIXME: Should check whether a commodity with this namespace and
    *        mnemonic already exists. If so, ask the user whether to use
    *        the existing one, or go back and change what they've entered.
@@ -2089,14 +2126,7 @@
   else
     g_free(namespace);
 
-  if(page == (g_list_last(wind->commodity_pages))->data)
-  {
-    /* it's time to import the accounts. */
-    gnc_ui_qif_import_convert(wind);
-    return TRUE;
-  }
-  else
-    return FALSE;
+  return FALSE;
 }
 
 
@@ -2105,13 +2135,27 @@
 {
 
   QIFDruidPage *retval = g_new0(QIFDruidPage, 1);
-  GtkWidget    *top_vbox;
-  GtkWidget    *info_label;
-  GtkWidget    *next_label;
-  GtkWidget    *temp;
+  GtkWidget    *table;
+  GtkWidget    *label;
   gchar        *title = NULL;
   const char   *str;
   GnomeDruidPageStandard *page;
+  char         *name_tooltip =
+   _("Enter a name or short description, such as \"Red Hat Stock\".");
+  char         *mnemonic_tooltip =
+   _("Enter the ticker symbol or other well known abbreviation, such as"
+     " \"RHT\". If there isn't one, or you don't know it, create your own.");
+  char         *namespace_tooltip =
+   _("Select the exchange on which the symbol is traded, or select the"
+     " type of investment (such as FUND for mutual funds.) If you don't"
+     " see your exchange or an appropriate investment type, you can"
+     " enter a new one.");
+#if GTK_CHECK_VERSION(2, 12, 0)
+  /* Use the GtkTooltip API */
+#elif GTK_CHECK_VERSION(2, 6, 0)
+  /* Use the deprecated GtkTooltips API */
+  GtkTooltips  *tooltips = gtk_tooltips_new();
+#endif
 
   /* Make the page widget. */
   retval->page = gnome_druid_page_standard_new_with_vals("", NULL, NULL);
@@ -2131,82 +2175,82 @@
   g_free(title);
 
   /* Set the page colors. */
-  gnome_druid_page_standard_set_background(page, & std_bg_color);
-  gnome_druid_page_standard_set_logo_background(page, & std_logo_bg_color);
-  gnome_druid_page_standard_set_title_foreground(page, & std_title_color);
+  gnome_druid_page_standard_set_background(page, &std_bg_color);
+  gnome_druid_page_standard_set_logo_background(page, &std_logo_bg_color);
+  gnome_druid_page_standard_set_title_foreground(page, &std_title_color);
 
   /*
    * Add all the widgets to the page.
    */
-  top_vbox = gtk_vbox_new(FALSE, 3);
-  gtk_box_pack_start(GTK_BOX(page->vbox), top_vbox, FALSE, FALSE, 0);
+  table = gtk_table_new(3, 2, FALSE);
+  gtk_table_set_row_spacings(GTK_TABLE(table), 6);
+  gtk_table_set_col_spacings(GTK_TABLE(table), 12);
 
-  info_label = gtk_label_new(_("Pick the commodity's exchange or listing "
-                               "(NASDAQ, NYSE, etc)."));
-  gtk_label_set_justify(GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
-  gtk_box_pack_start(GTK_BOX(top_vbox), info_label, TRUE, TRUE, 0);
-
-  temp = gtk_hbox_new(FALSE, 0);
-  gtk_box_pack_start(GTK_BOX(top_vbox), temp, FALSE, FALSE, 0);
-
-  info_label = gtk_label_new("");
-  gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
-
-  retval->new_type_combo = gtk_combo_box_entry_new_text();
-  gnc_cbe_add_completion(GTK_COMBO_BOX_ENTRY(retval->new_type_combo));
-  gtk_box_pack_start(GTK_BOX(temp), retval->new_type_combo, TRUE, TRUE, 0);
-
-  info_label = gtk_label_new("");
-  gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
-
-  info_label = gtk_label_new(_("Enter the full name of the commodity, "
-                               "such as \"Red Hat Stock\""));
-
-  gtk_label_set_justify(GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
-  gtk_box_pack_start(GTK_BOX(top_vbox), info_label, TRUE, TRUE, 0);
-
-  temp = gtk_hbox_new(FALSE, 0);
-  gtk_box_pack_start(GTK_BOX(top_vbox), temp, FALSE, FALSE, 0);
-
-  info_label = gtk_label_new("");
-  gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
-
-  retval->new_name_entry = gtk_entry_new();
-  gtk_box_pack_start(GTK_BOX(temp), retval->new_name_entry,
-                     TRUE, TRUE, 0);
-  gtk_entry_set_text(GTK_ENTRY(retval->new_name_entry),
+  /* Name entry */
+  retval->name_entry = gtk_entry_new();
+  gtk_entry_set_text(GTK_ENTRY(retval->name_entry),
                      gnc_commodity_get_fullname(comm));
-
-  info_label = gtk_label_new("");
-  gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
-
-  info_label = gtk_label_new(_("Enter the ticker symbol (such as \"RHAT\") or "
-                               "other unique abbreviation for the name."));
-
-  gtk_label_set_justify(GTK_LABEL(info_label), GTK_JUSTIFY_LEFT);
-  gtk_box_pack_start(GTK_BOX(top_vbox), info_label, TRUE, TRUE, 0);
-
-  temp = gtk_hbox_new(FALSE, 0);
-  gtk_box_pack_start(GTK_BOX(top_vbox), temp, FALSE, FALSE, 0);
-
-  info_label = gtk_label_new("");
-  gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
-
-  retval->new_mnemonic_entry = gtk_entry_new();
-  gtk_box_pack_start(GTK_BOX(temp), retval->new_mnemonic_entry,
-                     TRUE, TRUE, 0);
-  gtk_entry_set_text(GTK_ENTRY(retval->new_mnemonic_entry),
+  label = gtk_label_new_with_mnemonic(_("_Name or description:"));
+  gtk_label_set_mnemonic_widget(GTK_LABEL(label), retval->name_entry);
+  gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+#if GTK_CHECK_VERSION(2, 12, 0)
+  gtk_widget_set_tooltip_text(label, name_tooltip);
+  gtk_widget_set_tooltip_text(retval->name_entry, name_tooltip);
+#elif GTK_CHECK_VERSION(2, 6, 0)
+  gtk_tooltips_set_tip(tooltips, label,
+                       name_tooltip, NULL);
+  gtk_tooltips_set_tip(tooltips, retval->name_entry,
+                       name_tooltip, NULL);
+#endif
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
+                   GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach_defaults(GTK_TABLE(table), retval->name_entry,
+                            1, 2, 0, 1);
+  /* Mnemonic entry */
+  retval->mnemonic_entry = gtk_entry_new();
+  gtk_entry_set_text(GTK_ENTRY(retval->mnemonic_entry),
                      gnc_commodity_get_mnemonic(comm));
+  label = gtk_label_new_with_mnemonic(
+    _("_Ticker symbol or other abbreviation:"));
+  gtk_label_set_mnemonic_widget(GTK_LABEL(label), retval->mnemonic_entry);
+  gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+#if GTK_CHECK_VERSION(2, 12, 0)
+  gtk_widget_set_tooltip_text(label, mnemonic_tooltip);
+  gtk_widget_set_tooltip_text(retval->mnemonic_entry, mnemonic_tooltip);
+#elif GTK_CHECK_VERSION(2, 6, 0)
+  gtk_tooltips_set_tip(tooltips, label,
+                       mnemonic_tooltip, NULL);
+  gtk_tooltips_set_tip(tooltips, retval->mnemonic_entry,
+                       mnemonic_tooltip, NULL);
+#endif
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
+                   GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach_defaults(GTK_TABLE(table), retval->mnemonic_entry,
+                            1, 2, 1, 2);
 
-  info_label = gtk_label_new("");
-  gtk_box_pack_start(GTK_BOX(temp), info_label, TRUE, TRUE, 0);
+  /* Namespace entry */
+  retval->namespace_combo = gtk_combo_box_entry_new_text();
+  gnc_cbe_add_completion(GTK_COMBO_BOX_ENTRY(retval->namespace_combo));
+  label = gtk_label_new_with_mnemonic(
+    _("_Exchange or abbreviation type:"));
+  gtk_label_set_mnemonic_widget(GTK_LABEL(label), retval->namespace_combo);
+  gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+#if GTK_CHECK_VERSION(2, 12, 0)
+  gtk_widget_set_tooltip_text(label, namespace_tooltip);
+  gtk_widget_set_tooltip_text(retval->namespace_combo, namespace_tooltip);
+#elif GTK_CHECK_VERSION(2, 6, 0)
+  gtk_tooltips_set_tip(tooltips, label,
+                       namespace_tooltip, NULL);
+  gtk_tooltips_set_tip(tooltips, retval->namespace_combo,
+                       namespace_tooltip, NULL);
+#endif
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
+                   GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+  gtk_table_attach_defaults(GTK_TABLE(table), retval->namespace_combo,
+                            1, 2, 2, 3);
 
-  next_label = gtk_label_new(_("Click \"Forward\" to accept the information "
-                               "and move on."));
-  gtk_label_set_justify(GTK_LABEL(next_label), GTK_JUSTIFY_LEFT);
-  gtk_box_pack_end(GTK_BOX(top_vbox), next_label, TRUE, TRUE, 0);
+  gtk_box_pack_start(GTK_BOX(page->vbox), table, FALSE, FALSE, 0);
 
-
   return retval;
 }
 
@@ -2302,54 +2346,517 @@
 {
   QIFImportWindow * wind = user_data;
 
-  gnc_set_busy_cursor(NULL, TRUE);
+  /* If there are new securities, prepare the security pages. */
+  if (gnc_ui_qif_import_new_securities(wind))
+    prepare_security_pages(wind);
 
-  if (gnc_ui_qif_import_new_securities(wind))
+  return gnc_ui_qif_import_generic_next_cb(page, arg1, wind);
+}
+
+
+/****************************************************************
+ * gnc_ui_qif_import_commodity_update
+ *
+ * This function updates the commodities based on the values for
+ * mnemonic, namespace, and name approved by the user.
+ ****************************************************************/
+
+static void
+gnc_ui_qif_import_commodity_update(QIFImportWindow * wind)
+{
+  GList          *pageptr;
+  GnomeDruidPage *gtkpage;
+  QIFDruidPage   *page;
+  const gchar    *mnemonic = NULL;
+  gchar          *namespace = NULL;
+  const gchar    *fullname = NULL;
+  gnc_commodity  *tab_commodity;
+
+  for (pageptr = wind->commodity_pages; pageptr; pageptr=pageptr->next)
   {
-    /* There are new commodities, so show a commodity page next. */
-    if (wind->show_doc_pages)
-      gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                           get_named_page(wind, "commodity_doc_page"));
+    gtkpage   = GNOME_DRUID_PAGE(pageptr->data);
+    page      = g_object_get_data(G_OBJECT(gtkpage), "page_struct");
+
+    /* Get any changes from the commodity page. */
+    mnemonic  = gtk_entry_get_text(GTK_ENTRY(page->mnemonic_entry));
+    namespace = gnc_ui_namespace_picker_ns(page->namespace_combo);
+    fullname  = gtk_entry_get_text(GTK_ENTRY(page->name_entry));
+
+    /* Update the commodity with the new values. */
+    gnc_commodity_set_namespace(page->commodity, namespace);
+    gnc_commodity_set_fullname(page->commodity, fullname);
+    gnc_commodity_set_mnemonic(page->commodity, mnemonic);
+
+    /* Add the commodity to the commodity table (if it isn't a duplicate). */
+    tab_commodity = gnc_commodity_table_lookup(gnc_get_current_commodities(),
+                                               namespace, mnemonic);
+    if (!tab_commodity || tab_commodity == page->commodity)
+      tab_commodity = gnc_commodity_table_insert(gnc_get_current_commodities(),
+                                                 page->commodity);
+
+    /* Update the security hash table. */
+    scm_hash_set_x(wind->security_hash,
+                   page->hash_key,
+                   SWIG_NewPointerObj(tab_commodity,
+                                      SWIG_TypeQuery("_p_gnc_commodity"), 0));
+
+    g_free(namespace);
+  }
+}
+
+
+/****************************************************************
+ * gnc_ui_qif_import_prepare_duplicates
+ *
+ * This function prepares the duplicates checking page.
+ ****************************************************************/
+
+static void
+gnc_ui_qif_import_prepare_duplicates(QIFImportWindow * wind)
+{
+  GtkTreeView      *view;
+  GtkListStore     *store;
+  SCM               duplicates;
+  SCM               current_xtn;
+  Transaction      *gnc_xtn;
+  Split            *gnc_split;
+  GtkTreeIter       iter;
+  GtkTreeSelection *selection;
+  GtkTreePath      *path;
+  const gchar      *amount_str;
+  int               rownum = 0;
+
+  view = GTK_TREE_VIEW(wind->new_transaction_view);
+  store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+  gtk_list_store_clear(store);
+
+  if (!SCM_LISTP(wind->match_transactions))
+    return;
+
+  /* Loop through the list of new, potentially duplicate transactions. */
+  duplicates = wind->match_transactions;
+  while (!SCM_NULLP(duplicates))
+  {
+    current_xtn = SCM_CAAR(duplicates);
+    #define FUNC_NAME "xaccTransCountSplits"
+    gnc_xtn     = SWIG_MustGetPtr(current_xtn,
+                                  SWIG_TypeQuery("_p_Transaction"), 1, 0);
+    #undef FUNC_NAME
+    if (xaccTransCountSplits(gnc_xtn) > 2)
+      amount_str = _("(split)");
     else
     {
-      prepare_security_pages(wind);
-      gnome_druid_set_page(GNOME_DRUID(wind->druid),
-                           GNOME_DRUID_PAGE(wind->commodity_pages->data));
+      gnc_split = xaccTransGetSplit(gnc_xtn, 0);
+      amount_str =
+        xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
+                        gnc_account_print_info
+                        (xaccSplitGetAccount(gnc_split), TRUE));
     }
+
+    gtk_list_store_append(store, &iter);
+    gtk_list_store_set
+      (store, &iter,
+       QIF_TRANS_COL_INDEX, rownum++,
+       QIF_TRANS_COL_DATE,
+       gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
+       QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
+       QIF_TRANS_COL_AMOUNT, amount_str,
+       -1);
+
+    duplicates = SCM_CDR(duplicates);
   }
-  else
-    /* It's time to import the accounts. */
-    gnc_ui_qif_import_convert(wind);
 
+  selection = gtk_tree_view_get_selection(view);
+  path = gtk_tree_path_new_from_indices(0, -1);
+  gtk_tree_selection_select_path(selection, path);
+  gtk_tree_path_free(path);
+}
+
+
+/****************************************************************
+ * gnc_ui_qif_import_convert_undo
+ *
+ * This function launches the Scheme procedure that un-imports
+ * any imported accounts and transactions.
+ ****************************************************************/
+
+static void
+gnc_ui_qif_import_convert_undo(QIFImportWindow * wind)
+{
+  SCM undo = scm_c_eval_string("qif-import:qif-to-gnc-undo");
+
+  gnc_set_busy_cursor(NULL, TRUE);
+
+  /* Undo the conversion. */
+  scm_call_1(undo, wind->imported_account_tree);
+
+  /* There's no imported account tree any more. */
+  scm_gc_unprotect_object(wind->imported_account_tree);
+  wind->imported_account_tree = SCM_BOOL_F;
+  scm_gc_protect_object(wind->imported_account_tree);
+
+
+  /* Get rid of the list of matched transactions. */
+  scm_gc_unprotect_object(wind->match_transactions);
+  wind->match_transactions = SCM_BOOL_F;
+  scm_gc_protect_object(wind->match_transactions);
+
   gnc_unset_busy_cursor(NULL);
-  return TRUE;
 }
 
 
 /********************************************************************
- * gnc_ui_qif_import_commodity_prepare_cb
+ * gnc_ui_qif_import_convert_progress_prepare_cb
  *
- * build a mapping of QIF security name to gnc_commodity
+ * Prepare the data conversion progress page for display.
  ********************************************************************/
 
 static void
-gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
-                                       gpointer arg1,
-                                       gpointer user_data)
+gnc_ui_qif_import_convert_progress_prepare_cb(GnomeDruidPage * page,
+                                              gpointer arg1,
+                                              gpointer user_data)
 {
-  QIFImportWindow * wind = user_data;
+  QIFImportWindow   *wind = user_data;
 
-  /* This shouldn't happen, but do the right thing if it does. */
-  if (wind->new_securities == SCM_BOOL_F || SCM_NULLP(wind->new_securities))
+  /* Reset the progress display. */
+  gnc_progress_dialog_set_primary(wind->convert_progress, "");
+  gnc_progress_dialog_set_secondary(wind->convert_progress,
+    _("GnuCash is now importing your QIF data. If there are no errors or warnings, you will automatically proceed to the next step. Otherwise, the details will be shown below for your review."));
+  gnc_progress_dialog_set_sub(wind->convert_progress, " ");
+  gnc_progress_dialog_reset_value(wind->convert_progress);
+  gnc_progress_dialog_reset_log(wind->convert_progress);
+
+  /* Disable the "Forward" button for now.
+   *
+   * NOTE: Due to bug 91001 in GnomeDruid, gnome_druid_set_buttons_sensitive()
+   *       will not work in prepare callbacks unless they are run AFTER the
+   *       standard one. Make sure the Glade line has the callback set up with
+   *       after=yes. For example:
+   *         <signal name="prepare" handler="my_prepare_cb" after="yes"/>   */
+  gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
+                                    TRUE, FALSE, TRUE, TRUE);
+
+  /* Generate a show signal once the page is displayed. This
+   * will kick off our (potentially) long-running operations. */
+  gtk_widget_hide(GTK_WIDGET(page));
+  gtk_widget_set_sensitive(GTK_WIDGET(page), TRUE);
+  gtk_widget_show(GTK_WIDGET(page));
+}
+
+
+/********************************************************************
+ * gnc_ui_qif_import_convert_progress_show_cb
+ *
+ * Perform the conversion.
+ ********************************************************************/
+
+static void
+gnc_ui_qif_import_convert_progress_show_cb(GtkWidget *widget,
+                                           gpointer user_data)
+{
+  QIFImportWindow   *wind = user_data;
+  SCM qif_to_gnc      = scm_c_eval_string("qif-import:qif-to-gnc");
+  SCM find_duplicates = scm_c_eval_string("gnc:account-tree-find-duplicates");
+  SCM retval;
+
+  /* SCM for the progress dialog. */
+  SCM progress = SWIG_NewPointerObj(wind->convert_progress,
+                                    SWIG_TypeQuery("_p__GNCProgressDialog"),
+                                    0);
+
+  /* The default currency. */
+  gchar *currname =
+    gtk_combo_box_get_active_text(GTK_COMBO_BOX(wind->currency_picker));
+
+  /* Raise the busy flag so the druid can't be canceled unexpectedly. */
+  wind->busy = TRUE;
+  gtk_widget_set_sensitive(wind->convert_pause, TRUE);
+
+  /* Clear any previous pause or cancel state. */
+  scm_c_eval_string("(qif-import:reset-cancel-pause)");
+
+  /* Update the commodities. */
+  gnc_ui_qif_import_commodity_update(wind);
+
+
+  /*
+   * Convert the QIF data into GnuCash data.
+   *
+   * A Scheme function does all the work.  The return value is the
+   * root account of an account tree containing all the new accounts
+   * and transactions. Upon failure, #f is returned. If the user
+   * cancels, #t is returned.
+   */
+
+  /* This step will fill 70% of the bar. */
+  gnc_progress_dialog_push(wind->convert_progress, 0.7);
+  retval = scm_apply(qif_to_gnc,
+                     SCM_LIST7(wind->imported_files,
+                               wind->acct_map_info,
+                               wind->cat_map_info,
+                               wind->memo_map_info,
+                               wind->security_hash,
+                               scm_makfrom0str(currname),
+                               progress),
+                     SCM_EOL);
+  gnc_progress_dialog_pop(wind->convert_progress);
+  g_free(currname);
+
+  if (retval == SCM_BOOL_T)
   {
-    g_warning("QIF import: BUG DETECTED! Reached commodity doc page with nothing to do!");
-    gnc_ui_qif_import_convert(wind);
+    /* Canceled by the user. */
+
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->convert_pause, FALSE);
+
+    /* Remove any converted data. */
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Cleaning up"));
+    gnc_ui_qif_import_convert_undo(wind);
+
+    /* Inform the user. */
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Canceled"));
+    gnc_progress_dialog_reset_value(wind->convert_progress);
+
+    wind->busy = FALSE;
+    return;
   }
+  else if (retval == SCM_BOOL_F)
+  {
+    /* An bug was encountered during conversion. */
+
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->convert_pause, FALSE);
+
+    /* Remove any converted data. */
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Cleaning up"));
+    gnc_ui_qif_import_convert_undo(wind);
+
+    /* Inform the user. */
+    gnc_progress_dialog_append_log(wind->convert_progress,
+                     _( "A bug was detected while converting the QIF data."));
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Failed"));
+    gnc_progress_dialog_reset_value(wind->convert_progress);
+    gnc_error_dialog(wind->window,
+                     _( "A bug was detected while converting the QIF data."));
+    /* FIXME: How should we request that the user report this problem? */
+
+    wind->busy = FALSE;
+    return;
+  }
+  else if (SCM_SYMBOLP(retval))
+  {
+    /* An error was encountered during conversion. */
+
+    /* Disable the pause button. */
+    gtk_widget_set_sensitive(wind->convert_pause, FALSE);
+
+    /* Remove any converted data. */
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Cleaning up"));
+    gnc_ui_qif_import_convert_undo(wind);
+
+    /* Inform the user. */
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Failed"));
+    gnc_progress_dialog_reset_value(wind->convert_progress);
+
+    wind->busy = FALSE;
+    return;
+  }
+
+
+  /* Save the imported account tree. */
+  scm_gc_unprotect_object(wind->imported_account_tree);
+  wind->imported_account_tree = retval;
+  scm_gc_protect_object(wind->imported_account_tree);
+
+
+  /*
+   * Detect potentially duplicated transactions.
+   */
+
+  /* This step will fill the remainder of the bar. */
+  gnc_progress_dialog_push(wind->convert_progress, 1);
+  retval = scm_call_3(find_duplicates,
+                      scm_c_eval_string("(gnc-get-current-root-account)"),
+                      wind->imported_account_tree, progress);
+  gnc_progress_dialog_pop(wind->convert_progress);
+
+  /* Save the results. */
+  scm_gc_unprotect_object(wind->match_transactions);
+  wind->match_transactions = retval;
+  scm_gc_protect_object(wind->match_transactions);
+
+  if (retval == SCM_BOOL_T)
+  {
+    /* Canceled by the user. */
+    gtk_widget_set_sensitive(wind->convert_pause, FALSE);
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Canceling"));
+    wind->busy = FALSE;
+    return;
+  }
+  else if (retval == SCM_BOOL_F)
+  {
+    /* An error occurred during duplicate checking. */
+
+    /* Remove any converted data. */
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Cleaning up"));
+    gnc_ui_qif_import_convert_undo(wind);
+
+    /* Inform the user. */
+    gnc_progress_dialog_append_log(wind->convert_progress,
+                     _( "A bug was detected while detecting duplicates."));
+    gnc_progress_dialog_set_sub(wind->convert_progress, _("Failed"));
+    gnc_progress_dialog_reset_value(wind->convert_progress);
+    gnc_error_dialog(wind->window,
+                     _( "A bug was detected while detecting duplicates."));
+    /* FIXME: How should we request that the user report this problem? */
+
+    gtk_widget_set_sensitive(wind->convert_pause, FALSE);
+    wind->busy = FALSE;
+    return;
+  }
+
+
+  /* The conversion completed successfully. */
+  gnc_progress_dialog_set_sub(wind->convert_progress,
+                              _("Conversion completed"));
+  gnc_progress_dialog_set_value(wind->convert_progress, 1);
+
+  /* Enable all buttons. */
+  gnome_druid_set_buttons_sensitive(GNOME_DRUID(wind->druid),
+                                    TRUE, TRUE, TRUE, TRUE);
+
+  /* If the log is empty, move on to the next page automatically. */
+  if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(wind->convert_log))) == 0)
+    gnome_druid_page_next(GNOME_DRUID_PAGE(widget));
+
+  gtk_widget_set_sensitive(wind->convert_pause, FALSE);
+  wind->busy = FALSE;
+  return;
+}
+
+
+/********************************************************************
+ * gnc_ui_qif_import_convert_progress_pause_cb
+ *
+ * Invoked when the "Pause" button is clicked.
+ ********************************************************************/
+
+static void
+gnc_ui_qif_import_convert_progress_pause_cb(GtkButton * button,
+                                            gpointer user_data)
+{
+  QIFImportWindow *wind = user_data;
+  SCM toggle_pause      = scm_c_eval_string("qif-import:toggle-pause");
+  SCM progress;
+
+  if (!wind->busy)
+    return;
+
+  /* Create SCM for the progress helper. */
+  progress = SWIG_NewPointerObj(wind->convert_progress,
+                                SWIG_TypeQuery("_p__GNCProgressDialog"),
+                                0);
+
+  /* Pause (or resume) the currently running operation. */
+  scm_call_1(toggle_pause, progress);
+
+  /* Swap the button label between pause and resume. */
+  if (strcmp(gtk_button_get_label(button), _("_Resume")))
+  {
+    gtk_button_set_use_stock(button, FALSE);
+    gtk_button_set_use_underline(button, TRUE);
+    gtk_button_set_label(button, _("_Resume"));
+  }
   else
-    prepare_security_pages(wind);
+  {
+    gtk_button_set_use_stock(button, TRUE);
+    gtk_button_set_use_underline(button, FALSE);
+    gtk_button_set_label(button, "gtk-media-pause");
+  }
 }
 
 
+/********************************************************************
+ * gnc_ui_qif_import_convert_progress_next_cb
+ *
+ * Determine the next page after converting successfully.
+ ********************************************************************/
+
+static gboolean
+gnc_ui_qif_import_convert_progress_next_cb(GnomeDruidPage * page,
+                                           gpointer arg1,
+                                           gpointer user_data)
+{
+  QIFImportWindow *wind = user_data;
+
+  if (SCM_NULLP(wind->match_transactions))
+  {
+    /* No potential duplicates, so skip to the last page. */
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                         get_named_page(wind, "end_page"));
+    return TRUE;
+  }
+
+  /* Prepare the duplicates page. */
+  gnc_ui_qif_import_prepare_duplicates(wind);
+
+  /* Display the next page. */
+  return gnc_ui_qif_import_generic_next_cb(page, arg1, wind);
+}
+
+
+/****************************************************************
+ * convert_progress_back_timeout_cb
+ *
+ * This timer callback function waits until the busy flag
+ * has been cleared before going back to the previous page.
+ ****************************************************************/
+
+static gboolean
+convert_progress_back_timeout_cb(gpointer data)
+{
+  QIFImportWindow *wind = data;
+
+  if (wind->busy)
+    /* Wait for timer to go off again. */
+    return TRUE;
+
+  /* The busy flag was lowered. Go back to the previous page. */
+  gnome_druid_page_back(get_named_page(wind, "convert_progress_page"));
+
+  /* Cancel the timer. */
+  return FALSE;
+}
+
+
+/********************************************************************
+ * gnc_ui_qif_import_convert_progress_back_cb
+ *
+ * Return to the previous page, waiting if necessary.
+ ********************************************************************/
+
+static gboolean
+gnc_ui_qif_import_convert_progress_back_cb(GnomeDruidPage * page,
+                                           gpointer arg1,
+                                           gpointer user_data)
+{
+  QIFImportWindow *wind = user_data;
+
+  if (wind->busy)
+  {
+    /* Cancel any long-running Scheme operation. */
+    scm_c_eval_string("(qif-import:cancel)");
+
+    /* Wait for the busy flag to be lowered. */
+    g_timeout_add(200, convert_progress_back_timeout_cb, user_data);
+
+    return TRUE;
+  }
+
+  return gnc_ui_qif_import_generic_back_cb(page, arg1, user_data);
+}
+
+
 static void
 refresh_old_transactions(QIFImportWindow * wind, int selection)
 {
@@ -2368,7 +2875,7 @@
   store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
   gtk_list_store_clear(store);
 
-  if(wind->match_transactions != SCM_BOOL_F) {
+  if (wind->match_transactions != SCM_BOOL_F) {
     possible_matches = SCM_CDR(scm_list_ref(wind->match_transactions,
                                   scm_int2num(wind->selected_transaction)));
     scm_call_2(scm_c_eval_string("qif-import:refresh-match-selection"),
@@ -2382,7 +2889,7 @@
       #undef FUNC_NAME
       selected    = SCM_CDR(current_xtn);
 
-      if(xaccTransCountSplits(gnc_xtn) > 2) {
+      if (xaccTransCountSplits(gnc_xtn) > 2) {
         amount_str = _("(split)");
       }
       else {
@@ -2533,20 +3040,21 @@
 
 
 /****************************************************************
- * gnc_ui_qif_import_cancel_cb
+ * do_cancel
  *
- * Invoked when the "Cancel" button is clicked.
+ * Clears out any imported data and shuts down the importer.
  ****************************************************************/
 
 static void
-gnc_ui_qif_import_cancel_cb(GnomeDruid * druid, gpointer user_data)
+do_cancel(QIFImportWindow * wind)
 {
-  QIFImportWindow     *wind = user_data;
   GList               *pageptr;
   GnomeDruidPage      *gtkpage;
   QIFDruidPage        *page;
   gnc_commodity_table *table;
 
+  gnc_set_busy_cursor(NULL, TRUE);
+
   /* Remove any converted data. */
   gnc_ui_qif_import_convert_undo(wind);
 
@@ -2570,11 +3078,61 @@
                                               wind->new_namespaces);
   }
 
+  gnc_unset_busy_cursor(NULL);
+
   /* Destroy the druid. */
   gnc_ui_qif_import_druid_destroy(wind);
 }
 
 
+/****************************************************************
+ * cancel_timeout_cb
+ *
+ * This timer callback function waits until the busy flag
+ * has been cleared before acting to cancel the import.
+ ****************************************************************/
+
+static gboolean
+cancel_timeout_cb(gpointer data)
+{
+  QIFImportWindow *wind = data;
+
+  if (wind->busy)
+    /* Wait for timer to go off again. */
+    return TRUE;
+
+  /* The busy flag was lowered. Perform the cancel. */
+  do_cancel(wind);
+
+  /* Cancel the timer. */
+  return FALSE;
+}
+
+
+/****************************************************************
+ * gnc_ui_qif_import_cancel_cb
+ *
+ * Invoked when the "Cancel" button is clicked.
+ ****************************************************************/
+
+static void
+gnc_ui_qif_import_cancel_cb(GnomeDruid * druid, gpointer user_data)
+{
+  QIFImportWindow     *wind = user_data;
+
+  if (wind->busy)
+  {
+    /* Cancel any long-running Scheme operation. */
+    scm_c_eval_string("(qif-import:cancel)");
+
+    /* Wait for the busy flag to be lowered. */
+    g_timeout_add(200, cancel_timeout_cb, user_data);
+  }
+  else
+    do_cancel(wind);
+}
+
+
 SCM
 gnc_ui_qif_import_druid_get_mappings(QIFImportWindow * w)
 {
@@ -2584,253 +3142,394 @@
 }
 
 
-/* ======================================================== */
 
-static gboolean
-show_handler(const char *class, gint component_id,
-             gpointer user_data, gpointer iter_data)
-{
-  QIFImportWindow *qif_win = user_data;
+/* ================================================================== */
+/*                                                                    */
+/*                         IMPORTER CREATION                          */
+/*                                                                    */
+/* ================================================================== */
 
-  if (!qif_win)
-    return(FALSE);
-  gtk_window_present(GTK_WINDOW(qif_win->window));
-  return(TRUE);
-}
 
-void
-gnc_file_qif_import(void)
+/********************************************************************
+ * get_preferences
+ *
+ * Get all user preferences related to QIF import.
+ ********************************************************************/
+
+static void
+get_preferences(QIFImportWindow *wind)
 {
-  if (gnc_forall_gui_components(DRUID_QIF_IMPORT_CM_CLASS,
-                                show_handler, NULL))
-    return;
+  GError * err = NULL;
 
-  /* pop up the QIF File Import dialog box */
-  gnc_ui_qif_import_druid_make();
+  g_return_if_fail(wind);
+
+  /* Get the user's preference for showing documentation pages. */
+  wind->show_doc_pages =
+    gnc_gconf_get_bool(GCONF_SECTION, GCONF_NAME_SHOW_DOC, &err);
+  if (err != NULL) {
+    g_warning("QIF import: gnc_gconf_get_bool error: %s", err->message);
+    g_error_free(err);
+
+    /* Show documentation pages by default. */
+    g_warning("QIF import: Couldn't get %s setting from gconf.",
+              GCONF_NAME_SHOW_DOC);
+    g_warning("QIF import: Documentation pages will be shown by default.");
+    wind->show_doc_pages = TRUE;
+  }
 }
 
 
 /********************************************************************
- * gnc_ui_qif_import_druid_make()
- * build the druid.
+ * initialize_scheme
+ *
+ * Initialize all Scheme-controlled objects.
  ********************************************************************/
 
-QIFImportWindow *
-gnc_ui_qif_import_druid_make(void)
+static void
+initialize_scheme(QIFImportWindow *wind)
 {
-
-  QIFImportWindow * retval;
-  GladeXML        * xml;
-  GError * err = NULL;
   SCM  load_map_prefs;
   SCM  mapping_info;
   SCM  create_ticker_map;
+
+  g_return_if_fail(wind);
+
+  /* Initialize Scheme variables. */
+  wind->imported_files        = SCM_EOL;
+  wind->selected_file         = SCM_BOOL_F;
+  wind->gnc_acct_info         = SCM_BOOL_F;
+  wind->cat_display_info      = SCM_BOOL_F;
+  wind->cat_map_info          = SCM_BOOL_F;
+  wind->acct_display_info     = SCM_BOOL_F;
+  wind->acct_map_info         = SCM_BOOL_F;
+  wind->memo_display_info     = SCM_BOOL_F;
+  wind->memo_map_info         = SCM_BOOL_F;
+  wind->security_hash         = SCM_BOOL_F;
+  wind->security_prefs        = SCM_BOOL_F;
+  wind->new_securities        = SCM_BOOL_F;
+  wind->ticker_map            = SCM_BOOL_F;
+  wind->imported_account_tree = SCM_BOOL_F;
+  wind->match_transactions    = SCM_BOOL_F;
+
+  /* Get the saved state of mappings from Quicken accounts and
+   * categories to GnuCash accounts. */
+  load_map_prefs = scm_c_eval_string("qif-import:load-map-prefs");
+  mapping_info = scm_call_0(load_map_prefs);
+  wind->gnc_acct_info         = scm_list_ref(mapping_info, scm_int2num(0));
+  wind->acct_map_info         = scm_list_ref(mapping_info, scm_int2num(1));
+  wind->cat_map_info          = scm_list_ref(mapping_info, scm_int2num(2));
+  wind->memo_map_info         = scm_list_ref(mapping_info, scm_int2num(3));
+  wind->security_hash         = scm_list_ref(mapping_info, scm_int2num(4));
+  wind->security_prefs        = scm_list_ref(mapping_info, scm_int2num(5));
+
+  /* Get the initial ticker map. */
+  create_ticker_map = scm_c_eval_string("make-ticker-map");
+  wind->ticker_map            = scm_call_0(create_ticker_map);
+
+  /* Protect our data from garbage collection. */
+  scm_gc_protect_object(wind->imported_files);
+  scm_gc_protect_object(wind->selected_file);
+  scm_gc_protect_object(wind->gnc_acct_info);
+  scm_gc_protect_object(wind->cat_display_info);
+  scm_gc_protect_object(wind->cat_map_info);
+  scm_gc_protect_object(wind->memo_display_info);
+  scm_gc_protect_object(wind->memo_map_info);
+  scm_gc_protect_object(wind->acct_display_info);
+  scm_gc_protect_object(wind->acct_map_info);
+  scm_gc_protect_object(wind->security_hash);
+  scm_gc_protect_object(wind->security_prefs);
+  scm_gc_protect_object(wind->new_securities);
+  scm_gc_protect_object(wind->ticker_map);
+  scm_gc_protect_object(wind->imported_account_tree);
+  scm_gc_protect_object(wind->match_transactions);
+}
+
+
+/********************************************************************
+ * build_page_lists
+ *
+ * Build the lists of druid pages.
+ ********************************************************************/
+
+static void
+build_page_lists(QIFImportWindow *wind, GladeXML *xml)
+{
   int  i;
-  GtkTreeView *view;
-  GtkListStore *store;
-  GtkCellRenderer *renderer;
-  GtkTreeViewColumn *column;
-  GtkTreeSelection *selection;
 
-
+  /* Pages that may appear prior to security-related pages. */
   char * pre_page_names[NUM_PRE_PAGES] = {
-    "start_page", "load_file_page", "date_format_page", "account_name_page",
+    "start_page", "load_file_page", "load_progress_page",
+    "date_format_page", "account_name_page",
     "loaded_files_page", "account_doc_page", "account_match_page",
     "category_doc_page", "category_match_page", "memo_doc_page",
     "memo_match_page", "currency_page", "commodity_doc_page"
   };
 
+  /* Pages that may appear after security-related pages. */
   char * post_page_names[NUM_POST_PAGES] = {
-    "match_doc_page", "match_duplicates_page", "end_page"
+    "convert_progress_page", "match_doc_page", "match_duplicates_page",
+    "end_page"
   };
 
+  /* Optional pages that only show documention. */
   char * doc_page_names[NUM_DOC_PAGES] = {
     "start_page", "account_doc_page", "category_doc_page",
     "commodity_doc_page", "memo_doc_page", "match_doc_page"
   };
 
-  retval = g_new0(QIFImportWindow, 1);
+  g_return_if_fail(wind);
 
-  xml = gnc_glade_xml_new("qif.glade", "QIF Import Druid");
+  wind->pre_comm_pages   = NULL;
+  wind->post_comm_pages  = NULL;
+  wind->doc_pages        = NULL;
+  wind->commodity_pages = NULL;
 
+  g_return_if_fail(xml);
+
+  /* Build the page lists. */
+  for(i = 0; i < NUM_PRE_PAGES; i++) {
+    wind->pre_comm_pages =
+      g_list_append(wind->pre_comm_pages,
+                    glade_xml_get_widget(xml, pre_page_names[i]));
+  }
+  for(i = 0; i < NUM_POST_PAGES; i++) {
+    wind->post_comm_pages =
+      g_list_append(wind->post_comm_pages,
+                    glade_xml_get_widget(xml, post_page_names[i]));
+  }
+  for(i = 0; i < NUM_DOC_PAGES; i++) {
+    wind->doc_pages =
+      g_list_append(wind->doc_pages,
+                    glade_xml_get_widget(xml, doc_page_names[i]));
+  }
+}
+
+
+/********************************************************************
+ * get_glade_widgets
+ *
+ * Get all glade-defined widgets that need to be actively managed.
+ ********************************************************************/
+
+static void
+get_glade_widgets(QIFImportWindow *wind, GladeXML *xml)
+{
+  g_return_if_fail(wind);
+  g_return_if_fail(xml);
+
+  wind->window            = glade_xml_get_widget(xml, "QIF Import Druid");
+  wind->druid             = glade_xml_get_widget(xml, "qif_import_druid");
+  wind->filename_entry    = glade_xml_get_widget(xml, "qif_filename_entry");
+  wind->load_pause        = glade_xml_get_widget(xml, "load_progress_pause");
+  wind->load_log          = glade_xml_get_widget(xml, "load_progress_log");
+  wind->load_progress     = gnc_progress_dialog_custom(
+    GTK_LABEL(glade_xml_get_widget(xml, "load_progress_primary")),
+    GTK_LABEL(glade_xml_get_widget(xml, "load_progress_secondary")),
+    GTK_PROGRESS_BAR(glade_xml_get_widget(xml, "load_progress_bar")),
+    GTK_LABEL(glade_xml_get_widget(xml, "load_progress_sub")),
+    GTK_TEXT_VIEW(wind->load_log));
+  wind->acct_entry        = glade_xml_get_widget(xml, "qif_account_entry");
+  wind->date_format_combo = glade_xml_get_widget(xml, "date_format_combobox");
+  wind->selected_file_view = glade_xml_get_widget(xml, "selected_file_view");
+  wind->currency_picker   = glade_xml_get_widget(xml, "currency_comboboxentry");
+  wind->acct_view         = glade_xml_get_widget(xml, "account_page_view");
+  wind->acct_view_count   = glade_xml_get_widget(xml, "account_page_count");
+  wind->acct_view_btn     = glade_xml_get_widget(xml, "account_page_change");
+  wind->cat_view          = glade_xml_get_widget(xml, "category_page_view");
+  wind->cat_view_count    = glade_xml_get_widget(xml, "category_page_count");
+  wind->cat_view_btn      = glade_xml_get_widget(xml, "category_page_change");
+  wind->memo_view         = glade_xml_get_widget(xml, "memo_page_view");
+  wind->memo_view_count   = glade_xml_get_widget(xml, "memo_page_count");
+  wind->memo_view_btn     = glade_xml_get_widget(xml, "memo_page_change");
+  wind->convert_pause     = glade_xml_get_widget(xml, "convert_progress_pause");
+  wind->convert_log       = glade_xml_get_widget(xml, "convert_progress_log");
+  wind->convert_progress  = gnc_progress_dialog_custom(
+    GTK_LABEL(glade_xml_get_widget(xml, "convert_progress_primary")),
+    GTK_LABEL(glade_xml_get_widget(xml, "convert_progress_secondary")),
+    GTK_PROGRESS_BAR(glade_xml_get_widget(xml, "convert_progress_bar")),
+    GTK_LABEL(glade_xml_get_widget(xml, "convert_progress_sub")),
+    GTK_TEXT_VIEW(wind->convert_log));
+  wind->new_transaction_view =
+    glade_xml_get_widget(xml, "new_transaction_view");
+  wind->old_transaction_view =
+    glade_xml_get_widget(xml, "old_transaction_view");
+}
+
+
+/********************************************************************
+ * connect_glade_signals
+ *
+ * Connect all glade-defined signals to their handlers.
+ ********************************************************************/
+
+static void
+connect_glade_signals(QIFImportWindow *wind, GladeXML *xml)
+{
+  g_return_if_fail(wind);
+  g_return_if_fail(xml);
+
+  /*
+   * Connect all glade-defined signals to their handlers.
+   */
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_cancel_cb",
-     G_CALLBACK(gnc_ui_qif_import_cancel_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_cancel_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_generic_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_generic_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_generic_next_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_generic_back_cb",
-     G_CALLBACK(gnc_ui_qif_import_generic_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_generic_back_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_select_file_cb",
-     G_CALLBACK(gnc_ui_qif_import_select_file_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_select_file_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_load_file_back_cb",
-     G_CALLBACK(gnc_ui_qif_import_load_file_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_load_file_back_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_load_file_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_load_file_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_load_file_next_cb), wind);
 
   glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_load_progress_prepare_cb",
+     G_CALLBACK(gnc_ui_qif_import_load_progress_prepare_cb), wind);
+
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_load_progress_show_cb",
+     G_CALLBACK(gnc_ui_qif_import_load_progress_show_cb), wind);
+
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_load_progress_pause_cb",
+     G_CALLBACK(gnc_ui_qif_import_load_progress_pause_cb), wind);
+
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_load_progress_next_cb",
+     G_CALLBACK(gnc_ui_qif_import_load_progress_next_cb), wind);
+
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_load_progress_back_cb",
+     G_CALLBACK(gnc_ui_qif_import_load_progress_back_cb), wind);
+
+  glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_date_format_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_date_format_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_date_format_next_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_loaded_files_prepare_cb",
-     G_CALLBACK(gnc_ui_qif_import_loaded_files_prepare_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_loaded_files_prepare_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_load_another_cb",
-     G_CALLBACK(gnc_ui_qif_import_load_another_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_load_another_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_unload_file_cb",
-     G_CALLBACK(gnc_ui_qif_import_unload_file_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_unload_file_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_loaded_files_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_loaded_files_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_loaded_files_next_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_default_acct_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_default_acct_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_default_acct_next_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_default_acct_back_cb",
-     G_CALLBACK(gnc_ui_qif_import_default_acct_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_default_acct_back_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_account_rematch_cb",
-     G_CALLBACK(gnc_ui_qif_import_account_rematch_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_account_rematch_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_account_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_account_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_account_next_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_category_rematch_cb",
-     G_CALLBACK(gnc_ui_qif_import_category_rematch_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_category_rematch_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_category_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_category_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_category_next_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_memo_doc_back_cb",
-     G_CALLBACK(gnc_ui_qif_import_memo_doc_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_memo_doc_back_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_memo_rematch_cb",
-     G_CALLBACK(gnc_ui_qif_import_memo_rematch_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_memo_rematch_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_memo_back_cb",
-     G_CALLBACK(gnc_ui_qif_import_memo_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_memo_back_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_currency_back_cb",
-     G_CALLBACK(gnc_ui_qif_import_currency_back_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_currency_back_cb), wind);
 
   glade_xml_signal_connect_data
     (xml, "gnc_ui_qif_import_currency_next_cb",
-     G_CALLBACK(gnc_ui_qif_import_currency_next_cb), retval);
+     G_CALLBACK(gnc_ui_qif_import_currency_next_cb), wind);
 
   glade_xml_signal_connect_data
-    (xml, "gnc_ui_qif_import_commodity_prepare_cb",
-     G_CALLBACK(gnc_ui_qif_import_commodity_prepare_cb), retval);
+    (xml, "gnc_ui_qif_import_convert_progress_prepare_cb",
+     G_CALLBACK(gnc_ui_qif_import_convert_progress_prepare_cb), wind);
 
   glade_xml_signal_connect_data
-    (xml, "gnc_ui_qif_import_finish_cb",
-     G_CALLBACK(gnc_ui_qif_import_finish_cb), retval);
+    (xml, "gnc_ui_qif_import_convert_progress_show_cb",
+     G_CALLBACK(gnc_ui_qif_import_convert_progress_show_cb), wind);
 
-  retval->window = glade_xml_get_widget(xml, "QIF Import Druid");
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_convert_progress_pause_cb",
+     G_CALLBACK(gnc_ui_qif_import_convert_progress_pause_cb), wind);
 
-  retval->imported_files    =  SCM_EOL;
-  retval->selected_file     =  SCM_BOOL_F;
-  retval->gnc_acct_info     =  SCM_BOOL_F;
-  retval->cat_display_info  =  SCM_BOOL_F;
-  retval->cat_map_info      =  SCM_BOOL_F;
-  retval->acct_display_info =  SCM_BOOL_F;
-  retval->acct_map_info     =  SCM_BOOL_F;
-  retval->memo_display_info =  SCM_BOOL_F;
-  retval->memo_map_info     =  SCM_BOOL_F;
-  retval->security_hash     =  SCM_BOOL_F;
-  retval->new_securities    =  SCM_BOOL_F;
-  retval->new_namespaces    =  NULL;
-  retval->ticker_map        =  SCM_BOOL_F;
-  retval->imported_account_tree   = SCM_BOOL_F;
-  retval->match_transactions = SCM_BOOL_F;
-  retval->selected_transaction = 0;
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_convert_progress_next_cb",
+     G_CALLBACK(gnc_ui_qif_import_convert_progress_next_cb), wind);
 
-  retval->druid           = glade_xml_get_widget(xml, "qif_import_druid");
-  retval->filename_entry  = glade_xml_get_widget(xml, "qif_filename_entry");
-  retval->acct_entry      = glade_xml_get_widget(xml, "qif_account_entry");
-  retval->date_format_combo = glade_xml_get_widget(xml, "date_format_combobox");
-  retval->selected_file_view = glade_xml_get_widget(xml, "selected_file_view");
-  retval->currency_picker = glade_xml_get_widget(xml, "currency_comboboxentry");
-  retval->acct_view       = glade_xml_get_widget(xml, "account_page_view");
-  retval->acct_view_count = glade_xml_get_widget(xml, "account_page_count");
-  retval->acct_view_btn   = glade_xml_get_widget(xml, "account_page_change");
-  retval->cat_view        = glade_xml_get_widget(xml, "category_page_view");
-  retval->cat_view_count  = glade_xml_get_widget(xml, "category_page_count");
-  retval->cat_view_btn    = glade_xml_get_widget(xml, "category_page_change");
-  retval->memo_view       = glade_xml_get_widget(xml, "memo_page_view");
-  retval->memo_view_count = glade_xml_get_widget(xml, "memo_page_count");
-  retval->memo_view_btn   = glade_xml_get_widget(xml, "memo_page_change");
-  retval->new_transaction_view =
-    glade_xml_get_widget(xml, "new_transaction_view");
-  retval->old_transaction_view =
-    glade_xml_get_widget(xml, "old_transaction_view");
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_convert_progress_back_cb",
+     G_CALLBACK(gnc_ui_qif_import_convert_progress_back_cb), wind);
 
-  retval->pre_comm_pages   = NULL;
-  retval->post_comm_pages  = NULL;
-  retval->doc_pages        = NULL;
-  retval->commodity_pages = NULL;
+  glade_xml_signal_connect_data
+    (xml, "gnc_ui_qif_import_finish_cb",
+     G_CALLBACK(gnc_ui_qif_import_finish_cb), wind);
+}
 
-  /* Get the user's preference for showing documentation pages. */
-  retval->show_doc_pages =
-    gnc_gconf_get_bool(GCONF_SECTION, GCONF_NAME_SHOW_DOC, &err);
-  if (err != NULL) {
-    g_warning("QIF import: gnc_gconf_get_bool error: %s", err->message);
-    g_error_free(err);
 
-    /* Show documentation pages by default. */
-    g_warning("QIF import: Couldn't get %s setting from gconf.",
-              GCONF_NAME_SHOW_DOC);
-    g_warning("QIF import: Documentation pages will be shown by default.");
-    retval->show_doc_pages = TRUE;
-  }
+/********************************************************************
+ * build_views
+ *
+ * Build the details of all GtkTreeView widgets.
+ ********************************************************************/
 
-  for(i=0; i < NUM_PRE_PAGES; i++) {
-    retval->pre_comm_pages =
-      g_list_append(retval->pre_comm_pages,
-                    glade_xml_get_widget(xml, pre_page_names[i]));
-  }
-  for(i=0; i < NUM_POST_PAGES; i++) {
-    retval->post_comm_pages =
-      g_list_append(retval->post_comm_pages,
-                    glade_xml_get_widget(xml, post_page_names[i]));
-  }
-  for(i=0; i < NUM_DOC_PAGES; i++) {
-    retval->doc_pages =
-      g_list_append(retval->doc_pages,
-                    glade_xml_get_widget(xml, doc_page_names[i]));
-  }
+static void
+build_views(QIFImportWindow *wind)
+{
+  GtkTreeView *view;
+  GtkListStore *store;
+  GtkCellRenderer *renderer;
+  GtkTreeViewColumn *column;
+  GtkTreeSelection *selection;
 
+  g_return_if_fail(wind);
+
   /* Set up the selected file view */
-  view = GTK_TREE_VIEW(retval->selected_file_view);
+  view = GTK_TREE_VIEW(wind->selected_file_view);
   store = gtk_list_store_new(NUM_FILENAME_COLS, G_TYPE_INT, G_TYPE_STRING);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
   g_object_unref(store);
 
   renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Account"),
+  column = gtk_tree_view_column_new_with_attributes("unused",
                                                     renderer,
                                                     "text",
                                                     FILENAME_COL_NAME,
@@ -2840,28 +3539,28 @@
   selection = gtk_tree_view_get_selection(view);
   g_signal_connect(selection, "changed",
                    G_CALLBACK(gnc_ui_qif_import_select_loaded_file_cb),
-                   retval);
+                   wind);
 
   /* Set up the QIF account to GnuCash account matcher. */
-  create_account_picker_view(retval->acct_view, _("QIF account name"),
+  create_account_picker_view(wind->acct_view, _("QIF account name"),
                              G_CALLBACK(gnc_ui_qif_import_account_activate_cb),
                              G_CALLBACK(gnc_ui_qif_import_account_select_cb),
-                             retval);
+                             wind);
 
   /* Set up the QIF category to GnuCash account matcher. */
-  create_account_picker_view(retval->cat_view,  _("QIF category name"),
+  create_account_picker_view(wind->cat_view,  _("QIF category name"),
                              G_CALLBACK(gnc_ui_qif_import_category_activate_cb),
                              G_CALLBACK(gnc_ui_qif_import_category_select_cb),
-                             retval);
+                             wind);
 
   /* Set up the QIF payee/memo to GnuCash account matcher. */
-  create_account_picker_view(retval->memo_view, _("QIF payee/memo"),
+  create_account_picker_view(wind->memo_view, _("QIF payee/memo"),
                              G_CALLBACK(gnc_ui_qif_import_memo_activate_cb),
                              G_CALLBACK(gnc_ui_qif_import_memo_select_cb),
-                             retval);
+                             wind);
 
   /* Set up the new transaction view */
-  view = GTK_TREE_VIEW(retval->new_transaction_view);
+  view = GTK_TREE_VIEW(wind->new_transaction_view);
   store = gtk_list_store_new(NUM_QIF_TRANS_COLS, G_TYPE_INT, G_TYPE_STRING,
                              G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
@@ -2895,11 +3594,11 @@
   selection = gtk_tree_view_get_selection(view);
   g_signal_connect(selection, "changed",
                    G_CALLBACK(gnc_ui_qif_import_duplicate_new_select_cb),
-                   retval);
+                   wind);
 
 
   /* Set up the old transaction view */
-  view = GTK_TREE_VIEW(retval->old_transaction_view);
+  view = GTK_TREE_VIEW(wind->old_transaction_view);
   store = gtk_list_store_new(NUM_QIF_TRANS_COLS, G_TYPE_INT, G_TYPE_STRING,
                              G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
   gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
@@ -2931,7 +3630,7 @@
   gtk_tree_view_append_column(view, column);
 
   renderer = gtk_cell_renderer_toggle_new();
-  column = gtk_tree_view_column_new_with_attributes(_("Dup?"),
+  column = gtk_tree_view_column_new_with_attributes(_("Match?"),
                                                     renderer,
                                                     "active",
                                                     QIF_TRANS_COL_CHECKED,
@@ -2941,58 +3640,90 @@
   selection = gtk_tree_view_get_selection(view);
   g_signal_connect(selection, "changed",
                    G_CALLBACK(gnc_ui_qif_import_duplicate_old_select_cb),
-                   retval);
+                   wind);
+}
 
 
-  /* load the saved-state of the mappings from Quicken accounts and
-   * categories to gnucash accounts */
-  load_map_prefs = scm_c_eval_string("qif-import:load-map-prefs");
+/********************************************************************
+ * gnc_ui_qif_import_druid_make
+ *
+ * Build a new QIF import druid.
+ ********************************************************************/
 
-  mapping_info = scm_call_0(load_map_prefs);
-  retval->gnc_acct_info    = scm_list_ref(mapping_info, scm_int2num(0));
-  retval->acct_map_info    = scm_list_ref(mapping_info, scm_int2num(1));
-  retval->cat_map_info     = scm_list_ref(mapping_info, scm_int2num(2));
-  retval->memo_map_info    = scm_list_ref(mapping_info, scm_int2num(3));
-  retval->security_hash    = scm_list_ref(mapping_info, scm_int2num(4));
-  retval->security_prefs   = scm_list_ref(mapping_info, scm_int2num(5));
+QIFImportWindow *
+gnc_ui_qif_import_druid_make(void)
+{
+  QIFImportWindow * wind;
+  GladeXML        * xml;
 
-  create_ticker_map = scm_c_eval_string("make-ticker-map");
-  retval->ticker_map = scm_call_0(create_ticker_map);
+  /* Allocate space for the druid and load its design. */
+  wind = g_new0(QIFImportWindow, 1);
+  xml = gnc_glade_xml_new("qif.glade", "QIF Import Druid");
 
-  scm_gc_protect_object(retval->imported_files);
-  scm_gc_protect_object(retval->selected_file);
-  scm_gc_protect_object(retval->gnc_acct_info);
-  scm_gc_protect_object(retval->cat_display_info);
-  scm_gc_protect_object(retval->cat_map_info);
-  scm_gc_protect_object(retval->memo_display_info);
-  scm_gc_protect_object(retval->memo_map_info);
-  scm_gc_protect_object(retval->acct_display_info);
-  scm_gc_protect_object(retval->acct_map_info);
-  scm_gc_protect_object(retval->security_hash);
-  scm_gc_protect_object(retval->security_prefs);
-  scm_gc_protect_object(retval->new_securities);
-  scm_gc_protect_object(retval->ticker_map);
-  scm_gc_protect_object(retval->imported_account_tree);
-  scm_gc_protect_object(retval->match_transactions);
+  wind->new_namespaces       = NULL;
+  wind->selected_transaction = 0;
+  wind->busy                 = FALSE;
 
-  /* set a default currency for new accounts */
-  gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(retval->currency_picker));
-  gnc_ui_update_commodity_picker(retval->currency_picker,
+  /* Get all user preferences related to QIF importing. */
+  get_preferences(wind);
+
+  /* Set up the Scheme side of things. */
+  initialize_scheme(wind);
+
+  /* Build lists of the druid pages. */
+  build_page_lists(wind, xml);
+
+  /* Get all interesting glade-defined widgets. */
+  get_glade_widgets(wind, xml);
+
+  /* Connect all glade-defined signals to their handlers. */
+  connect_glade_signals(wind, xml);
+
+  /* Build the details of all GtkTreeView widgets. */
+  build_views(wind);
+
+  /* Set a default currency for new accounts */
+  gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(wind->currency_picker));
+  gnc_ui_update_commodity_picker(wind->currency_picker,
                                  GNC_COMMODITY_NS_CURRENCY,
-                                 gnc_commodity_get_printname
-                                 (gnc_default_currency()));
+                                 gnc_commodity_get_printname(
+                                   gnc_default_currency()));
 
-  if(!retval->show_doc_pages) {
-    gnome_druid_set_page(GNOME_DRUID(retval->druid),
-                         get_named_page(retval, "load_file_page"));
-  }
+  /* If desired, skip the initial documentation pages. */
+  if (!wind->show_doc_pages)
+    gnome_druid_set_page(GNOME_DRUID(wind->druid),
+                         get_named_page(wind, "load_file_page"));
 
-  gnc_druid_set_colors(GNOME_DRUID(retval->druid));
+  gnc_druid_set_colors(GNOME_DRUID(wind->druid));
 
-  gnc_register_gui_component(DRUID_QIF_IMPORT_CM_CLASS, NULL, NULL, retval);
+  gnc_register_gui_component(DRUID_QIF_IMPORT_CM_CLASS, NULL, NULL, wind);
 
-  gtk_widget_show_all(retval->window);
-  gtk_window_present(GTK_WINDOW(retval->window));
+  gtk_widget_show_all(wind->window);
+  gtk_window_present(GTK_WINDOW(wind->window));
 
-  return retval;
+  return wind;
 }
+
+
+static gboolean
+show_handler(const char *class, gint component_id,
+             gpointer user_data, gpointer iter_data)
+{
+  QIFImportWindow *qif_win = user_data;
+
+  if (!qif_win)
+    return(FALSE);
+  gtk_window_present(GTK_WINDOW(qif_win->window));
+  return(TRUE);
+}
+
+void
+gnc_file_qif_import(void)
+{
+  if (gnc_forall_gui_components(DRUID_QIF_IMPORT_CM_CLASS,
+                                show_handler, NULL))
+    return;
+
+  /* pop up the QIF File Import dialog box */
+  gnc_ui_qif_import_druid_make();
+}

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-dialog-utils.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-dialog-utils.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-dialog-utils.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -10,12 +10,14 @@
   (string-append brokerage (gnc-get-account-separator-string) security))
 
 (define (default-dividend-acct brokerage security)
-  (string-append (_ "Dividends") (gnc-get-account-separator-string)
+  (string-append (_ "Income") (gnc-get-account-separator-string)
+                 (_ "Dividends") (gnc-get-account-separator-string)
                  brokerage (gnc-get-account-separator-string)
                  security))
 
 (define (default-interest-acct brokerage security)
-  (string-append (_ "Interest") (gnc-get-account-separator-string)
+  (string-append (_ "Income") (gnc-get-account-separator-string)
+                 (_ "Interest") (gnc-get-account-separator-string)
                  brokerage
                  (if (string=? security "")
                   ""
@@ -23,35 +25,45 @@
                                   security))))
 
 (define (default-capital-return-acct brokerage security)
-  (string-append (_ "Cap Return") (gnc-get-account-separator-string)
+  (string-append (_ "Income") (gnc-get-account-separator-string)
+                 (_ "Cap Return") (gnc-get-account-separator-string)
                  brokerage (gnc-get-account-separator-string)
                  security))
 
 (define (default-cglong-acct brokerage security)
-  (string-append (_ "Cap. gain (long)") (gnc-get-account-separator-string)
+  (string-append (_ "Income") (gnc-get-account-separator-string)
+                 (_ "Cap. gain (long)") (gnc-get-account-separator-string)
                  brokerage (gnc-get-account-separator-string)
                  security))
 
 (define (default-cgmid-acct brokerage security)
-  (string-append (_ "Cap. gain (mid)") (gnc-get-account-separator-string)
+  (string-append (_ "Income") (gnc-get-account-separator-string)
+                 (_ "Cap. gain (mid)") (gnc-get-account-separator-string)
                  brokerage (gnc-get-account-separator-string)
                  security))
 
 (define (default-cgshort-acct brokerage security)
-  (string-append (_ "Cap. gain (short)") (gnc-get-account-separator-string)
+  (string-append (_ "Income") (gnc-get-account-separator-string)
+                 (_ "Cap. gain (short)") (gnc-get-account-separator-string)
                  brokerage (gnc-get-account-separator-string)
                  security))
 
-(define (default-equity-holding security) (_ "Retained Earnings"))
+(define (default-equity-holding security)
+  (string-append (_ "Equity") (gnc-get-account-separator-string)
+                 (_ "Retained Earnings")))
 
-(define (default-equity-account) (_ "Retained Earnings"))
+(define (default-equity-account)
+  (string-append (_ "Equity") (gnc-get-account-separator-string)
+                 (_ "Retained Earnings")))
 
 (define (default-commission-acct brokerage)
-  (string-append (_ "Commissions") (gnc-get-account-separator-string)
+  (string-append (_ "Expenses") (gnc-get-account-separator-string)
+                 (_ "Commissions") (gnc-get-account-separator-string)
                  brokerage))
 
 (define (default-margin-interest-acct brokerage)
-  (string-append (_ "Margin Interest") (gnc-get-account-separator-string)
+  (string-append (_ "Expenses") (gnc-get-account-separator-string)
+                 (_ "Margin Interest") (gnc-get-account-separator-string)
                  brokerage))
 
 (define (default-unspec-acct)
@@ -889,5 +901,3 @@
                (set-cdr! match #f))
            (set! i (+ 1 i)))
          matches))))
-
-

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-file.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-file.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-file.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -29,13 +29,18 @@
 ;;  Suck in all the lines. Don't do any string interpretation,
 ;;  just store the fields "raw".
 ;;
+;;  The return value will be:
+;;    success:   ()
+;;    failure:   (#f error-message)
+;;    warning:   (#t error-message)
+;;    cancel:    #t
+;;    exception: #f
+;;
 ;; FIXME: This function really should be able to return multiple
 ;;        errors and warnings rather than a single one.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-file:read-file self path ticker-map window)
-  (let ((progress-dialog '())
-        (retval #f))
+(define (qif-file:read-file self path ticker-map progress-dialog)
 
   ;; This procedure does all the work. We'll define it, then call it safely.
   (define (private-read)
@@ -47,18 +52,35 @@
           (default-split #f)
           (first-xtn #f)
           (ignore-accounts #f)
-          (return-val #t)
+          (private-retval '())
           (line-num 0)
           (line #f)
           (tag #f)
           (value #f)
-          (heinous-error #f)
-          (missing-date-warned #f)
+          (abort-read #f)
           (delimiters (string #\cr #\nl))
           (file-stats #f)
           (file-size 0)
           (bytes-read 0))
 
+      ;; This procedure simplifies handling of warnings.
+      (define (mywarn . args)
+        (let ((str (gnc:list-display-to-string
+                     (append (list (_ "Line") " " line-num ": ") args))))
+          (set! private-retval (list #t str))
+          (qif-import:log progress-dialog "qif-file:read-file" str)))
+
+
+      ;; This procedure simplifies handling of failures
+      (define (myfail . args)
+        (let ((str (gnc:list-display-to-string
+                         (append (list (_ "Line") " " line-num ": ") args))))
+          (set! private-retval (list #f str))
+          (qif-import:log progress-dialog "qif-file:read-file"
+                          (string-append str "\n" (_ "Read aborted.")))
+          (set! abort-read #t)))
+
+
       (qif-file:set-path! self path)
       (if (not (access? path R_OK))
           ;; A UTF-8 encoded path won't succeed on some systems, such as
@@ -68,12 +90,9 @@
       (set! file-size (stat:size file-stats))
 
 
-      (if (> file-size 10000)
-          (begin
-            (set! progress-dialog (gnc-progress-dialog-new window #f))
-            (gnc-progress-dialog-set-title progress-dialog (_ "Progress"))
-            (gnc-progress-dialog-set-heading progress-dialog
-                                             (_ "Loading QIF file..."))))
+      (if progress-dialog
+          (gnc-progress-dialog-set-sub progress-dialog
+                                       (string-append (_ "Reading") " " path)))
 
       (with-input-from-file path
         (lambda ()
@@ -101,26 +120,13 @@
                                 (not (gnc-utf8? converted-value)))
                             (begin
                               (set! value (gnc-utf8-strip-invalid-strdup value))
-                              (set! return-val
-                                    (list #t (string-append
-                               (_ "This file is not encoded in UTF-8 or ASCII.")
-                               " "
-                               (_ "Some characters have been discarded."))))
-                              (gnc:warn "qif-file:read-file:"
-                                        " stripping invalid characters"
-                                        " at line " line-num
-                                        "\nAfter: [" value "]"))
+                              (mywarn
+                               (_ "Some characters have been discarded.")
+                               " " (_"Converted to: ") value))
                             (begin
-                              (set! return-val
-                                    (list #t (string-append
-                               (_ "This file is not encoded in UTF-8 or ASCII.")
-                               " "
-                               (_ "Some characters have been converted according to your locale."))))
-                              (gnc:warn "qif-file:read-file:"
-                                        " converting characters by locale"
-                                        " at line " line-num
-                                        "\nBefore: [" value "]"
-                                        "\nAfter:  [" converted-value "]")
+                              (mywarn
+                               (_ "Some characters have been converted according to your locale.")
+                               " " (_"Converted to: ") converted-value)
                               (set! value converted-value)))))
 
                   (if (eq? tag #\!)
@@ -178,9 +184,8 @@
                            (if (string-match "^option:"
                                              (symbol->string qstate-type))
                                (begin
-                                 (gnc:warn "qif-file:read-file:"
-                                           " ignoring '" qstate-type "' option"
-                                           " at line " line-num)
+                                 (mywarn (_ "Ignoring unknown option") " '"
+                                         qstate-type "'")
                                  (set! qstate-type old-qstate))))))
 
 
@@ -312,15 +317,9 @@
 
                             (if (qif-xtn:date current-xtn)
                                 (qif-file:add-xtn! self current-xtn)
-                                ;; The date is missing! Warn the user if they
-                                ;; haven't been warned already.
-                                (if (not missing-date-warned)
-                                    (begin
-                                      (set! missing-date-warned #t)
-                                      (gnc-warning-dialog '() (string-append
-                               (_ "One or more transactions is missing a date.")
-                               "\n"
-                               (_ "Some transactions may be discarded."))))))
+                                ;; The date is missing! Warn the user.
+                                (mywarn (_ "Date required.") " "
+                                        (_ "Discarding this transaction.")))
 
                             ;;(write current-xtn) (newline)
                             (set! current-xtn (make-qif-xtn))
@@ -352,10 +351,7 @@
                             (set! current-xtn (make-qif-class)))
 
                            (else
-                            (gnc:warn "qif-file:read-file:"
-                                      " ignoring class '" tag "'"
-                                      " at line " line-num
-                                      "\nLine content: [" line "]"))))
+                            (mywarn (_ "Ignoring class line") ": " line))))
 
 
                         ;;;;;;;;;;;;;;;;;;
@@ -423,9 +419,7 @@
                             (set! current-xtn (make-qif-cat)))
 
                            (else
-                            (gnc:warn "qif-file:read-file:"
-                                      " ignoring category '" tag "' line."
-                                      "\nLine content: [" line "]"))))
+                            (mywarn (_ "Ignoring category line") ": " line))))
 
 
                         ;;;;;;;;;;;;;;;;;;;
@@ -456,37 +450,35 @@
                             (set! current-xtn (make-qif-stock-symbol)))
 
                            (else
-                            (gnc:warn "qif-file:read-file:"
-                                      " ignoring security '" tag "'"
-                                      " at line " line-num
-                                      "\nLine content: [" line "]"))))
+                            (mywarn (_ "Ignoring security line") ": " line))))
 
 
                         ;; trying to sneak one by, eh?
                         (else
                           (if (and (not qstate-type)
                                    (not (string=? (string-trim line) "")))
-                              (begin
-                                (gnc:warn "qif-file:read-file:"
-                                          " file does not appear to be a QIF"
-                                          " at line " line-num
-                                          "\nLine content: [" line "]")
-                                (set! return-val
-                                      (list #f "File does not appear to be a QIF file."))
-                                (set! heinous-error #t))))))
+                              (myfail
+                                (_ "File does not appear to be in QIF format")
+                                ": " line)))))
 
-                  ;; Update the progress bar for each line read.
-                  (if (and (not (null? progress-dialog))
+                  ;; Report the progress.
+                  (if (and progress-dialog
                            (zero? (remainder line-num 32)))
-                      (gnc-progress-dialog-set-value progress-dialog
-                                                     (/ bytes-read file-size)))
+                      (begin
+                        (gnc-progress-dialog-set-value progress-dialog
+                                                       (/ bytes-read file-size))
+                        (qif-import:check-pause progress-dialog)
+                        (if qif-import:canceled
+                            (begin
+                              (set! private-retval #t)
+                              (set! abort-read #t)))))
 
                   ;; This is if we read a normal (non-null, non-eof) line...
-                  (if (not heinous-error)
+                  (if (not abort-read)
                       (line-loop)))
 
                 ;; ...and this is if we read a null or eof line.
-                (if (and (not heinous-error)
+                (if (and (not abort-read)
                          (not (eof-object? line)))
                     (line-loop))))))
 
@@ -494,19 +486,21 @@
       ;; they appeared in the file.  This is important in a few cases.
       (qif-file:set-xtns! self (reverse (qif-file:xtns self)))
 
-      return-val))
+      private-retval))
 
 
-    ;; Safely read the file.
-    (set! retval (gnc:backtrace-if-exception private-read))
+  (gnc:backtrace-if-exception
+    (lambda ()
+      (let ((retval #f))
+        ;; Safely read the file.
+        (set! retval (gnc:backtrace-if-exception private-read))
 
-    ;; Get rid of the progress dialog (if any).
-    (if (not (null? progress-dialog))
-        (begin
-          (gnc-progress-dialog-set-value progress-dialog 1)
-          (gnc-progress-dialog-destroy progress-dialog)))
+        ;; Fill the progress dialog.
+        (if (and progress-dialog
+                 (list? retval))
+          (gnc-progress-dialog-set-value progress-dialog 1))
 
-    retval))
+        retval))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -574,135 +568,238 @@
    qif-parse:parse-date/format
    (qif-file:xtns self)
    qif-parse:print-date
-   'error-on-ambiguity
-   (lambda (t e) e) 'date))
+   'error-on-ambiguity (lambda (t e) e) 'date
+   (lambda (fraction) #t)))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;  qif-file:parse-fields-results
+;;  qif-file:parse-fields
 ;;
-;;  Take the results from qif-file:parse fields and find the
-;;  results for a particular type of parse.
+;;  Take a previously-read qif file and convert fields from
+;;  strings to the appropriate type.
+;;
+;;  The return value will be:
+;;    success:   ()
+;;    failure:   (#f . ((type . error) ...))
+;;    warning:   (#t . ((type . error) ...))
+;;    cancel:    #t
+;;    exception: #f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-file:parse-fields-results results type)
-  (define (test-results results)
-    (if (null? results) #f
-        (let* ((this-res (car results))
-               (this-type (car this-res)))
-          (if (eq? this-type type)
-              (cdr this-res)
-              (test-results (cdr results))))))
+(define (qif-file:parse-fields self progress-dialog)
 
-  (if results (test-results results) #f))
+  ;; This procedure does all the work. We'll define it, then call it safely.
+  (define (private-parse)
+   (let ((error #f)
+         (update-count 0)
+         (all-ok #f))
 
+     ;; This procedure sets a suboperation name.
+     (define (set-sub str)
+       (if progress-dialog
+           (gnc-progress-dialog-set-sub progress-dialog str))
+       #t)
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;  qif-file:parse-fields
-;;
-;;  Take a previously-read qif file and convert fields from
-;;  strings to the appropriate type.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-file:parse-fields self)
-;  (false-if-exception
-   (let* ((error #f)
-          (all-ok #f)
-          (set-error
-           (lambda (t e)
-             (if (not error)
-                 (set! error (list (cons t e)))
-                 (set! error (cons (cons t e) error)))))
-          (errlist-to-string
-           (lambda (lst)
-             (with-output-to-string
-               (lambda ()
-                 (for-each
-                  (lambda (elt)
-                    (display elt))
-                  lst))))))
+     ;; This procedure sets a suboperation weight.
+     (define (start-sub weight)
+       (if progress-dialog
+           (gnc-progress-dialog-push progress-dialog weight))
+       #t)
+
+
+     ;; This procedure finishes a suboperation.
+     (define (finish-sub)
+       (if progress-dialog
+           (gnc-progress-dialog-pop-full progress-dialog))
+       #t)
+
+
+     ;; This procedure handles progress reporting, pause, and cancel.
+     (define (update-progress fraction)
+       (set! update-count (+ 1 update-count))
+       (if (and progress-dialog
+                (zero? (remainder update-count 32)))
+           (begin
+             (gnc-progress-dialog-set-value progress-dialog fraction)
+             (qif-import:check-pause progress-dialog)
+             (if qif-import:canceled
+                 (throw 'cancel)))))
+
+
+     ;; This procedure is the generic error handler for parsing.
+     (define (add-error t e)
+       ;; Log the error message.
+       (if (string? e)
+           (qif-import:log progress-dialog
+                           "qif-file:parse-fields"
+                           (string-append (case t
+                                            ((date) (_ "Transaction date"))
+                                            ((split-amounts) (_ "Transaction amount"))
+                                            ((share-price) (_ "Share price"))
+                                            ((num-shares) (_ "Share quantity"))
+                                            ((action) (_ "Investment action"))
+                                            ((cleared) (_ "Reconciliation status"))
+                                            ((commission) (_ "Commission"))
+                                            ((acct-type) (_ "Account type"))
+                                            ((tax-class) (_ "Tax class"))
+                                            ((budget-amt) (_ "Category budget amount"))
+                                            ((budget) (_ "Account budget amount"))
+                                            ((limit) (_ "Credit limit"))
+                                            (else (symbol->string t)))
+                                          ": " e)))
+       ;; Save the error condition.
+       (if (not error)
+           (set! error (list (cons t e)))
+           (set! error (cons (cons t e) error))))
+
+
      (and
-      ;; fields of categories.
+      ;;
+      ;; Fields of categories.
+      ;;
+      (set-sub (_ "Parsing categories"))
+      ;; The category tasks will be 5% of the overall parsing effort.
+      (start-sub 0.05)
+
+      ;; Tax classes; assume this is 50% of the category parsing effort.
+      (start-sub 0.5)
       (check-and-parse-field
        qif-cat:tax-class qif-cat:set-tax-class! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:cats self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'tax-class)
+       'guess-on-ambiguity add-error 'tax-class
+       update-progress)
+      (finish-sub)
 
+      ;; Budget amounts; this is the last task for category parsing.
+      (start-sub 1)
       (check-and-parse-field
        qif-cat:budget-amt qif-cat:set-budget-amt! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:cats self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'budget-amt)
+       'guess-on-ambiguity add-error 'budget-amt
+       update-progress)
+      (finish-sub)
 
-      ;; fields of accounts
+      (finish-sub)
+
+
+      ;;
+      ;; Fields of accounts
+      ;;
+      (set-sub (_ "Parsing accounts"))
+      ;; The account tasks will be 5% of the overall parsing effort.
+      (start-sub 0.05)
+
+      ;; Account limits; assume this is 20% of the account parsing effort.
+      (start-sub 0.2)
       (check-and-parse-field
        qif-acct:limit qif-acct:set-limit! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:accounts self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'limit)
+       'guess-on-ambiguity add-error 'limit
+       update-progress)
+      (finish-sub)
 
+      ;; Budget amounts; assume this is 20% of the account parsing effort.
+      (start-sub 0.2)
       (check-and-parse-field
        qif-acct:budget qif-acct:set-budget! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:accounts self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'budget)
+       'guess-on-ambiguity add-error 'budget
+       update-progress)
+      (finish-sub)
 
+      ;; Account types; this is the last task for account parsing.
+      (start-sub 1)
       (parse-field
        qif-acct:type qif-acct:set-type!
        qif-parse:parse-acct-type (qif-file:accounts self)
-       set-error)
+       add-error 'acct-type
+       update-progress)
+      (finish-sub)
 
+      (finish-sub)
+
+
+      ;;
       ;; fields of transactions
+      ;;
+      (set-sub (_ "Parsing transactions"))
+      ;; Transaction parsing takes up the rest of the overall parsing effort.
+      (start-sub 1)
+
+      ;; Dates; assume this is 15% of the transaction effort.
+      (start-sub 0.15)
       (check-and-parse-field
        qif-xtn:date qif-xtn:set-date! equal?
        qif-parse:check-date-format '(m-d-y d-m-y y-m-d y-d-m)
        qif-parse:parse-date/format
        (qif-file:xtns self)
        qif-parse:print-date
-       'error-on-ambiguity
-       set-error 'date)
+       'error-on-ambiguity add-error 'date
+       update-progress)
+      (finish-sub)
 
+      ;; Clear flags; assume this is 5% of the transaction effort.
+      (start-sub 0.05)
       (parse-field
        qif-xtn:cleared qif-xtn:set-cleared!
-       qif-parse:parse-cleared-field (qif-file:xtns self) set-error)
+       qif-parse:parse-cleared-field (qif-file:xtns self)
+       add-error 'cleared
+       update-progress)
+      (finish-sub)
 
+      ;; Investment actions; assume this is 10% of the transaction effort.
+      (start-sub 0.1)
       (parse-field
        qif-xtn:action qif-xtn:set-action!
-       qif-parse:parse-action-field (qif-file:xtns self) set-error)
+       qif-parse:parse-action-field (qif-file:xtns self)
+       add-error 'action
+       update-progress)
+      (finish-sub)
 
+      ;; Share prices; assume this is 10% of the transaction effort.
+      (start-sub 0.1)
       (check-and-parse-field
        qif-xtn:share-price qif-xtn:set-share-price! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:xtns self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'share-price)
+       'guess-on-ambiguity add-error 'share-price
+       update-progress)
+      (finish-sub)
 
+      ;; Share quantities; assume this is 10% of the transaction effort.
+      (start-sub 0.1)
       (check-and-parse-field
        qif-xtn:num-shares qif-xtn:set-num-shares! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:xtns self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'num-shares)
+       'guess-on-ambiguity add-error 'num-shares
+       update-progress)
+      (finish-sub)
 
+      ;; Commissions; assume this is 10% of the transaction effort.
+      (start-sub 0.1)
       (check-and-parse-field
        qif-xtn:commission qif-xtn:set-commission! gnc-numeric-equal
        qif-parse:check-number-format '(decimal comma)
        qif-parse:parse-number/format (qif-file:xtns self)
        qif-parse:print-number
-       'guess-on-ambiguity
-       set-error 'commission)
+       'guess-on-ambiguity add-error 'commission
+       update-progress)
+      (finish-sub)
 
+      ;; Splits; this is the rest of the transaction effort.
+      (start-sub 1)
       ;; this one's a little tricky... it checks and sets all the
       ;; split amounts for the transaction together.
       (check-and-parse-field
@@ -710,19 +807,30 @@
        qif-parse:check-number-formats '(decimal comma)
        qif-parse:parse-numbers/format (qif-file:xtns self)
        qif-parse:print-numbers
-       'guess-on-ambiguity
-       set-error 'split-amounts)
+       'guess-on-ambiguity add-error 'split-amounts
+       update-progress)
+      (finish-sub)
 
+      (finish-sub)
+
+
       (begin
         (set! all-ok #t)
         #t))
 
-     (cond (error
+     ;; Determine what to return.
+     (cond (qif-import:canceled
+            #t)
+           (error
             (cons all-ok error))
-           (#t #t))))
-;)
+           (else '()))))
 
 
+  ;; Safely read the file and return the result.
+  (gnc:backtrace-if-exception
+    (lambda () (catch 'cancel private-parse (lambda (key . args) #t)))))
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;  parse-field
 ;;
@@ -731,13 +839,18 @@
 ;;  of objects.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (parse-field getter setter parser objects errormsg)
-  (for-each
-   (lambda (obj)
-     (let ((unparsed (getter obj)))
+(define (parse-field getter setter parser objects errorproc errortype reporter)
+  (let ((work-to-do (length objects))
+        (work-done 0)
+        (unparsed #f))
+    (for-each
+     (lambda (obj)
+       (set! unparsed (getter obj))
        (if (and unparsed (string? unparsed))
-           (setter obj (parser unparsed)))))
-   objects)
+           (setter obj (parser unparsed errorproc errortype)))
+       (set! work-done (+ 1 work-done))
+       (reporter (/ work-done work-to-do)))
+     objects))
   #t)
 
 
@@ -753,11 +866,16 @@
 
 (define (check-and-parse-field getter setter equiv-thunk checker
                                formats parser objects printer
-                               on-error errormsg errortype)
-  ;; first find the right format for the field
-  (let ((do-parsing #f)
-        (retval #t)
-        (format #f))
+                               on-error errorproc errortype
+                               reporter)
+  (let* ((do-parsing #f)
+         (retval #t)
+         (format #f)
+         (len (length objects))
+         (work-to-do (* len 2))
+         (work-done 0))
+
+    ;; first find the right format for the field
     ;; loop over objects.  If the formats list ever gets down
     ;; to 1 element, we can stop right there.
     (if (not (null? objects))
@@ -767,7 +885,9 @@
             (if val
                 (begin
                   (set! do-parsing #t)
-                  (set! formats (checker val formats)))))
+                  (set! formats (checker val formats))))
+            (set! work-done (+ 1 work-done))
+            (reporter (/ work-done work-to-do)))
           (if (and (not (null? formats))
                    ;; (not (null? (cdr formats)))
                    (not (null? rest)))
@@ -786,24 +906,30 @@
     (cond
      ((or (not formats)
           (null? formats))
-      (errormsg errortype "Data for number or date does not match a known format.")
+      ;; Data was not in any of the supplied formats.
+      (errorproc errortype (_ "Unrecognized or inconsistent format."))
       (set! retval #f)
       (set! do-parsing #f))
+
      ((and (not (null? (cdr formats))) do-parsing)
-      ;; there are multiple formats that fit.  If they all produce the
+      ;; There are multiple formats that fit.  If they all produce the
       ;; same interpretation for every data point in the set, then
       ;; just ignore the format ambiguity.  Otherwise, it's really an
       ;; error.  ATM since there's no way to correct the error let's
       ;; just leave it be.
       (if (or (eq? on-error 'guess-on-ambiguity)
               (all-formats-equivalent? getter parser equiv-thunk formats
-                                       objects printer errormsg errortype))
+                                       objects printer errorproc errortype))
           (set! format (car formats))
           (begin
-            (errormsg errortype formats)
+            (errorproc errortype formats)
             (set! do-parsing #f)
+            ;; NOTE: It seems like this ought to be (set! retval #f) instead,
+            ;;       but that would stop all parsing dead in its tracks. Not
+            ;;       sure that this can happen to anything other than dates,
+            ;;       and those will get reparsed anyway.
             (set! retval #t))))
-     (#t
+     (else
       (set! format (car formats))))
 
     ;; do-parsing is false if there were no objects with non-#f values
@@ -812,19 +938,25 @@
     ;; all of them once, but at least not twice.
     (if do-parsing
         (for-each
-         (lambda (current)
-           (let ((val (getter current))
-                 (parsed #f))
-             (if val
-                 (begin
-                   (set! parsed (parser val format))
-                   (if parsed
-                       (setter current parsed)
-                       (begin
-                         (set! retval #f)
-                         (errormsg errortype
-                          "Data format inconsistent in QIF file.")))))))
+          (lambda (current)
+            (let ((val (getter current))
+                  (parsed #f))
+              (if val
+                  (begin
+                    (set! parsed (parser val format))
+                    (if parsed
+                        (setter current parsed)
+                        (begin
+                          (set! retval #f)
+                          (errorproc errortype
+                           (_ "Parsing failed.")))))))
+            (set! work-done (+ 1 work-done))
+            (reporter (/ work-done work-to-do)))
          objects))
+
+    (if retval
+        (reporter 1))
+
     retval))
 
 
@@ -839,35 +971,51 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define (all-formats-equivalent? getter parser equiv-thunk formats objects
-                                 printer errormsg errortype)
+                                 printer errorproc errortype)
   (let ((all-ok #t))
     (let obj-loop ((objlist objects))
       (let* ((unparsed (getter (car objlist)))
              (parsed #f))
         (if (string? unparsed)
             (begin
+              ;; Parse using the first format in the list.
               (set! parsed (parser unparsed (car formats)))
+              ;; For each remaining format, see if the result is the same.
               (for-each
                (lambda (fmt)
                  (let ((this-parsed (parser unparsed fmt)))
                    (if (not (equiv-thunk parsed this-parsed))
                        (begin
                          (set! all-ok #f)
-                         (errormsg errortype
-                          (with-output-to-string
-                            (lambda ()
-                              (for-each
-                               (lambda (elt)
-                                 (display elt))
-                               (list
-                                "Parse ambiguity : between formats "
-                                formats "\nValue " unparsed " could be "
-                                (printer parsed) " or "
-                                (printer this-parsed)
-                                "\nand no evidence exists to distinguish."
-                                "\nUsing " (printer parsed) ". "
-                                "\nSee help for more info.")))))))))
+                         (if (not (eq? errortype 'date))
+                             (errorproc errortype
+                                        (gnc:list-display-to-string (list
+                              (_ "Parse ambiguity between formats") " "
+                              formats "\n"
+                              (sprintf #f (_ "Value '%s' could be %s or %s.")
+                                       parsed
+                                       (printer parsed)
+                                       (printer this-parsed))))))))))
                (cdr formats))))
         (if (and all-ok (not (null? (cdr objlist))))
             (obj-loop (cdr objlist)))))
     all-ok))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;  qif-file:parse-fields-results
+;;
+;;  Take the results from qif-file:parse fields and find the
+;;  first result for a particular type of parse.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define (qif-file:parse-fields-results results type)
+  (define (test-results results)
+    (if (null? results) #f
+        (let* ((this-res (car results))
+               (this-type (car this-res)))
+          (if (eq? this-type type)
+              (cdr this-res)
+              (test-results (cdr results))))))
+
+  (if results (test-results results) #f))

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-import.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-import.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-import.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -44,6 +44,9 @@
 (export qif-import:load-map-prefs)
 (export qif-import:qif-to-gnc)
 (export qif-import:qif-to-gnc-undo)
+(export qif-import:reset-cancel-pause)
+(export qif-import:cancel)
+(export qif-import:toggle-pause)
 
 (export qif-map-entry:gnc-name)
 (export qif-map-entry:set-gnc-name!)

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-merge-groups.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-merge-groups.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-merge-groups.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -50,161 +50,177 @@
 ;;  and change #f to #t where duplication is found.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (gnc:account-tree-find-duplicates old-root new-root window)
+(define (gnc:account-tree-find-duplicates old-root new-root progress-dialog)
 
-  ;; Given a list of accounts, this predicate returns true if any
-  ;; of those accounts are involved in a transaction.
-  (define (has-any-xtns? acctlist)
-    (if (null? acctlist)
-        #f
-        (let ((splits (xaccAccountGetSplitList (car acctlist))))
-          (if (null? splits)
-              (has-any-xtns? (cdr acctlist))
-              #t))))
+  ;; This procedure does all the work. We'll define it, then call it safely.
+  (define (private-find)
 
-  (let ((old-accounts (gnc-account-get-descendants-sorted old-root)))
-    (if (has-any-xtns? old-accounts)
-        ;; Get all the transactions in the new tree, then iterate over them
-        ;; trying to find matches in the old tree.  If there are matches,
-        ;; push the matches onto a list.
-        (let* ((new-xtns (gnc:account-tree-get-transactions new-root))
-               (progress-dialog '())
-               (work-to-do (length new-xtns))
-               (work-done 0)
-               (matches '()))
+    ;; Given a list of accounts, this predicate returns true if any
+    ;; of those accounts are involved in a transaction.
+    (define (has-any-xtns? acctlist)
+      (if (null? acctlist)
+          #f
+          (let ((splits (xaccAccountGetSplitList (car acctlist))))
+            (if (null? splits)
+                (has-any-xtns? (cdr acctlist))
+                #t))))
 
-          ;; Use a progress dialog if this might take a while.
-          (if (> work-to-do 100)
-            (begin
-              (set! progress-dialog (gnc-progress-dialog-new window #f))
-              (gnc-progress-dialog-set-title progress-dialog (_ "Progress"))
-              (gnc-progress-dialog-set-heading progress-dialog
-                (_ "Finding duplicate transactions..."))))
 
-          ;; For each transaction in the new account tree, build a query
-          ;; that matches possibly duplicate transactions in the old tree.
-          (for-each
-            (lambda (xtn)
-              (let ((query (qof-query-create-for-splits))
-                    (num-splits 0))
-                (set! work-done (+ 1 work-done))
-                (if (not (null? progress-dialog))
+    (let ((old-accounts (gnc-account-get-descendants-sorted old-root)))
+      (if (has-any-xtns? old-accounts)
+          ;; Get all the transactions in the new tree, then iterate over them
+          ;; trying to find matches in the old tree.  If there are matches,
+          ;; push the matches onto a list.
+          (let* ((new-xtns (gnc:account-tree-get-transactions new-root))
+                 (work-to-do (length new-xtns))
+                 (work-done 0)
+                 (matches '()))
+
+            ;; This procedure handles progress reporting, pause, and cancel.
+            (define (update-progress)
+              (set! work-done (+ 1 work-done))
+              (if (and progress-dialog
+                       (zero? (remainder work-done 8)))
                   (begin
                     (gnc-progress-dialog-set-value progress-dialog
                                                    (/ work-done work-to-do))
-                    (gnc-progress-dialog-update progress-dialog)))
+                    (qif-import:check-pause progress-dialog)
+                    (if qif-import:canceled
+                        (throw 'cancel)))))
 
-                (qof-query-set-book query (gnc-account-get-book old-root))
 
-                ;; First, we only want to find only transactions
-                ;; from accounts in the old tree.
-                (xaccQueryAddAccountMatch query
-                                          old-accounts
-                                          QOF-GUID-MATCH-ANY QOF-QUERY-AND)
+            (if progress-dialog
+                (gnc-progress-dialog-set-sub progress-dialog
+                                         (_ "Finding duplicate transactions")))
 
-                ;; The date should be close to the same.. +/- a week.
-                (let ((date (gnc-transaction-get-date-posted xtn)))
-                  (xaccQueryAddDateMatchTS query #t
-                                           (decdate date WeekDelta) #t
-                                           (incdate date WeekDelta)
-                                           QOF-QUERY-AND))
+            ;; For each transaction in the new account tree, build a query
+            ;; that matches possibly duplicate transactions in the old tree.
+            (for-each
+              (lambda (xtn)
+                (let ((query (qof-query-create-for-splits))
+                      (num-splits 0))
+                  (qof-query-set-book query (gnc-account-get-book old-root))
 
-                ;; For each split in the new transaction, add a
-                ;; term that can match on its properties.
-                (let ((q-splits (qof-query-create-for-splits)))
-                  (for-each
-                    (lambda (split)
-                      (set! num-splits (+ num-splits 1))
-                      (let ((sq (qof-query-create-for-splits)))
-                        (qof-query-set-book sq (gnc-account-get-book old-root))
+                  ;; First, we only want to find only transactions
+                  ;; from accounts in the old tree.
+                  (xaccQueryAddAccountMatch query
+                                            old-accounts
+                                            QOF-GUID-MATCH-ANY QOF-QUERY-AND)
 
-                        ;; Require a match on the account name. If the name
-                        ;; doesn't exist in the old tree (indicating a new
-                        ;; account), the match will be NULL and the query
-                        ;; won't find anything.  Optimize this later.
-                        (xaccQueryAddSingleAccountMatch
-                          sq
-                          (gnc-account-lookup-by-full-name old-root
-                            (gnc-account-get-full-name
-                              (xaccSplitGetAccount split)))
-                          QOF-QUERY-AND)
+                  ;; The date should be close to the same.. +/- a week.
+                  (let ((date (gnc-transaction-get-date-posted xtn)))
+                    (xaccQueryAddDateMatchTS query #t
+                                             (decdate date WeekDelta) #t
+                                             (incdate date WeekDelta)
+                                             QOF-QUERY-AND))
 
-                        ;; Require the value of the split in the new tree
-                        ;; to match the the value of the split in the old
-                        ;; tree.  We should really check for fuzziness.
-                        (xaccQueryAddValueMatch sq
-                                                (xaccSplitGetValue split)
-                                                QOF-NUMERIC-MATCH-ANY
-                                                QOF-COMPARE-EQUAL
-                                                QOF-QUERY-AND)
+                  ;; For each split in the new transaction, add a
+                  ;; term that can match on its properties.
+                  (let ((q-splits (qof-query-create-for-splits)))
+                    (for-each
+                      (lambda (split)
+                        (set! num-splits (+ num-splits 1))
+                        (let ((sq (qof-query-create-for-splits)))
+                          (qof-query-set-book sq (gnc-account-get-book old-root))
 
-                        ;; Now merge into the split query.  Reminder: q-splits
-                        ;; must be merged with an OR. Otherwise, nothing will
-                        ;; match. (For example, something can be equal to 4 or
-                        ;; to -4, but not both.)
-                        (let ((q-new (qof-query-merge q-splits
-                                                      sq
-                                                      QOF-QUERY-OR)))
-                          (qof-query-destroy q-splits)
-                          (qof-query-destroy sq)
-                          (set! q-splits q-new))))
-                    (xaccTransGetSplitList xtn))
+                          ;; Require a match on the account name. If the name
+                          ;; doesn't exist in the old tree (indicating a new
+                          ;; account), the match will be NULL and the query
+                          ;; won't find anything.  Optimize this later.
+                          (xaccQueryAddSingleAccountMatch
+                            sq
+                            (gnc-account-lookup-by-full-name old-root
+                              (gnc-account-get-full-name
+                                (xaccSplitGetAccount split)))
+                            QOF-QUERY-AND)
 
-                  ;; Now q-splits will find every split that is the same as
-                  ;; any one split of the new-root transaction.  Merge it in.
-                  (let ((q-new (qof-query-merge query
-                                                q-splits
-                                                QOF-QUERY-AND)))
-                    (qof-query-destroy query)
-                    (qof-query-destroy q-splits)
-                    (set! query q-new)))
+                          ;; Require the value of the split in the new tree
+                          ;; to match the the value of the split in the old
+                          ;; tree.  We should really check for fuzziness.
+                          (xaccQueryAddValueMatch sq
+                                                  (xaccSplitGetValue split)
+                                                  QOF-NUMERIC-MATCH-ANY
+                                                  QOF-COMPARE-EQUAL
+                                                  QOF-QUERY-AND)
 
-                ;; Now that we have built a query that finds matching splits
-                ;; in the old tree, run it and build a list of transactions
-                ;; from the results.
-                ;;
-                ;; If the transaction from the new tree has more than two
-                ;; splits, then we'll assume that it fully reflects what
-                ;; occurred, and only consider transactions in the old tree
-                ;; that match with every single split.
-                ;;
-                ;; All other new transactions could be incomplete, so we'll
-                ;; consider transactions from the old tree to be possible
-                ;; duplicates even if only one split matches.
-                ;;
-                ;; For more information, see bug 481528.
-                (let ((old-xtns (xaccQueryGetTransactions
-                                  query
-                                  (if (> num-splits 2)
-                                      QUERY-TXN-MATCH-ALL
-                                      QUERY-TXN-MATCH-ANY))))
+                          ;; Now merge into the split query.  Reminder: q-splits
+                          ;; must be merged with an OR. Otherwise, nothing will
+                          ;; match. (For example, something can be equal to 4 or
+                          ;; to -4, but not both.)
+                          (let ((q-new (qof-query-merge q-splits
+                                                        sq
+                                                        QOF-QUERY-OR)))
+                            (qof-query-destroy q-splits)
+                            (qof-query-destroy sq)
+                            (set! q-splits q-new))))
+                      (xaccTransGetSplitList xtn))
 
-                  ;; Turn the resulting list of possibly duplicated
-                  ;; transactions into an association list.
-                  (set! old-xtns (map
-                                   (lambda (elt)
-                                     (cons elt #f)) old-xtns))
+                    ;; Now q-splits will find every split that is the same as
+                    ;; any one split of the new-root transaction.  Merge it in.
+                    (let ((q-new (qof-query-merge query
+                                                  q-splits
+                                                  QOF-QUERY-AND)))
+                      (qof-query-destroy query)
+                      (qof-query-destroy q-splits)
+                      (set! query q-new)))
 
-                  ;; If anything matched the query, add it to our "matches"
-                  ;; association list, keyed by the new-root transaction.
-                  (if (not (null? old-xtns))
-                      (set! matches (cons (cons xtn old-xtns) matches))))
+                  ;; Now that we have built a query that finds matching splits
+                  ;; in the old tree, run it and build a list of transactions
+                  ;; from the results.
+                  ;;
+                  ;; If the transaction from the new tree has more than two
+                  ;; splits, then we'll assume that it fully reflects what
+                  ;; occurred, and only consider transactions in the old tree
+                  ;; that match with every single split.
+                  ;;
+                  ;; All other new transactions could be incomplete, so we'll
+                  ;; consider transactions from the old tree to be possible
+                  ;; duplicates even if only one split matches.
+                  ;;
+                  ;; For more information, see bug 481528.
+                  (let ((old-xtns (xaccQueryGetTransactions
+                                    query
+                                    (if (> num-splits 2)
+                                        QUERY-TXN-MATCH-ALL
+                                        QUERY-TXN-MATCH-ANY))))
 
-                (qof-query-destroy query)))
-            new-xtns)
+                    ;; Turn the resulting list of possibly duplicated
+                    ;; transactions into an association list.
+                    (set! old-xtns (map
+                                     (lambda (elt)
+                                       (cons elt #f)) old-xtns))
 
-          ;; Get rid of the progress dialog.
-          (if (not (null? progress-dialog))
-              (gnc-progress-dialog-destroy progress-dialog))
+                    ;; If anything matched the query, add it to our "matches"
+                    ;; association list, keyed by the new-root transaction.
+                    (if (not (null? old-xtns))
+                        (set! matches (cons (cons xtn old-xtns) matches))))
 
-          ;; Return the matches.
-          matches)
+                  (qof-query-destroy query))
+                (update-progress))
+              new-xtns)
 
-        ;; Since there are either no accounts or no transactions in the old
-        ;; tree, duplicate checking is unnecessary. Return an empty list.
-        '())))
+            ;; Finished.
+            (if progress-dialog
+                (gnc-progress-dialog-set-value progress-dialog 1))
 
+            ;; Return the matches.
+            matches)
 
+          ;; Since there are either no accounts or no transactions in the old
+          ;; tree, duplicate checking is unnecessary.
+          (begin
+            ;; Finished.
+            (if progress-dialog
+                (gnc-progress-dialog-set-value progress-dialog 1))
+
+            ;; Return an empty list.
+            '()))))
+
+  ;; Safely do the work and return the result.
+  (gnc:backtrace-if-exception
+    (lambda () (catch 'cancel private-find (lambda (key . args) #t)))))
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;  gnc:prune-matching-transactions
 ;;

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-parse.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-parse.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-parse.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -138,7 +138,7 @@
 ;;  conventions.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-parse:parse-acct-type read-value)
+(define (qif-parse:parse-acct-type read-value errorproc errortype)
   (let ((mangled-string
          (string-downcase! (string-remove-trailing-space
                             (string-remove-leading-space read-value)))))
@@ -162,9 +162,9 @@
      ((string=? mangled-string "mutual")
       (list GNC-BANK-TYPE))
      (#t
-      (gnc:warn "qif-parse:parse-acct-type: unrecognized account type ["
-                read-value
-                "]... substituting Bank.")
+      (errorproc errortype
+                 (sprintf #f (_ "Unrecognized account type '%s'. Defaulting to Bank.")
+                          read-value))
       (list GNC-BANK-TYPE)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -185,7 +185,7 @@
     (string->symbol bang-field)))
 
 
-(define (qif-parse:parse-action-field read-value)
+(define (qif-parse:parse-action-field read-value errorproc errortype)
   (if read-value
       (let ((action-symbol (string-to-canonical-symbol read-value)))
         (case action-symbol
@@ -269,12 +269,8 @@
 ;          ((vest)
 ;           'vest)
           (else
-           (gnc-warning-dialog '()
-            (string-append
-             (sprintf #f (_ "The file contains an unknown Action '%s'.")
-                      read-value)
-             "\n"
-             (_ "Some transactions may be discarded.")))
+           (errorproc errortype
+                      (sprintf #f (_ "Unrecognized action '%s'.") read-value))
            #f)))
       #f))
 
@@ -284,7 +280,7 @@
 ;;  budget related stuff I don't understand.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(define (qif-parse:parse-cleared-field read-value)
+(define (qif-parse:parse-cleared-field read-value errorproc errortype)
   (if (and (string? read-value)
            (> (string-length read-value) 0))
       (let ((secondchar (string-ref read-value 0)))
@@ -296,7 +292,7 @@
               ((or (eq? secondchar #\?)
                    (eq? secondchar #\!))
                'budgeted)
-              (#t
+              (else
                #f)))
       #f))
 

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-to-gnc.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-to-gnc.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-to-gnc.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -201,194 +201,215 @@
 ;; This is the top-level of the back end conversion from QIF
 ;; to GnuCash. All the account mappings and so on should be
 ;; done before this is called.
+;;
+;; This procedure returns:
+;;   success: the root of the imported tree
+;;   failure: a symbol indicating the reason
+;;   cancel:  #t
+;;   bug:     #f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define (qif-import:qif-to-gnc qif-files-list
                                qif-acct-map qif-cat-map
                                qif-memo-map stock-map
-                               default-currency-name window)
-  (let ((progress-dialog '())
-        (retval #f))
-    (set! retval
-      (gnc:backtrace-if-exception
-       (lambda ()
-         (let* ((old-root (gnc-get-current-root-account))
-                (new-root (xaccMallocAccount (gnc-get-current-book)))
-                (gnc-acct-hash (make-hash-table 20))
-                (sep (gnc-get-account-separator-string))
-                (default-currency
-                  (gnc-commodity-table-find-full
-                   (gnc-commodity-table-get-table (gnc-get-current-book))
-                   GNC_COMMODITY_NS_CURRENCY default-currency-name))
-                (sorted-accounts-list '())
-                (markable-xtns '())
-                (sorted-qif-files-list
-                 (sort qif-files-list
-                       (lambda (a b)
-                         (> (length (qif-file:xtns a))
-                            (length (qif-file:xtns b))))))
-                (work-to-do 0)
-                (work-done 0))
+                               default-currency-name progress-dialog)
 
-           ;; first, build a local account tree that mirrors the gnucash
-           ;; accounts in the mapping data.  we need to iterate over the
-           ;; cat-map and the acct-map to build the list
-           (hash-fold
-            (lambda (k v p)
-              (if (qif-map-entry:display? v)
-                  (set! sorted-accounts-list
-                        (cons v sorted-accounts-list)))
-              #t)
-            #t qif-acct-map)
+  ;; This procedure does all the work. We'll define it, then call it safely.
+  (define (private-convert)
+    (let* ((old-root (gnc-get-current-root-account))
+           (new-root (xaccMallocAccount (gnc-get-current-book)))
+           (gnc-acct-hash (make-hash-table 20))
+           (sep (gnc-get-account-separator-string))
+           (default-currency
+             (gnc-commodity-table-find-full
+              (gnc-commodity-table-get-table (gnc-get-current-book))
+              GNC_COMMODITY_NS_CURRENCY default-currency-name))
+           (sorted-accounts-list '())
+           (markable-xtns '())
+           (sorted-qif-files-list (sort qif-files-list
+                                        (lambda (a b)
+                                          (> (length (qif-file:xtns a))
+                                             (length (qif-file:xtns b))))))
+           (work-to-do 0)
+           (work-done 0))
 
-           (hash-fold
-            (lambda (k v p)
-              (if (qif-map-entry:display? v)
-                  (set! sorted-accounts-list
-                        (cons v sorted-accounts-list)))
-              #t)
-            #t qif-cat-map)
+      ;; This procedure handles progress reporting, pause, and cancel.
+      (define (update-progress)
+        (set! work-done (+ 1 work-done))
+        (if (and progress-dialog
+                 (zero? (remainder work-done 8)))
+            (begin
+              (gnc-progress-dialog-set-value progress-dialog
+                                             (/ work-done work-to-do))
+              (qif-import:check-pause progress-dialog)
+              (if qif-import:canceled
+                  (throw 'cancel)))))
 
-           (hash-fold
-            (lambda (k v p)
-              (if (qif-map-entry:display? v)
-                  (set! sorted-accounts-list
-                        (cons v sorted-accounts-list)))
-              #t)
-            #t qif-memo-map)
 
-           ;; sort the account info on the depth of the account path.  if a
-           ;; short part is explicitly mentioned, make sure it gets created
-           ;; before the deeper path, which will create the parent accounts
-           ;; without the information about their type.
-           (set! sorted-accounts-list
-                 (sort sorted-accounts-list
-                       (lambda (a b)
-                         (< (gnc:substring-count (qif-map-entry:gnc-name a)
-                                                 sep)
-                            (gnc:substring-count (qif-map-entry:gnc-name b)
-                                                 sep)))))
+      (if progress-dialog
+          (gnc-progress-dialog-set-sub progress-dialog
+                                      (_ "Preparing to convert your QIF data")))
 
-           ;; make all the accounts
-           (for-each
-            (lambda (acctinfo)
-              (let* ((security
-                      (and stock-map
-                           (hash-ref stock-map
-                                     (qif-import:get-account-name
-                                      (qif-map-entry:qif-name acctinfo)))))
-                     (ok-types (qif-map-entry:allowed-types acctinfo))
-                     (equity? (memv GNC-EQUITY-TYPE ok-types))
-                     (stock? (or (memv GNC-STOCK-TYPE ok-types)
-                                 (memv GNC-MUTUAL-TYPE ok-types))))
+      ;; Build a list of all accounts to create for the import tree.
+      ;; We need to iterate over the account, category, and payee/memo
+      ;; mappings to build the list.
+      (hash-fold
+       (lambda (k v p)
+         (if (qif-map-entry:display? v)
+             (set! sorted-accounts-list
+                   (cons v sorted-accounts-list)))
+         #t)
+       #t qif-acct-map)
 
-                ;; Debug
-                ;; (for-each
-                ;;  (lambda (expr)
-                ;;    (display expr))
-                ;;  (list "Account: " acctinfo "\nsecurity = " security
-                ;;     "\nequity? = " equity?
-                ;;     "\n"))
+      (hash-fold
+       (lambda (k v p)
+         (if (qif-map-entry:display? v)
+             (set! sorted-accounts-list
+                   (cons v sorted-accounts-list)))
+         #t)
+       #t qif-cat-map)
 
-                (cond ((and equity? security)  ;; a "retained holdings" acct
-                       (qif-import:find-or-make-acct acctinfo #f
-                                                     security #t
-                                                     default-currency
-                                                     gnc-acct-hash
-                                                     old-root new-root))
-                      ((and security (or stock?
-                                         (gnc-commodity-is-currency security)))
-                       (qif-import:find-or-make-acct
-                        acctinfo #f security #t default-currency
-                        gnc-acct-hash old-root new-root))
-                      (#t
-                       (qif-import:find-or-make-acct
-                        acctinfo #f default-currency #t default-currency
-                        gnc-acct-hash old-root new-root)))))
-            sorted-accounts-list)
+      (hash-fold
+       (lambda (k v p)
+         (if (qif-map-entry:display? v)
+             (set! sorted-accounts-list
+                   (cons v sorted-accounts-list)))
+         #t)
+       #t qif-memo-map)
+      (set! work-to-do (length sorted-accounts-list))
 
-           ;; before trying to mark transactions, prune down the list of
-           ;; ones to match.
-           (for-each
-            (lambda (qif-file)
-              (for-each
-               (lambda (xtn)
-                 (set! work-to-do (+ 1 work-to-do))
-                 (let splitloop ((splits (qif-xtn:splits xtn)))
-                   (if (qif-split:category-is-account? (car splits))
-                       (begin
-                         (set! markable-xtns (cons xtn markable-xtns))
-                         (set! work-to-do (+ 1 work-to-do)))
-                       (if (not (null? (cdr splits)))
-                           (splitloop (cdr splits))))))
-               (qif-file:xtns qif-file)))
-            qif-files-list)
+      ;; Before trying to mark transactions, prune down the list to
+      ;; those that are transfers between QIF accounts.
+      (for-each
+       (lambda (qif-file)
+         (for-each
+          (lambda (xtn)
+            (set! work-to-do (+ 1 work-to-do))
+            (let splitloop ((splits (qif-xtn:splits xtn)))
+              (if (qif-split:category-is-account? (car splits))
+                  (begin
+                    (set! markable-xtns (cons xtn markable-xtns))
+                    (set! work-to-do (+ 1 work-to-do)))
+                  (if (not (null? (cdr splits)))
+                      (splitloop (cdr splits))))))
+          (qif-file:xtns qif-file)))
+       qif-files-list)
 
-           (if (> work-to-do 100)
-               (begin
-                 (set! progress-dialog (gnc-progress-dialog-new window #f))
-                 (gnc-progress-dialog-set-title progress-dialog (_ "Progress"))
-                 (gnc-progress-dialog-set-heading progress-dialog
-                                             (_ "Importing transactions..."))))
 
+      ;; Build a local account tree to hold converted transactions.
+      (if progress-dialog
+          (gnc-progress-dialog-set-sub progress-dialog
+                                       (_ "Creating accounts")))
 
-           ;; now run through the markable transactions marking any
-           ;; duplicates.  marked transactions/splits won't get imported.
-           (if (> (length markable-xtns) 1)
-               (let xloop ((xtn (car markable-xtns))
-                           (rest (cdr markable-xtns)))
-                 (set! work-done (+ 1 work-done))
-                 (if (not (null? progress-dialog))
-                     (begin
-                       (gnc-progress-dialog-set-value
-                        progress-dialog (/ work-done work-to-do))
-                       (gnc-progress-dialog-update progress-dialog)))
-                 (if (not (qif-xtn:mark xtn))
-                     (qif-import:mark-matching-xtns xtn rest))
-                 (if (not (null? (cdr rest)))
-                     (xloop (car rest) (cdr rest)))))
+      ;; Sort the account list on the depth of the account path.  If a
+      ;; short part is explicitly mentioned, make sure it gets created
+      ;; before the deeper path that would create the parent accounts
+      ;; without enough information about their type.
+      (set! sorted-accounts-list
+            (sort sorted-accounts-list
+                  (lambda (a b)
+                    (< (gnc:substring-count (qif-map-entry:gnc-name a)
+                                            sep)
+                       (gnc:substring-count (qif-map-entry:gnc-name b)
+                                            sep)))))
 
-           ;; iterate over files. Going in the sort order by number of
-           ;; transactions should give us a small speed advantage.
-           (for-each
-            (lambda (qif-file)
-              (for-each
-               (lambda (xtn)
-                 (set! work-done (+ 1 work-done))
-                 (if (not (null? progress-dialog))
-                     (begin
-                       (gnc-progress-dialog-set-value
-                        progress-dialog (/ work-done work-to-do))
-                       (gnc-progress-dialog-update progress-dialog)))
-                 (if (not (qif-xtn:mark xtn))
-                     (begin
-                       ;; create and fill in the GNC transaction
-                       (let ((gnc-xtn (xaccMallocTransaction
-                                       (gnc-get-current-book))))
-                         (xaccTransBeginEdit gnc-xtn)
+      ;; Make all the accounts.
+      (for-each
+       (lambda (acctinfo)
+         (let* ((security
+                 (and stock-map
+                      (hash-ref stock-map
+                                (qif-import:get-account-name
+                                 (qif-map-entry:qif-name acctinfo)))))
+                (ok-types (qif-map-entry:allowed-types acctinfo))
+                (equity? (memv GNC-EQUITY-TYPE ok-types))
+                (stock? (or (memv GNC-STOCK-TYPE ok-types)
+                            (memv GNC-MUTUAL-TYPE ok-types))))
 
-                         ;; FIXME. This is probably wrong
-                         (xaccTransSetCurrency gnc-xtn (gnc-default-currency))
+           (update-progress)
+           (cond ((and equity? security)  ;; a "retained holdings" acct
+                  (qif-import:find-or-make-acct acctinfo #f
+                                                security #t
+                                                default-currency
+                                                gnc-acct-hash
+                                                old-root new-root))
+                 ((and security (or stock?
+                                    (gnc-commodity-is-currency security)))
+                  (qif-import:find-or-make-acct
+                   acctinfo #f security #t default-currency
+                   gnc-acct-hash old-root new-root))
+                 (#t
+                  (qif-import:find-or-make-acct
+                   acctinfo #f default-currency #t default-currency
+                   gnc-acct-hash old-root new-root)))))
+       sorted-accounts-list)
 
-                         ;; build the transaction
-                         (qif-import:qif-xtn-to-gnc-xtn
-                          xtn qif-file gnc-xtn gnc-acct-hash
-                          qif-acct-map qif-cat-map qif-memo-map)
+      ;; Run through the markable transactions marking any
+      ;; duplicates.  marked transactions/splits won't get imported.
+      (if progress-dialog
+          (gnc-progress-dialog-set-sub progress-dialog
+                                    (_ "Matching transfers between accounts")))
+      (if (> (length markable-xtns) 1)
+          (let xloop ((xtn (car markable-xtns))
+                      (rest (cdr markable-xtns)))
+            ;; Update the progress.
+            (update-progress)
 
-                         ;; rebalance and commit everything
-                         (xaccTransCommitEdit gnc-xtn)))))
-               (qif-file:xtns qif-file)))
-            sorted-qif-files-list)
+            (if (not (qif-xtn:mark xtn))
+                (qif-import:mark-matching-xtns xtn rest))
+            (if (not (null? (cdr rest)))
+                (xloop (car rest) (cdr rest)))))
 
-           new-root))))
+      ;; Iterate over files. Going in the sort order by number of
+      ;; transactions should give us a small speed advantage.
+      (for-each
+       (lambda (qif-file)
+         (if progress-dialog
+             (gnc-progress-dialog-set-sub progress-dialog
+                                          (string-append (_ "Converting") " "
+                                                     (qif-file:path qif-file))))
+         (for-each
+          (lambda (xtn)
+            ;; Update the progress.
+            (update-progress)
 
-    ;; Get rid of the progress dialog (if any).
-    (if (not (null? progress-dialog))
-        (gnc-progress-dialog-destroy progress-dialog))
+            (if (not (qif-xtn:mark xtn))
+                ;; Convert into a GnuCash transaction.
+                (let ((gnc-xtn (xaccMallocTransaction
+                                (gnc-get-current-book))))
+                  (xaccTransBeginEdit gnc-xtn)
 
-    retval))
+                  ;; FIXME. This is probably wrong
+                  (xaccTransSetCurrency gnc-xtn (gnc-default-currency))
 
+                  ;; Build the transaction.
+                  (qif-import:qif-xtn-to-gnc-xtn xtn qif-file gnc-xtn
+                                                 gnc-acct-hash
+                                                 qif-acct-map
+                                                 qif-cat-map
+                                                 qif-memo-map
+                                                 progress-dialog)
 
+                  ;; rebalance and commit everything
+                  (xaccTransCommitEdit gnc-xtn))))
+          (qif-file:xtns qif-file)))
+       sorted-qif-files-list)
+
+      ;; Finished.
+      (if progress-dialog
+          (gnc-progress-dialog-set-value progress-dialog 1))
+
+      new-root))
+
+  ;; Safely convert the files and return the result.
+  (gnc:backtrace-if-exception
+    (lambda ()
+      (catch 'cancel
+             (lambda ()
+               (catch 'bad-date private-convert (lambda (key . args) key)))
+             (lambda (key . args) #t)))))
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; qif-import:qif-xtn-to-gnc-xtn
 ;; translate a single transaction to a set of gnucash splits and
@@ -397,7 +418,8 @@
 
 (define (qif-import:qif-xtn-to-gnc-xtn qif-xtn qif-file gnc-xtn
                                        gnc-acct-hash
-                                       qif-acct-map qif-cat-map qif-memo-map)
+                                       qif-acct-map qif-cat-map qif-memo-map
+                                       progress-dialog)
   (let ((splits (qif-xtn:splits qif-xtn))
         (gnc-near-split (xaccMallocSplit (gnc-get-current-book)))
         (near-split-total (gnc-numeric-zero))
@@ -424,12 +446,18 @@
     ;; Set the transaction date.
     (cond
       ((not qif-date)
+        (qif-import:log progress-dialog
+                        "qif-import:qif-xtn-to-gnc-xtn"
+                        (_ "Missing transaction date."))
         (throw 'bad-date
                "qif-import:qif-xtn-to-gnc-xtn"
                "Missing transaction date."
                #f
                #f))
       ((< (list-ref qif-date 2) 1970)
+        (qif-import:log progress-dialog
+                        "qif-import:qif-xtn-to-gnc-xtn"
+                        (_ "Dates earlier than 1970 are not supported."))
         (throw 'bad-date
                "qif-import:qif-xtn-to-gnc-xtn"
                "Invalid transaction year (~A)."
@@ -482,7 +510,6 @@
                                        (gnc-get-current-book)))
                        (far-acct-info #f)
                        (far-acct-name #f)
-                       (far-acct-type #f)
                        (far-acct #f)
                        (split-amt (qif-split:amount qif-split))
                        ;; For split transactions, get this split's memo.
@@ -572,7 +599,6 @@
                (commission-acct #f)
                (commission-amt (qif-xtn:commission qif-xtn))
                (commission-split #f)
-               (defer-share-price #f)
                (gnc-far-split (xaccMallocSplit (gnc-get-current-book))))
 
           (if (not num-shares) (set! num-shares (gnc-numeric-zero)))
@@ -796,11 +822,9 @@
          (date (qif-xtn:date xtn))
          (amount (n- (qif-split:amount split)))
          (group-amount #f)
-         (memo (qif-split:memo split))
          (security-name (qif-xtn:security-name xtn))
          (action (qif-xtn:action xtn))
          (bank-xtn? (not security-name))
-         (cleared? #f)
          (different-acct-splits '())
          (same-acct-splits '())
          (how #f)
@@ -895,8 +919,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define (qif-import:xtn-has-matches? xtn acct-name date amount group-amt)
-  (let ((matching-splits '())
-        (same-acct-splits '())
+  (let ((same-acct-splits '())
         (this-group-amt (gnc-numeric-zero))
         (how #f)
         (date-matches
@@ -959,9 +982,7 @@
           ;; we can still have a many-to-one match.
           (if (and (not how)
                    (gnc-numeric-equal this-group-amt amount))
-              (begin
-                (set! how
-                      (cons 'many-to-one same-acct-splits))))))
+              (set! how (cons 'many-to-one same-acct-splits)))))
 
     ;; we're all done.  'how' either is #f or a
     ;; cons of the way-it-matched and a list of the matching

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif-utils.scm
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif-utils.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif-utils.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -7,6 +7,8 @@
 
 (use-modules (ice-9 regex))
 
+(define qif-import:paused #f)
+(define qif-import:canceled #f)
 
 (define (simple-filter pred list)
   (let ((retval '()))
@@ -67,3 +69,32 @@
    (string-downcase
     (string-remove-leading-space
      (string-remove-trailing-space str)))))
+
+
+(define (qif-import:log progress-dialog proc str)
+  (if progress-dialog
+      (gnc-progress-dialog-append-log progress-dialog (string-append str "\n"))
+      (gnc:warn proc ": " str)))
+
+(define (qif-import:reset-cancel-pause)
+  (set! qif-import:paused #f)
+  (set! qif-import:canceled #f))
+
+(define (qif-import:cancel)
+  (set! qif-import:canceled #t))
+
+(define (qif-import:toggle-pause progress-dialog)
+  (if qif-import:paused
+      (begin
+        (set! qif-import:paused #f)
+        (if progress-dialog
+            (gnc-progress-dialog-resume progress-dialog)))
+      (begin
+        (set! qif-import:paused #t)
+        (if progress-dialog
+            (gnc-progress-dialog-pause progress-dialog)))))
+
+(define (qif-import:check-pause progress-dialog)
+  (while (and qif-import:paused (not qif-import:canceled))
+    (gnc-progress-dialog-update progress-dialog)))
+

Modified: gnucash/branches/gda-dev2/src/import-export/qif-import/qif.glade
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-import/qif.glade	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/import-export/qif-import/qif.glade	2008-07-30 01:08:07 UTC (rev 17438)
@@ -87,55 +87,55 @@
 	  <property name="homogeneous">False</property>
 	  <property name="spacing">0</property>
 
-	      <child>
-		<widget class="GtkLabel" id="label1">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">_Select or add a GnuCash account:</property>
-		  <property name="use_underline">Yes</property>
-		  <property name="use_markup">False</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">5</property>
-		  <property name="ypad">0</property>
-                  <property name="mnemonic_widget">account_tree</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="padding">5</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
+	  <child>
+	    <widget class="GtkLabel" id="label1">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">_Select or add a GnuCash account:</property>
+	      <property name="use_underline">Yes</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">5</property>
+	      <property name="ypad">0</property>
+              <property name="mnemonic_widget">account_tree</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">5</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
 
+	  <child>
+	    <widget class="GtkScrolledWindow" id="scrolledwindow24">
+	      <property name="visible">True</property>
+	      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	      <property name="shadow_type">GTK_SHADOW_IN</property>
+	      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
 	      <child>
-		<widget class="GtkScrolledWindow" id="scrolledwindow24">
-		  <property name="visible">True</property>
-		  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-		  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-		  <property name="shadow_type">GTK_SHADOW_IN</property>
-		  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-		  <child>
-		    <widget class="GtkTreeView" id="account_tree">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="headers_visible">True</property>
-		      <property name="rules_hint">True</property>
-		      <property name="reorderable">False</property>
-		      <property name="enable_search">True</property>
-		      <property name="fixed_height_mode">False</property>
-		      <property name="hover_selection">False</property>
-		      <property name="hover_expand">False</property>
-		    </widget>
-		  </child>
-		</widget>
+	        <widget class="GtkTreeView" id="account_tree">
+	          <property name="visible">True</property>
+	          <property name="can_focus">True</property>
+	          <property name="headers_visible">True</property>
+	          <property name="rules_hint">True</property>
+	          <property name="reorderable">False</property>
+	          <property name="enable_search">True</property>
+	          <property name="fixed_height_mode">False</property>
+	          <property name="hover_selection">False</property>
+	          <property name="hover_expand">False</property>
+	        </widget>
 	      </child>
+	    </widget>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
@@ -193,7 +193,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox8">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -282,6 +282,186 @@
       </child>
 
       <child>
+	<widget class="GnomeDruidPageStandard" id="load_progress_page">
+	  <property name="visible">True</property>
+	  <property name="title" translatable="yes">Load QIF files</property>
+	  <signal name="prepare" handler="gnc_ui_qif_import_load_progress_prepare_cb" after="yes"/>
+	  <signal name="show" handler="gnc_ui_qif_import_load_progress_show_cb" after="yes"/>
+	  <signal name="next" handler="gnc_ui_qif_import_load_progress_next_cb"/>
+	  <signal name="back" handler="gnc_ui_qif_import_load_progress_back_cb"/>
+
+	  <child internal-child="vbox">
+	    <widget class="GtkVBox" id="druid-vbox7609">
+	      <property name="border_width">12</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">12</property>
+
+	      <child>
+		<widget class="GtkLabel" id="load_progress_primary">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="no">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Primary text&lt;/span&gt;</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">True</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="load_progress_secondary">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="no">Secondary text.</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">True</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkVBox" id="load_progress_vbox1">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
+
+		  <child>
+		    <widget class="GtkProgressBar" id="load_progress_bar">
+	              <property name="visible">True</property>
+	              <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
+	              <property name="fraction">0</property>
+	              <property name="pulse_step">0.10000000149</property>
+	              <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		    </widget>
+		    <packing>
+	              <property name="padding">0</property>
+	              <property name="expand">False</property>
+	              <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="load_progress_sub">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="no">Sub-operation text</property>
+		      <property name="label" translatable="no">&lt;span style=&quot;italic&quot;&gt;Sub-operation text&lt;/span&gt;</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">True</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">True</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHButtonBox" id="load_progress_hbuttonbox1">
+		      <property name="visible">True</property>
+		      <property name="layout_style">GTK_BUTTONBOX_END</property>
+  
+		      <child>
+	                <widget class="GtkButton" id="load_progress_pause">
+	                  <property name="visible">True</property>
+	                  <property name="sensitive">True</property>
+	                  <property name="can_default">True</property>
+	                  <property name="can_focus">True</property>
+	                  <property name="label">gtk-media-pause</property>
+	                  <property name="use_stock">True</property>
+	                  <property name="relief">GTK_RELIEF_NORMAL</property>
+	                  <property name="focus_on_click">True</property>
+	                  <signal name="clicked" handler="gnc_ui_qif_import_load_progress_pause_cb"/>
+	                </widget>
+	              </child>
+		    </widget>
+		    <packing>
+	              <property name="padding">0</property>
+	              <property name="expand">False</property>
+	              <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">6</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+	        <widget class="GtkScrolledWindow" id="scrolledwindow25">
+	          <property name="visible">True</property>
+	          <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	          <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	          <property name="shadow_type">GTK_SHADOW_IN</property>
+	          <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+	          <child>
+		    <widget class="GtkTextView" id="load_progress_log">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">False</property>
+		      <property name="overwrite">False</property>
+		      <property name="accepts_tab">False</property>
+		      <property name="justification">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap_mode">GTK_WRAP_WORD</property>
+		      <property name="cursor_visible">False</property>
+		      <property name="pixels_above_lines">0</property>
+		      <property name="pixels_below_lines">0</property>
+		      <property name="pixels_inside_wrap">0</property>
+		      <property name="left_margin">0</property>
+		      <property name="right_margin">0</property>
+		      <property name="indent">0</property>
+		      <property name="text" translatable="no">Log for errors and warnings</property>
+		    </widget>
+	          </child>
+	        </widget>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+      </child>
+
+      <child>
 	<widget class="GnomeDruidPageStandard" id="date_format_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Set a date format for this QIF file</property>
@@ -291,7 +471,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox22">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -378,7 +558,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox9">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -509,7 +689,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox1">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">4</property>
@@ -622,7 +802,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox13">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -669,7 +849,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox3">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -825,7 +1005,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox18">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -873,7 +1053,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox4">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -1028,7 +1208,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox39">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -1074,7 +1254,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox40">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -1229,7 +1409,7 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox16">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -1310,13 +1490,12 @@
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Tradable commodities</property>
 	  <property name="title_foreground">#f5f5f5f5f5f5</property>
-	  <signal name="prepare" handler="gnc_ui_qif_import_commodity_prepare_cb"/>
 	  <signal name="next" handler="gnc_ui_qif_import_generic_next_cb"/>
 	  <signal name="back" handler="gnc_ui_qif_import_generic_back_cb"/>
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox17">
-	      <property name="border_width">25</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
@@ -1324,11 +1503,11 @@
 	      <child>
 		<widget class="GtkLabel" id="label833">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">In the next pages, you will be asked to provide information about stocks, mutual funds, and other tradable commodities that appear in the QIF file(s) you are importing. GnuCash requires more information about tradable commodities than the QIF format can represent. 
+		  <property name="label" translatable="yes">In the following pages you will be asked to provide information about stocks, mutual funds, and other investments that appear in the QIF file(s) you are importing. GnuCash needs some additional details about these investments that the QIF format does not provide. 
 
-Each stock, mutual fund, or other commodity must have a type, which is the exchange or listing that it is found on (NASDAQ, NYSE, US Mutual Funds, etc), a full name, and an abbreviation.
+Each stock, mutual fund, or other investment must have a name and an abbreviation, such as a stock symbol. Because some unrelated investments have the same abbreviation, you also need to indicate what type of abbreviation you have entered. For example, you could select the exchange that assigned the symbol (NASDAQ, NYSE, etc.), or select an investment type.
 
-Check to see if there is an existing Type that is appropriate; if not, you can enter a new Type name by hand in the box. Make sure that the abbreviation you enter matches the ticker symbol used for the commodity on the exchange or listing for its type.</property>
+If you don't see your exchange listed, or none of the available choices are appropriate, you can enter a new one.</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">False</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1355,36 +1534,56 @@
       </child>
 
       <child>
-	<widget class="GnomeDruidPageStandard" id="match_doc_page">
+	<widget class="GnomeDruidPageStandard" id="convert_progress_page">
 	  <property name="visible">True</property>
-	  <property name="title" translatable="yes">Match duplicate transactions</property>
-	  <property name="title_foreground">#f5f5f5f5f5f5</property>
-	  <signal name="next" handler="gnc_ui_qif_import_generic_next_cb"/>
-	  <signal name="back" handler="gnc_ui_qif_import_generic_back_cb"/>
+	  <property name="title" translatable="yes">QIF Import</property>
+	  <signal name="prepare" handler="gnc_ui_qif_import_convert_progress_prepare_cb" after="yes"/>
+	  <signal name="show" handler="gnc_ui_qif_import_convert_progress_show_cb" after="yes"/>
+	  <signal name="next" handler="gnc_ui_qif_import_convert_progress_next_cb"/>
+	  <signal name="back" handler="gnc_ui_qif_import_convert_progress_back_cb"/>
 
 	  <child internal-child="vbox">
-	    <widget class="GtkVBox" id="druid-vbox34">
-	      <property name="border_width">5</property>
+	    <widget class="GtkVBox" id="convert_progress_vbox7609">
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
+	      <property name="spacing">12</property>
 
 	      <child>
-		<widget class="GtkLabel" id="label847694">
+		<widget class="GtkLabel" id="convert_progress_primary">
 		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">If you are importing a QIF file downloaded from a bank or other financial institution, some of the information in the QIF file may duplicate information already in your GnuCash accounts.  GnuCash will try to detect duplicates of existing transactions.  
+		  <property name="label" translatable="no">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Primary text&lt;/span&gt;</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">True</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
 
-On the next page, you will be asked to confirm that an existing transaction matches an imported transaction.  Imported transactions are shown on the left side of the page, and possible matches for the selected left-hand transaction are shown to the right.  There may be several old transactions that could match an imported transaction; you will be able to select the correct one by double-clicking in the &quot;Dup?&quot; column of the correct transaction.
-
-You can control the rules used by GnuCash to find duplicate transactions in the &quot;QIF Import&quot; section of the GnuCash Preferences dialog.
-
-Click &quot;Forward&quot; to find duplicate transactions. </property>
+	      <child>
+		<widget class="GtkLabel" id="convert_progress_secondary">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="no">Secondary text.</property>
 		  <property name="use_underline">False</property>
 		  <property name="use_markup">False</property>
 		  <property name="justify">GTK_JUSTIFY_LEFT</property>
 		  <property name="wrap">True</property>
 		  <property name="selectable">False</property>
-		  <property name="xalign">0.5</property>
+		  <property name="xalign">0</property>
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
@@ -1399,62 +1598,40 @@
 		  <property name="fill">False</property>
 		</packing>
 	      </child>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
 
-      <child>
-	<widget class="GnomeDruidPageStandard" id="failed_page">
-	  <property name="visible">True</property>
-	  <property name="title" translatable="yes">Cancel import</property>
-	  <property name="title_foreground">#f5f5f5f5f5f5</property>
-	  <signal name="next" handler="gnc_ui_qif_import_generic_next_cb"/>
-	  <signal name="back" handler="gnc_ui_qif_import_generic_back_cb"/>
+	      <child>
+		<widget class="GtkVBox" id="convert_progress_vbox1">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
 
-	  <child internal-child="vbox">
-	    <widget class="GtkVBox" id="failed_vbox">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">12</property>
-
-      	      <child>
-	        <widget class="GtkHBox" id="failed_hbox">
-	          <property name="border_width">6</property>
-	          <property name="visible">True</property>
-	          <property name="homogeneous">False</property>
-	          <property name="spacing">12</property>
-
-	          <child>
-	            <widget class="GtkImage" id="failed_image">
+		  <child>
+		    <widget class="GtkProgressBar" id="convert_progress_bar">
 	              <property name="visible">True</property>
-	              <property name="stock">gtk-dialog-warning</property>
-	              <property name="icon_size">6</property>
-	              <property name="xalign">0.5</property>
-	              <property name="yalign">0</property>
-	              <property name="xpad">0</property>
-	              <property name="ypad">0</property>
-	            </widget>
-	            <packing>
+	              <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
+	              <property name="fraction">0</property>
+	              <property name="pulse_step">0.10000000149</property>
+	              <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		    </widget>
+		    <packing>
 	              <property name="padding">0</property>
 	              <property name="expand">False</property>
 	              <property name="fill">False</property>
-	            </packing>
-	          </child>
+		    </packing>
+		  </child>
 
-	          <child>
-		    <widget class="GtkLabel" id="label_failed">
+		  <child>
+		    <widget class="GtkLabel" id="convert_progress_sub">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;The QIF import has failed&lt;/span&gt;
-
-An error occurred while importing transactions into GnuCash. Your accounts are unchanged.</property>
+		      <property name="label" translatable="no">Sub-operation text</property>
+		      <property name="label" translatable="no">&lt;span style=&quot;italic&quot;&gt;Sub-operation text&lt;/span&gt;</property>
 		      <property name="use_underline">False</property>
 		      <property name="use_markup">True</property>
 		      <property name="justify">GTK_JUSTIFY_LEFT</property>
 		      <property name="wrap">True</property>
-		      <property name="selectable">True</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
 		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
@@ -1467,13 +1644,69 @@
 		      <property name="expand">False</property>
 		      <property name="fill">False</property>
 		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHButtonBox" id="convert_progress_hbuttonbox1">
+		      <property name="visible">True</property>
+		      <property name="layout_style">GTK_BUTTONBOX_END</property>
+  
+		      <child>
+	                <widget class="GtkButton" id="convert_progress_pause">
+	                  <property name="visible">True</property>
+	                  <property name="sensitive">True</property>
+	                  <property name="can_default">True</property>
+	                  <property name="can_focus">True</property>
+	                  <property name="label">gtk-media-pause</property>
+	                  <property name="use_stock">True</property>
+	                  <property name="relief">GTK_RELIEF_NORMAL</property>
+	                  <property name="focus_on_click">True</property>
+	                  <signal name="clicked" handler="gnc_ui_qif_import_convert_progress_pause_cb"/>
+	                </widget>
+	              </child>
+		    </widget>
+		    <packing>
+	              <property name="padding">0</property>
+	              <property name="expand">False</property>
+	              <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">6</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+	        <widget class="GtkScrolledWindow" id="scrolledwindow25">
+	          <property name="visible">True</property>
+	          <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	          <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	          <property name="shadow_type">GTK_SHADOW_IN</property>
+	          <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+	          <child>
+		    <widget class="GtkTextView" id="convert_progress_log">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">False</property>
+		      <property name="overwrite">False</property>
+		      <property name="accepts_tab">False</property>
+		      <property name="justification">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap_mode">GTK_WRAP_WORD</property>
+		      <property name="cursor_visible">False</property>
+		      <property name="pixels_above_lines">0</property>
+		      <property name="pixels_below_lines">0</property>
+		      <property name="pixels_inside_wrap">0</property>
+		      <property name="left_margin">0</property>
+		      <property name="right_margin">0</property>
+		      <property name="indent">0</property>
+		      <property name="text" translatable="no">Log for errors and warnings</property>
+		    </widget>
 	          </child>
 	        </widget>
-	        <packing>
-	          <property name="padding">0</property>
-	          <property name="expand">False</property>
-	          <property name="fill">False</property>
-	        </packing>
 	      </child>
 	    </widget>
 	  </child>
@@ -1481,6 +1714,54 @@
       </child>
 
       <child>
+	<widget class="GnomeDruidPageStandard" id="match_doc_page">
+	  <property name="visible">True</property>
+	  <property name="title" translatable="yes">Match existing transactions</property>
+	  <property name="title_foreground">#f5f5f5f5f5f5</property>
+	  <signal name="next" handler="gnc_ui_qif_import_generic_next_cb"/>
+	  <signal name="back" handler="gnc_ui_qif_import_generic_back_cb"/>
+
+	  <child internal-child="vbox">
+	    <widget class="GtkVBox" id="druid-vbox34">
+	      <property name="border_width">5</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkLabel" id="label847694">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">If you are importing a QIF file from a bank or other financial institution, some of the transactions may already exist in your GnuCash accounts. To avoid duplication, GnuCash has tried to identify matches and needs your help to review them.
+
+On the next page you will be shown a list of imported transactions. As you select each one, a list of possible matches will be shown below it. If you find a correct match, click on it. Your selection will be confirmed by a check mark in the &quot;Match?&quot; column.
+
+Click &quot;Forward&quot; to review the possible matches.</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">True</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+      </child>
+
+      <child>
 	<widget class="GnomeDruidPageStandard" id="match_duplicates_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Select possible duplicates</property>
@@ -1490,13 +1771,13 @@
 
 	  <child internal-child="vbox">
 	    <widget class="GtkVBox" id="druid-vbox35">
-	      <property name="border_width">5</property>
+	      <property name="border_width">12</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
 	      <property name="spacing">0</property>
 
 	      <child>
-		<widget class="GtkHBox" id="hbox94">
+		<widget class="GtkVBox" id="vbox94">
 		  <property name="visible">True</property>
 		  <property name="homogeneous">False</property>
 		  <property name="spacing">2</property>
@@ -1506,7 +1787,7 @@
 		      <property name="visible">True</property>
 		      <property name="label_xalign">0</property>
 		      <property name="label_yalign">0.5</property>
-		      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
 
 		      <child>
 			<widget class="GtkScrolledWindow" id="scrolledwindow22">
@@ -1535,8 +1816,8 @@
 		      <child>
 			<widget class="GtkLabel" id="label847716">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">Imported transactions with duplicates</property>
-			  <property name="use_underline">False</property>
+			  <property name="label" translatable="yes">_Imported transactions needing review:</property>
+			  <property name="use_underline">True</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
 			  <property name="wrap">False</property>
@@ -1545,6 +1826,7 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+                          <property name="mnemonic_widget">new_transaction_view</property>
 			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 			  <property name="width_chars">-1</property>
 			  <property name="single_line_mode">False</property>
@@ -1567,7 +1849,7 @@
 		      <property name="visible">True</property>
 		      <property name="label_xalign">0</property>
 		      <property name="label_yalign">0.5</property>
-		      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
 
 		      <child>
 			<widget class="GtkScrolledWindow" id="scrolledwindow23">
@@ -1596,8 +1878,8 @@
 		      <child>
 			<widget class="GtkLabel" id="label847717">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">Possible duplicates for selected new transaction</property>
-			  <property name="use_underline">False</property>
+			  <property name="label" translatable="yes">_Possible matches for the selected transaction:</property>
+			  <property name="use_underline">True</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
 			  <property name="wrap">False</property>
@@ -1606,6 +1888,7 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">0</property>
 			  <property name="ypad">0</property>
+                          <property name="mnemonic_widget">old_transaction_view</property>
 			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 			  <property name="width_chars">-1</property>
 			  <property name="single_line_mode">False</property>


Property changes on: gnucash/branches/gda-dev2/src/import-export/qif-import/schemas
___________________________________________________________________
Name: svn:ignore
   - .deps
.libs
.scm-links
*.gladep
*.la
*.lo
Makefile
Makefile.in
import-export
gnucash
qif-import
semantic.cache
TAGS
apps_gnucash_import_qif.schemas

   + .deps
.libs
.scm-links
*.gladep
*.la
*.lo
*.schemas
Makefile
Makefile.in
import-export
gnucash
qif-import
semantic.cache
TAGS
apps_gnucash_import_qif.schemas


Modified: gnucash/branches/gda-dev2/src/optional/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/optional/Makefile.am	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/optional/Makefile.am	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1 +1,2 @@
-SUBDIRS = xsl
+SUBDIRS = xsl ${PYTHON_DIR}
+DIST_SUBDIRS = xsl python-bindings

Copied: gnucash/branches/gda-dev2/src/optional/python-bindings (from rev 17437, gnucash/trunk/src/optional/python-bindings)


Property changes on: gnucash/branches/gda-dev2/src/optional/python-bindings
___________________________________________________________________
Name: svn:ignore
   + .deps
.libs
Makefile
Makefile.in
gnucash_core.c
gnucash_core_c.py


Modified: gnucash/branches/gda-dev2/src/register/ledger-core/split-register-control.c
===================================================================
--- gnucash/branches/gda-dev2/src/register/ledger-core/split-register-control.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/register/ledger-core/split-register-control.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -750,7 +750,7 @@
 
     case CURSOR_CLASS_SPLIT:
       {
-        char *fullname;
+        char *account_name;
         const char *memo;
         gboolean unit_price;
         Split *auto_split;
@@ -820,9 +820,9 @@
         /* auto-complete the account name */
         cell = gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL);
 
-        fullname = xaccAccountGetFullName (xaccSplitGetAccount (auto_split));
-        gnc_combo_cell_set_value ((ComboCell *) cell, fullname);
-        g_free(fullname);
+        account_name = gnc_get_account_name_for_register (xaccSplitGetAccount (auto_split));
+        gnc_combo_cell_set_value ((ComboCell *) cell, account_name);
+        g_free(account_name);
 
         gnc_basic_cell_set_changed (cell, TRUE);
 
@@ -1043,7 +1043,7 @@
 
   /* If this is an un-expanded, multi-split transaction, then warn the user */
   if (force_dialog && !expanded && !xfer_acc) {
-    gnc_error_dialog (gnc_split_register_get_parent (reg), message);
+    gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
     return TRUE;
   }
 
@@ -1092,7 +1092,7 @@
   if (!expanded && osplit &&
       gnc_split_register_split_needs_amount (reg, split) &&
       gnc_split_register_split_needs_amount (reg, osplit)) {
-    gnc_error_dialog (gnc_split_register_get_parent (reg), message);
+    gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
     return TRUE;
   }
 

Modified: gnucash/branches/gda-dev2/src/register/ledger-core/split-register-model.c
===================================================================
--- gnucash/branches/gda-dev2/src/register/ledger-core/split-register-model.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/register/ledger-core/split-register-model.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -82,7 +82,7 @@
     const char *name;
 
     name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
-    account = gnc_account_lookup_by_full_name (gnc_get_current_root_account (), name);
+    account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
   }
 
   if (!account)
@@ -1205,7 +1205,7 @@
 
   g_free (name);
 
-  name = xaccAccountGetFullName (xaccSplitGetAccount (split));
+  name = gnc_get_account_name_for_register (xaccSplitGetAccount (split));
 
   return name;
 }
@@ -1246,7 +1246,7 @@
   g_free (name);
 
   if (s)
-    name = xaccAccountGetFullName (xaccSplitGetAccount (s));
+    name = gnc_get_account_name_for_register (xaccSplitGetAccount (s));
   else
   {
     /* For multi-split transactions and stock splits,
@@ -1737,7 +1737,7 @@
 
     account = xaccAccountLookup (guid, gnc_get_current_book ());
 
-    name = account ? xaccAccountGetFullName(account) : NULL;
+    name = account ? gnc_get_account_name_for_register (account) : NULL;
   }
   else
     name = NULL;

Modified: gnucash/branches/gda-dev2/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/branches/gda-dev2/src/register/ledger-core/split-register.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/register/ledger-core/split-register.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -723,7 +723,7 @@
 
     if (split != NULL)
       result = gnc_verify_dialog (gnc_split_register_get_parent (reg),
-				  FALSE, message);
+				  FALSE, "%s", message);
     else
       result = TRUE;
 
@@ -759,7 +759,7 @@
 
     if (split != blank_split)
       result = gnc_verify_dialog(gnc_split_register_get_parent(reg),
-				 FALSE, message);
+				 FALSE, "%s", message);
     else
       result = TRUE;
 
@@ -1498,7 +1498,7 @@
   const char *placeholder = _("The account %s does not allow transactions.");
   const char *missing = _("The account %s does not exist. "
 			  "Would you like to create it?");
-  char *fullname;
+  char *account_name;
   ComboCell *cell = (ComboCell *) bcell;
   Account *account;
 
@@ -1506,7 +1506,9 @@
     return NULL;
 
   /* Find the account */
-  account = gnc_account_lookup_by_full_name (gnc_get_current_root_account (), name);
+  account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
+  if (!account)
+	  account = gnc_account_lookup_by_code (gnc_get_current_root_account (), name);
 
   if (!account) {
     /* Ask if they want to create a new one. */
@@ -1519,15 +1521,15 @@
     account = gnc_ui_new_accounts_from_name_window (name);
     if (!account)
       return NULL;
-    *refresh = TRUE;
-
-    /* Now have a new account. Update the cell with the name as created. */
-    fullname = xaccAccountGetFullName (account);
-    gnc_combo_cell_set_value (cell, fullname);
-    gnc_basic_cell_set_changed (&cell->cell, TRUE);
-    g_free (fullname);
   }
 
+  /* Now have the account. Update the cell with the name as created. */
+  *refresh = TRUE;
+  account_name = gnc_get_account_name_for_register (account);
+  gnc_combo_cell_set_value (cell, account_name);
+  gnc_basic_cell_set_changed (&cell->cell, TRUE);
+  g_free (account_name);
+
   /* See if the account (either old or new) is a placeholder. */
   if (xaccAccountGetPlaceholder (account)) {
     gnc_error_dialog (gnc_split_register_get_parent (reg),

Modified: gnucash/branches/gda-dev2/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-gnome/gnc-plugin-page-report.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-gnome/gnc-plugin-page-report.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -1345,7 +1345,7 @@
         {
                 const char *message = _("You cannot save to that file.");
 
-                gnc_error_dialog (NULL, message);
+                gnc_error_dialog (NULL, "%s", message);
                 g_free(filepath);
                 return NULL;
         }

Modified: gnucash/branches/gda-dev2/src/report/report-gnome/window-report.c
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-gnome/window-report.c	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-gnome/window-report.c	2008-07-30 01:08:07 UTC (rev 17438)
@@ -122,8 +122,10 @@
 GtkWidget * 
 gnc_report_window_default_params_editor(SCM options, SCM report)
 {
-  SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
-  SCM get_title  = scm_c_eval_string("gnc:report-type");
+  SCM get_editor        = scm_c_eval_string("gnc:report-editor-widget");
+  SCM get_report_type   = scm_c_eval_string("gnc:report-type");
+  SCM get_template      = scm_c_eval_string("gnc:find-report-template");
+  SCM get_template_name = scm_c_eval_string("gnc:report-template-name");
   SCM ptr;
   
   const gchar *title = NULL;
@@ -144,10 +146,17 @@
     prm->cur_report  = report;
     prm->db          = gnc_option_db_new(prm->scm_options);
 
-    ptr = scm_call_1(get_title, report);
-    if (SCM_STRINGP(ptr)) {
-      title = SCM_STRING_CHARS(ptr);
+    /* Get the title of the report's template. */
+    ptr = scm_call_1(get_report_type, report);
+    if (ptr != SCM_BOOL_F) {
+      ptr = scm_call_1(get_template, ptr);
+      if (ptr != SCM_BOOL_F) {
+        ptr = scm_call_1(get_template_name, ptr);
+        if (SCM_STRINGP(ptr))
+          title = SCM_STRING_CHARS(ptr);
+      }
     }
+
     /* Don't forget to translate the window title */
     prm->win  = gnc_options_dialog_new((gchar*) (title && *title ? _(title) : ""));
     

Modified: gnucash/branches/gda-dev2/src/report/report-system/commodity-utilities.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-system/commodity-utilities.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-system/commodity-utilities.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -184,10 +184,14 @@
 			report-currency (gnc-numeric-zero)))
 		 (gnc-numeric-zero))
 	       (begin
-		 (set! total-foreign (gnc-numeric-add-fixed
-				      total-foreign (third foreignlist)))
-		 (set! total-domestic (gnc-numeric-add-fixed
-				       total-domestic (second foreignlist)))
+		 (set! total-foreign (gnc-numeric-add total-foreign
+                                                      (third foreignlist)
+                                                      GNC-DENOM-AUTO
+                                                      GNC-DENOM-LCD))
+		 (set! total-domestic (gnc-numeric-add total-domestic
+                                                       (second foreignlist)
+                                                       GNC-DENOM-AUTO
+                                                       GNC-DENOM-LCD))
 		 (gnc-numeric-div
 		  total-domestic
 		  total-foreign
@@ -565,6 +569,94 @@
 				 (assoc account-comm sumlist)
 				 tmp)))
 	       
+             (cond ((gnc-numeric-zero-p share-amount)
+                    ;; Without shares this is not a buy or sell; ignore it.
+                    #f)
+
+                   ((not comm-list)
+	            ;; entry doesn't exist in comm-list
+		    ;; create sub-alist from scratch
+		    (let ((pair (list transaction-comm
+				      (cons (gnc:make-numeric-collector)
+					    (gnc:make-numeric-collector)))))
+		      ((caadr pair) 'add value-amount)
+		      ((cdadr pair) 'add share-amount)
+		      (set! comm-list (list account-comm (list pair)))
+		      ;; and add the new sub-alist to sumlist.
+		      (set! sumlist (cons comm-list sumlist))))
+
+                   (else
+		    (let* 
+		          ;; Put the amounts in the right place.
+		          ((foreignlist 
+		            (if (gnc-commodity-equiv transaction-comm
+						      (car comm-list))
+			        (list account-comm 
+				      share-amount value-amount)
+			        (list transaction-comm 
+				      value-amount share-amount)))
+		           ;; second commodity already existing in comm-list?
+		           (pair (assoc (car foreignlist) (cadr comm-list))))
+		      ;; if not, create a new entry in comm-list.
+		      (if (not pair)
+		          (begin
+			    (set! 
+			     pair (list (car foreignlist)
+				        (cons (gnc:make-numeric-collector) 
+					      (gnc:make-numeric-collector))))
+			    (set! 
+			     comm-list (list (car comm-list) 
+					     (cons pair (cadr comm-list))))
+			    (set! 
+			     sumlist (cons comm-list 
+					   (alist-delete 
+					    (car comm-list) sumlist)))))
+		      ;; And add the balances to the comm-list entry.
+		      ((caadr pair) 'add (cadr foreignlist))
+		      ((cdadr pair) 'add (caddr foreignlist)))))))
+	 (gnc:get-all-commodity-splits curr-accounts end-date)))
+  
+    (gnc:resolve-unknown-comm sumlist report-commodity)))
+
+;; Calculate the volume-weighted average cost of all commodities,
+;; priced in the 'report-commodity'. Uses all transactions up until
+;; the 'end-date'. Returns an alist, see sumlist.
+(define (gnc:get-exchange-cost-totals report-commodity end-date)
+  (let ((curr-accounts 
+	 ;;(filter gnc:account-has-shares? ))
+	 ;; -- use all accounts, not only share accounts, since gnucash-1.7
+	 (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
+	;; sumlist: a multilevel alist. Each element has a commodity
+	;; as key, and another alist as a value. The value-alist's
+	;; elements consist of a commodity as a key, and a pair of two
+	;; value-collectors as value, e.g. with only one (the report-)
+	;; commodity DEM in the outer alist: ( {DEM ( [USD (400 .
+	;; 1000)] [FRF (300 . 100)] ) } ) where DEM,USD,FRF are
+	;; <gnc:commodity> and the numbers are a numeric-collector
+	;; which in turn store a <gnc:numeric>. In the example, USD
+	;; 400 were bought for an amount of DEM 1000, FRF 300 were
+	;; bought for DEM 100. The reason for the outer alist is that
+	;; there might be commodity transactions which do not involve
+	;; the report-commodity, but which can still be calculated
+	;; after *all* transactions are processed.
+	(sumlist (list (list report-commodity '()))))
+
+    (if (not (null? curr-accounts))
+	;; Go through all splits and add up all value-amounts
+	;; and share-amounts
+	(for-each 
+	 (lambda (a)
+	   (let* ((transaction-comm (xaccTransGetCurrency
+				     (xaccSplitGetParent a)))
+		  (account-comm (xaccAccountGetCommodity
+				 (xaccSplitGetAccount a)))
+		  (share-amount (xaccSplitGetAmount a))
+		  (value-amount (xaccSplitGetValue a))
+		  (tmp (assoc transaction-comm sumlist))
+		  (comm-list (if (not tmp) 
+				 (assoc account-comm sumlist)
+				 tmp)))
+	       
 	     ;; entry exists already in comm-list?
 	     (if (not comm-list)
 		 ;; no, create sub-alist from scratch
@@ -626,10 +718,24 @@
 			     (logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)))))
    (gnc:get-exchange-totals report-commodity end-date)))
 
+(define (gnc:make-exchange-cost-alist report-commodity end-date)
+  ;; This returns the alist with the actual exchange rates, i.e. the
+  ;; total balances from get-exchange-totals are divided by each
+  ;; other.
+  (map 
+   (lambda (e)
+     (list (car e) 
+	   (gnc-numeric-abs
+	    (gnc-numeric-div ((cdadr e) 'total #f)
+			     ((caadr e) 'total #f)
+			     GNC-DENOM-AUTO 
+			     (logior (GNC-DENOM-SIGFIGS 8) GNC-RND-ROUND)))))
+   (gnc:get-exchange-cost-totals report-commodity end-date)))
 
 
 
 
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Actual functions for exchanging amounts.
 
@@ -673,23 +779,24 @@
 (define (gnc:make-exchange-function exchange-alist)
   (let ((exchangelist exchange-alist))
     (lambda (foreign domestic)
-      (begin
-	(gnc:debug "foreign: " foreign)
-	(gnc:debug "domestic: " domestic)
-	(if foreign
-	    (or (gnc:exchange-by-euro foreign domestic #f)
-		(gnc:exchange-if-same foreign domestic)
-		(gnc:make-gnc-monetary 
-		 domestic
-		 (let ((pair (assoc (gnc:gnc-monetary-commodity foreign) 
-				    exchangelist)))
-		   (if (not pair)
-		       (gnc-numeric-zero)
-		       (gnc-numeric-mul (gnc:gnc-monetary-amount foreign)
-					(cadr pair)
-					(gnc-commodity-get-fraction domestic)
-					GNC-RND-ROUND)))))
-	  #f)))))
+      (gnc:debug "foreign: " foreign)
+      (gnc:debug "domestic: " domestic)
+      (if foreign
+          (or (gnc:exchange-by-euro foreign domestic #f)
+              (gnc:exchange-if-same foreign domestic)
+              (gnc:make-gnc-monetary
+               domestic
+               (let ((pair (assoc (gnc:gnc-monetary-commodity foreign)
+                                  exchangelist))
+                     (foreign-amount (gnc:gnc-monetary-amount foreign)))
+                 (if (or (not pair)
+                         (gnc-numeric-zero-p foreign-amount))
+                     (gnc-numeric-zero)
+                     (gnc-numeric-mul foreign-amount
+                                      (cadr pair)
+                                      (gnc-commodity-get-fraction domestic)
+                                      GNC-RND-ROUND)))))
+          #f))))
 
 ;; Helper for the gnc:exchange-by-pricalist* below. Exchange the
 ;; <gnc:monetary> 'foreign' into the <gnc:commodity*> 'domestic' by
@@ -821,6 +928,9 @@
 (define (gnc:case-exchange-fn 
 	 source-option report-currency to-date-tp)
   (case source-option
+    ((average-cost) (gnc:make-exchange-function 
+                     (gnc:make-exchange-cost-alist
+                      report-currency to-date-tp)))
     ((weighted-average) (gnc:make-exchange-function 
 			(gnc:make-exchange-alist 
 			 report-currency to-date-tp)))
@@ -872,7 +982,7 @@
     (else 
      (begin
        (gnc:warn "gnc:case-exchange-time-fn: bad price-source value: " 
-                    source-option " using pricedb-nearest.")
+                    source-option ". Using pricedb-nearest.")
        ;; FIX-ME another hack to prevent report crashing when an
        ;; unimplemented source-option comes through
        gnc:exchange-by-pricedb-nearest

Modified: gnucash/branches/gda-dev2/src/report/report-system/html-table.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-system/html-table.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-system/html-table.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -484,7 +484,8 @@
              (rest-new (cdr newcol))
              (rest-existing (cdr existing-data))
              (rest-result (append-to-element rest-new rest-existing 
-                                             (- length-to-append 1))))
+                                             (- length-to-append 1)
+                                             width-to-make)))
           (cons (cons (widen-and-append 
                        current-existing 
                        current-new 

Modified: gnucash/branches/gda-dev2/src/report/report-system/options-utilities.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-system/options-utilities.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-system/options-utilities.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -171,7 +171,10 @@
    (gnc:make-multichoice-option
     pagename optname
     sort-tag (N_ "The source of price information") default
-    (list (vector 'weighted-average 
+    (list (vector 'average-cost
+		  (N_ "Average Cost")
+		  (N_ "The volume-weighted average cost of purchases"))
+          (vector 'weighted-average 
 		  (N_ "Weighted Average")
 		  (N_ "The weighted average of all currency transactions of the past"))
 	  (vector 'pricedb-latest 

Modified: gnucash/branches/gda-dev2/src/report/report-system/report-system.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-system/report-system.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-system/report-system.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -33,7 +33,9 @@
 (export gnc:pricealist-lookup-nearest-in-time)
 (export gnc:resolve-unknown-comm)
 (export gnc:get-exchange-totals)
+(export gnc:get-exchange-cost-totals)
 (export gnc:make-exchange-alist)
+(export gnc:make-exchange-cost-alist)
 (export gnc:exchange-by-euro)
 (export gnc:exchange-if-same)
 (export gnc:make-exchange-function)
@@ -578,6 +580,8 @@
 (export gnc-commodity-collector-commodity-count)
 (export gnc:account-get-balance-at-date)
 (export gnc:account-get-comm-balance-at-date)
+(export gnc:account-get-comm-value-interval)
+(export gnc:account-get-comm-value-at-date)
 (export gnc:accounts-get-balance-helper)
 (export gnc:accounts-get-comm-total-profit)
 (export gnc:accounts-get-comm-total-income)

Modified: gnucash/branches/gda-dev2/src/report/report-system/report-utilities.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-system/report-utilities.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-system/report-utilities.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -270,9 +270,11 @@
     (lambda (action amount)  ;;; Dispatch function
       (case action
 	((add) (if (gnc:gnc-numeric? amount) 
-		  (set! value (gnc-numeric-add-fixed amount value))
-		  (gnc:warn 
-		   "gnc:numeric-collector called with wrong argument: " amount)))
+                   (set! value (gnc-numeric-add amount value
+                                                GNC-DENOM-AUTO GNC-DENOM-LCD))
+                   (gnc:warn 
+                    "gnc:numeric-collector called with wrong argument: "
+                    amount)))
 	((total) value)
 	(else (gnc:warn "bad gnc:numeric-collector action: " action))))))
 
@@ -488,6 +490,57 @@
 				       (xaccSplitGetBalance (car splits))))
       balance-collector))
 
+;; Calculate the increase in the balance of the account in terms of
+;; "value" (as opposed to "amount") between the specified dates.
+;; If include-children? is true, the balances of all children (not
+;; just direct children) are are included in the calculation. The results
+;; are returned in a commodity collector.
+(define (gnc:account-get-comm-value-interval account start-date end-date
+                                                include-children?)
+  (let ((value-collector (gnc:make-commodity-collector))
+	(query (qof-query-create-for-splits))
+	(splits #f))
+
+    (if include-children?
+        (for-each
+         (lambda (x)
+           (gnc-commodity-collector-merge value-collector x))
+         (gnc:account-map-descendants
+          (lambda (d)
+            (gnc:account-get-comm-value-interval d start-date end-date #f))
+          account)))
+
+    ;; Build a query to find all splits between the indicated dates.
+    (qof-query-set-book query (gnc-get-current-book))
+    (xaccQueryAddSingleAccountMatch query account QOF-QUERY-AND)
+    (xaccQueryAddDateMatchTS query
+                             (and start-date #t) start-date
+                             (and end-date #t) end-date
+                             QOF-QUERY-AND)
+
+    ;; Get the query results.
+    (set! splits (qof-query-run query))
+    (qof-query-destroy query)
+
+    ;; Add the "value" of each split returned (which is measured
+    ;; in the transaction currency).
+    (for-each
+     (lambda (split)
+       (value-collector 'add
+                        (xaccTransGetCurrency (xaccSplitGetParent split))
+                        (xaccSplitGetValue split)))
+     splits)
+
+    value-collector))
+
+;; Calculate the balance of the account in terms of "value" (rather
+;; than "amount") at the specified date. If include-children? is
+;; true, the balances of all children (not just direct children) are
+;; are included in the calculation. The results are returned in a
+;; commodity collector.
+(define (gnc:account-get-comm-value-at-date account date include-children?)
+  (gnc:account-get-comm-value-interval account #f date include-children?))
+
 ;; Adds all accounts' balances, where the balances are determined with
 ;; the get-balance-fn. The reverse-balance-fn
 ;; (e.g. gnc-reverse-balance) should return #t if the

Modified: gnucash/branches/gda-dev2/src/report/report-system/report.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-system/report.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/report-system/report.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -326,11 +326,11 @@
 
 ;; gnc:make-report instantiates a report from a report-template.
 ;; The actual report is stored away in a hash-table -- only the id is returned.
-(define (gnc:make-report template-name . rest)
-  (let* ((template-parent (gnc:report-template-parent-type (hash-ref *gnc:_report-templates_* template-name)))
+(define (gnc:make-report template-id . rest)
+  (let* ((template-parent (gnc:report-template-parent-type (hash-ref *gnc:_report-templates_* template-id)))
 	 (report-type (if template-parent
 			  template-parent
-			  template-name))
+			  template-id))
 	 (r ((record-constructor <report>) 
             report-type ;; type
             #f            ;; id
@@ -340,7 +340,7 @@
             #f            ;; editor-widget
             #f            ;; ctext
             ))
-        (template (hash-ref *gnc:_report-templates_* template-name))
+        (template (hash-ref *gnc:_report-templates_* template-id))
         )
     (let ((options 
            (if (not (null? rest))
@@ -381,8 +381,8 @@
 	#f))
   )
 
-(define (gnc:make-report-options template-name)
-  (let ((template (hash-ref *gnc:_report-templates_* template-name)))
+(define (gnc:make-report-options template-id)
+  (let ((template (hash-ref *gnc:_report-templates_* template-id)))
     (if template
         (gnc:report-template-new-options template)
         #f)))

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/account-piecharts.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/account-piecharts.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/account-piecharts.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -100,7 +100,7 @@
     
     (gnc:options-add-price-source! 
      options gnc:pagename-general
-     optname-price-source "c" 'weighted-average)
+     optname-price-source "c" 'average-cost)
 
     (add-option
      (gnc:make-account-list-option
@@ -238,8 +238,8 @@
         ;; Future improvement: Let the user choose which kind of
         ;; currency combining she want to be done. Right now
         ;; everything foreign gets converted
-        ;; (gnc:sum-collector-commodity) based on the weighted
-        ;; average of all past transactions.
+        ;; (gnc:sum-collector-commodity) based on the average
+        ;; cost of all holdings.
         (gnc-numeric-to-double
          (gnc:gnc-monetary-amount
           (gnc:sum-collector-commodity 

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/account-summary.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/account-summary.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/account-summary.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -188,7 +188,7 @@
     
     (gnc:options-add-price-source! 
      options pagename-commodities
-     optname-price-source "b" 'weighted-average)
+     optname-price-source "b" 'average-cost)
     
     (add-option 
      (gnc:make-simple-boolean-option

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/balance-sheet.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/balance-sheet.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/balance-sheet.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -207,7 +207,7 @@
     
     (gnc:options-add-price-source! 
      options pagename-commodities
-     optname-price-source "b" 'weighted-average)
+     optname-price-source "b" 'average-cost)
     
     (add-option 
      (gnc:make-simple-boolean-option
@@ -416,22 +416,6 @@
        (+ (* 2 tree-depth)
 	  (if (equal? tabbing 'canonically-tabbed) 1 0))))
 
-    ;; Get the value of all transactions (in transaction currency)
-    ;; in the given account before the given date
-    (define (get-account-value-at-date account to-date)
-      (let ((value (gnc:make-commodity-collector)))
-        (for-each
-         (lambda (split)
-           (let* ((parent (xaccSplitGetParent split))
-                  (currency (xaccTransGetCurrency parent)))
-             (if (gnc:timepair-le (gnc-transaction-get-date-posted parent) to-date)
-                 (value 'add currency (xaccSplitGetValue split)))))
-         (xaccAccountGetSplitList account)
-         )
-        value
-        )
-      )
-    
     ;;(gnc:warn "account names" liability-account-names)
     (gnc:html-document-set-title! 
      doc (string-append company-name " " report-title " "
@@ -451,7 +435,6 @@
 	
         ;; Get all the balances for each of the account types.
         (let* ((asset-balance #f)
-               (asset-basis #f)
                (neg-liability-balance #f) ;; credit balances are < 0
                (liability-balance #f)
                (neg-equity-balance #f)
@@ -478,7 +461,7 @@
 		   account date-tp #f)))
                (get-total-value-fn
                 (lambda (account)
-                  (get-account-value-at-date account date-tp)))
+                  (gnc:account-get-comm-value-at-date account date-tp #f)))
 	       )
 	  
 	  ;; If you ask me, any outstanding(TM) retained earnings and
@@ -490,9 +473,6 @@
 	  (set! asset-balance 
                 (gnc:accounts-get-comm-total-assets 
                  asset-accounts get-total-balance-fn))
-          (set! asset-basis
-                (gnc:accounts-get-comm-total-assets
-                 asset-accounts get-total-value-fn))
 	  (gnc:report-percent-done 6)
 	  ;; sum liabilities
 	  (set! neg-liability-balance
@@ -533,8 +513,18 @@
           ;; commodity trading accounts they will automatically accumulate the gains.
           (set! unrealized-gain-collector (gnc:make-commodity-collector))
           (if compute-unrealized-gains?
-              (begin (unrealized-gain-collector 'merge asset-balance #f)
-                     (unrealized-gain-collector 'minusmerge asset-basis #f)))
+              (let ((asset-basis 
+                     (gnc:accounts-get-comm-total-assets asset-accounts
+                                                         get-total-value-fn))
+                    (neg-liability-basis 
+                     (gnc:accounts-get-comm-total-assets liability-accounts
+                                                         get-total-value-fn)))
+                ;; Calculate unrealized gains from assets.
+                (unrealized-gain-collector 'merge asset-balance #f)
+                (unrealized-gain-collector 'minusmerge asset-basis #f)
+                ;; Combine with unrealized gains from liabilities
+                (unrealized-gain-collector 'merge neg-liability-balance #f)
+                (unrealized-gain-collector 'minusmerge neg-liability-basis #f)))
 
           ;; calculate equity and liability+equity totals
 	  (set! total-equity-balance (gnc:make-commodity-collector))

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/budget.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/budget.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/budget.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -68,7 +68,7 @@
     ;; optname-from-date optname-to-date "a")
 
     (gnc:options-add-price-source!
-     options gnc:pagename-general optname-price-source "c" 'weighted-average)
+     options gnc:pagename-general optname-price-source "c" 'average-cost)
 
     ;;(gnc:register-option
     ;; options

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/category-barchart.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/category-barchart.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/category-barchart.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -146,13 +146,20 @@
       "c" (N_ "Maximum number of bars in the chart") 8
       2 24 0 1))
 
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (N_ "Show table")
+      "d" (N_ "Display a table of the selected data.")
+      #f))
+
     (gnc:options-add-plot-size! 
      options gnc:pagename-display 
-     optname-plot-width optname-plot-height "d" 400 400)
+     optname-plot-width optname-plot-height "e" 400 400)
 
     (gnc:options-add-sort-method! 
      options gnc:pagename-display
-     optname-sort-method "e" 'amount)
+     optname-sort-method "f" 'amount)
 
     (gnc:options-set-default-section options gnc:pagename-general)
 
@@ -209,8 +216,10 @@
         
 	(work-done 0)
 	(work-to-do 0)
+        (show-table? (get-option gnc:pagename-display (N_ "Show table")))
         (document (gnc:make-html-document))
         (chart (gnc:make-html-barchart))
+        (table (gnc:make-html-table))
         (topl-accounts (gnc:filter-accountlist-type 
                         account-types
                         (gnc-account-get-children-sorted
@@ -518,8 +527,80 @@
                 chart (append urls urls)))
              
 	     (gnc:report-percent-done 98)
-             (gnc:html-document-add-object! document chart))
+             (gnc:html-document-add-object! document chart)
+             (if show-table?
+                 (begin
+                   (gnc:html-table-append-column! table date-string-list)
 
+                   (letrec
+                       ((addcol
+                         (lambda (col)
+                           (if (not (null? col))
+                               (begin
+                                 (gnc:html-table-append-column!
+                                  table (car col))
+                                 (addcol (cdr col))
+                                 )
+                               ))
+                         ))
+                     (addcol (map cadr all-data))
+                     )
+
+                   (gnc:html-table-set-col-headers!
+                    table
+                    (append
+                     (list (_ "Date"))
+                     (map (lambda (pair)
+                            (regexp-substitute/global #f "&"
+                                                      (if (string? (car pair))
+                                                          (car pair)
+                                                          ((if show-fullname?
+                                                               gnc-account-get-full-name
+                                                               xaccAccountGetName) (car pair)))
+                                                      'pre " " (_ "and") " " 'post))
+                          all-data)
+                     (if (> (gnc:html-table-num-columns table) 2)
+                         (list (_ "Grand Total"))
+                         (list nil)
+                         )
+                     ))
+
+                   (if (> (gnc:html-table-num-columns table) 2)
+                       (letrec
+                           ((sumtot
+                             (lambda (row)
+                               (if (null? row)
+                                   '()
+                                   (cons (sumrow (car row)) (sumtot (cdr row)))
+                                   )
+                               )
+                             )
+                            (sumrow
+                             (lambda (row)
+                               (if (not (null? row))
+                                   (+ (car row) (sumrow (cdr row)))
+                                   0
+                                   )
+                               )
+                             ))
+                         (gnc:html-table-append-column!
+                          table
+                          (sumtot (apply zip (map cadr all-data)))
+                          )
+                         )
+                       )
+                       ;; set numeric columns to align right
+                   (for-each
+                    (lambda (col)
+                      (gnc:html-table-set-col-style!
+                       table col "td"
+                       'attribute (list "align" "right")))
+                    '(1 2 3 4 5 6 7 8 9 10 11 12 13 14))
+                   (gnc:html-document-add-object! document table)
+                   ) ;; begin if
+                 )
+             )
+
            ;; else if empty data
            (gnc:html-document-add-object!
             document

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/equity-statement.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/equity-statement.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/equity-statement.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -144,7 +144,7 @@
     
     (gnc:options-add-price-source! 
      options pagename-commodities
-     optname-price-source "b" 'weighted-average)
+     optname-price-source "b" 'average-cost)
     
     (add-option 
      (gnc:make-simple-boolean-option

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/income-statement.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/income-statement.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/income-statement.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -181,7 +181,7 @@
     
     (gnc:options-add-price-source! 
      options pagename-commodities
-     optname-price-source "b" 'weighted-average)
+     optname-price-source "b" 'average-cost)
     
     (add-option 
      (gnc:make-simple-boolean-option

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/net-barchart.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/net-barchart.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/net-barchart.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -120,9 +120,16 @@
           (N_ "Show a Net Worth bar?")) 
       #t))
 
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      (N_ "Show table")
+      "c" (N_ "Display a table of the selected data.")
+      #f))
+
     (gnc:options-add-plot-size! 
      options gnc:pagename-display 
-     optname-plot-width optname-plot-height "c" 500 400)
+     optname-plot-width optname-plot-height "d" 500 400)
 
     (gnc:options-set-default-section options gnc:pagename-general)
 
@@ -179,6 +186,7 @@
 	 (report-title (get-option gnc:pagename-general 
                                   gnc:optname-reportname))
          (classified-accounts (gnc:decompose-accountlist accounts))
+         (show-table? (get-option gnc:pagename-display (N_ "Show table")))
          (document (gnc:make-html-document))
          (chart (gnc:make-html-barchart))
          (non-zeros #f))
@@ -356,7 +364,45 @@
        
        ;; Test for all-zero data here.
        (if non-zeros
+           (begin
            (gnc:html-document-add-object! document chart) 
+             (if show-table?
+             (let ((table (gnc:make-html-table)))
+                (gnc:html-table-set-col-headers!
+                 table
+                 (append
+                  (list (_ "Date"))
+                  (if show-sep?
+                      (if inc-exp?
+                          (list (_ "Income") (_ "Expense"))
+                          (list (_ "Assets") (_ "Liabilities")))
+                      '())
+                  (if show-net?
+                      (if inc-exp?
+                          (list (_ "Net Profit"))
+                          (list (_ "Net Worth")))
+                      '()))
+                 )
+               (gnc:html-table-append-column! table date-string-list)
+               (if show-sep?
+                   (begin
+                     (gnc:html-table-append-column! table assets-list)
+                     (gnc:html-table-append-column! table liability-list)
+                    )
+                   )
+               (if show-net?
+                   (gnc:html-table-append-column! table net-list)
+                   )
+               ;; set numeric columns to align right
+                (for-each
+                 (lambda (col)
+                   (gnc:html-table-set-col-style!
+                    table col "td"
+                    'attribute (list "align" "right")))
+                 '(1 2 3))
+
+              (gnc:html-document-add-object! document table))
+             ))
            (gnc:html-document-add-object!
             document
             (gnc:html-make-empty-data-warning

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/portfolio.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/portfolio.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/portfolio.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -127,8 +127,16 @@
                  (units (cadr (unit-collector 'getpair commodity #f)))
 
                  (price-info (price-fn commodity to-date))
-                 
-		 (value (exchange-fn (gnc:make-gnc-monetary commodity units) currency)))
+                 (price (car price-info))
+                 (price-monetary (if price
+                                     (gnc:make-gnc-monetary
+                                      (gnc-price-get-currency price)
+                                      (gnc-price-get-value price))
+                                     (gnc:make-gnc-monetary
+                                      currency
+                                      (cdr price-info))))
+                 (value (exchange-fn (gnc:make-gnc-monetary commodity units)
+                                     currency)))
 
 	    (set! work-done (+ 1 work-done))
 	    (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
@@ -145,10 +153,7 @@
 			       (xaccPrintAmount units share-print-info))
 			      (gnc:make-html-table-header-cell/markup
 			       "number-cell"
-			       (gnc:html-price-anchor
-				(car price-info)
-				(gnc:make-gnc-monetary (gnc-price-get-currency (car price-info))
-						       (gnc-price-get-value (car price-info)))))
+                               (gnc:html-price-anchor price price-monetary))
 			      (gnc:make-html-table-header-cell/markup
 			       "number-cell" value)))
 		       ;;(display (sprintf #f "Shares: %6.6d  " (gnc-numeric-to-double units)))

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/register.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/register.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/register.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -26,22 +26,24 @@
   (vector-ref columns-used 1))
 (define (description-col columns-used)
   (vector-ref columns-used 2))
+(define (memo-col columns-used)
+  (vector-ref columns-used 3))
 (define (account-col columns-used)
-  (vector-ref columns-used 3))
+  (vector-ref columns-used 4))
 (define (shares-col columns-used)
-  (vector-ref columns-used 4))
+  (vector-ref columns-used 5))
 (define (price-col columns-used)
-  (vector-ref columns-used 5))
+  (vector-ref columns-used 6))
 (define (amount-single-col columns-used)
-  (vector-ref columns-used 6))
+  (vector-ref columns-used 7))
 (define (debit-col columns-used)
-  (vector-ref columns-used 7))
+  (vector-ref columns-used 8))
 (define (credit-col columns-used)
-  (vector-ref columns-used 8))
+  (vector-ref columns-used 9))
 (define (balance-col columns-used)
-  (vector-ref columns-used 9))
+  (vector-ref columns-used 10))
 
-(define columns-used-size 10)
+(define columns-used-size 11)
 
 (define (num-columns-required columns-used)  
   (do ((i 0 (+ i 1)) 
@@ -67,18 +69,29 @@
          (set-col (make-set-col col-vector)))
     (set-col (opt-val "Display" "Date") 0)
     (set-col (opt-val "Display" "Num") 1)
-    (set-col (opt-val "Display" "Description") 2)
-    (set-col (opt-val "Display" "Account") 3)
-    (set-col (opt-val "Display" "Shares") 4)
-    (set-col (opt-val "Display" "Price") 5)
+    (set-col 
+        (if (opt-val "__reg" "journal")
+        (or (opt-val "Display" "Memo") (opt-val "Display" "Description") (opt-val "__reg" "double") )
+        (opt-val "Display" "Description") 
+        )
+        2)
+    (set-col 
+        (if (opt-val "__reg" "journal")
+        #f
+        (opt-val "Display" "Memo") 
+        )
+        3)
+    (set-col (opt-val "Display" "Account") 4)
+    (set-col (opt-val "Display" "Shares") 5)
+    (set-col (opt-val "Display" "Price") 6)
     (let ((invoice? #f)
           (amount-setting (opt-val "Display" "Amount")))
       (if (or invoice? (eq? amount-setting 'single))
-          (set-col #t 6)
+          (set-col #t 7)
           (begin
-            (set-col #t 7)
-            (set-col #t 8))))
-    (set-col (opt-val "Display" "Running Balance") 9)
+            (set-col #t 8)
+            (set-col #t 9))))
+    (set-col (opt-val "Display" "Running Balance") 10)
 
     col-vector))
 
@@ -93,6 +106,8 @@
         (addto! heading-list (_ "Num")))
     (if (description-col column-vector)
         (addto! heading-list (_ "Description")))
+    (if (memo-col column-vector)
+        (addto! heading-list (_ "Memo")))
     (if (account-col column-vector)
         (addto! heading-list (if multi-rows?
                                  (_ "Account")
@@ -119,7 +134,7 @@
         balance)))
 
 (define (add-split-row table split column-vector row-style
-                       transaction-info? split-info? double?)
+                       transaction-info? split-info? double? memo? description?)
   (let* ((row-contents '())
          (parent (xaccSplitGetParent split))
          (account (xaccSplitGetAccount split))
@@ -145,10 +160,19 @@
     (if (description-col column-vector)
         (addto! row-contents
                 (if transaction-info?
-                    (xaccTransGetDescription parent)
+                    (if description?
+                        (xaccTransGetDescription parent)
+                        " " )
                     (if split-info?
-                        (xaccSplitGetMemo split)
+                        (if memo?
+                            (xaccSplitGetMemo split)
+                            " ")
                         " "))))
+    (if (memo-col column-vector)
+        (addto! row-contents
+                (if transaction-info?
+                    (xaccSplitGetMemo split)
+                    " ")))
     (if (account-col column-vector)
         (addto! row-contents
                 (if split-info?
@@ -277,6 +301,11 @@
 
   (gnc:register-reg-option
    (gnc:make-simple-boolean-option
+    (N_ "Display") (N_ "Memo")
+    "e" (N_ "Display the memo?") #t))
+
+  (gnc:register-reg-option
+   (gnc:make-simple-boolean-option
     (N_ "Display") (N_ "Account")
     "g" (N_ "Display the account?") #t))
 
@@ -374,7 +403,7 @@
       (let ((current (xaccTransGetSplit parent i)))
         (if (not (null? current))
             (begin
-              (add-split-row table current used-columns row-style #f #t #f)
+              (add-split-row table current used-columns row-style #f #t #f (opt-val "Display" "Memo") (opt-val "Display" "Description"))
               (other-rows-driver split parent table
                                  used-columns (+ i 1))))))
 
@@ -417,7 +446,9 @@
                                            current-row-style
                                            #t
                                            (not multi-rows?)
-                                           double?)))
+                                           double?
+                                           (opt-val "Display" "Memo")
+                                           (opt-val "Display" "Description"))))
 
           (if multi-rows?
               (add-other-split-rows 

Modified: gnucash/branches/gda-dev2/src/report/standard-reports/trial-balance.scm
===================================================================
--- gnucash/branches/gda-dev2/src/report/standard-reports/trial-balance.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/report/standard-reports/trial-balance.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -220,7 +220,7 @@
     
     (gnc:options-add-price-source! 
      options pagename-commodities
-     optname-price-source "b" 'weighted-average)
+     optname-price-source "b" 'average-cost)
     
     (add-option 
      (gnc:make-simple-boolean-option
@@ -421,9 +421,7 @@
 	       (acct-table #f)
 	       (debit-tot (gnc:make-commodity-collector))
 	       (credit-tot (gnc:make-commodity-collector))
-               (unrealized-gain-collector #f)
-               (neg-unrealized-gain-collector #f)
-	       (book-balance #f) ;; assets - liabilities - equity, norm 0
+               (neg-unrealized-gain-collector (gnc:make-commodity-collector))
 	       (table-env #f)    ;; parameters for :make-
 	       (account-cols #f)
 	       (indented-depth #f)
@@ -502,15 +500,7 @@
 	       )
 	      cell)
 	    )
-	  
-	  ;; set default cell alignment
-	  (gnc:html-table-set-style!
-	   build-table "td"
-	   'attribute '("align" "right")
-	   'attribute '("valign" "top")
-	   )
-	  
-	  (gnc:report-percent-done 4)
+
 	  ;; sum any unrealized gains
 	  ;; 
 	  ;; Hm... unrealized gains....  This is when you purchase
@@ -521,40 +511,63 @@
 	  ;; I *think* a decrease in the value of a liability or
 	  ;; equity constitutes an unrealized loss.  I'm unsure about
 	  ;; that though....
-	  ;; 
-	  (set! book-balance (gnc:make-commodity-collector))
-	  (map (lambda (acct)
-		 (book-balance
-		  'merge
-		  (gnc:account-get-comm-balance-at-date acct end-date-tp #f)
-		  #f)
-		 )
-	       all-accounts)
-          (set! unrealized-gain-collector (gnc:make-commodity-collector))
-          (let* ((weighted-fn
-                  (gnc:case-exchange-fn 'weighted-average
-                                        report-commodity end-date-tp))
-		 
-                 (value
-                  (gnc:gnc-monetary-amount
-                   (gnc:sum-collector-commodity book-balance
-                                                report-commodity
-                                                exchange-fn)))
-		 
-                 (cost
-                  (gnc:gnc-monetary-amount
-                   (gnc:sum-collector-commodity book-balance
-                                                report-commodity
-                                                weighted-fn)))
-		 
-                 (unrealized-gain (gnc-numeric-sub-fixed value cost)))
-	    
-            (unrealized-gain-collector 'add report-commodity unrealized-gain)
-	    )
-	  (set! neg-unrealized-gain-collector (gnc:make-commodity-collector))
-	  (neg-unrealized-gain-collector 'minusmerge
-					 unrealized-gain-collector
-					 #f)
+          ;;
+          ;; This procedure returns a commodity collector.
+          (define (collect-unrealized-gains)
+            (if (equal? price-source 'average-cost)
+                ;; No need to calculate if doing valuation at cost.
+                (gnc:make-commodity-collector)
+                (let ((book-balance (gnc:make-commodity-collector))
+                      (unrealized-gain-collector (gnc:make-commodity-collector))
+                      (cost-fn (gnc:case-exchange-fn 'average-cost
+                                                     report-commodity
+                                                     end-date-tp))
+                      (value #f)
+                      (cost #f))
+
+                  ;; Calculate book balance.
+                  ;; assets - liabilities - equity; normally 0
+                  (map
+                   (lambda (acct)
+                     (book-balance 'merge
+                                   (gnc:account-get-comm-balance-at-date
+                                    acct end-date-tp #f)
+                     #f))
+                   all-accounts)
+
+                 ;; Get the value of all holdings.
+                 (set! value (gnc:gnc-monetary-amount
+                              (gnc:sum-collector-commodity book-balance
+                                                           report-commodity
+                                                           exchange-fn)))
+
+                 ;; Get the cost of all holdings.
+                 (set! cost (gnc:gnc-monetary-amount
+                             (gnc:sum-collector-commodity book-balance
+                                                          report-commodity
+                                                          cost-fn)))
+
+                 ;; Get the unrealized gain or loss (value minus cost).
+                 (unrealized-gain-collector 'add
+                                            report-commodity
+                                            (gnc-numeric-sub-fixed value cost))
+                 unrealized-gain-collector)))
+
+
+	  ;; set default cell alignment
+	  (gnc:html-table-set-style!
+	   build-table "td"
+	   'attribute '("align" "right")
+	   'attribute '("valign" "top")
+	   )
+	  
+	  (gnc:report-percent-done 4)
+
+          ;; Get any unrealized gains/losses.
+          (neg-unrealized-gain-collector 'minusmerge
+                                         (collect-unrealized-gains)
+                                         #f)
+
 	  (set! table-env
 		(list
 		 (list 'start-date #f)
@@ -821,28 +834,23 @@
 	  ;; we omit unrealized gains from the balance report, if
 	  ;; zero, since they are not present on normal trial balances
 	  (and (not (gnc-commodity-collector-allzero?
-		     unrealized-gain-collector))
+		     neg-unrealized-gain-collector))
 	       (let* ((ug-row (+ header-rows
-				 (gnc:html-acct-table-num-rows
-				  acct-table)))
+				 (gnc:html-acct-table-num-rows acct-table)))
+                      (credit? (gnc:double-col
+                                'credit-q neg-unrealized-gain-collector
+                                report-commodity exchange-fn show-fcur?))
+                      (entry (gnc:double-col
+                              'entry neg-unrealized-gain-collector
+                              report-commodity exchange-fn show-fcur?))
 		      )
-		 (add-line
-		  build-table (_ "Unrealized Gains")
-		  neg-unrealized-gain-collector)
-		 ;; make table line wide enough
-		 (gnc:html-table-set-cell!
-		  build-table
-		  ug-row
-		  (+ account-cols 1)
-		  #f)
+                 (add-line build-table
+                           (if credit?
+                               (_ "Unrealized Gains")
+                               (_ "Unrealized Losses"))
+                           neg-unrealized-gain-collector)
 		 (if (equal? report-variant 'work-sheet)
-		     (let* ((credit? (gnc:double-col
-				      'credit-q neg-unrealized-gain-collector
-				      report-commodity exchange-fn show-fcur?))
-			    (entry (gnc:double-col
-				    'entry neg-unrealized-gain-collector
-				    report-commodity exchange-fn show-fcur?))
-			    )
+		     (begin
 		       ;; make table line wide enough
 		       (gnc:html-table-set-cell!
 			build-table

Modified: gnucash/branches/gda-dev2/src/scm/string.scm
===================================================================
--- gnucash/branches/gda-dev2/src/scm/string.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/scm/string.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -119,3 +119,24 @@
 
 (define-public (gnc:string-delete-chars s chars)
   (string-delete s (lambda (c) (string-index chars c))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;  gnc:list-display
+;;
+;;  Run the display procedure on each element in a list.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-public (gnc:list-display lst)
+  (for-each (lambda (elt) (display elt)) lst))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;  gnc:list-display-to-string
+;;
+;;  Return a string containing the output that would be generated
+;;  by running the display procedure on each element in a list.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-public (gnc:list-display-to-string lst)
+  (with-output-to-string (lambda () (gnc:list-display lst))))
+

Modified: gnucash/branches/gda-dev2/src/tax/us/txf-de_DE.scm
===================================================================
--- gnucash/branches/gda-dev2/src/tax/us/txf-de_DE.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/tax/us/txf-de_DE.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -74,8 +74,10 @@
    (cons 'K76 #(none "76" "Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist (Bemessungsgrundlage)" 2 #f "76"))
    (cons 'K77 #(none "77" "Lieferungen in das übrige Gemeinschaftsgebiet an Abnehmer mit USt-IdNr." 2 #f "77"))
    (cons 'K80 #(none "80" "Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist (Steuer)" 1 #f "80"))
+   (cons 'K81 #(none "81" "Steuerpflichtige Umsätze, Steuersatz 19 v.H." 2 #f "81"))
    (cons 'K83 #(none "83" "Verbleibende Umsatzsteuer-Vorauszahlung" 1 #f "83"))
    (cons 'K86 #(none "86" "Steuerpflichtige Umsätze, Steuersatz 7 v.H." 2 #f "86"))
+   (cons 'K89 #(none "89" "Steuerpflichtige innergemeinschaftliche Erwerbe zum Steuersatz von 16 v.H." 2 #f "89"))
    (cons 'K93 #(none "93" "Steuerpflichtige innergemeinschaftliche Erwerbe zum Steuersatz von 7 v.H." 2 #f "93"))
    (cons 'K97 #(none "97" "Steuerpflichtige innergemeinschaftliche Erwerbe zum Steuersatz von 16 v.H." 2 #f "97"))
    (cons 'K98 #(none "98" "Steuerpflichtige innergemeinschaftliche Erwerbe zu anderen Steuersätzen (Steuer)" 1 #f "98"))

Modified: gnucash/branches/gda-dev2/src/tax/us/txf-help-de_DE.scm
===================================================================
--- gnucash/branches/gda-dev2/src/tax/us/txf-help-de_DE.scm	2008-07-29 21:32:54 UTC (rev 17437)
+++ gnucash/branches/gda-dev2/src/tax/us/txf-help-de_DE.scm	2008-07-30 01:08:07 UTC (rev 17438)
@@ -24,6 +24,7 @@
     (K48 . "Steuerfreie Umsätze ohne Vorsteuerabzug: Umsätze nach § 4 Nr. 8 bis 28 UStG (Bemessungsgrundlage)")
 
     (K51 . "Steuerpflichtige Umsätze (Lieferungen und sonstige Leistungen einschl. unentgeltlicher Wertabgaben) zum Steuersatz von 16 v.H. (Bemessungsgrundlage)")
+    (K81 . "Steuerpflichtige Umsätze (Lieferungen und sonstige Leistungen einschl. unentgeltlicher Wertabgaben) zum Steuersatz von 19 v.H. (Bemessungsgrundlage)")
     (K86 . "Steuerpflichtige Umsätze (Lieferungen und sonstige Leistungen einschl. unentgeltlicher Wertabgaben) zum Steuersatz von 7 v.H. (Bemessungsgrundlage)")
     (K35 . "Umsätze, die anderen Steuersätzen unterliegen (Bemessungsgrundlage)")
     (K36 . "Umsätze, die anderen Steuersätzen unterliegen (Steuer)")
@@ -31,8 +32,9 @@
     (K76 . "Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist (Sägewerkserzeugnisse, Getränke und alkohol. Flüssigkeiten, z.B. Wein) (Bemessungsgrundlage)")
     (K80 . "Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist (Sägewerkserzeugnisse, Getränke und alkohol. Flüssigkeiten, z.B. Wein) (Steuer)")
 
+    (K89 . "Steuerpflichtige innergemeinschaftliche Erwerbe zum Steuersatz von 19 v.H. (Bemessungsgrundlage)")
     (K91 . "Steuerfreie innergemeinschaftliche Erwerbe: Erwerbe nach § 4b UStG (Bemessungsgrundlage)")
+    (K93 . "Steuerpflichtige innergemeinschaftliche Erwerbe zum Steuersatz von 7 v.H. (Bemessungsgrundlage)")
 
-
     (K66 . "Vorsteuerbeträge aus Rechnungen von anderen Unternehmern (§ 15 Abs. 1 Satz 1 Nr. 1 UStG), aus Leistungen im Sinne des § 13a Abs. 1 Nr. 6 UStG (§ 15 Abs. 1 Satz 1 Nr. 5 UStG) und aus innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 5 UStG)")
     ))



More information about the gnucash-changes mailing list