summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
commitdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch)
tree99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/dialogs
downloadkmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz
kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/dialogs')
-rw-r--r--kmymoney2/dialogs/Makefile.am22
-rw-r--r--kmymoney2/dialogs/investactivities.cpp624
-rw-r--r--kmymoney2/dialogs/investactivities.h158
-rw-r--r--kmymoney2/dialogs/investtransactioneditor.cpp1094
-rw-r--r--kmymoney2/dialogs/investtransactioneditor.h173
-rw-r--r--kmymoney2/dialogs/kaccountselectdlg.cpp192
-rw-r--r--kmymoney2/dialogs/kaccountselectdlg.h155
-rw-r--r--kmymoney2/dialogs/kaccountselectdlgdecl.ui215
-rw-r--r--kmymoney2/dialogs/kbackupdlg.cpp101
-rw-r--r--kmymoney2/dialogs/kbackupdlg.h44
-rw-r--r--kmymoney2/dialogs/kbackupdlgdecl.ui210
-rw-r--r--kmymoney2/dialogs/kbalancechartdlg.cpp227
-rw-r--r--kmymoney2/dialogs/kbalancechartdlg.h46
-rw-r--r--kmymoney2/dialogs/kbalancewarning.cpp67
-rw-r--r--kmymoney2/dialogs/kbalancewarning.h50
-rw-r--r--kmymoney2/dialogs/kcategoryreassigndlg.cpp106
-rw-r--r--kmymoney2/dialogs/kcategoryreassigndlg.h66
-rw-r--r--kmymoney2/dialogs/kcategoryreassigndlgdecl.ui175
-rw-r--r--kmymoney2/dialogs/kchooseimportexportdlg.cpp108
-rw-r--r--kmymoney2/dialogs/kchooseimportexportdlg.h47
-rw-r--r--kmymoney2/dialogs/kchooseimportexportdlgdecl.ui235
-rw-r--r--kmymoney2/dialogs/kconfirmmanualenterdlg.cpp202
-rw-r--r--kmymoney2/dialogs/kconfirmmanualenterdlg.h60
-rw-r--r--kmymoney2/dialogs/kconfirmmanualenterdlgdecl.ui160
-rw-r--r--kmymoney2/dialogs/kcsvprogressdlg.cpp252
-rw-r--r--kmymoney2/dialogs/kcsvprogressdlg.h68
-rw-r--r--kmymoney2/dialogs/kcsvprogressdlgdecl.ui535
-rw-r--r--kmymoney2/dialogs/kcurrencycalculator.cpp315
-rw-r--r--kmymoney2/dialogs/kcurrencycalculator.h88
-rw-r--r--kmymoney2/dialogs/kcurrencycalculatordecl.ui414
-rw-r--r--kmymoney2/dialogs/kcurrencyeditdlg.cpp291
-rw-r--r--kmymoney2/dialogs/kcurrencyeditdlg.h84
-rw-r--r--kmymoney2/dialogs/kcurrencyeditdlgdecl.ui304
-rw-r--r--kmymoney2/dialogs/keditequityentrydecl.ui306
-rw-r--r--kmymoney2/dialogs/keditequityentrydlg.cpp138
-rw-r--r--kmymoney2/dialogs/keditequityentrydlg.h69
-rw-r--r--kmymoney2/dialogs/keditloanwizard.cpp514
-rw-r--r--kmymoney2/dialogs/keditloanwizard.h89
-rw-r--r--kmymoney2/dialogs/keditscheduledlg.cpp558
-rw-r--r--kmymoney2/dialogs/keditscheduledlg.h103
-rw-r--r--kmymoney2/dialogs/keditscheduledlgdecl.ui532
-rw-r--r--kmymoney2/dialogs/kendingbalancedlg.cpp611
-rw-r--r--kmymoney2/dialogs/kendingbalancedlg.h147
-rw-r--r--kmymoney2/dialogs/kendingbalancedlgdecl.ui980
-rw-r--r--kmymoney2/dialogs/kenterscheduledlg.cpp327
-rw-r--r--kmymoney2/dialogs/kenterscheduledlg.h91
-rw-r--r--kmymoney2/dialogs/kenterscheduledlgdecl.ui330
-rw-r--r--kmymoney2/dialogs/kequitypriceupdatedlg.cpp588
-rw-r--r--kmymoney2/dialogs/kequitypriceupdatedlg.h81
-rw-r--r--kmymoney2/dialogs/kequitypriceupdatedlgdecl.ui179
-rw-r--r--kmymoney2/dialogs/kexportdlg.cpp284
-rw-r--r--kmymoney2/dialogs/kexportdlg.h180
-rw-r--r--kmymoney2/dialogs/kexportdlgdecl.ui507
-rw-r--r--kmymoney2/dialogs/kfindtransactiondlg.cpp843
-rw-r--r--kmymoney2/dialogs/kfindtransactiondlg.h203
-rw-r--r--kmymoney2/dialogs/kfindtransactiondlgdecl.ui1101
-rw-r--r--kmymoney2/dialogs/kgncimportoptionsdlg.cpp128
-rw-r--r--kmymoney2/dialogs/kgncimportoptionsdlg.h70
-rw-r--r--kmymoney2/dialogs/kgncimportoptionsdlgdecl.ui383
-rw-r--r--kmymoney2/dialogs/kgncpricesourcedlg.cpp106
-rw-r--r--kmymoney2/dialogs/kgncpricesourcedlg.h53
-rw-r--r--kmymoney2/dialogs/kgncpricesourcedlgdecl.ui248
-rw-r--r--kmymoney2/dialogs/kgpgkeyselectiondlg.cpp149
-rw-r--r--kmymoney2/dialogs/kgpgkeyselectiondlg.h66
-rw-r--r--kmymoney2/dialogs/kimportdlg.cpp228
-rw-r--r--kmymoney2/dialogs/kimportdlg.h118
-rw-r--r--kmymoney2/dialogs/kimportdlgdecl.ui246
-rw-r--r--kmymoney2/dialogs/kloadtemplatedlg.cpp55
-rw-r--r--kmymoney2/dialogs/kloadtemplatedlg.h46
-rw-r--r--kmymoney2/dialogs/kloadtemplatedlgdecl.ui106
-rw-r--r--kmymoney2/dialogs/kmergetransactionsdlg.cpp55
-rw-r--r--kmymoney2/dialogs/kmergetransactionsdlg.h52
-rw-r--r--kmymoney2/dialogs/kmymoneyfileinfodlg.cpp92
-rw-r--r--kmymoney2/dialogs/kmymoneyfileinfodlg.h44
-rw-r--r--kmymoney2/dialogs/kmymoneyfileinfodlgdecl.ui358
-rw-r--r--kmymoney2/dialogs/kmymoneypricedlg.cpp258
-rw-r--r--kmymoney2/dialogs/kmymoneypricedlg.h59
-rw-r--r--kmymoney2/dialogs/kmymoneypricedlgdecl.ui220
-rw-r--r--kmymoney2/dialogs/kmymoneysplittable.cpp999
-rw-r--r--kmymoney2/dialogs/kmymoneysplittable.h264
-rw-r--r--kmymoney2/dialogs/knewaccountdlg.cpp1209
-rw-r--r--kmymoney2/dialogs/knewaccountdlg.h143
-rw-r--r--kmymoney2/dialogs/knewaccountdlgdecl.ui1044
-rw-r--r--kmymoney2/dialogs/knewbankdlg.cpp105
-rw-r--r--kmymoney2/dialogs/knewbankdlg.h57
-rw-r--r--kmymoney2/dialogs/knewbankdlgdecl.ui268
-rw-r--r--kmymoney2/dialogs/knewbudgetdlg.cpp83
-rw-r--r--kmymoney2/dialogs/knewbudgetdlg.h59
-rw-r--r--kmymoney2/dialogs/knewbudgetdlgdecl.ui175
-rw-r--r--kmymoney2/dialogs/knewequityentrydecl.ui236
-rw-r--r--kmymoney2/dialogs/knewequityentrydlg.cpp99
-rw-r--r--kmymoney2/dialogs/knewequityentrydlg.h64
-rw-r--r--kmymoney2/dialogs/knewfiledlg.cpp138
-rw-r--r--kmymoney2/dialogs/knewfiledlg.h63
-rw-r--r--kmymoney2/dialogs/knewfiledlgdecl.ui328
-rw-r--r--kmymoney2/dialogs/knewinvestmentwizard.cpp314
-rw-r--r--kmymoney2/dialogs/knewinvestmentwizard.h94
-rw-r--r--kmymoney2/dialogs/knewinvestmentwizarddecl.ui591
-rw-r--r--kmymoney2/dialogs/knewloanwizard.cpp1088
-rw-r--r--kmymoney2/dialogs/knewloanwizard.h167
-rw-r--r--kmymoney2/dialogs/knewloanwizarddecl.ui5497
-rw-r--r--kmymoney2/dialogs/konlinequoteconfigurationdecl.ui199
-rw-r--r--kmymoney2/dialogs/konlinequoteconfigurationdlg.cpp51
-rw-r--r--kmymoney2/dialogs/konlinequoteconfigurationdlg.h49
-rw-r--r--kmymoney2/dialogs/kpayeereassigndlg.cpp81
-rw-r--r--kmymoney2/dialogs/kpayeereassigndlg.h74
-rw-r--r--kmymoney2/dialogs/kpayeereassigndlgdecl.ui186
-rw-r--r--kmymoney2/dialogs/kplugindlg.ui154
-rw-r--r--kmymoney2/dialogs/krecentfileitem.cpp62
-rw-r--r--kmymoney2/dialogs/krecentfileitem.h56
-rw-r--r--kmymoney2/dialogs/kreconciledlg.cpp463
-rw-r--r--kmymoney2/dialogs/kreconciledlg.h90
-rw-r--r--kmymoney2/dialogs/kreconciledlgdecl.ui709
-rw-r--r--kmymoney2/dialogs/kreportconfigurationfilterdlg.cpp687
-rw-r--r--kmymoney2/dialogs/kreportconfigurationfilterdlg.h78
-rw-r--r--kmymoney2/dialogs/ksecuritylisteditor.cpp220
-rw-r--r--kmymoney2/dialogs/ksecuritylisteditor.h58
-rw-r--r--kmymoney2/dialogs/ksecuritylisteditordecl.ui262
-rw-r--r--kmymoney2/dialogs/kselectdatabasedlg.cpp232
-rw-r--r--kmymoney2/dialogs/kselectdatabasedlg.h64
-rw-r--r--kmymoney2/dialogs/kselectdatabasedlgdecl.ui250
-rw-r--r--kmymoney2/dialogs/kselecttransactionsdlg.cpp178
-rw-r--r--kmymoney2/dialogs/kselecttransactionsdlg.h73
-rw-r--r--kmymoney2/dialogs/kselecttransactionsdlgdecl.ui174
-rw-r--r--kmymoney2/dialogs/ksortoptiondlg.ui129
-rw-r--r--kmymoney2/dialogs/ksortoptiondlg.ui.h53
-rw-r--r--kmymoney2/dialogs/ksplitcorrectiondlg.ui245
-rw-r--r--kmymoney2/dialogs/ksplittransactiondlg.cpp449
-rw-r--r--kmymoney2/dialogs/ksplittransactiondlg.h174
-rw-r--r--kmymoney2/dialogs/ksplittransactiondlgdecl.ui424
-rw-r--r--kmymoney2/dialogs/kstartdlg.cpp243
-rw-r--r--kmymoney2/dialogs/kstartdlg.h84
-rw-r--r--kmymoney2/dialogs/kupdatestockpricedlg.cpp119
-rw-r--r--kmymoney2/dialogs/kupdatestockpricedlg.h77
-rw-r--r--kmymoney2/dialogs/kupdatestockpricedlgdecl.ui257
-rw-r--r--kmymoney2/dialogs/mymoneyqifprofileeditor.cpp483
-rw-r--r--kmymoney2/dialogs/mymoneyqifprofileeditor.h96
-rw-r--r--kmymoney2/dialogs/mymoneyqifprofileeditordecl.ui905
-rw-r--r--kmymoney2/dialogs/settings/Makefile.am25
-rw-r--r--kmymoney2/dialogs/settings/ksettingscolors.cpp37
-rw-r--r--kmymoney2/dialogs/settings/ksettingscolors.h40
-rw-r--r--kmymoney2/dialogs/settings/ksettingscolorsdecl.ui406
-rw-r--r--kmymoney2/dialogs/settings/ksettingsfonts.cpp37
-rw-r--r--kmymoney2/dialogs/settings/ksettingsfonts.h40
-rw-r--r--kmymoney2/dialogs/settings/ksettingsfontsdecl.ui131
-rw-r--r--kmymoney2/dialogs/settings/ksettingsforecast.cpp37
-rw-r--r--kmymoney2/dialogs/settings/ksettingsforecast.h41
-rw-r--r--kmymoney2/dialogs/settings/ksettingsforecastdecl.ui268
-rw-r--r--kmymoney2/dialogs/settings/ksettingsgeneral.cpp63
-rw-r--r--kmymoney2/dialogs/settings/ksettingsgeneral.h44
-rw-r--r--kmymoney2/dialogs/settings/ksettingsgeneraldecl.ui646
-rw-r--r--kmymoney2/dialogs/settings/ksettingsgpg.cpp200
-rw-r--r--kmymoney2/dialogs/settings/ksettingsgpg.h54
-rw-r--r--kmymoney2/dialogs/settings/ksettingsgpgdecl.ui238
-rw-r--r--kmymoney2/dialogs/settings/ksettingshome.cpp173
-rw-r--r--kmymoney2/dialogs/settings/ksettingshome.h52
-rw-r--r--kmymoney2/dialogs/settings/ksettingshomedecl.ui231
-rw-r--r--kmymoney2/dialogs/settings/ksettingsonlinequotes.cpp219
-rw-r--r--kmymoney2/dialogs/settings/ksettingsonlinequotes.h59
-rw-r--r--kmymoney2/dialogs/settings/ksettingsonlinequotesdecl.ui234
-rw-r--r--kmymoney2/dialogs/settings/ksettingsplugins.cpp66
-rw-r--r--kmymoney2/dialogs/settings/ksettingsplugins.h47
-rw-r--r--kmymoney2/dialogs/settings/ksettingsregister.cpp75
-rw-r--r--kmymoney2/dialogs/settings/ksettingsregister.h45
-rw-r--r--kmymoney2/dialogs/settings/ksettingsregisterdecl.ui549
-rw-r--r--kmymoney2/dialogs/settings/ksettingsschedules.cpp37
-rw-r--r--kmymoney2/dialogs/settings/ksettingsschedules.h41
-rw-r--r--kmymoney2/dialogs/settings/ksettingsschedulesdecl.ui145
-rw-r--r--kmymoney2/dialogs/transactioneditor.cpp2156
-rw-r--r--kmymoney2/dialogs/transactioneditor.h416
-rw-r--r--kmymoney2/dialogs/transactionmatcher.cpp361
-rw-r--r--kmymoney2/dialogs/transactionmatcher.h145
172 files changed, 47420 insertions, 0 deletions
diff --git a/kmymoney2/dialogs/Makefile.am b/kmymoney2/dialogs/Makefile.am
new file mode 100644
index 0000000..ad9be80
--- /dev/null
+++ b/kmymoney2/dialogs/Makefile.am
@@ -0,0 +1,22 @@
+noinst_LIBRARIES = libdialogs.a
+KDE_OPTIONS = noautodist
+
+INCLUDES = $(all_includes) -I$(top_srcdir) -I. -I$(top_srcdir)/libkdchart -I$(top_srcdir)/kmymoney2/mymoney
+
+libdialogs_a_METASOURCES = AUTO
+
+libdialogs_a_SOURCES = kreportconfigurationfilterdlg.cpp kcurrencycalculator.cpp kcurrencyeditdlg.cpp keditequityentrydlg.cpp keditloanwizard.cpp knewloanwizard.cpp kenterscheduledlg.cpp krecentfileitem.cpp keditscheduledlg.cpp mymoneyqifprofileeditor.cpp kaccountselectdlg.cpp kupdatestockpricedlg.cpp knewequityentrydlg.cpp kstartdlg.cpp kreconciledlg.cpp knewfiledlg.cpp knewbankdlg.cpp knewaccountdlg.cpp kfindtransactiondlg.cpp kendingbalancedlg.cpp ksplittransactiondlg.cpp kimportdlg.cpp kexportdlg.cpp kcsvprogressdlg.cpp kchooseimportexportdlg.cpp kbackupdlg.cpp kequitypriceupdatedlg.cpp kmymoneypricedlg.cpp knewinvestmentwizard.cpp knewinvestmentwizard.h ksecuritylisteditor.cpp kgncimportoptionsdlg.cpp konlinequoteconfigurationdlg.cpp kgncpricesourcedlg.cpp kmymoneyfileinfodlg.cpp kselectdatabasedlg.cpp kpayeereassigndlg.cpp kcategoryreassigndlg.cpp kconfirmmanualenterdlg.cpp kaccountselectdlgdecl.ui kbackupdlgdecl.ui kchooseimportexportdlgdecl.ui kconfirmmanualenterdlgdecl.ui kcsvprogressdlgdecl.ui kcurrencycalculatordecl.ui kcurrencyeditdlgdecl.ui keditequityentrydecl.ui keditscheduledlgdecl.ui kendingbalancedlgdecl.ui kenterscheduledlgdecl.ui kequitypriceupdatedlgdecl.ui kexportdlgdecl.ui kfindtransactiondlgdecl.ui kgncimportoptionsdlgdecl.ui kimportdlgdecl.ui kmymoneypricedlgdecl.ui knewaccountdlgdecl.ui knewbankdlgdecl.ui knewequityentrydecl.ui knewfiledlgdecl.ui knewinvestmentwizarddecl.ui knewloanwizarddecl.ui konlinequoteconfigurationdecl.ui kreconciledlgdecl.ui ksecuritylisteditordecl.ui ksplitcorrectiondlg.ui ksplittransactiondlgdecl.ui kupdatestockpricedlgdecl.ui mymoneyqifprofileeditordecl.ui kgncpricesourcedlgdecl.ui kmymoneyfileinfodlgdecl.ui kselectdatabasedlgdecl.ui kpayeereassigndlgdecl.ui kcategoryreassigndlgdecl.ui transactioneditor.cpp investtransactioneditor.cpp investactivities.cpp kbalancechartdlg.cpp kplugindlg.ui kgpgkeyselectiondlg.cpp transactionmatcher.cpp kbalancewarning.cpp \
+knewbudgetdlgdecl.ui knewbudgetdlg.cpp kselecttransactionsdlgdecl.ui kselecttransactionsdlg.cpp kmergetransactionsdlg.cpp ksortoptiondlg.ui kloadtemplatedlgdecl.ui kloadtemplatedlg.cpp kmymoneysplittable.cpp
+
+EXTRA_DIST = kaccountselectdlgdecl.ui kbackupdlgdecl.ui kchooseimportexportdlgdecl.ui kconfirmmanualenterdlgdecl.ui kcsvprogressdlgdecl.ui kcurrencycalculatordecl.ui kcurrencyeditdlgdecl.ui keditequityentrydecl.ui keditscheduledlgdecl.ui kendingbalancedlgdecl.ui kenterscheduledlgdecl.ui kequitypriceupdatedlgdecl.ui kexportdlgdecl.ui kfindtransactiondlgdecl.ui kgncimportoptionsdlgdecl.ui kimportdlgdecl.ui kmymoneypricedlgdecl.ui knewaccountdlgdecl.ui knewbankdlgdecl.ui knewequityentrydecl.ui knewfiledlgdecl.ui knewinvestmentwizarddecl.ui knewloanwizarddecl.ui konlinequoteconfigurationdecl.ui kreconciledlgdecl.ui ksecuritylisteditordecl.ui ksplitcorrectiondlg.ui ksplittransactiondlgdecl.ui kupdatestockpricedlgdecl.ui mymoneyqifprofileeditordecl.ui kgncpricesourcedlgdecl.ui kmymoneyfileinfodlgdecl.ui kselectdatabasedlgdecl.ui kpayeereassigndlgdecl.ui kcategoryreassigndlgdecl.ui knewbudgetdlgdecl.ui kselecttransactionsdlgdecl.ui ksortoptiondlg.ui ksortoptiondlg.ui.h kplugindlg.ui kloadtemplatedlgdecl.ui
+
+DISTCLEANFILES= kaccountselectdlgdecl.cpp kbackupdlgdecl.cpp kchooseimportexportdlgdecl.cpp kcsvprogressdlgdecl.cpp kcurrencycalculatordecl.cpp kcurrencyeditdlgdecl.cpp keditequityentrydecl.cpp keditscheduledlgdecl.cpp kendingbalancedlgdecl.cpp kenterscheduledlgdecl.cpp kequitypriceupdatedlgdecl.cpp kexportdlgdecl.cpp kfindtransactiondlgdecl.cpp kgncimportoptionsdlgdecl.cpp kimportdlgdecl.cpp kmymoneypricedlgdecl.cpp knewaccountdlgdecl.cpp knewbankdlgdecl.cpp knewequityentrydecl.cpp knewfiledlgdecl.cpp knewinvestmentwizarddecl.cpp knewloanwizarddecl.cpp konlinequoteconfigurationdecl.cpp kreconciledlgdecl.cpp kreportconfigurationdecl.cpp ksecuritylisteditordecl.cpp ksplittransactiondlgdecl.cpp kupdatestockpricedlgdecl.cpp mymoneyqifprofileeditordecl.cpp kpayeereassigndlgdecl.cpp kcategoryreassigndlgdecl.cpp kconfirmmanualenterdlgdecl.cpp kaccountselectdlgdecl.h kbackupdlgdecl.h kchooseimportexportdlgdecl.h kcsvprogressdlgdecl.h kcurrencycalculatordecl.h kcurrencyeditdlgdecl.h keditequityentrydecl.h keditscheduledlgdecl.h kendingbalancedlgdecl.h kenterscheduledlgdecl.h kequitypriceupdatedlgdecl.h kexportdlgdecl.h kfindtransactiondlgdecl.h kgncimportoptionsdlgdecl.h kimportdlgdecl.h kmymoneypricedlgdecl.h knewaccountdlgdecl.h knewbankdlgdecl.h knewequityentrydecl.h knewfiledlgdecl.h knewinvestmentwizarddecl.h knewloanwizarddecl.h konlinequoteconfigurationdecl.h kreconciledlgdecl.h kreportconfigurationdecl.h ksecuritylisteditordecl.h ksplittransactiondlgdecl.h kupdatestockpricedlgdecl.h mymoneyqifprofileeditordecl.h kmymoneyfileinfodlgdecl.h kselectdatabasedlgdecl.h kpayeereassigndlgdecl.h kcategoryreassigndlgdecl.h knewbudgetdlgdecl.cpp knewbudgetdlgdecl.h kselecttransactionsdlgdecl.cpp kselecttransactionsdlgdecl.h kconfirmmanualenterdlgdecl.h kloadtemplatedlgdecl.cpp kloadtemplatedlgdecl.h
+
+noinst_HEADERS = keditscheduledlg.h kaccountselectdlg.h kbackupdlg.h kchooseimportexportdlg.h kcsvprogressdlg.h kcurrencyeditdlg.h keditequityentrydlg.h keditloanwizard.h kendingbalancedlg.h kenterscheduledlg.h kequitypriceupdatedlg.h kexportdlg.h kfindtransactiondlg.h kgncimportoptionsdlg.h kimportdlg.h kmymoneypricedlg.h knewaccountdlg.h knewbankdlg.h knewequityentrydlg.h knewfiledlg.h knewinvestmentwizard.h knewloanwizard.h konlinequoteconfigurationdlg.h krecentfileitem.h kreconciledlg.h kreportconfigurationfilterdlg.h ksecuritylisteditor.h ksplittransactiondlg.h kstartdlg.h kupdatestockpricedlg.h mymoneyqifprofileeditor.h kgncpricesourcedlg.h kmymoneyfileinfodlg.h kselectdatabasedlg.h kpayeereassigndlg.h kcategoryreassigndlg.h knewbudgetdlg.h kselecttransactionsdlg.h kmergetransactionsdlg.h kconfirmmanualenterdlg.h investactivities.h kbalancechartdlg.h kloadtemplatedlg.h kmymoneysplittable.h kgpgkeyselectiondlg.h transactionmatcher.h kbalancewarning.h
+
+instdir=$(includedir)/kmymoney
+inst_HEADERS = transactioneditor.h investtransactioneditor.h kcurrencycalculator.h
+
+SUBDIRS = settings
+
+messages: rc.cpp
diff --git a/kmymoney2/dialogs/investactivities.cpp b/kmymoney2/dialogs/investactivities.cpp
new file mode 100644
index 0000000..d929c38
--- /dev/null
+++ b/kmymoney2/dialogs/investactivities.cpp
@@ -0,0 +1,624 @@
+/***************************************************************************
+ investactivities.cpp
+ ----------
+ begin : Fri Dec 15 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kmymoneycompletion.h>
+#include <kmymoney/mymoneyfile.h>
+
+#include "investactivities.h"
+
+using namespace Invest;
+using namespace KMyMoneyRegister;
+
+bool Activity::isComplete(QString& reason) const
+{
+ bool rc = false;
+ KMyMoneySecurity* security = dynamic_cast<KMyMoneySecurity*>(haveWidget("security"));
+ if(!security->currentText().isEmpty()) {
+ rc = security->selector()->contains(security->currentText());
+ }
+ return rc;
+}
+
+bool Activity::haveAssetAccount(void) const
+{
+ KMyMoneyCategory* cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("asset-account"));
+
+ bool rc = true;
+ if(!isMultiSelection())
+ rc = !cat->currentText().isEmpty();
+
+ if(rc && !cat->currentText().isEmpty()) {
+ rc = cat->selector()->contains(cat->currentText());
+ }
+ return rc;
+}
+
+bool Activity::haveCategoryAndAmount(const QString& category, const QString& amount, bool optional) const
+{
+ KMyMoneyCategory* cat = dynamic_cast<KMyMoneyCategory*>(haveWidget(category));
+
+ bool rc = true;
+ if(!isMultiSelection() && !optional)
+ rc = !cat->currentText().isEmpty();
+
+ if(rc && !cat->currentText().isEmpty()) {
+ rc = cat->selector()->contains(cat->currentText()) || cat->isSplitTransaction();
+ if(rc && !amount.isEmpty()) {
+ MyMoneyMoney value = dynamic_cast<kMyMoneyEdit*>(haveWidget(amount))->value();
+ if(!isMultiSelection())
+ rc = !value.isZero();
+ }
+ }
+ return rc;
+}
+
+bool Activity::haveShares(void) const
+{
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ if(isMultiSelection() && amount->text().isEmpty())
+ return true;
+
+ return !amount->value().isZero();
+}
+
+bool Activity::havePrice(void) const
+{
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(haveWidget("price"));
+ if(isMultiSelection() && amount->text().isEmpty())
+ return true;
+
+ return !amount->value().isZero();
+}
+
+bool Activity::createCategorySplits(const MyMoneyTransaction& t, KMyMoneyCategory* cat, kMyMoneyEdit* amount, MyMoneyMoney factor, QValueList<MyMoneySplit>&splits, const QValueList<MyMoneySplit>& osplits ) const
+{
+ bool rc = true;
+ if(!isMultiSelection() || (isMultiSelection() && !cat->currentText().isEmpty())) {
+ if(!cat->isSplitTransaction()) {
+ splits.clear();
+ MyMoneySplit s1;
+ QString categoryId;
+ categoryId = cat->selectedItem();
+ if(!categoryId.isEmpty()) {
+ s1.setAccountId(categoryId);
+ s1.setValue(amount->value() * factor);
+ if(!s1.value().isZero()) {
+ rc = m_parent->setupPrice(t, s1);
+ }
+ splits.append(s1);
+ }
+ } else {
+ splits = osplits;
+ }
+ }
+ return rc;
+}
+
+void Activity::createAssetAccountSplit(MyMoneySplit& split, const MyMoneySplit& stockSplit) const
+{
+ KMyMoneyCategory* cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("asset-account"));
+ if(!isMultiSelection() || (isMultiSelection() && !cat->currentText().isEmpty())) {
+ QString categoryId;
+ categoryId = cat->selectedItem();
+ split.setAccountId(categoryId);
+ }
+ split.setMemo(stockSplit.memo());
+}
+
+MyMoneyMoney Activity::sumSplits(const MyMoneySplit& s0, const QValueList<MyMoneySplit>& feeSplits, const QValueList<MyMoneySplit>& interestSplits) const
+{
+ MyMoneyMoney total;
+ total = s0.value();
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = feeSplits.begin(); it_s != feeSplits.end(); ++it_s) {
+ total += (*it_s).value();
+ }
+ for(it_s = interestSplits.begin(); it_s != interestSplits.end(); ++it_s) {
+ total += (*it_s).value();
+ }
+ return total;
+}
+
+void Activity::setLabelText(const QString& idx, const QString& txt) const
+{
+ QLabel* w = dynamic_cast<QLabel*>(haveWidget(idx));
+ if(w) {
+ w->setText(txt);
+ } else {
+ qDebug("Unknown QLabel named '%s'", idx.data());
+ }
+}
+
+void Activity::preloadAssetAccount(void)
+{
+ KMyMoneyCategory* cat;
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("asset-account"));
+ if(cat->isVisible()) {
+ if(cat->currentText().isEmpty()) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->accountByName(i18n("%1 (Brokerage)").arg(m_parent->account().name()));
+ if(!acc.id().isEmpty()) {
+ bool blocked = cat->signalsBlocked();
+ // block signals, so that the focus does not go crazy
+ cat->blockSignals(true);
+ cat->completion()->setSelected(acc.id());
+ cat->slotItemSelected(acc.id());
+ cat->blockSignals(blocked);
+ }
+ }
+ }
+}
+
+void Buy::showWidgets(void) const
+{
+ KMyMoneyCategory* cat;
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account"));
+ cat->parentWidget()->show();
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ cat->parentWidget()->show();
+ kMyMoneyEdit* shareEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ shareEdit->show();
+ shareEdit->setPrecision(MyMoneyMoney::denomToPrec(m_parent->security().smallestAccountFraction()));
+ cat->parentWidget()->show();
+ haveWidget("asset-account")->show();
+ haveWidget("price")->show();
+ haveWidget("total")->show();
+ setLabelText("fee-label", i18n("Fees"));
+ setLabelText("interest-label", i18n("Interest"));
+ setLabelText("interest-amount-label", i18n("Amount"));
+ setLabelText("asset-label", i18n("Account"));
+ setLabelText("shares-label", i18n("Shares"));
+ setLabelText("price-label", i18n("Price/share"));
+ setLabelText("total-label", i18n("Total"));
+}
+
+bool Buy::isComplete(QString& reason) const
+{
+ bool rc = Activity::isComplete(reason);
+ rc &= haveAssetAccount();
+ rc &= haveFees(true);
+ rc &= haveInterest(true);
+ rc &= haveShares();
+ rc &= havePrice();
+
+ return rc;
+}
+
+bool Buy::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(m_interestSplits);
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ QString reason;
+ if(!isComplete(reason))
+ return false;
+
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ kMyMoneyEdit* priceEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("price"));
+
+ s0.setAction(MyMoneySplit::BuyShares);
+
+ MyMoneyMoney shares = s0.shares();
+ MyMoneyMoney price;
+ if(!s0.shares().isZero())
+ price = (s0.value() / s0.shares()).reduce();
+
+ if(!isMultiSelection() || (isMultiSelection() && !sharesEdit->text().isEmpty())) {
+ shares = sharesEdit->value().abs();
+ s0.setShares(shares);
+ s0.setValue((shares * price).reduce());
+ s0.setPrice(price);
+ }
+ if(!isMultiSelection() || (isMultiSelection() && !priceEdit->text().isEmpty())) {
+ price = priceEdit->value().abs();
+ if(priceMode() == InvestTransactionEditor::PricePerTransaction) {
+ s0.setValue(price.reduce());
+ if(!s0.shares().isZero())
+ s0.setPrice((price / s0.shares()).reduce());
+ } else {
+ s0.setValue((shares * price).reduce());
+ s0.setPrice(price);
+ }
+ }
+
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("fee-amount")), MyMoneyMoney(1,1), feeSplits, m_feeSplits))
+ return false;
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("interest-amount")), MyMoneyMoney(-1,1), interestSplits, m_interestSplits))
+ return false;
+
+ createAssetAccountSplit(assetAccountSplit, s0);
+
+ MyMoneyMoney total = sumSplits(s0, feeSplits, interestSplits);
+ assetAccountSplit.setValue(-total);
+
+ if(!m_parent->setupPrice(t, assetAccountSplit))
+ return false;
+
+ return true;
+}
+
+void Sell::showWidgets(void) const
+{
+ KMyMoneyCategory* cat;
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ cat->parentWidget()->show();
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account"));
+ cat->parentWidget()->show();
+ kMyMoneyEdit* shareEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ shareEdit->show();
+ shareEdit->setPrecision(MyMoneyMoney::denomToPrec(m_parent->security().smallestAccountFraction()));
+ haveWidget("asset-account")->show();
+ haveWidget("price")->show();
+ haveWidget("total")->show();
+
+ setLabelText("fee-label", i18n("Fees"));
+ setLabelText("interest-label", i18n("Interest"));
+ setLabelText("interest-amount-label", i18n("Amount"));
+ setLabelText("asset-label", i18n("Account"));
+ setLabelText("shares-label", i18n("Shares"));
+ setLabelText("price-label", i18n("Price/share"));
+ setLabelText("total-label", i18n("Total"));
+}
+
+bool Sell::isComplete(QString& reason) const
+{
+ bool rc = Activity::isComplete(reason);
+ rc &= haveAssetAccount();
+ rc &= haveFees(true);
+ rc &= haveInterest(true);
+ rc &= haveShares();
+ rc &= havePrice();
+ return rc;
+}
+
+bool Sell::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ QString reason;
+ if(!isComplete(reason))
+ return false;
+
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ kMyMoneyEdit* priceEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("price"));
+
+ s0.setAction(MyMoneySplit::BuyShares);
+
+ MyMoneyMoney shares = s0.shares();
+ MyMoneyMoney price;
+ if(!s0.shares().isZero())
+ price = (s0.value() / s0.shares()).reduce();
+
+ if(!isMultiSelection() || (isMultiSelection() && !sharesEdit->text().isEmpty())) {
+ shares = -sharesEdit->value().abs();
+ s0.setShares(shares);
+ s0.setValue((shares * price).reduce());
+ s0.setPrice(price);
+ }
+ if(!isMultiSelection() || (isMultiSelection() && !priceEdit->text().isEmpty())) {
+ price = priceEdit->value().abs();
+ if(priceMode() == InvestTransactionEditor::PricePerTransaction) {
+ price = -price;
+ s0.setValue(price.reduce());
+ if(!s0.shares().isZero())
+ s0.setPrice((price / s0.shares()).reduce());
+ } else {
+ s0.setValue((shares * price).reduce());
+ s0.setPrice(price);
+ }
+ }
+
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("fee-amount")), MyMoneyMoney(1,1), feeSplits, m_feeSplits))
+ return false;
+
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("interest-amount")), MyMoneyMoney(-1,1), interestSplits, m_interestSplits))
+ return false;
+
+ createAssetAccountSplit(assetAccountSplit, s0);
+
+ MyMoneyMoney total = sumSplits(s0, feeSplits, interestSplits);
+ assetAccountSplit.setValue(-total);
+
+ if(!m_parent->setupPrice(t, assetAccountSplit))
+ return false;
+
+ return true;
+}
+
+void Div::showWidgets(void) const
+{
+ KMyMoneyCategory* cat;
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ cat->parentWidget()->show();
+ haveWidget("asset-account")->show();
+ haveWidget("total")->show();
+
+ setLabelText("interest-amount-label", i18n("Amount"));
+ setLabelText("interest-label", i18n("Interest"));
+ setLabelText("asset-label", i18n("Account"));
+ setLabelText("total-label", i18n("Total"));
+}
+
+bool Div::isComplete(QString& reason) const
+{
+ bool rc = haveAssetAccount();
+ rc &= haveInterest(false);
+ return rc;
+}
+
+bool Div::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(m_feeSplits);
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ QString reason;
+ if(!isComplete(reason))
+ return false;
+
+ s0.setAction(MyMoneySplit::Dividend);
+
+ // for dividends, we only use the stock split as a marker
+ MyMoneyMoney shares;
+ s0.setShares(shares);
+ s0.setValue(shares);
+ s0.setPrice(MyMoneyMoney(1,1));
+
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("interest-amount")), MyMoneyMoney(-1,1), interestSplits, m_interestSplits))
+ return false;
+
+ createAssetAccountSplit(assetAccountSplit, s0);
+
+ MyMoneyMoney total = sumSplits(s0, feeSplits, interestSplits);
+ assetAccountSplit.setValue(-total);
+
+ if(!m_parent->setupPrice(t, assetAccountSplit))
+ return false;
+
+ return true;
+}
+
+void Reinvest::showWidgets(void) const
+{
+ KMyMoneyCategory* cat;
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ cat->parentWidget()->show();
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account"));
+ cat->parentWidget()->show();
+ kMyMoneyEdit* shareEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ shareEdit->show();
+ shareEdit->setPrecision(MyMoneyMoney::denomToPrec(m_parent->security().smallestAccountFraction()));
+ haveWidget("price")->show();
+ haveWidget("total")->show();
+
+ setLabelText("fee-label", i18n("Fees"));
+ setLabelText("interest-label", i18n("Interest"));
+ setLabelText("shares-label", i18n("Shares"));
+ setLabelText("price-label", i18n("Price/share"));
+ setLabelText("total-label", i18n("Total"));
+}
+
+bool Reinvest::isComplete(QString& reason) const
+{
+ bool rc = Activity::isComplete(reason);
+ rc &= haveCategoryAndAmount("interest-account", QString(), false);
+ rc &= haveFees(true);
+ rc &= haveShares();
+ rc &= havePrice();
+ return rc;
+}
+
+bool Reinvest::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(assetAccountSplit);
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ QString reason;
+ if(!isComplete(reason))
+ return false;
+
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ kMyMoneyEdit* priceEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("price"));
+
+ s0.setAction(MyMoneySplit::ReinvestDividend);
+
+ MyMoneyMoney shares = s0.shares();
+ MyMoneyMoney price;
+ if(!s0.shares().isZero())
+ price = (s0.value() / s0.shares()).reduce();
+
+ if(!isMultiSelection() || (isMultiSelection() && !sharesEdit->text().isEmpty())) {
+ shares = sharesEdit->value().abs();
+ s0.setShares(shares);
+ s0.setValue((shares * price).reduce());
+ s0.setPrice(price);
+ }
+ if(!isMultiSelection() || (isMultiSelection() && !priceEdit->text().isEmpty())) {
+ price = priceEdit->value().abs();
+ if(priceMode() == InvestTransactionEditor::PricePerTransaction) {
+ s0.setValue(price.reduce());
+ if(!s0.shares().isZero())
+ s0.setPrice((price / s0.shares()).reduce());
+ } else {
+ s0.setValue((shares * price).reduce());
+ s0.setPrice(price);
+ }
+ }
+
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("fee-amount")), MyMoneyMoney(1,1), feeSplits, m_feeSplits))
+ return false;
+
+ if(!createCategorySplits(t, dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account")), dynamic_cast<kMyMoneyEdit*>(haveWidget("interest-amount")), MyMoneyMoney(-1,1), interestSplits, m_interestSplits))
+ return false;
+
+ if(interestSplits.count() != 1) {
+ qDebug("more or less than one interest split in Reinvest::createTransaction. Not created.");
+ return false;
+ }
+
+ MyMoneySplit& s1 = interestSplits[0];
+
+ MyMoneyMoney total = sumSplits(s0, feeSplits, QValueList<MyMoneySplit>());
+ s1.setValue(-total);
+
+ if(!m_parent->setupPrice(t, s1))
+ return false;
+
+ return true;
+}
+
+void Add::showWidgets(void) const
+{
+ kMyMoneyEdit* shareEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ shareEdit->show();
+ shareEdit->setPrecision(MyMoneyMoney::denomToPrec(m_parent->security().smallestAccountFraction()));
+
+ setLabelText("shares-label", i18n("Shares"));
+}
+
+bool Add::isComplete(QString& reason) const
+{
+ bool rc = Activity::isComplete(reason);
+ rc &= haveShares();
+ return rc;
+}
+
+bool Add::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(t);
+ Q_UNUSED(assetAccountSplit);
+ Q_UNUSED(m_feeSplits);
+ Q_UNUSED(m_interestSplits);
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ QString reason;
+ if(!isComplete(reason))
+ return false;
+
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+
+ s0.setAction(MyMoneySplit::AddShares);
+ s0.setShares(sharesEdit->value().abs());
+ s0.setValue(MyMoneyMoney(0, 1));
+ s0.setPrice(MyMoneyMoney(0, 1));
+
+ feeSplits.clear();
+ interestSplits.clear();
+
+ return true;
+}
+
+void Remove::showWidgets(void) const
+{
+ kMyMoneyEdit* shareEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ shareEdit->show();
+ shareEdit->setPrecision(MyMoneyMoney::denomToPrec(m_parent->security().smallestAccountFraction()));
+ setLabelText("shares-label", i18n("Shares"));
+}
+
+bool Remove::isComplete(QString& reason) const
+{
+ bool rc = Activity::isComplete(reason);
+ rc &= haveShares();
+ return rc;
+}
+
+bool Remove::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(t);
+ Q_UNUSED(assetAccountSplit);
+ Q_UNUSED(m_feeSplits);
+ Q_UNUSED(m_interestSplits);
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ QString reason;
+ if(!isComplete(reason))
+ return false;
+
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+
+ s0.setAction(MyMoneySplit::AddShares);
+ s0.setShares(-(sharesEdit->value().abs()));
+ s0.setValue(MyMoneyMoney(0, 1));
+ s0.setPrice(MyMoneyMoney(0, 1));
+
+ feeSplits.clear();
+ interestSplits.clear();
+
+ return true;
+}
+
+void Split::showWidgets(void) const
+{
+ // TODO do we need a special split ratio widget?
+ // TODO maybe yes, currently the precision is the one of the fraction and might differ from it
+ kMyMoneyEdit* shareEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ shareEdit->show();
+ shareEdit->setPrecision(-1);
+ setLabelText("shares-label", i18n("Ratio 1/"));
+}
+
+bool Split::isComplete(QString& reason) const
+{
+ bool rc = Activity::isComplete(reason);
+ rc &= haveShares();
+ return rc;
+}
+
+bool Split::createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency)
+{
+ Q_UNUSED(t);
+ Q_UNUSED(assetAccountSplit);
+ Q_UNUSED(m_feeSplits);
+ Q_UNUSED(m_interestSplits);
+ Q_UNUSED(security);
+ Q_UNUSED(currency);
+
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+
+ s0.setAction(MyMoneySplit::SplitShares);
+ s0.setShares(sharesEdit->value().abs());
+ s0.setValue(MyMoneyMoney(0, 1));
+ s0.setPrice(MyMoneyMoney(0, 1));
+
+ feeSplits.clear();
+ interestSplits.clear();
+
+ return true;
+}
+
+
diff --git a/kmymoney2/dialogs/investactivities.h b/kmymoney2/dialogs/investactivities.h
new file mode 100644
index 0000000..91b474d
--- /dev/null
+++ b/kmymoney2/dialogs/investactivities.h
@@ -0,0 +1,158 @@
+/***************************************************************************
+ investactivities.h
+ ----------
+ begin : Fri Dec 15 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef INVESTACTIVITIES_H
+#define INVESTACTIVITIES_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/register.h>
+#include <kmymoney/investtransactioneditor.h>
+
+namespace Invest {
+
+class Activity
+{
+public:
+ virtual MyMoneySplit::investTransactionTypeE type(void) const = 0;
+ virtual void showWidgets(void) const = 0;
+ virtual bool isComplete(QString& reason) const = 0;
+
+ /**
+ * Create a transaction @p t based on the split @p s0 and the data contained
+ * in the widgets. In multiselection mode, @p assetAccountSplit, @p feeSplits, @p
+ * interestSplits, @p security and @p currency are taken from the original
+ * transaction and should be used as well.
+ *
+ * @return @p true if creation was successful, @p false otherwise
+ */
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency) = 0;
+
+ virtual void preloadAssetAccount(void);
+ virtual ~Activity() {}
+
+protected:
+ Activity(InvestTransactionEditor* editor) { m_parent = editor; }
+ QWidget* haveWidget(const QString& name) const { return m_parent->haveWidget(name); }
+ bool haveAssetAccount(void) const;
+ bool haveFees(bool optional = false) const { return haveCategoryAndAmount("fee-account", "fee-amount", optional); }
+ bool haveInterest(bool optional = false) const { return haveCategoryAndAmount("interest-account", "interest-amount", optional); }
+ bool haveShares(void) const;
+ bool havePrice(void) const;
+ bool isMultiSelection(void) const { return m_parent->isMultiSelection(); }
+ bool createCategorySplits(const MyMoneyTransaction& t, KMyMoneyCategory* cat, kMyMoneyEdit* amount, MyMoneyMoney factor, QValueList<MyMoneySplit>&splits, const QValueList<MyMoneySplit>& osplits ) const;
+ void createAssetAccountSplit(MyMoneySplit& split, const MyMoneySplit& stockSplit) const;
+ MyMoneyMoney sumSplits(const MyMoneySplit& s0, const QValueList<MyMoneySplit>& feeSplits, const QValueList<MyMoneySplit>& interestSplits) const;
+ bool haveCategoryAndAmount(const QString& category, const QString& amount, bool optional) const;
+ void setLabelText(const QString& idx, const QString& txt) const;
+ InvestTransactionEditor::priceModeE priceMode(void) const { return m_parent->priceMode(); }
+
+protected:
+ InvestTransactionEditor* m_parent;
+ QMap<QString, MyMoneyMoney> m_priceInfo;
+};
+
+class Buy : public Activity
+{
+public:
+ Buy(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Buy() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::BuyShares; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+class Sell : public Activity
+{
+public:
+ Sell(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Sell() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::SellShares; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+class Div : public Activity
+{
+public:
+ Div(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Div() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::Dividend; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+class Reinvest : public Activity
+{
+public:
+ Reinvest(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Reinvest() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::ReinvestDividend; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+class Add : public Activity
+{
+public:
+ Add(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Add() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::AddShares; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+class Remove : public Activity
+{
+public:
+ Remove(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Remove() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::RemoveShares; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+class Split : public Activity
+{
+public:
+ Split(InvestTransactionEditor* editor) : Activity(editor) {}
+ virtual ~Split() {}
+ virtual MyMoneySplit::investTransactionTypeE type(void) const { return MyMoneySplit::SplitShares; }
+ virtual void showWidgets(void) const;
+ virtual bool isComplete(QString& reason) const;
+ virtual bool createTransaction(MyMoneyTransaction& t, MyMoneySplit& s0, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& m_feeSplits, QValueList<MyMoneySplit>& interestSplits, QValueList<MyMoneySplit>& m_interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency);
+};
+
+} // namespace Invest
+
+
+
+#endif // INVESTACTIVITIES_H
+
diff --git a/kmymoney2/dialogs/investtransactioneditor.cpp b/kmymoney2/dialogs/investtransactioneditor.cpp
new file mode 100644
index 0000000..5a62436
--- /dev/null
+++ b/kmymoney2/dialogs/investtransactioneditor.cpp
@@ -0,0 +1,1094 @@
+/***************************************************************************
+ investtransactioneditor.cpp
+ ----------
+ begin : Fri Dec 15 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <typeinfo>
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qapplication.h>
+#include <qeventloop.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <ktextedit.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+#include <kstdguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/investtransactioneditor.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneyaccountcompletion.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/transactionform.h>
+
+#include "../dialogs/ksplittransactiondlg.h"
+#include "../dialogs/kcurrencycalculator.h"
+
+#include "../kmymoneyglobalsettings.h"
+
+#include "investactivities.h"
+
+using namespace KMyMoneyRegister;
+using namespace KMyMoneyTransactionForm;
+using namespace Invest;
+
+class InvestTransactionEditor::Private {
+ friend class Invest::Activity;
+
+public:
+ Private(InvestTransactionEditor* parent) :
+ m_parent(parent),
+ m_activity(0)
+ {
+ m_phonyAccount = MyMoneyAccount("Phony-ID", MyMoneyAccount());
+ }
+
+ ~Private() {
+ delete m_activity;
+ }
+
+ QWidget* haveWidget(const QString& name) { return m_parent->haveWidget(name); }
+
+ InvestTransactionEditor* m_parent;
+ Activity* m_activity;
+ MyMoneyAccount m_phonyAccount;
+ MyMoneySplit m_phonySplit;
+};
+
+
+InvestTransactionEditor::InvestTransactionEditor() :
+ d(new Private(this))
+{
+}
+
+InvestTransactionEditor::~InvestTransactionEditor()
+{
+ delete d;
+}
+
+InvestTransactionEditor::InvestTransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::InvestTransaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate) :
+ TransactionEditor(regForm, item, list, lastPostDate),
+ d(new Private(this))
+{
+ // dissect the transaction into its type, splits, currency, security etc.
+ dissectTransaction(m_transaction, m_split,
+ m_assetAccountSplit,
+ m_feeSplits,
+ m_interestSplits,
+ m_security,
+ m_currency,
+ m_transactionType);
+
+ // determine initial activity object
+ activityFactory(m_transactionType);
+}
+
+void InvestTransactionEditor::activityFactory(MyMoneySplit::investTransactionTypeE type)
+{
+ if(!d->m_activity || type != d->m_activity->type()) {
+ delete d->m_activity;
+ switch(type) {
+ default:
+ case MyMoneySplit::BuyShares:
+ d->m_activity = new Buy(this);
+ break;
+ case MyMoneySplit::SellShares:
+ d->m_activity = new Sell(this);
+ break;
+ case MyMoneySplit::Dividend:
+ case MyMoneySplit::Yield:
+ d->m_activity = new Div(this);
+ break;
+ case MyMoneySplit::ReinvestDividend:
+ d->m_activity = new Reinvest(this);
+ break;
+ case MyMoneySplit::AddShares:
+ d->m_activity = new Add(this);
+ break;
+ case MyMoneySplit::RemoveShares:
+ d->m_activity = new Remove(this);
+ break;
+ case MyMoneySplit::SplitShares:
+ d->m_activity = new Split(this);
+ break;
+ }
+ }
+}
+
+void InvestTransactionEditor::dissectTransaction(const MyMoneyTransaction& transaction, const MyMoneySplit& split, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency, MyMoneySplit::investTransactionTypeE& transactionType)
+{
+ // collect the splits. split references the stock account and should already
+ // be set up. assetAccountSplit references the corresponding asset account (maybe
+ // empty), feeSplits is the list of all expenses and interestSplits
+ // the list of all incomes
+ MyMoneyFile* file = MyMoneyFile::instance();
+ QValueList<MyMoneySplit>::ConstIterator it_s;
+ for(it_s = transaction.splits().begin(); it_s != transaction.splits().end(); ++it_s) {
+ MyMoneyAccount acc = file->account((*it_s).accountId());
+ if((*it_s).id() == split.id()) {
+ security = file->security(acc.currencyId());
+ } else if(acc.accountGroup() == MyMoneyAccount::Expense) {
+ feeSplits.append(*it_s);
+ // feeAmount += (*it_s).value();
+ } else if(acc.accountGroup() == MyMoneyAccount::Income) {
+ interestSplits.append(*it_s);
+ // interestAmount += (*it_s).value();
+ } else {
+ assetAccountSplit = *it_s;
+ }
+ }
+
+ // determine transaction type
+ if(split.action() == MyMoneySplit::ActionAddShares) {
+ transactionType = (!split.shares().isNegative()) ? MyMoneySplit::AddShares : MyMoneySplit::RemoveShares;
+ } else if(split.action() == MyMoneySplit::ActionBuyShares) {
+ transactionType = (!split.value().isNegative()) ? MyMoneySplit::BuyShares : MyMoneySplit::SellShares;
+ } else if(split.action() == MyMoneySplit::ActionDividend) {
+ transactionType = MyMoneySplit::Dividend;
+ } else if(split.action() == MyMoneySplit::ActionReinvestDividend) {
+ transactionType = MyMoneySplit::ReinvestDividend;
+ } else if(split.action() == MyMoneySplit::ActionYield) {
+ transactionType = MyMoneySplit::Yield;
+ } else if(split.action() == MyMoneySplit::ActionSplitShares) {
+ transactionType = MyMoneySplit::SplitShares;
+ } else
+ transactionType = MyMoneySplit::BuyShares;
+
+ currency.setTradingSymbol("???");
+ try {
+ currency = file->security(transaction.commodity());
+ } catch(MyMoneyException *e) {
+ delete e;
+ }
+}
+
+void InvestTransactionEditor::createEditWidgets(void)
+{
+ KMyMoneyActivityCombo* activity = new KMyMoneyActivityCombo();
+ m_editWidgets["activity"] = activity;
+ connect(activity, SIGNAL(activitySelected(MyMoneySplit::investTransactionTypeE)), this, SLOT(slotUpdateActivity(MyMoneySplit::investTransactionTypeE)));
+ connect(activity, SIGNAL(activitySelected(MyMoneySplit::investTransactionTypeE)), this, SLOT(slotUpdateButtonState()));
+
+ m_editWidgets["postdate"] = new kMyMoneyDateInput;
+ connect(m_editWidgets["postdate"], SIGNAL(dateChanged(const QDate&)), this, SLOT(slotUpdateButtonState()));
+
+ KMyMoneySecurity* security = new KMyMoneySecurity;
+ security->setHint(i18n("Security"));
+ m_editWidgets["security"] = security;
+ connect(security, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateSecurity(const QString&)));
+ connect(security, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(security, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateSecurity(const QString&, QString&)));
+ connect(security, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+
+ KMyMoneyCategory* asset = new KMyMoneyCategory(0, 0, false);
+ asset->setHint(i18n("Asset account"));
+ m_editWidgets["asset-account"] = asset;
+ connect(asset, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(asset, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+
+ KMyMoneyCategory* fees = new KMyMoneyCategory(0, 0, true);
+ fees->setHint(i18n("Fees"));
+ m_editWidgets["fee-account"] = fees;
+ connect(fees, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateFeeCategory(const QString&)));
+ connect(fees, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(fees, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateFeeVisibility(const QString&)));
+ connect(fees, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateFeeCategory(const QString&, QString&)));
+ connect(fees, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+ connect(fees->splitButton(), SIGNAL(clicked()), this, SLOT(slotEditFeeSplits()));
+
+ KMyMoneyCategory* interest = new KMyMoneyCategory(0, 0, true);
+ interest->setHint(i18n("Interest"));
+ m_editWidgets["interest-account"] = interest;
+ connect(interest, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateInterestCategory(const QString&)));
+ connect(interest, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(interest, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateInterestVisibility(const QString&)));
+ connect(interest, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateInterestCategory(const QString&, QString&)));
+ connect(interest, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+ connect(interest->splitButton(), SIGNAL(clicked()), this, SLOT(slotEditInterestSplits()));
+
+ KTextEdit* memo = new KTextEdit;
+ memo->setTabChangesFocus(true);
+ m_editWidgets["memo"] = memo;
+
+ kMyMoneyEdit* value = new kMyMoneyEdit;
+ value->setHint(i18n("Shares"));
+ value->setResetButtonVisible(false);
+ m_editWidgets["shares"] = value;
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateTotalAmount()));
+
+ value = new kMyMoneyEdit;
+ value->setHint(i18n("Price"));
+ value->setResetButtonVisible(false);
+ value->setPrecision(KMyMoneyGlobalSettings::pricePrecision());
+ m_editWidgets["price"] = value;
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateTotalAmount()));
+
+ value = new kMyMoneyEdit;
+ // TODO once we have the selected transactions as array of Transaction
+ // we can allow multiple splits for fee and interest
+ value->setResetButtonVisible(false);
+ m_editWidgets["fee-amount"] = value;
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateTotalAmount()));
+
+ value = new kMyMoneyEdit;
+ // TODO once we have the selected transactions as array of Transaction
+ // we can allow multiple splits for fee and interest
+ value->setResetButtonVisible(false);
+ m_editWidgets["interest-amount"] = value;
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateTotalAmount()));
+
+ KMyMoneyReconcileCombo* reconcile = new KMyMoneyReconcileCombo;
+ m_editWidgets["status"] = reconcile;
+ connect(reconcile, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateButtonState()));
+
+ KMyMoneyRegister::QWidgetContainer::iterator it_w;
+ for(it_w = m_editWidgets.begin(); it_w != m_editWidgets.end(); ++it_w) {
+ (*it_w)->installEventFilter(this);
+ }
+
+ QLabel* label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::AlignRight | Qt::DontClip);
+ m_editWidgets["total"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["total-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["asset-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["fee-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["fee-amount-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["interest-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["interest-amount-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["price-label"] = label;
+
+ label = new QLabel("", 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["shares-label"] = label;
+
+ // if we don't have more than 1 selected transaction, we don't need
+ // the "don't change" item in some of the combo widgets
+ if(m_transactions.count() < 2) {
+ reconcile->removeDontCare();
+ }
+}
+
+int InvestTransactionEditor::slotEditFeeSplits(void)
+{
+ return editSplits("fee-account", "fee-amount", m_feeSplits, false, SLOT(slotEditFeeSplits()));
+}
+
+int InvestTransactionEditor::slotEditInterestSplits(void)
+{
+ return editSplits("interest-account", "interest-amount", m_interestSplits, true, SLOT(slotEditInterestSplits()));
+}
+
+int InvestTransactionEditor::editSplits(const QString& categoryWidgetName, const QString& amountWidgetName, QValueList<MyMoneySplit>& splits, bool isIncome, const char* slotEditSplits)
+{
+ int rc = QDialog::Rejected;
+
+ if(!m_openEditSplits) {
+ // only get in here in a single instance
+ m_openEditSplits = true;
+
+ // force focus change to update all data
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets[categoryWidgetName]);
+ QWidget* w = category->splitButton();
+ if(w)
+ w->setFocus();
+
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(haveWidget(amountWidgetName));
+
+ MyMoneyTransaction transaction;
+ transaction.setCommodity(m_currency.id());
+ if(splits.count() == 0 && category->selectedItem()) {
+ MyMoneySplit s;
+ s.setAccountId(category->selectedItem());
+ s.setShares(amount->value());
+ s.setValue(s.shares());
+ splits << s;
+ }
+ // use the transactions commodity as the currency indicator for the splits
+ // this is used to allow some useful setting for the fractions in the amount fields
+ try {
+ d->m_phonyAccount.setCurrencyId(m_transaction.commodity());
+ d->m_phonyAccount.fraction(MyMoneyFile::instance()->security(m_transaction.commodity()));
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to setup precision");
+ delete e;
+ }
+
+ if(createPseudoTransaction(transaction, splits)) {
+ MyMoneyMoney value;
+
+ KSplitTransactionDlg* dlg = new KSplitTransactionDlg(transaction,
+ d->m_phonySplit,
+ d->m_phonyAccount,
+ false,
+ isIncome,
+ 0,
+ m_priceInfo,
+ m_regForm);
+ // connect(dlg, SIGNAL(newCategory(MyMoneyAccount&)), this, SIGNAL(newCategory(MyMoneyAccount&)));
+
+ if((rc = dlg->exec()) == QDialog::Accepted) {
+ transaction = dlg->transaction();
+ // collect splits out of the transaction
+ splits.clear();
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ MyMoneyMoney fees;
+ for(it_s = transaction.splits().begin(); it_s != transaction.splits().end(); ++it_s) {
+ if((*it_s).accountId() == d->m_phonyAccount.id())
+ continue;
+ splits << *it_s;
+ fees += (*it_s).shares();
+ }
+ if(isIncome)
+ fees = -fees;
+
+ QString categoryId;
+ setupCategoryWidget(category, splits, categoryId, slotEditSplits);
+ amount->setValue(fees);
+ slotUpdateTotalAmount();
+ }
+
+ delete dlg;
+ }
+
+ // focus jumps into the memo field
+ if((w = haveWidget("memo")) != 0) {
+ w->setFocus();
+ }
+
+ m_openEditSplits = false;
+ }
+ return rc;
+}
+
+bool InvestTransactionEditor::createPseudoTransaction(MyMoneyTransaction& t, const QValueList<MyMoneySplit>& splits)
+{
+ t.removeSplits();
+
+ MyMoneySplit split;
+ split.setAccountId(d->m_phonyAccount.id());
+ split.setValue(-subtotal(splits));
+ split.setShares(split.value());
+ t.addSplit(split);
+ d->m_phonySplit = split;
+
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ split = *it_s;
+ split.clearId();
+ t.addSplit(split);
+ }
+ return true;
+}
+
+void InvestTransactionEditor::slotCreateSecurity(const QString& name, QString& id)
+{
+ MyMoneyAccount acc;
+ QRegExp exp("([^:]+)");
+ if(exp.search(name) != -1) {
+ acc.setName(exp.cap(1));
+
+ emit createSecurity(acc, m_account);
+
+ // return id
+ id = acc.id();
+
+ if(!id.isEmpty()) {
+ slotUpdateSecurity(id);
+ }
+ }
+}
+
+void InvestTransactionEditor::slotCreateFeeCategory(const QString& name, QString& id)
+{
+ MyMoneyAccount acc;
+ acc.setName(name);
+
+ emit createCategory(acc, MyMoneyFile::instance()->expense());
+
+ // return id
+ id = acc.id();
+}
+
+void InvestTransactionEditor::slotUpdateFeeCategory(const QString& id)
+{
+ haveWidget("fee-amount")->setDisabled(id.isEmpty());
+}
+
+void InvestTransactionEditor::slotUpdateFeeVisibility(const QString& txt)
+{
+ haveWidget("fee-amount")->setHidden(txt.isEmpty());
+ QWidget* w = haveWidget("fee-amount-label");
+ if(w)
+ w->setShown(haveWidget("fee-amount")->isVisible());
+}
+
+void InvestTransactionEditor::slotUpdateInterestCategory(const QString& id)
+{
+ haveWidget("interest-amount")->setDisabled(id.isEmpty());
+}
+
+void InvestTransactionEditor::slotUpdateInterestVisibility(const QString& txt)
+{
+ KMyMoneyCategory* interest = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ QWidget* w = haveWidget("interest-amount-label");
+
+ if(dynamic_cast<Reinvest*>(d->m_activity)) {
+ interest->splitButton()->hide();
+ haveWidget("interest-amount")->setHidden(true);
+ // for the reinvest case, we don't ever hide the label do avoid a shine through
+ // of the underlying transaction data.
+ w = 0;
+ } else {
+ haveWidget("interest-amount")->setHidden(txt.isEmpty());
+ // FIXME once we can handle split interest, we need to uncomment the next line
+ // interest->splitButton()->show();
+ }
+
+ if(w)
+ w->setShown(haveWidget("interest-amount")->isVisible());
+}
+
+void InvestTransactionEditor::slotCreateInterestCategory(const QString& name, QString& id)
+{
+ MyMoneyAccount acc;
+ acc.setName(name);
+
+ emit createCategory(acc, MyMoneyFile::instance()->income());
+
+ // return id
+ id = acc.id();
+}
+
+void InvestTransactionEditor::slotReloadEditWidgets(void)
+{
+ KMyMoneyCategory* interest = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ KMyMoneyCategory* fees = dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account"));
+ KMyMoneySecurity* security = dynamic_cast<KMyMoneySecurity*>(haveWidget("security"));
+
+ AccountSet aSet;
+ QString id;
+
+ // interest-account
+ aSet.clear();
+ aSet.addAccountGroup(MyMoneyAccount::Income);
+ aSet.load(interest->selector());
+ setupCategoryWidget(interest, m_interestSplits, id, SLOT(slotEditInterestSplits()));
+
+ // fee-account
+ aSet.clear();
+ aSet.addAccountGroup(MyMoneyAccount::Expense);
+ aSet.load(fees->selector());
+ setupCategoryWidget(fees, m_feeSplits, id, SLOT(slotEditFeeSplits()));
+
+ // security
+ aSet.clear();
+ aSet.load(security->selector(), i18n("Security"), m_account.accountList(), true);
+}
+
+void InvestTransactionEditor::loadEditWidgets(KMyMoneyRegister::Action /* action */)
+{
+ QString id;
+
+ kMyMoneyDateInput* postDate = dynamic_cast<kMyMoneyDateInput*>(haveWidget("postdate"));
+ KMyMoneyReconcileCombo* reconcile = dynamic_cast<KMyMoneyReconcileCombo*>(haveWidget("status"));
+ KMyMoneySecurity* security = dynamic_cast<KMyMoneySecurity*>(haveWidget("security"));
+ KMyMoneyActivityCombo* activity = dynamic_cast<KMyMoneyActivityCombo*>(haveWidget("activity"));
+ KMyMoneyCategory* asset = dynamic_cast<KMyMoneyCategory*>(haveWidget("asset-account"));
+ KTextEdit* memo = dynamic_cast<KTextEdit*>(m_editWidgets["memo"]);
+ kMyMoneyEdit* value;
+ KMyMoneyCategory* interest = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ KMyMoneyCategory* fees = dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account"));
+
+ // check if the current transaction has a reference to an equity account
+ bool haveEquityAccount = false;
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = m_transaction.splits().begin(); !haveEquityAccount && it_s != m_transaction.splits().end(); ++it_s) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId());
+ if(acc.accountType() == MyMoneyAccount::Equity)
+ haveEquityAccount = true;
+ }
+
+ // asset-account
+ AccountSet aSet;
+ aSet.clear();
+ aSet.addAccountType(MyMoneyAccount::Checkings);
+ aSet.addAccountType(MyMoneyAccount::Savings);
+ aSet.addAccountType(MyMoneyAccount::Cash);
+ aSet.addAccountType(MyMoneyAccount::Asset);
+ aSet.addAccountType(MyMoneyAccount::Currency);
+ aSet.addAccountType(MyMoneyAccount::CreditCard);
+ if(KMyMoneyGlobalSettings::expertMode() || haveEquityAccount)
+ aSet.addAccountGroup(MyMoneyAccount::Equity);
+ aSet.load(asset->selector());
+
+ // security
+ security->setSuppressObjectCreation(false); // allow object creation on the fly
+ aSet.clear();
+ aSet.load(security->selector(), i18n("Security"), m_account.accountList(), true);
+
+ if(!isMultiSelection()) {
+ // date
+ if(m_transaction.postDate().isValid())
+ postDate->setDate(m_transaction.postDate());
+ else if(m_lastPostDate.isValid())
+ postDate->setDate(m_lastPostDate);
+ else
+ postDate->setDate(QDate::currentDate());
+
+ // security (but only if it's not the investment account)
+ if(m_split.accountId() != m_account.id()) {
+ security->completion()->setSelected(m_split.accountId());
+ security->slotItemSelected(m_split.accountId());
+ }
+
+ // activity
+ activity->setActivity(d->m_activity->type());
+ slotUpdateActivity(activity->activity());
+
+ asset->completion()->setSelected(m_assetAccountSplit.accountId());
+ asset->slotItemSelected(m_assetAccountSplit.accountId());
+
+ // interest-account
+ aSet.clear();
+ aSet.addAccountGroup(MyMoneyAccount::Income);
+ aSet.load(interest->selector());
+ setupCategoryWidget(interest, m_interestSplits, id, SLOT(slotEditInterestSplits()));
+ slotUpdateInterestVisibility(interest->currentText());
+
+ // fee-account
+ aSet.clear();
+ aSet.addAccountGroup(MyMoneyAccount::Expense);
+ aSet.load(fees->selector());
+ setupCategoryWidget(fees, m_feeSplits, id, SLOT(slotEditFeeSplits()));
+ slotUpdateFeeVisibility(fees->currentText());
+
+ // memo
+ memo->setText(m_split.memo());
+
+ // shares
+ // don't set the value if the number of shares is zero so that
+ // we can see the hint
+ value = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ if(typeid(*(d->m_activity)) != typeid(Invest::Split(this)))
+ value->setPrecision(MyMoneyMoney::denomToPrec(m_security.smallestAccountFraction()));
+ else
+ value->setPrecision(-1);
+
+ if(!m_split.shares().isZero())
+ value->setValue(m_split.shares().abs());
+
+ // price
+ updatePriceMode(m_split);
+
+ // fee amount
+ value = dynamic_cast<kMyMoneyEdit*>(haveWidget("fee-amount"));
+ value->setValue(subtotal(m_feeSplits));
+
+ // interest amount
+ value = dynamic_cast<kMyMoneyEdit*>(haveWidget("interest-amount"));
+ value->setValue(-subtotal(m_interestSplits));
+
+ // total
+ slotUpdateTotalAmount();
+
+ // status
+ if(m_split.reconcileFlag() == MyMoneySplit::Unknown)
+ m_split.setReconcileFlag(MyMoneySplit::NotReconciled);
+ reconcile->setState(m_split.reconcileFlag());
+
+ } else {
+ postDate->loadDate(QDate());
+ reconcile->setState(MyMoneySplit::Unknown);
+ memo->setText(QString());
+
+ // We don't allow to change the activity
+ activity->setActivity(d->m_activity->type());
+ slotUpdateActivity(activity->activity());
+ activity->setDisabled(true);
+
+ // scan the list of selected transactions and check that they have
+ // the same activity.
+ KMyMoneyRegister::SelectedTransactions::iterator it_t = m_transactions.begin();
+ const QString& action = m_item->split().action();
+ bool isNegative = m_item->split().shares().isNegative();
+ bool allSameActivity = true;
+ for(it_t = m_transactions.begin(); allSameActivity && (it_t != m_transactions.end()); ++it_t) {
+ allSameActivity = (action == (*it_t).split().action() && (*it_t).split().shares().isNegative() == isNegative);
+ }
+
+ QStringList fields;
+ fields << "shares" << "price" << "fee-amount" << "interest-amount";
+ QStringList::const_iterator it_f;
+ for(it_f = fields.begin(); it_f != fields.end(); ++it_f) {
+ value = dynamic_cast<kMyMoneyEdit*>(haveWidget((*it_f)));
+ value->setText("");
+ value->setAllowEmpty();
+ }
+
+ // if we have transactions with different activities, disable some more widgets
+ if(!allSameActivity) {
+ fields << "asset-account" << "fee-account" << "interest-account";
+ QStringList::const_iterator it_f;
+ for(it_f = fields.begin(); it_f != fields.end(); ++it_f) {
+ haveWidget(*it_f)->setDisabled(true);
+ }
+ }
+ }
+}
+
+QWidget* InvestTransactionEditor::firstWidget(void) const
+{
+ return 0; // let the creator use the first widget in the tab order
+}
+
+bool InvestTransactionEditor::isComplete(QString& reason) const
+{
+ reason = QString();
+ // reason.clear(); // for Qt4
+ return d->m_activity->isComplete(reason);
+}
+
+MyMoneyMoney InvestTransactionEditor::subtotal(const QValueList<MyMoneySplit>& splits) const
+{
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ MyMoneyMoney sum;
+
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ sum += (*it_s).value();
+ }
+
+ return sum;
+}
+
+void InvestTransactionEditor::slotUpdateSecurity(const QString& stockId)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+ MyMoneyAccount stock = file->account(stockId);
+ m_security = file->security(stock.currencyId());
+ m_currency = file->security(m_security.tradingCurrency());
+ bool currencyKnown = !m_currency.id().isEmpty();
+ if(!currencyKnown) {
+ m_currency.setTradingSymbol("???");
+ } else {
+ if(typeid(*(d->m_activity)) != typeid(Invest::Split(this))) {
+ dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"))->setPrecision(MyMoneyMoney::denomToPrec(m_security.smallestAccountFraction()));
+ } else {
+ dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"))->setPrecision(-1);
+ }
+ }
+
+ updatePriceMode();
+
+ d->m_activity->preloadAssetAccount();
+
+ haveWidget("shares")->setEnabled(currencyKnown);
+ haveWidget("price")->setEnabled(currencyKnown);
+ haveWidget("fee-amount")->setEnabled(currencyKnown);
+ haveWidget("interest-amount")->setEnabled(currencyKnown);
+
+ slotUpdateTotalAmount();
+}
+
+void InvestTransactionEditor::totalAmount(MyMoneyMoney& amount) const
+{
+ KMyMoneyActivityCombo* activityCombo = dynamic_cast<KMyMoneyActivityCombo*>(haveWidget("activity"));
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ kMyMoneyEdit* priceEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("price"));
+ kMyMoneyEdit* feesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("fee-amount"));
+ kMyMoneyEdit* interestEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("interest-amount"));
+
+ if(priceMode() == InvestTransactionEditor::PricePerTransaction)
+ amount = priceEdit->value().abs();
+ else
+ amount = sharesEdit->value().abs() * priceEdit->value().abs();
+
+ if(feesEdit->isVisible()) {
+ MyMoneyMoney fee = feesEdit->value();
+ MyMoneyMoney factor(-1,1);
+ switch(activityCombo->activity()) {
+ case MyMoneySplit::BuyShares:
+ case MyMoneySplit::ReinvestDividend:
+ factor = MyMoneyMoney(1,1);
+ break;
+ default:
+ break;
+ }
+ amount += (fee * factor);
+ }
+
+ if(interestEdit->isVisible()) {
+ MyMoneyMoney interest = interestEdit->value();
+ MyMoneyMoney factor(1,1);
+ switch(activityCombo->activity()) {
+ case MyMoneySplit::BuyShares:
+ factor = MyMoneyMoney(-1,1);
+ break;
+ default:
+ break;
+ }
+ amount += (interest * factor);
+ }
+}
+
+void InvestTransactionEditor::slotUpdateTotalAmount(void)
+{
+ QLabel* total = dynamic_cast<QLabel*>(haveWidget("total"));
+
+ if(total && total->isVisible()) {
+ MyMoneyMoney amount;
+ totalAmount(amount);
+ total->setText(amount.formatMoney(m_currency.tradingSymbol(), MyMoneyMoney::denomToPrec(m_security.smallestAccountFraction())));
+ }
+}
+
+void InvestTransactionEditor::slotUpdateActivity(MyMoneySplit::investTransactionTypeE activity)
+{
+ // create new activity object if required
+ activityFactory(activity);
+
+ KMyMoneyCategory* cat;
+
+ // hide all dynamic widgets (make sure to use the parentWidget for the
+ // category widgets)
+ haveWidget("interest-account")->parentWidget()->hide();
+ haveWidget("fee-account")->parentWidget()->hide();
+
+ QStringList dynwidgets;
+ dynwidgets << "total-label" << "asset-label" << "fee-label" << "fee-amount-label" << "interest-label" << "interest-amount-label" << "price-label" << "shares-label";
+
+ // hiding labels works by clearing them. hide() does not do the job
+ // as the underlying text in the QTable object will shine through
+ QStringList::const_iterator it_s;
+ for(it_s = dynwidgets.begin(); it_s != dynwidgets.end(); ++it_s) {
+ QLabel* w = dynamic_cast<QLabel*>(haveWidget(*it_s));
+ if(w)
+ w->setText(" ");
+ }
+
+ // real widgets can be hidden
+ dynwidgets.clear();
+ dynwidgets << "asset-account" << "interest-amount" << "fee-amount" << "shares" << "price" << "total";
+
+ for(it_s = dynwidgets.begin(); it_s != dynwidgets.end(); ++it_s) {
+ QWidget* w = haveWidget(*it_s);
+ if(w)
+ w->hide();
+ }
+
+ d->m_activity->showWidgets();
+
+ d->m_activity->preloadAssetAccount();
+
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("interest-account"));
+ if(cat->parentWidget()->isVisible())
+ slotUpdateInterestVisibility(cat->currentText());
+
+ cat = dynamic_cast<KMyMoneyCategory*>(haveWidget("fee-account"));
+ if(cat->parentWidget()->isVisible())
+ slotUpdateFeeVisibility(cat->currentText());
+}
+
+InvestTransactionEditor::priceModeE InvestTransactionEditor::priceMode(void) const
+{
+ priceModeE mode = static_cast<priceModeE>(0);
+ KMyMoneySecurity* sec = dynamic_cast<KMyMoneySecurity*>(m_editWidgets["security"]);
+ QString accId;
+ if(!sec->currentText().isEmpty()) {
+ accId = sec->selectedItem();
+ if(accId.isEmpty())
+ accId = m_account.id();
+ }
+ while(!accId.isEmpty() && mode == 0) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(accId);
+ if(acc.value("priceMode").isEmpty())
+ accId = acc.parentAccountId();
+ else
+ mode = static_cast<priceModeE>(acc.value("priceMode").toInt());
+ }
+
+ // if it's still <default> then use that default
+ if(mode == 0)
+ mode = PricePerShare;
+ return mode;
+}
+
+bool InvestTransactionEditor::setupPrice(const MyMoneyTransaction& t, MyMoneySplit& split)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+ MyMoneyAccount acc = file->account(split.accountId());
+ MyMoneySecurity toCurrency(file->security(acc.currencyId()));
+ int fract = acc.fraction();
+
+ if(acc.currencyId() != t.commodity()) {
+ QMap<QString, MyMoneyMoney>::Iterator it_p;
+ QString key = t.commodity() + "-" + acc.currencyId();
+ it_p = m_priceInfo.find(key);
+
+ // if it's not found, then collect it from the user first
+ MyMoneyMoney price;
+ if(it_p == m_priceInfo.end()) {
+ MyMoneySecurity fromCurrency = file->security(t.commodity());
+ MyMoneyMoney fromValue, toValue;
+
+ fromValue = split.value();
+ MyMoneyPrice priceInfo = MyMoneyFile::instance()->price(fromCurrency.id(), toCurrency.id());
+ toValue = split.value() * priceInfo.rate(toCurrency.id());
+
+ KCurrencyCalculator calc(fromCurrency,
+ toCurrency,
+ fromValue,
+ toValue,
+ t.postDate(),
+ fract,
+ m_regForm, "currencyCalculator");
+
+ if(calc.exec() == QDialog::Rejected) {
+ return false;
+ }
+ price = calc.price();
+ m_priceInfo[key] = price;
+ } else {
+ price = (*it_p);
+ }
+
+ // update shares if the transaction commodity is the currency
+ // of the current selected account
+ split.setShares((split.value() * price).convert(fract));
+ } else {
+ split.setShares(split.value().convert(fract));
+ }
+
+ return true;
+}
+
+bool InvestTransactionEditor::createTransaction(MyMoneyTransaction& t, const MyMoneyTransaction& torig, const MyMoneySplit& sorig, bool /* skipPriceDialog */)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+ // we start with the previous values, make sure we can add them later on
+ t = torig;
+ MyMoneySplit s0 = sorig;
+ s0.clearId();
+
+ KMyMoneySecurity* sec = dynamic_cast<KMyMoneySecurity*>(m_editWidgets["security"]);
+ if(!isMultiSelection() || (isMultiSelection() && !sec->currentText().isEmpty())) {
+ QString securityId = sec->selectedItem();
+ if(!securityId.isEmpty()) {
+ s0.setAccountId(securityId);
+ MyMoneyAccount stockAccount = file->account(securityId);
+ QString currencyId = stockAccount.currencyId();
+ MyMoneySecurity security = file->security(currencyId);
+
+ t.setCommodity(security.tradingCurrency());
+ } else {
+ s0.setAccountId(m_account.id());
+ t.setCommodity(m_account.currencyId());
+ }
+ }
+
+ // extract price info from original transaction
+ m_priceInfo.clear();
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ if(!torig.id().isEmpty()) {
+ for(it_s = torig.splits().begin(); it_s != torig.splits().end(); ++it_s) {
+ if((*it_s).id() != sorig.id()) {
+ MyMoneyAccount cat = file->account((*it_s).accountId());
+ if(cat.currencyId() != m_account.currencyId()) {
+ if(!(*it_s).shares().isZero() && !(*it_s).value().isZero()) {
+ m_priceInfo[cat.currencyId()] = ((*it_s).shares() / (*it_s).value()).reduce();
+ }
+ }
+ }
+ }
+ }
+
+ t.removeSplits();
+
+ kMyMoneyDateInput* postDate = dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"]);
+ if(postDate->date().isValid()) {
+ t.setPostDate(postDate->date());
+ }
+
+ // memo and number field are special: if we have multiple transactions selected
+ // and the edit field is empty, we treat it as "not modified".
+ // FIXME a better approach would be to have a 'dirty' flag with the widgets
+ // which identifies if the originally loaded value has been modified
+ // by the user
+ KTextEdit* memo = dynamic_cast<KTextEdit*>(m_editWidgets["memo"]);
+ if(memo) {
+ if(!isMultiSelection() || (isMultiSelection() && !memo->text().isEmpty() ) )
+ s0.setMemo(memo->text());
+ }
+
+ MyMoneySplit assetAccountSplit;
+ QValueList<MyMoneySplit> feeSplits;
+ QValueList<MyMoneySplit> interestSplits;
+ MyMoneySecurity security, currency;
+ MyMoneySplit::investTransactionTypeE transactionType;
+
+ // extract the splits from the original transaction
+ dissectTransaction(torig, sorig,
+ assetAccountSplit,
+ feeSplits,
+ interestSplits,
+ security,
+ currency,
+ transactionType);
+
+ // check if the trading currency is the same if the security has changed
+ // in case it differs, check that we have a price (request from user)
+ // and convert all splits
+ // TODO
+
+ // do the conversions here
+ // TODO
+
+ // keep the current activity object and create a new one
+ // that can be destroyed later on
+ Activity* activity = d->m_activity;
+ d->m_activity = 0; // make sure we create a new one
+ activityFactory(activity->type());
+
+ // if the activity is not set in the combo widget, we keep
+ // the one which is used in the original transaction
+ KMyMoneyActivityCombo* activityCombo = dynamic_cast<KMyMoneyActivityCombo*>(haveWidget("activity"));
+ if(activityCombo->activity() == MyMoneySplit::UnknownTransactionType) {
+ activityFactory(transactionType);
+ }
+
+ // if we mark the split reconciled here, we'll use today's date if no reconciliation date is given
+ KMyMoneyReconcileCombo* status = dynamic_cast<KMyMoneyReconcileCombo*>(m_editWidgets["status"]);
+ if(status->state() != MyMoneySplit::Unknown)
+ s0.setReconcileFlag(status->state());
+
+ if(s0.reconcileFlag() == MyMoneySplit::Reconciled && !s0.reconcileDate().isValid())
+ s0.setReconcileDate(QDate::currentDate());
+
+ // call the creation logic for the current selected activity
+ bool rc = d->m_activity->createTransaction(t, s0, assetAccountSplit, feeSplits, m_feeSplits, interestSplits, m_interestSplits, security, currency);
+
+ // now switch back to the original activity
+ delete d->m_activity;
+ d->m_activity = activity;
+
+ // add the splits to the transaction
+ if(rc) {
+ if(!assetAccountSplit.accountId().isEmpty()) {
+ assetAccountSplit.clearId();
+ t.addSplit(assetAccountSplit);
+ }
+
+ t.addSplit(s0);
+
+ QValueList<MyMoneySplit>::iterator it_s;
+ for(it_s = feeSplits.begin(); it_s != feeSplits.end(); ++it_s) {
+ (*it_s).clearId();
+ t.addSplit(*it_s);
+ }
+
+ for(it_s = interestSplits.begin(); it_s != interestSplits.end(); ++it_s) {
+ (*it_s).clearId();
+ t.addSplit(*it_s);
+ }
+ }
+
+ // adjust the value to the smallestAccountFraction found
+ // for the commodity of the transaction.
+ for(it_s = t.splits().begin(); it_s != t.splits().end(); ++it_s) {
+ MyMoneySplit s = (*it_s);
+ s.setValue((*it_s).value().convert(currency.smallestAccountFraction()));
+ t.modifySplit(s);
+ }
+
+ return rc;
+}
+
+void InvestTransactionEditor::updatePriceMode(const MyMoneySplit& split)
+{
+ QLabel* label = dynamic_cast<QLabel*>(haveWidget("price-label"));
+ if(label) {
+ kMyMoneyEdit* sharesEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("shares"));
+ kMyMoneyEdit* priceEdit = dynamic_cast<kMyMoneyEdit*>(haveWidget("price"));
+ MyMoneyMoney price;
+ if(!split.id().isEmpty())
+ price = split.price().reduce();
+ else
+ price = priceEdit->value().abs();
+
+ if(priceMode() == PricePerTransaction && label->text() != i18n("Price")) {
+ label->setText(i18n("Price"));
+ if(!sharesEdit->value().isZero())
+ priceEdit->setValue(sharesEdit->value().abs() * price);
+
+ } else if(priceMode() == PricePerShare && label->text() == i18n("Price")) {
+ label->setText(i18n("Price/Share"));
+ if(!sharesEdit->value().isZero())
+ priceEdit->setValue(price / sharesEdit->value().abs());
+
+ } else if(priceMode() == PricePerTransaction) {
+ priceEdit->setValue(sharesEdit->value().abs() * price);
+
+ } else
+ priceEdit->setValue(price);
+ }
+}
+
+void InvestTransactionEditor::setupFinalWidgets(void)
+{
+ addFinalWidget(haveWidget("memo"));
+}
+
+#include "investtransactioneditor.moc"
+
diff --git a/kmymoney2/dialogs/investtransactioneditor.h b/kmymoney2/dialogs/investtransactioneditor.h
new file mode 100644
index 0000000..4d56697
--- /dev/null
+++ b/kmymoney2/dialogs/investtransactioneditor.h
@@ -0,0 +1,173 @@
+/***************************************************************************
+ investtransactioneditor.h
+ ----------
+ begin : Fri Dec 15 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef INVESTMENTTRANSACTIONEDITOR_H
+#define INVESTMENTTRANSACTIONEDITOR_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/transactioneditor.h>
+
+class InvestTransactionEditor : public TransactionEditor
+{
+ friend class InvestTransactionEditorPrivate;
+
+ Q_OBJECT
+public:
+ typedef enum {
+ PricePerShare = 1,
+ PricePerTransaction
+ } priceModeE;
+
+ InvestTransactionEditor();
+ InvestTransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::InvestTransaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate);
+ virtual ~InvestTransactionEditor();
+
+ /**
+ * This method returns information about the completeness of the data
+ * entered. This can be used to control the availability of the
+ * 'Enter transaction' action.
+ *
+ * @retval true if entering the transaction into the engine
+ * @retval false if not enough information is present to enter the
+ * transaction into the engine
+ *
+ * @param reason will be filled with a string about the reason why the
+ * completeness is not reached. Empty if the return value
+ * is @c true.
+ *
+ * @sa transactionDataSufficient()
+ */
+ virtual bool isComplete(QString& reason) const;
+
+ virtual QWidget* firstWidget(void) const;
+
+ virtual bool fixTransactionCommodity(const MyMoneyAccount& /* account */) { return true; }
+
+ void totalAmount(MyMoneyMoney& amount) const;
+
+ static void dissectTransaction(const MyMoneyTransaction& transaction, const MyMoneySplit& split, MyMoneySplit& assetAccountSplit, QValueList<MyMoneySplit>& feeSplits, QValueList<MyMoneySplit>& interestSplits, MyMoneySecurity& security, MyMoneySecurity& currency, MyMoneySplit::investTransactionTypeE& transactionType);
+
+ bool setupPrice(const MyMoneyTransaction& t, MyMoneySplit& split);
+
+ /**
+ * This method creates a transaction based on the contents of the current widgets,
+ * the splits in m_split in single selection mode or an existing transaction/split
+ * and the contents of the widgets in multi selection mode.
+ *
+ * The split referencing the current account is returned as the first split in the
+ * transaction's split list.
+ *
+ * @param t reference to created transaction
+ * @param torig the original transaction
+ * @param sorig the original split
+ *
+ * @param skipPriceDialog if @p true the user will not be requested for price information
+ * (defaults to @p false)
+ *
+ * @return @p false if aborted by user, @p true otherwise
+ *
+ * @note Usually not used directly. If unsure, use enterTransactions() instead.
+ */
+ bool createTransaction(MyMoneyTransaction& t, const MyMoneyTransaction& torig, const MyMoneySplit& sorig, bool skipPriceDialog = false);
+
+ priceModeE priceMode(void) const;
+
+ const MyMoneySecurity& security(void) const { return m_security; }
+
+protected slots:
+ void slotCreateSecurity(const QString& name, QString& id);
+ void slotCreateFeeCategory(const QString& name, QString& id);
+ void slotCreateInterestCategory(const QString& name, QString& id);
+
+ int slotEditInterestSplits(void);
+ int slotEditFeeSplits(void);
+ void slotReloadEditWidgets(void);
+
+ void slotUpdateActivity(MyMoneySplit::investTransactionTypeE);
+ void slotUpdateSecurity(const QString& stockId);
+ void slotUpdateInterestCategory(const QString& id);
+ void slotUpdateInterestVisibility(const QString&);
+ void slotUpdateFeeCategory(const QString& id);
+ void slotUpdateFeeVisibility(const QString&);
+ void slotUpdateTotalAmount(void);
+
+protected:
+ /**
+ * This method creates all necessary widgets for this transaction editor.
+ * All signals will be connected to the relevant slots.
+ */
+ void createEditWidgets(void);
+
+ /**
+ * This method (re-)loads the widgets with the transaction information
+ * contained in @a m_transaction and @a m_split.
+ *
+ * @param action preset the edit wigdets for @a action if no transaction
+ * is present
+ */
+ void loadEditWidgets(KMyMoneyRegister::Action action = KMyMoneyRegister::ActionNone);
+
+ void activityFactory(MyMoneySplit::investTransactionTypeE type);
+
+ MyMoneyMoney subtotal(const QValueList<MyMoneySplit>& splits) const;
+
+ /**
+ * This method creates a transaction to be used for the split fee/interest editor.
+ * It has a reference to a phony account and the splits contained in @a splits .
+ */
+ bool createPseudoTransaction(MyMoneyTransaction& t, const QValueList<MyMoneySplit>& splits);
+
+ /**
+ * Convenience method used by slotEditInterestSplits() and slotEditFeeSplits().
+ *
+ * @param categoryWidgetName name of the category widget
+ * @param amountWidgetName name of the amount widget
+ * @param splits the splits that make up the transaction to be edited
+ * @param isIncome @c false for fees, @c true for interest
+ * @param slotEditSplits name of the slot to be connected to the focusIn signal of the
+ * category widget named @p categoryWidgetName in case of multiple splits
+ * in @p splits .
+ */
+ int editSplits(const QString& categoryWidgetName, const QString& amountWidgetName, QValueList<MyMoneySplit>& splits, bool isIncome, const char* slotEditSplits);
+
+ void updatePriceMode(const MyMoneySplit& split = MyMoneySplit());
+
+ void setupFinalWidgets(void);
+
+private:
+ MyMoneySplit m_assetAccountSplit;
+ QValueList<MyMoneySplit> m_interestSplits;
+ QValueList<MyMoneySplit> m_feeSplits;
+ MyMoneySecurity m_security;
+ MyMoneySecurity m_currency;
+ MyMoneySplit::investTransactionTypeE m_transactionType;
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kaccountselectdlg.cpp b/kmymoney2/dialogs/kaccountselectdlg.cpp
new file mode 100644
index 0000000..0b172f0
--- /dev/null
+++ b/kmymoney2/dialogs/kaccountselectdlg.cpp
@@ -0,0 +1,192 @@
+/***************************************************************************
+ kaccountselectdlg.cpp - description
+ -------------------
+ begin : Mon Feb 10 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kconfig.h>
+#include <kglobal.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+#include <kactivelabel.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kaccountselectdlg.h"
+#include <kmymoney/mymoneyinstitution.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneycategory.h>
+#include "../widgets/kmymoneyaccountselector.h"
+
+#include <../kmymoney2.h>
+
+KAccountSelectDlg::KAccountSelectDlg(const KMyMoneyUtils::categoryTypeE accountType, const QString& purpose, QWidget *parent, const char *name )
+ : KAccountSelectDlgDecl(parent, name),
+ m_purpose(purpose),
+ m_accountType(accountType),
+ m_aborted(false)
+{
+ // Hide the abort button. It needs to be shown on request by the caller
+ // using showAbortButton()
+ m_kButtonAbort->hide();
+
+ slotReloadWidget();
+
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem skipButtonItem( i18n( "&Skip" ),
+ QIconSet(il->loadIcon("redo", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Skip this transaction"),
+ i18n("Use this to skip importing this transaction and proceed with the next one."));
+ m_qbuttonCancel->setGuiItem(skipButtonItem);
+
+ KGuiItem createButtenItem( i18n( "&Create..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new account/category"),
+ i18n("Use this to add a new account/category to the file"));
+ m_createButton->setGuiItem(createButtenItem);
+ m_qbuttonOk->setGuiItem(KStdGuiItem::ok());
+
+ KGuiItem abortButtenItem( i18n("&Abort" ),
+ QIconSet(il->loadIcon("stop", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Abort the import operation and dismiss all changes"),
+ i18n("Use this to abort the import. Your financial data will be in the state before you started the QIF import."));
+ m_kButtonAbort->setGuiItem(abortButtenItem);
+
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotReloadWidget()));
+
+ connect(m_createButton, SIGNAL(clicked()), this, SLOT(slotCreateAccount()));
+ connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(m_qbuttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_kButtonAbort, SIGNAL(clicked()), this, SLOT(abort()));
+}
+
+KAccountSelectDlg::~KAccountSelectDlg()
+{
+}
+
+void KAccountSelectDlg::slotReloadWidget(void)
+{
+ AccountSet set;
+ if(m_accountType & KMyMoneyUtils::asset)
+ set.addAccountGroup(MyMoneyAccount::Asset);
+ if(m_accountType & KMyMoneyUtils::liability)
+ set.addAccountGroup(MyMoneyAccount::Liability);
+ if(m_accountType & KMyMoneyUtils::income)
+ set.addAccountGroup(MyMoneyAccount::Income);
+ if(m_accountType & KMyMoneyUtils::expense)
+ set.addAccountGroup(MyMoneyAccount::Expense);
+ if(m_accountType & KMyMoneyUtils::equity)
+ set.addAccountGroup(MyMoneyAccount::Equity);
+
+ set.load(m_accountSelector->selector());
+}
+
+void KAccountSelectDlg::setDescription(const QString& msg)
+{
+ m_descLabel->setText(msg);
+}
+
+void KAccountSelectDlg::setHeader(const QString& msg)
+{
+ m_headerLabel->setText(msg);
+}
+
+void KAccountSelectDlg::setAccount(const MyMoneyAccount& account, const QString& id)
+{
+ m_account = account;
+ m_accountSelector->setSelectedItem(id);
+}
+
+void KAccountSelectDlg::slotCreateInstitution(void)
+{
+ kmymoney2->slotInstitutionNew();
+}
+
+void KAccountSelectDlg::slotCreateAccount(void)
+{
+ if(!(m_accountType & (KMyMoneyUtils::expense | KMyMoneyUtils::income))) {
+ kmymoney2->slotAccountNew(m_account);
+ if(!m_account.id().isEmpty()) {
+ slotReloadWidget();
+ m_accountSelector->setSelectedItem(m_account.id());
+ accept();
+ }
+ } else {
+ if(m_account.accountType() == MyMoneyAccount::Expense)
+ kmymoney2->createCategory(m_account, MyMoneyFile::instance()->expense());
+ else
+ kmymoney2->createCategory(m_account, MyMoneyFile::instance()->income());
+ if(!m_account.id().isEmpty()) {
+ slotReloadWidget();
+ m_accountSelector->setSelectedItem(m_account.id());
+ accept();
+ }
+ }
+}
+
+void KAccountSelectDlg::abort(void)
+{
+ m_aborted = true;
+ reject();
+}
+
+void KAccountSelectDlg::setMode(const int mode)
+{
+ m_mode = mode ? 1 : 0;
+}
+
+void KAccountSelectDlg::showAbortButton(const bool visible)
+{
+ m_kButtonAbort->setShown(visible);
+}
+
+int KAccountSelectDlg::exec(void)
+{
+ int rc = Rejected;
+
+ if(m_mode == 1) {
+ slotCreateAccount();
+ rc = result();
+ }
+ if(rc != Accepted) {
+ m_createButton->setFocus();
+ rc = KAccountSelectDlgDecl::exec();
+ }
+ return rc;
+}
+
+const QString& KAccountSelectDlg::selectedAccount(void) const
+{
+ return m_accountSelector->selectedItem();
+}
+
+#include "kaccountselectdlg.moc"
diff --git a/kmymoney2/dialogs/kaccountselectdlg.h b/kmymoney2/dialogs/kaccountselectdlg.h
new file mode 100644
index 0000000..271cd0f
--- /dev/null
+++ b/kmymoney2/dialogs/kaccountselectdlg.h
@@ -0,0 +1,155 @@
+/***************************************************************************
+ kaccountselectdlg.h - description
+ -------------------
+ begin : Mon Feb 10 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KACCOUNTSELECTDLG_H
+#define KACCOUNTSELECTDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+#include <qstring.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/kmymoneycombo.h>
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/kmymoneyutils.h>
+#include "../dialogs/kaccountselectdlgdecl.h"
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KAccountSelectDlg : public KAccountSelectDlgDecl
+{
+ Q_OBJECT
+public:
+ KAccountSelectDlg(const KMyMoneyUtils::categoryTypeE type, const QString& purpose = "General", QWidget *parent=0, const char *name=0);
+ ~KAccountSelectDlg();
+
+ /**
+ * This method is used to setup the descriptive text in the account
+ * selection dialog box. The @p msg should contain a descriptive
+ * text about the purpose of the dialog and it's options.
+ *
+ * @param msg const reference to QString object containing the text.
+ */
+ void setDescription(const QString& msg);
+
+ /**
+ * This method is used to setup the buddy text of the account
+ * selection box. the @p msg should contain a short text
+ * which is placed above the selection box with the account
+ * names.
+ *
+ * @param msg const reference to QString object containing the text.
+ */
+ void setHeader(const QString& msg);
+
+ /**
+ * This method is used to pass information to the account selection
+ * dialog which will be used as initial selection in the account
+ * selection combo box and during account creation.
+ *
+ * @param account MyMoneyAccount filled with the relevant and available information
+ * @param id account id to be used.
+ */
+ void setAccount(const MyMoneyAccount& account, const QString& id);
+
+ /**
+ * This method returns the name of the selected account in the combo box.
+ *
+ * @return QString containing the id of the selected account
+ */
+ const QString& selectedAccount(void) const;
+
+ /**
+ * This method is used to set the mode of the dialog. Two modes
+ * are supplied: a) select or create and b) create only.
+ * If @p mode is 0, select or create is selected, otherwise create only
+ * is selected.
+ *
+ * @param mode selected mode
+ */
+ void setMode(const int mode);
+
+ /**
+ * This method allows to control the visibilty of the abort button
+ * in this dialog according to the the parameter @p visible.
+ *
+ * @param visible @p true shows the abort button, @p false hides it.
+ */
+ void showAbortButton(const bool visible);
+
+ /**
+ * This method is used to determine if the user pressed the 'Skip' or
+ * the 'Abort' button. The return value is valid only, if the exec()
+ * function of the dialog returns false.
+ *
+ * @retval false Dialog was left using the 'Skip' button
+ * @retval true Dialog was left using the 'Abort' button
+ */
+ bool aborted(void) const { return m_aborted; };
+
+public slots:
+ /**
+ * Reimplemented from QDialog
+ */
+ int exec();
+
+protected slots:
+ /**
+ * This slot is used to fire up the new account wizard and preset it
+ * with the values found in m_account. If an account was created using
+ * the wizard, this will be the selected account.
+ */
+ void slotCreateAccount(void);
+
+ /**
+ * This slot is used to fire up the new institution dialog
+ */
+ void slotCreateInstitution(void);
+
+ /**
+ * This slot is used to react on the abort button
+ */
+ void abort(void);
+
+ /**
+ * This is the slot which will be called if the engine data is changed.
+ */
+ void slotReloadWidget(void);
+
+private:
+ QString m_purpose;
+ MyMoneyAccount m_account;
+ int m_mode; // 0 - select or create, 1 - create only
+ KMyMoneyUtils::categoryTypeE m_accountType;
+ bool m_aborted;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kaccountselectdlgdecl.ui b/kmymoney2/dialogs/kaccountselectdlgdecl.ui
new file mode 100644
index 0000000..1908339
--- /dev/null
+++ b/kmymoney2/dialogs/kaccountselectdlgdecl.ui
@@ -0,0 +1,215 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAccountSelectDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KAccountSelectDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>651</width>
+ <height>434</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Account selection</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout19</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>m_qifEntry</cstring>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ <property name="wordWrap">
+ <enum>NoWrap</enum>
+ </property>
+ <property name="undoDepth">
+ <number>0</number>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="undoRedoEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>m_createButton</cstring>
+ </property>
+ <property name="text">
+ <string>Create</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_accountSelector</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>110</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KActiveLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_descLabel</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_headerLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Account to import to</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_kButtonAbort</cstring>
+ </property>
+ <property name="text">
+ <string>Abort</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>160</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Skip</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kbackupdlg.cpp b/kmymoney2/dialogs/kbackupdlg.cpp
new file mode 100644
index 0000000..d98aeaf
--- /dev/null
+++ b/kmymoney2/dialogs/kbackupdlg.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ kbackupdialog.cpp - description
+ -------------------
+ begin : Mon Jun 4 2001
+ copyright : (C) 2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@ctv.es>
+ Felix Rodriguez <frodriguez@mail.wesleyan.edu>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qpixmap.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kglobal.h>
+#include <klocale.h>
+#if QT_VERSION > 300
+#include <kstandarddirs.h>
+#else
+#include <kstddirs.h>
+#endif
+
+#include <kconfig.h>
+#include <kdirselectdialog.h>
+#include <kglobalsettings.h>
+#include <kpushbutton.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kbackupdlg.h"
+
+KBackupDlg::KBackupDlg( QWidget* parent, const char* name/*, bool modal*/)
+ : kbackupdlgdecl( parent, name , true)
+{
+ readConfig();
+
+ // add icons to buttons
+ KIconLoader *il = KGlobal::iconLoader();
+ btnOK->setGuiItem(KStdGuiItem::ok());
+ btnCancel->setGuiItem(KStdGuiItem::cancel());
+
+ KGuiItem chooseButtenItem( i18n("C&hoose..."),
+ QIconSet(il->loadIcon("folder", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Select mount point"),
+ i18n("Use this to browse to the mount point."));
+ chooseButton->setGuiItem(chooseButtenItem);
+
+ connect(chooseButton, SIGNAL(clicked()), this, SLOT(chooseButtonClicked()));
+ connect(btnOK,SIGNAL(clicked()),this,SLOT(accept()));
+ connect(btnCancel,SIGNAL(clicked()),this,SLOT(reject()));
+}
+
+KBackupDlg::~KBackupDlg()
+{
+ writeConfig();
+}
+
+void KBackupDlg::chooseButtonClicked()
+{
+ KURL newDir = KDirSelectDialog::selectDirectory(KGlobalSettings::documentPath());
+ if (newDir.hasPath())
+ txtMountPoint->setText(newDir.path());
+}
+
+void KBackupDlg::readConfig(void)
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Last Use Settings");
+ mountCheckBox->setChecked(config->readBoolEntry("KBackupDlg_mountDevice", false));
+ txtMountPoint->setText(config->readEntry("KBackupDlg_BackupMountPoint", "/mnt/floppy"));
+}
+
+void KBackupDlg::writeConfig(void)
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Last Use Settings");
+ config->writeEntry("KBackupDlg_mountDevice", mountCheckBox->isChecked());
+ config->writeEntry("KBackupDlg_BackupMountPoint", txtMountPoint->text());
+ config->sync();
+}
+
+#include "kbackupdlg.moc"
diff --git a/kmymoney2/dialogs/kbackupdlg.h b/kmymoney2/dialogs/kbackupdlg.h
new file mode 100644
index 0000000..b275606
--- /dev/null
+++ b/kmymoney2/dialogs/kbackupdlg.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ kbackupdialog.h - description
+ -------------------
+ begin : Mon Jun 4 2001
+ copyright : (C) 2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@ctv.es>
+ Felix Rodriguez <frodriguez@mail.wesleyan.edu>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KBACKUPDIALOG_H
+#define KBACKUPDIALOG_H
+
+#include <qwidget.h>
+#include "../dialogs/kbackupdlgdecl.h"
+
+/**
+ *@author Michael Edwardes
+ */
+
+class KBackupDlg : public kbackupdlgdecl {
+ Q_OBJECT
+private:
+ void readConfig(void);
+ void writeConfig(void);
+
+protected slots:
+ void chooseButtonClicked();
+
+public:
+ KBackupDlg( QWidget* parent, const char* name/*, bool modal*/);
+ ~KBackupDlg();
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kbackupdlgdecl.ui b/kmymoney2/dialogs/kbackupdlgdecl.ui
new file mode 100644
index 0000000..ff9795f
--- /dev/null
+++ b/kmymoney2/dialogs/kbackupdlgdecl.ui
@@ -0,0 +1,210 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>kbackupdlgdecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kbackupdlgdecl</cstring>
+ </property>
+ <property name="caption">
+ <string>Backup</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Use this dialog to backup your data.
+
+Please make sure you have a disk inserted and that the drive is ready. Then choose the mount point from either the Choose button or by entering the path in the available box.
+
+Click OK to perform the backup. If your system does not use an automounter, make sure you mark the checkbox below to "mount this directory before backing up."</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Device options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout42</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lblMountPoint</cstring>
+ </property>
+ <property name="text">
+ <string>Mount Point:</string>
+ <comment>This is the mount point</comment>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>txtMountPoint</cstring>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>chooseButton</cstring>
+ </property>
+ <property name="text">
+ <string>Choose...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>mountCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Mount this directory before backing up.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>24</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout44</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>455</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnOK</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kbalancechartdlg.cpp b/kmymoney2/dialogs/kbalancechartdlg.cpp
new file mode 100644
index 0000000..05eccf3
--- /dev/null
+++ b/kmymoney2/dialogs/kbalancechartdlg.cpp
@@ -0,0 +1,227 @@
+/***************************************************************************
+ kbalancechartdlg - description
+ -------------------
+ begin : Mon Nov 26 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlayout.h>
+#include <qframe.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kbalancechartdlg.h"
+
+#include <kmymoney/mymoneyreport.h>
+#include "../reports/kreportchartview.h"
+#include "../reports/pivottable.h"
+
+#include <kmymoney/kmymoneyglobalsettings.h>
+
+
+// in KOffice version < 1.5 KDCHART_PROPSET_NORMAL_DATA was a static const
+// but in 1.5 this has been changed into a #define'd value. So we have to
+// make sure, we use the right one.
+#ifndef KDCHART_PROPSET_NORMAL_DATA
+#define KMM_KDCHART_PROPSET_NORMAL_DATA KDChartParams::KDCHART_PROPSET_NORMAL_DATA
+#else
+#define KMM_KDCHART_PROPSET_NORMAL_DATA KDCHART_PROPSET_NORMAL_DATA
+#endif
+
+KBalanceChartDlg::KBalanceChartDlg(const MyMoneyAccount& account, QWidget* parent, const char* name) :
+ KDialog(parent, name)
+{
+#ifdef HAVE_KDCHART
+ setCaption(i18n("Balance of %1").arg(account.name()));
+ setSizeGripEnabled( TRUE );
+ setModal( TRUE );
+
+ QVBoxLayout* KBalanceChartDlgLayout = new QVBoxLayout( this, 11, 6, "KBalanceChartDlgLayout");
+
+ MyMoneyReport reportCfg = MyMoneyReport(
+ MyMoneyReport::eAssetLiability,
+ MyMoneyReport::eMonths,
+ MyMoneyTransactionFilter::userDefined, // overridden by the setDateFilter() call below
+ MyMoneyReport::eDetailTotal,
+ i18n("%1 Balance History").arg(account.name()),
+ i18n("Generated Report")
+ );
+ reportCfg.setChartByDefault(true);
+ reportCfg.setChartGridLines(false);
+ reportCfg.setChartDataLabels(false);
+ reportCfg.setChartType(MyMoneyReport::eChartLine);
+ reportCfg.setIncludingSchedules( true );
+ if(account.accountType() == MyMoneyAccount::Investment) {
+ QStringList::const_iterator it_a;
+ for(it_a = account.accountList().begin(); it_a != account.accountList().end(); ++it_a)
+ reportCfg.addAccount(*it_a);
+ } else
+ reportCfg.addAccount(account.id());
+ reportCfg.setColumnsAreDays( true );
+ reportCfg.setConvertCurrency( false );
+ reportCfg.setDateFilter(QDate::currentDate().addDays(-90),QDate::currentDate().addDays(+90));
+
+ reports::PivotTable table(reportCfg);
+
+ reports::KReportChartView* chartWidget = new reports::KReportChartView(this, 0);
+
+ table.drawChart(*chartWidget);
+
+ chartWidget->params()->setLineMarker(false);
+ chartWidget->params()->setLegendPosition(KDChartParams::NoLegend);
+ chartWidget->params()->setLineWidth(2);
+ chartWidget->params()->setDataColor(0, KGlobalSettings::textColor());
+
+ // draw future values in a different line style
+ KDChartPropertySet propSetFutureValue("future value", KMM_KDCHART_PROPSET_NORMAL_DATA);
+ propSetFutureValue.setLineStyle(KDChartPropertySet::OwnID, Qt::DotLine);
+ int m_idPropFutureValue = chartWidget->params()->registerProperties(propSetFutureValue);
+
+ KDChartPropertySet propSetLastValue("last value", m_idPropFutureValue);
+ propSetLastValue.setExtraLinesAlign(KDChartPropertySet::OwnID, Qt::AlignLeft | Qt::AlignBottom);
+ propSetLastValue.setExtraLinesWidth(KDChartPropertySet::OwnID, -4);
+ propSetLastValue.setExtraLinesColor(KDChartPropertySet::OwnID, KMyMoneyGlobalSettings::listGridColor());
+
+ int m_idPropLastValue = chartWidget->params()->registerProperties(propSetLastValue);
+
+ KDChartPropertySet propSetMinBalance("min balance", m_idPropFutureValue);
+ propSetMinBalance.setLineStyle(KDChartPropertySet::OwnID, Qt::NoPen);
+ propSetMinBalance.setExtraLinesAlign(KDChartPropertySet::OwnID, Qt::AlignLeft | Qt::AlignRight);
+ int m_idPropMinBalance = chartWidget->params()->registerProperties(propSetMinBalance);
+
+ KDChartPropertySet propSetMaxCredit("max credit", m_idPropMinBalance);
+ propSetMaxCredit.setExtraLinesColor(KDChartPropertySet::OwnID, KMyMoneyGlobalSettings::listNegativeValueColor());
+ propSetMaxCredit.setExtraLinesStyle(KDChartPropertySet::OwnID, Qt::DotLine);
+ int m_idPropMaxCredit = chartWidget->params()->registerProperties(propSetMaxCredit);
+
+ KBalanceChartDlgLayout->addWidget(chartWidget, 10);
+
+
+ // add another row for markers if required or remove it if not necessary
+ // see http://www.klaralvdalens-datakonsult.se/kdchart/ProgrammersManual/KDChart.pdf
+ // Chapter 6, "Adding separate Lines/Markers".
+
+ bool needRow = false;
+ bool haveMinBalance = false;
+ bool haveMaxCredit = false;
+ MyMoneyMoney minBalance, maxCredit;
+ MyMoneyMoney factor(1,1);
+ if(account.accountGroup() == MyMoneyAccount::Asset)
+ factor = -factor;
+
+ if(account.value("maxCreditEarly").length() > 0) {
+ needRow = true;
+ haveMaxCredit = true;
+ maxCredit = MyMoneyMoney(account.value("maxCreditEarly")) * factor;
+ }
+ if(account.value("maxCreditAbsolute").length() > 0) {
+ needRow = true;
+ haveMaxCredit = true;
+ maxCredit = MyMoneyMoney(account.value("maxCreditAbsolute")) * factor;
+ }
+
+ if(account.value("minBalanceEarly").length() > 0) {
+ needRow = true;
+ haveMinBalance = true;
+ minBalance = MyMoneyMoney(account.value("minBalanceEarly"));
+ }
+ if(account.value("minBalanceAbsolute").length() > 0) {
+ needRow = true;
+ haveMinBalance = true;
+ minBalance = MyMoneyMoney(account.value("minBalanceAbsolute"));
+ }
+
+ KDChartTableDataBase* data = chartWidget->data();
+ if(!needRow && data->usedRows() == 2) {
+ data->expand( data->usedRows()-1, data->usedCols() );
+ } else if(needRow && data->usedRows() == 1) {
+ data->expand( data->usedRows()+1, data->usedCols() );
+ }
+
+ if(needRow) {
+ if(haveMinBalance) {
+ data->setCell(1, 0, minBalance.toDouble());
+ chartWidget->setProperty(1, 0, m_idPropMinBalance);
+ }
+ if(haveMaxCredit) {
+ data->setCell(1, 1, maxCredit.toDouble());
+ chartWidget->setProperty(1, 1, m_idPropMaxCredit);
+ }
+ }
+
+ for(int iCell = 90; iCell < 180; ++iCell) {
+ chartWidget->setProperty(0, iCell, m_idPropFutureValue);
+ }
+ chartWidget->setProperty(0, 90, m_idPropLastValue);
+
+
+
+ QFrame* line1 = new QFrame( this, "line1" );
+ line1->setFrameShape( QFrame::HLine );
+ line1->setFrameShadow( QFrame::Sunken );
+ line1->setFrameShape( QFrame::HLine );
+
+ KBalanceChartDlgLayout->addWidget(line1);
+ QHBoxLayout* Layout1 = new QHBoxLayout( KBalanceChartDlgLayout, 6, "Layout1");
+#if 0
+ KPushButton* buttonHelp = new KPushButton( this, "buttonHelp" );
+ buttonHelp->setAutoDefault( TRUE );
+ buttonHelp->setText(i18n("&Help"));
+ Layout1->addWidget( buttonHelp );
+#endif
+
+ QSpacerItem* Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout1->addItem( Horizontal_Spacing2 );
+
+#if 0
+ KPushButton* buttonOk = new KPushButton( this, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ buttonOk->setText(i18n("&OK"));
+ Layout1->addWidget( buttonOk );
+#endif
+ KPushButton* buttonClose = new KPushButton( this, "buttonClose" );
+ buttonClose->setEnabled( TRUE );
+ buttonClose->setAutoDefault( TRUE );
+ buttonClose->setGuiItem(KStdGuiItem::Close);
+ Layout1->addWidget( buttonClose );
+
+ // connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonClose, SIGNAL( clicked() ), this, SLOT( accept() ) );
+
+ resize( QSize(700, 500).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+#endif
+}
+
+
+KBalanceChartDlg::~KBalanceChartDlg()
+{
+}
+
+#include "kbalancechartdlg.moc"
+
diff --git a/kmymoney2/dialogs/kbalancechartdlg.h b/kmymoney2/dialogs/kbalancechartdlg.h
new file mode 100644
index 0000000..8fe2502
--- /dev/null
+++ b/kmymoney2/dialogs/kbalancechartdlg.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ kbalancechartdlg - description
+ -------------------
+ begin : Mon Nov 26 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KBALANCECHARTDLG_H
+#define KBALANCECHARTDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdialog.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class MyMoneyAccount;
+
+/**
+ * @author Thomas Baumgart <ipwizard@users.sourceforge.net>
+ */
+class KBalanceChartDlg : public KDialog
+{
+ Q_OBJECT
+ public:
+ KBalanceChartDlg(const MyMoneyAccount& account, QWidget* parent = 0, const char* name = 0);
+ ~KBalanceChartDlg();
+
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kbalancewarning.cpp b/kmymoney2/dialogs/kbalancewarning.cpp
new file mode 100644
index 0000000..16f3dc0
--- /dev/null
+++ b/kmymoney2/dialogs/kbalancewarning.cpp
@@ -0,0 +1,67 @@
+/***************************************************************************
+ kbalancewarning.cpp
+ -------------------
+ begin : Mon Feb 9 2009
+ copyright : (C) 2009 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+#include <qstring.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "mymoneyaccount.h"
+#include "kbalancewarning.h"
+
+class KBalanceWarning::Private
+{
+public:
+ QString dontShowAgain() const { return "BalanceWarning"; }
+ QMap<QString, bool> m_deselectedAccounts;
+};
+
+KBalanceWarning::KBalanceWarning(QObject* parent, const char* name) :
+ QObject(parent, name),
+ d(new Private)
+{
+ KMessageBox::enableMessage(d->dontShowAgain());
+}
+
+KBalanceWarning::~KBalanceWarning()
+{
+ delete d;
+}
+
+void KBalanceWarning::slotShowMessage(QWidget* parent, const MyMoneyAccount& account, const QString& msg)
+{
+ if(d->m_deselectedAccounts.find(account.id()) == d->m_deselectedAccounts.end()) {
+ KMessageBox::information(parent, msg, QString::null, d->dontShowAgain());
+ if(!KMessageBox::shouldBeShownContinue(d->dontShowAgain())) {
+ d->m_deselectedAccounts[account.id()] = true;
+ KMessageBox::enableMessage(d->dontShowAgain());
+ }
+ }
+}
+
+
+#include "kbalancewarning.moc"
diff --git a/kmymoney2/dialogs/kbalancewarning.h b/kmymoney2/dialogs/kbalancewarning.h
new file mode 100644
index 0000000..2e3c4d4
--- /dev/null
+++ b/kmymoney2/dialogs/kbalancewarning.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ kbalancewarning.h
+ -------------------
+ begin : Mon Feb 9 2009
+ copyright : (C) 2009 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KBALANCEWARNING_H
+#define KBALANCEWARNING_H
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qobject.h>
+class QString;
+class QWidget;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class MyMoneyAccount;
+
+class KBalanceWarning : public QObject
+{
+ Q_OBJECT
+public:
+ KBalanceWarning(QObject* parent, const char* name = 0);
+ virtual ~KBalanceWarning();
+
+public slots:
+ void slotShowMessage(QWidget* parent, const MyMoneyAccount& account, const QString& msg);
+
+private:
+ class Private;
+ Private* d;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kcategoryreassigndlg.cpp b/kmymoney2/dialogs/kcategoryreassigndlg.cpp
new file mode 100644
index 0000000..f457134
--- /dev/null
+++ b/kmymoney2/dialogs/kcategoryreassigndlg.cpp
@@ -0,0 +1,106 @@
+/***************************************************************************
+ kcategoryreassigndlg.cpp
+ -------------------
+ copyright : (C) 2007 by Thomas Baumgart
+ author : Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kcategoryreassigndlg.h"
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kguiutils.h>
+
+KCategoryReassignDlg::KCategoryReassignDlg( QWidget* parent, const char* name) :
+ KCategoryReassignDlgDecl( parent, name)
+{
+ buttonOk->setGuiItem(KStdGuiItem::ok());
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+ kMandatoryFieldGroup* mandatory = new kMandatoryFieldGroup(this);
+ mandatory->add(m_category);
+ mandatory->setOkButton(buttonOk);
+}
+
+KCategoryReassignDlg::~KCategoryReassignDlg()
+{
+}
+
+QString KCategoryReassignDlg::show(const MyMoneyAccount& category)
+{
+ if (category.id().isEmpty())
+ return QString(); // no payee available? nothing can be selected...
+
+ AccountSet set;
+ set.addAccountGroup(MyMoneyAccount::Income);
+ set.addAccountGroup(MyMoneyAccount::Expense);
+ set.load(m_category->selector());
+
+ // remove the category we are about to delete
+ m_category->selector()->removeItem(category.id());
+
+ // make sure the available categories have the same currency
+ QStringList list;
+ QStringList::const_iterator it_a;
+ m_category->selector()->itemList(list);
+ for(it_a = list.begin(); it_a != list.end(); ++it_a) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(*it_a);
+ if(acc.currencyId() != category.currencyId())
+ m_category->selector()->removeItem(*it_a);
+ }
+
+ // reload the list
+ m_category->selector()->itemList(list);
+
+ // if there is no category for reassignment left, we bail out
+ if(list.isEmpty()) {
+ KMessageBox::sorry(this, QString("<qt>")+i18n("At least one transaction/schedule still references the category <b>%1</b>. However, at least one category with the same currency must exist so that the transactions/schedules can be reassigned.").arg(category.name())+QString("</qt>"));
+ return QString();
+ }
+
+ // execute dialog and if aborted, return empty string
+ if (this->exec() == QDialog::Rejected)
+ return QString();
+
+ // otherwise return index of selected payee
+ return m_category->selectedItem();
+}
+
+
+void KCategoryReassignDlg::accept(void)
+{
+ // force update of payeeCombo
+ buttonOk->setFocus();
+
+ if(m_category->selectedItem().isEmpty()) {
+ KMessageBox::information(this, i18n("This dialog does not allow to create new categories. Please pick a category from the list."), i18n("Category creation"));
+ } else {
+ KCategoryReassignDlgDecl::accept();
+ }
+}
+
+#include "kcategoryreassigndlg.moc"
diff --git a/kmymoney2/dialogs/kcategoryreassigndlg.h b/kmymoney2/dialogs/kcategoryreassigndlg.h
new file mode 100644
index 0000000..ce756ee
--- /dev/null
+++ b/kmymoney2/dialogs/kcategoryreassigndlg.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ kcategoryreassigndlg.cpp
+ -------------------
+ copyright : (C) 2007 by Thomas Baumgart
+ author : Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KCATEGORYREASSIGNDLG_H
+#define KCATEGORYREASSIGNDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qvaluelist.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyaccount.h>
+#include "kmymoney2/dialogs/kcategoryreassigndlgdecl.h"
+
+/**
+ * Implementation of the dialog that lets the user select a payee in order
+ * to re-assign transactions (for instance, if payees are deleted).
+ */
+class KCategoryReassignDlg : public KCategoryReassignDlgDecl
+{
+ Q_OBJECT
+public:
+ /** Default constructor */
+ KCategoryReassignDlg( QWidget* parent = 0, const char* name = 0);
+
+ /** Destructor */
+ ~KCategoryReassignDlg();
+
+ /**
+ * This function sets up the dialog, lets the user select a category and returns
+ * the id of the selected category in the list of all known income and expense accounts.
+ *
+ * @param category reference to MyMoneyAccount object of the category to be deleted
+ *
+ * @return Returns the id of the selected category in the list or QString() if
+ * the dialog was aborted. QString() is also returned if the @a category
+ * does not have an id.
+ */
+ QString show(const MyMoneyAccount& category);
+
+protected:
+ void accept(void);
+
+};
+
+#endif // KCATEGORYREASSIGNDLG_H
diff --git a/kmymoney2/dialogs/kcategoryreassigndlgdecl.ui b/kmymoney2/dialogs/kcategoryreassigndlgdecl.ui
new file mode 100644
index 0000000..5b9a954
--- /dev/null
+++ b/kmymoney2/dialogs/kcategoryreassigndlgdecl.ui
@@ -0,0 +1,175 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KCategoryReassignDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KCategoryeReassignDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>308</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Reassign categories</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>The transactions, schedules and budgets associated with the selected category need to be re-assigned to a different category before the selected category can be deleted. Please select a category from the list below.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignJustify|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Available categories:</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory">
+ <property name="name">
+ <cstring>m_category</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>305</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KCategoryeReassignDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KCategoryeReassignDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kchooseimportexportdlg.cpp b/kmymoney2/dialogs/kchooseimportexportdlg.cpp
new file mode 100644
index 0000000..0c390a8
--- /dev/null
+++ b/kmymoney2/dialogs/kchooseimportexportdlg.cpp
@@ -0,0 +1,108 @@
+/***************************************************************************
+ kchooseimportexportdlg.cpp - description
+ -------------------
+ begin : Thu Jul 12 2001
+ copyright : (C) 2000-2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include <kglobal.h>
+#include <klocale.h>
+#if QT_VERSION > 300
+#include <kstandarddirs.h>
+#else
+#include <kstddirs.h>
+#endif
+
+#include <qpixmap.h>
+
+#include <qlabel.h>
+#include <qcombobox.h>
+#include <qpushbutton.h>
+
+#include <kglobal.h>
+#include <kconfig.h>
+#include <klocale.h>
+
+#include "kchooseimportexportdlg.h"
+
+KChooseImportExportDlg::KChooseImportExportDlg(int type, QWidget *parent, const char *name )
+ : KChooseImportExportDlgDecl(parent,name, true)
+{
+ QString filename;
+
+ if (type==0) { // import
+ topLabel->setText(i18n("Please choose the type of import you wish to perform. A simple explanation\n"
+ "of the import type is available at the bottom of the screen and is updated when\n"
+ "you select an item from the choice box."
+ "\n\nOnce you have chosen an import type please press the OK button." ));
+ promptLabel->setText(i18n("Choose import type:"));
+ setCaption(i18n("Choose Import Type Dialog"));
+ } else { // export
+ topLabel->setText(i18n("Please choose the type of export you wish to perform. A simple explanation\n"
+ "of the export type is available at the bottom of the screen and is updated when\n"
+ "you select an item from the choice box."
+ "\n\nOnce you have chosen an export type please press the OK button." ));
+ promptLabel->setText(i18n("Choose export type:"));
+ setCaption(i18n("Choose Export Type Dialog"));
+ }
+
+ readConfig();
+ slotTypeActivated(m_lastType);
+ typeCombo->setCurrentItem(((m_lastType=="QIF") ? 0 : 1));
+
+ connect(typeCombo, SIGNAL(activated(const QString&)), this, SLOT(slotTypeActivated(const QString&)));
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+KChooseImportExportDlg::~KChooseImportExportDlg()
+{
+ writeConfig();
+}
+
+void KChooseImportExportDlg::slotTypeActivated(const QString& text)
+{
+ if (text=="QIF") {
+ descriptionLabel->setText(i18n("QIF files are created by the popular accounting program Quicken.\n"
+ "Another dialog will appear, if you choose this type, asking for further\n"
+ "information relevant to the Quicken format."));
+ } else {
+ descriptionLabel->setText(i18n("The CSV type uses a comma delimeted text file that can be used by\n"
+ "most popular spreadsheet programs available for Linux and other operating\n"
+ "systems."));
+ }
+}
+
+QString KChooseImportExportDlg::importExportType(void)
+{
+ return typeCombo->currentText();
+}
+
+void KChooseImportExportDlg::readConfig(void)
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Last Use Settings");
+ m_lastType = config->readEntry("KChooseImportExportDlg_LastType");
+}
+
+void KChooseImportExportDlg::writeConfig(void)
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Last Use Settings");
+ config->writeEntry("KChooseImportExportDlg_LastType", typeCombo->currentText());
+ config->sync();
+}
+
+#include "kchooseimportexportdlg.moc"
diff --git a/kmymoney2/dialogs/kchooseimportexportdlg.h b/kmymoney2/dialogs/kchooseimportexportdlg.h
new file mode 100644
index 0000000..ac562f3
--- /dev/null
+++ b/kmymoney2/dialogs/kchooseimportexportdlg.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ kchooseimportexportdlg.h - description
+ -------------------
+ begin : Thu Jul 12 2001
+ copyright : (C) 2000-2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KCHOOSEIMPORTEXPORTDLG_H
+#define KCHOOSEIMPORTEXPORTDLG_H
+
+#include <qwidget.h>
+#include "../dialogs/kchooseimportexportdlgdecl.h"
+
+/**
+ *@author Michael Edwardes
+ */
+
+class KChooseImportExportDlg : public KChooseImportExportDlgDecl {
+ Q_OBJECT
+private:
+ void readConfig(void);
+ void writeConfig(void);
+ QString m_lastType;
+
+protected slots:
+ void slotTypeActivated(const QString& text);
+
+public:
+ KChooseImportExportDlg(int type, QWidget *parent=0, const char *name=0);
+ ~KChooseImportExportDlg();
+ QString importExportType(void);
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kchooseimportexportdlgdecl.ui b/kmymoney2/dialogs/kchooseimportexportdlgdecl.ui
new file mode 100644
index 0000000..3d12a14
--- /dev/null
+++ b/kmymoney2/dialogs/kchooseimportexportdlgdecl.ui
@@ -0,0 +1,235 @@
+<!DOCTYPE UI><UI>
+<class>KChooseImportExportDlgDecl</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>kChooseImportDlgDecl</cstring>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Choose Import Type Dialog</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>topLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Please choose the type of import you wish to perform. A simple explanation
+of the import type is available at the bottom of the screen and is updated when
+you select an item from the choice box.
+
+Once you have chosen an import type please press the OK button.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>Line</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Line1</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>Raised</enum>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>promptLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Choose import type:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>QIF</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>CSV</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>typeCombo</cstring>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>descriptionLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>410</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Some descripton</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>okButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>OK</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cancelButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+</UI>
diff --git a/kmymoney2/dialogs/kconfirmmanualenterdlg.cpp b/kmymoney2/dialogs/kconfirmmanualenterdlg.cpp
new file mode 100644
index 0000000..3c20a48
--- /dev/null
+++ b/kmymoney2/dialogs/kconfirmmanualenterdlg.cpp
@@ -0,0 +1,202 @@
+/***************************************************************************
+ kconfirmmanualenterdlg.cpp
+ -------------------
+ begin : Mon Apr 9 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qradiobutton.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <ktextedit.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneyutils.h>
+#include "kconfirmmanualenterdlg.h"
+
+KConfirmManualEnterDlg::KConfirmManualEnterDlg(const MyMoneySchedule& schedule, QWidget* parent, const char* name) :
+ KConfirmManualEnterDlgDecl(parent, name)
+{
+ buttonOk->setGuiItem(KStdGuiItem::ok());
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+ m_onceRadio->setChecked(true);
+ m_onceRadio->setFocus();
+
+ if(schedule.type() == MyMoneySchedule::TYPE_LOANPAYMENT) {
+ m_setRadio->setEnabled(false);
+ m_discardRadio->setEnabled(false);
+ }
+
+}
+
+void KConfirmManualEnterDlg::loadTransactions(const MyMoneyTransaction& to, const MyMoneyTransaction& tn)
+{
+ QString messageDetail("<qt>");
+ MyMoneyFile* file = MyMoneyFile::instance();
+ int noItemsChanged=0;
+
+#if 0
+ // if no schedule is present, we cannot enter it
+ if(m_schedule.id().isEmpty())
+ return false;
+
+ if (m_fromAccountId == m_toAccountId)
+ {
+ KMessageBox::error(this, i18n("Account and transfer account are the same. Please change one."));
+ m_from->setFocus();
+ return false;
+ }
+
+ if (!checkDateInPeriod(m_date->date()))
+ return false;
+#endif
+
+ try
+ {
+ QString po, pn;
+ if(to.splits()[0].payeeId())
+ po = file->payee(to.splits()[0].payeeId()).name();
+ if(tn.splits()[0].payeeId())
+ pn = file->payee(tn.splits()[0].payeeId()).name();
+
+ if (po != pn) {
+ noItemsChanged++;
+ messageDetail += i18n("Payee changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>").arg(po).arg(pn);
+ }
+#if 0
+ if ( (m_schedule.type() == MyMoneySchedule::TYPE_TRANSFER ||
+ m_schedule.type() == MyMoneySchedule::TYPE_BILL) &&
+ m_from->currentText() != m_schedule.account().name())
+ {
+ noItemsChanged++;
+ messageDetail += i18n("Account changed. Old: \"%1\", New: \"%2\"")
+ .arg(m_schedule.account().name()).arg(m_from->currentText()) + QString("\n");
+ }
+
+ if ( m_schedule.type() == MyMoneySchedule::TYPE_DEPOSIT &&
+ m_to->currentText() != m_schedule.account().name())
+ {
+ noItemsChanged++;
+ messageDetail += i18n("Account changed. Old: \"%1\", New: \"%2\"")
+ .arg(m_schedule.account().name()).arg(m_to->currentText()) + QString("\n");
+ }
+#endif
+
+ if(to.splits()[0].accountId() != tn.splits()[0].accountId()) {
+ noItemsChanged++;
+ messageDetail += i18n("Account changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>")
+ .arg(file->account(to.splits()[0].accountId()).name())
+ .arg(file->account(tn.splits()[0].accountId()).name());
+ }
+
+ if(file->isTransfer(to) && file->isTransfer(tn)) {
+ if(to.splits()[1].accountId() != tn.splits()[1].accountId()) {
+ noItemsChanged++;
+ messageDetail += i18n("Transfer account changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>")
+ .arg(file->account(to.splits()[1].accountId()).name())
+ .arg(file->account(tn.splits()[1].accountId()).name());
+ }
+ } else {
+ QString co, cn;
+ switch(to.splitCount()) {
+ default:
+ co = i18n("Split transaction (category replacement)", "Split transaction");
+ break;
+ case 2:
+ co = file->accountToCategory(to.splits()[1].accountId());
+ case 1:
+ break;
+ }
+
+ switch(tn.splitCount()) {
+ default:
+ cn = i18n("Split transaction (category replacement)", "Split transaction");
+ break;
+ case 2:
+ cn = file->accountToCategory(tn.splits()[1].accountId());
+ case 1:
+ break;
+ }
+ if (co != cn)
+ {
+ noItemsChanged++;
+ messageDetail += i18n("Category changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>").arg(co).arg(cn);
+ }
+ }
+
+ QString mo, mn;
+ mo = to.splits()[0].memo();
+ mn = tn.splits()[0].memo();
+ if(mo.isEmpty())
+ mo = QString("<i>")+i18n("empty")+QString("</i>");
+ if(mn.isEmpty())
+ mn = QString("<i>")+i18n("empty")+QString("</i>");
+ if (mo != mn)
+ {
+ noItemsChanged++;
+ messageDetail += i18n("Memo changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>").arg(mo).arg(mn);
+ }
+
+ const MyMoneySecurity& sec = MyMoneyFile::instance()->security(to.commodity());
+ MyMoneyMoney ao, an;
+ ao = to.splits()[0].value();
+ an = tn.splits()[0].value();
+ if (ao != an) {
+ noItemsChanged++;
+ messageDetail += i18n("Amount changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>")
+ .arg(ao.formatMoney(sec.smallestAccountFraction())).arg(an.formatMoney(sec.smallestAccountFraction()));
+ }
+
+ MyMoneySplit::reconcileFlagE fo, fn;
+ fo = to.splits()[0].reconcileFlag();
+ fn = tn.splits()[0].reconcileFlag();
+ if(fo != fn) {
+ noItemsChanged++;
+ messageDetail += i18n("Reconciliation flag changed.<br>&nbsp;&nbsp;&nbsp;Old: <b>%1</b>, New: <b>%2</b><p>")
+ .arg(KMyMoneyUtils::reconcileStateToString(fo, true))
+ .arg(KMyMoneyUtils::reconcileStateToString(fn, true));
+ }
+ }
+ catch (MyMoneyException *e)
+ {
+ KMessageBox::error(this, i18n("Fatal error in determining data: ") + e->what());
+ delete e;
+ }
+
+ messageDetail += "</qt>";
+ m_details->setText(messageDetail);
+ return;
+}
+
+KConfirmManualEnterDlg::Action KConfirmManualEnterDlg::action(void) const
+{
+ if(m_discardRadio->isChecked())
+ return UseOriginal;
+ if(m_setRadio->isChecked())
+ return ModifyAlways;
+ return ModifyOnce;
+}
+
+#include "kconfirmmanualenterdlg.moc"
diff --git a/kmymoney2/dialogs/kconfirmmanualenterdlg.h b/kmymoney2/dialogs/kconfirmmanualenterdlg.h
new file mode 100644
index 0000000..43ff65a
--- /dev/null
+++ b/kmymoney2/dialogs/kconfirmmanualenterdlg.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ kconfirmmanualenterdlg.h
+ -------------------
+ begin : Mon Apr 9 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KCONFIRMMANUALENTERDLG_H
+#define KCONFIRMMANUALENTERDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneytransaction.h>
+#include "../dialogs/kconfirmmanualenterdlgdecl.h"
+
+class KConfirmManualEnterDlg : public KConfirmManualEnterDlgDecl
+{
+ Q_OBJECT
+public:
+ KConfirmManualEnterDlg(const MyMoneySchedule& schedule, QWidget* parent = 0, const char* name = 0);
+
+ typedef enum {
+ UseOriginal = 0,
+ ModifyOnce,
+ ModifyAlways
+ } Action;
+
+ /**
+ * setup the dialog for the difference between the original transaction
+ * @a to and the transaction to be entered @a tn.
+ */
+ void loadTransactions(const MyMoneyTransaction& to, const MyMoneyTransaction& tn);
+
+ /**
+ * Returns information about what to do with the transaction
+ */
+ Action action(void) const;
+};
+
+#endif // KCONFIRMMANUALENTERDLG_H
diff --git a/kmymoney2/dialogs/kconfirmmanualenterdlgdecl.ui b/kmymoney2/dialogs/kconfirmmanualenterdlgdecl.ui
new file mode 100644
index 0000000..f88f0ce
--- /dev/null
+++ b/kmymoney2/dialogs/kconfirmmanualenterdlgdecl.ui
@@ -0,0 +1,160 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KConfirmManualEnterDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KConfirmManualEnterDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>578</width>
+ <height>384</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Confirm Manual Enter</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_message</cstring>
+ </property>
+ <property name="text">
+ <string>The following changes have been made to the transaction data:</string>
+ </property>
+ <property name="textFormat">
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>m_details</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="title">
+ <string>Please choose what you wish to do with the above changes</string>
+ </property>
+ <property name="selectedId" stdset="0">
+ <number>1</number>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_discardRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Discard the changes and enter the original transaction into the register.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_onceRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Enter these new values this one time, for this occurence only.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_setRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Set all further occurences in this schedule to be these values.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>180</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KConfirmManualEnterDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KConfirmManualEnterDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kcsvprogressdlg.cpp b/kmymoney2/dialogs/kcsvprogressdlg.cpp
new file mode 100644
index 0000000..d8f85ed
--- /dev/null
+++ b/kmymoney2/dialogs/kcsvprogressdlg.cpp
@@ -0,0 +1,252 @@
+/***************************************************************************
+ kcsvprogressdlg.cpp - description
+ -------------------
+ begin : Sun Jul 29 2001
+ copyright : (C) 2000-2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include <kglobal.h>
+#include <klocale.h>
+#if QT_VERSION > 300
+#include <kstandarddirs.h>
+#else
+#include <kstddirs.h>
+#endif
+
+#include <qpixmap.h>
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qprogressbar.h>
+#include <qlineedit.h>
+#include <qgroupbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <kfiledialog.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kconfig.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "kcsvprogressdlg.h"
+#include "../widgets/kmymoneydateinput.h"
+#include "../kmymoneyutils.h"
+
+/** Simple constructor */
+KCsvProgressDlg::KCsvProgressDlg(int type, MyMoneyAccount *account, QWidget *parent, const char *name )
+ : KCsvProgressDlgDecl(parent,name, true)
+{
+ m_nType = type;
+ if (m_nType==0)
+ {
+ m_kmymoneydateEnd->setEnabled(false);
+ m_kmymoneydateStart->setEnabled(false);
+ m_qbuttonRun->setText(i18n("&Import"));
+ }
+ else
+ m_qbuttonRun->setText(i18n("&Export"));
+
+ m_mymoneyaccount = account;
+
+ m_qbuttonOk->setText(i18n("C&lose"));
+
+ readConfig();
+
+ connect(m_qbuttonBrowse, SIGNAL(clicked()), this, SLOT(slotBrowseClicked()));
+ connect(m_qbuttonRun, SIGNAL(clicked()), this, SLOT(slotRunClicked()));
+ connect(m_qlineeditFile, SIGNAL(textChanged(const QString&)), this,
+ SLOT(slotFileTextChanged(const QString&)));
+ connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+}
+
+/** Simple destructor */
+KCsvProgressDlg::~KCsvProgressDlg()
+{
+ writeConfig();
+}
+
+/** Perform the export process */
+void KCsvProgressDlg::performExport(void)
+{
+/*
+ // Do some validation on the inputs.
+ if (m_qlineeditFile->text().isEmpty()) {
+ KMessageBox::information(this, i18n("Please enter the path to the CSV file"), i18n("Export CSV"));
+ m_qlineeditFile->setFocus();
+ return;
+ }
+
+ QString strFile = m_qlineeditFile->text();
+ if(KMyMoneyUtils::appendCorrectFileExt(strFile, QString("csv")))
+ m_qlineeditFile->setText(strFile);
+
+ if (m_kmymoneydateEnd->getQDate() < m_kmymoneydateStart->getQDate()) {
+ KMessageBox::information(this, i18n("Please enter a start date lower than the end date."));
+ return;
+ }
+
+ QFile qfile(m_qlineeditFile->text());
+ if (!qfile.open(IO_WriteOnly)) {
+ KMessageBox::error(this, i18n("Unable to open export file for writing."));
+ return;
+ }
+ qfile.close();
+
+ m_qlabelAccount->setText(m_mymoneyaccount->name());
+ m_qlabelTransaction->setText(QString("0") + i18n(" of ") + QString::number(m_mymoneyaccount->transactionCount()));
+ m_qprogressbar->setTotalSteps(m_mymoneyaccount->transactionCount());
+
+ // Make sure we have an account to operate on
+ if (m_mymoneyaccount) {
+ // Connect to the provided signals in MyMoneyAccount
+ // These signals will be emitted at appropriate times.
+ connect(m_mymoneyaccount, SIGNAL(signalProgressCount(int)), m_qprogressbar, SLOT(setTotalSteps(int)));
+ connect(m_mymoneyaccount, SIGNAL(signalProgress(int)), this, SLOT(slotSetProgress(int)));
+
+ int nTransCount = 0;
+
+ // Do the actual write
+ if (!m_mymoneyaccount->writeCSVFile(m_qlineeditFile->text(), m_kmymoneydateStart->getQDate(),
+ m_kmymoneydateEnd->getQDate(), nTransCount)) {
+ KMessageBox::error(this, i18n("Error occurred whilst exporting to csv file."), i18n("Export CSV"));
+ }
+ else {
+ QString qstringPrompt = i18n("Export finished successfully.\n\n");
+ qstringPrompt += i18n("Number of transactions exported ");
+ qstringPrompt += QString::number(nTransCount);
+ qstringPrompt += ".";
+ KMessageBox::information(this, qstringPrompt, i18n("Export CSV"));
+ }
+ }
+*/
+}
+
+/** perform the import process */
+void KCsvProgressDlg::performImport(void)
+{
+/*
+ // Do some validation on the inputs.
+ if (m_qlineeditFile->text().isEmpty()) {
+ KMessageBox::information(this, i18n("Please enter the path to the CSV file"), i18n("Import CSV"));
+ m_qlineeditFile->setFocus();
+ return;
+ }
+
+ QFile qfile(m_qlineeditFile->text());
+ if (!qfile.open(IO_ReadOnly)) {
+ KMessageBox::error(this, i18n("Unable to open import file for reading."));
+ return;
+ }
+ qfile.close();
+
+ m_qlabelAccount->setText(m_mymoneyaccount->name());
+
+ // Make sure we have an account to operate on
+ if (m_mymoneyaccount) {
+ // Connect to the provided signals in MyMoneyAccount
+ // These signals will be emitted at appropriate times.
+ connect(m_mymoneyaccount, SIGNAL(signalProgressCount(int)), m_qprogressbar, SLOT(setTotalSteps(int)));
+ connect(m_mymoneyaccount, SIGNAL(signalProgress(int)), this, SLOT(slotSetProgress(int)));
+
+ int nTransCount = 0;
+
+ // Do the actual write
+ if (!m_mymoneyaccount->readCSVFile(m_qlineeditFile->text(), nTransCount)) {
+ KMessageBox::error(this, i18n("Error occurred whilst importing csv file."), i18n("Import CSV"));
+ }
+ else {
+ QString qstringPrompt = i18n("Import finished successfully.\n\n");
+ qstringPrompt += i18n("Number of transactions imported ");
+ qstringPrompt += QString::number(nTransCount);
+ qstringPrompt += ".";
+ KMessageBox::information(this, qstringPrompt, i18n("Import CSV"));
+ }
+ }
+*/
+}
+
+/** Called when the user clicks on the Browser button */
+void KCsvProgressDlg::slotBrowseClicked()
+{
+ QString newName = KFileDialog::getSaveFileName(QString::null,"*.CSV");
+ if (!newName.isEmpty())
+ {
+ m_qlineeditFile->setText(newName);
+ m_qbuttonRun->setEnabled(true);
+ }
+ else
+ m_qbuttonRun->setEnabled(false);
+}
+
+/** Called when user clicks on the Run button */
+void KCsvProgressDlg::slotRunClicked()
+{
+ m_qgroupbox->setEnabled(true);
+ if (m_nType==0)
+ performImport();
+ else
+ performExport();
+}
+
+/** Make sure the text input is ok */
+void KCsvProgressDlg::slotFileTextChanged(const QString& text)
+{
+ if (!text.isEmpty()) {
+ m_qlineeditFile->setText(text);
+ m_qbuttonRun->setEnabled(true);
+ } else
+ m_qbuttonRun->setEnabled(false);
+}
+
+void KCsvProgressDlg::readConfig(void)
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup("Last Use Settings");
+ m_kmymoneydateStart->setDate(kconfig->readDateTimeEntry("KCsvProgressDlg_StartDate").date());
+ m_kmymoneydateEnd->setDate(kconfig->readDateTimeEntry("KCsvProgressDlg_EndDate").date());
+ m_qlineeditFile->setText(kconfig->readEntry("KCsvProgressDlg_LastFile", ""));
+ if (m_qlineeditFile->text().length()>=1)
+ m_qbuttonRun->setEnabled(true);
+ else
+ m_qbuttonRun->setEnabled(false);
+}
+
+void KCsvProgressDlg::writeConfig(void)
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup("Last Use Settings");
+ kconfig->writeEntry("KCsvProgressDlg_LastFile", m_qlineeditFile->text());
+ kconfig->writeEntry("KCsvProgressDlg_StartDate", QDateTime(m_kmymoneydateStart->date()));
+ kconfig->writeEntry("KCsvProgressDlg_EndDate", QDateTime(m_kmymoneydateEnd->date()));
+ kconfig->sync();
+}
+
+/** Update the progress bar, and update the transaction count indicator. */
+void KCsvProgressDlg::slotSetProgress(int progress)
+{
+ m_qprogressbar->setProgress(progress);
+ QString qstring = QString::number(progress);
+ qstring += i18n(" of ");
+ qstring += QString::number(m_qprogressbar->totalSteps());
+ m_qlabelTransaction->setText(qstring);
+}
+
+#include "kcsvprogressdlg.moc"
diff --git a/kmymoney2/dialogs/kcsvprogressdlg.h b/kmymoney2/dialogs/kcsvprogressdlg.h
new file mode 100644
index 0000000..339d210
--- /dev/null
+++ b/kmymoney2/dialogs/kcsvprogressdlg.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ kcsvprogressdlg.h - description
+ -------------------
+ begin : Sun Jul 29 2001
+ copyright : (C) 2000-2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef KCSVPROGRESSDLG_H
+#define KCSVPROGRESSDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "../mymoney/mymoneyaccount.h"
+#include "../dialogs/kcsvprogressdlgdecl.h"
+
+/**
+ * This class is used to show the progress of an import or export of type
+ * csv. It could eventually become a base class for other import/export
+ * types which would reimplement performImport/performExport.
+ *
+ * @author Michael Edwardes 2000-2001
+ * $Id: kcsvprogressdlg.h,v 1.5 2005/03/23 20:42:31 ipwizard Exp $
+ *
+ * @short A class to show the progress of a CSV import or export.
+**/
+class KCsvProgressDlg : public KCsvProgressDlgDecl {
+ Q_OBJECT
+private:
+ MyMoneyAccount *m_mymoneyaccount;
+ int m_nType;
+
+protected:
+ void performExport(void);
+ void performImport(void);
+ void readConfig(void);
+ void writeConfig(void);
+
+protected slots:
+ void slotBrowseClicked();
+ void slotRunClicked();
+ void slotFileTextChanged(const QString& text);
+ void slotSetProgress(int progress);
+
+public:
+ KCsvProgressDlg(int type, MyMoneyAccount *account, QWidget *parent=0, const char *name=0);
+ ~KCsvProgressDlg();
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kcsvprogressdlgdecl.ui b/kmymoney2/dialogs/kcsvprogressdlgdecl.ui
new file mode 100644
index 0000000..4b1afd5
--- /dev/null
+++ b/kmymoney2/dialogs/kcsvprogressdlgdecl.ui
@@ -0,0 +1,535 @@
+<!DOCTYPE UI><UI>
+<class>KCsvProgressDlgDecl</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>kcsvprogressdlgdecl</cstring>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>CSV Dialog</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout7</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>CSV Dialog. Choose a file and then click on Run. You can view your progress at
+the bottom of the screen.
+
+You can cancel the process at any time by clicking on the Cancel button.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>Line</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Line2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout20</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout19</cstring>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Choose the csv file:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout18</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qlineeditFile</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qbuttonBrowse</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Browse</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qgroupboxDates</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Between These Dates</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblStartDate</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Start on:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>kMyMoneyDateInput</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_kmymoneydateStart</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout7_2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lblEndDate</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>End on:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>kMyMoneyDateInput</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_kmymoneydateEnd</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout7</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qbuttonRun</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Run</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qgroupbox</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Progress Info</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Processing Account:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qlabelAccount</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Unknown</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Processing Transaction:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qlabelTransaction</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>0 of 0</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qprogressbar</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_qbuttonOk</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Close</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyDateInput</class>
+ <header location="global">../widgets/kmymoneydateinput.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>1</hordata>
+ <verdata>1</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+</UI>
diff --git a/kmymoney2/dialogs/kcurrencycalculator.cpp b/kmymoney2/dialogs/kcurrencycalculator.cpp
new file mode 100644
index 0000000..6e674dc
--- /dev/null
+++ b/kmymoney2/dialogs/kcurrencycalculator.cpp
@@ -0,0 +1,315 @@
+/***************************************************************************
+ kcurrencycalculator.cpp - description
+ -------------------
+ begin : Thu Apr 8 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qwidgetstack.h>
+#include <qgroupbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <kcombobox.h>
+#include <kstdguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kcurrencycalculator.h"
+
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneycurrencyselector.h>
+#include <kmymoney/mymoneyprice.h>
+#include <kmymoney/mymoneytransaction.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+
+#include "../kmymoneyutils.h"
+
+bool KCurrencyCalculator::setupSplitPrice(MyMoneyMoney& shares, const MyMoneyTransaction& t, const MyMoneySplit& s, const QMap<QString, MyMoneyMoney>& priceInfo, QWidget* parentWidget)
+{
+ bool rc = true;
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ if(!s.value().isZero()) {
+ MyMoneyAccount cat = file->account(s.accountId());
+ MyMoneySecurity toCurrency;
+ toCurrency = file->security(cat.currencyId());
+ // determine the fraction required for this category/account
+ int fract = cat.fraction(toCurrency);
+
+ if(cat.currencyId() != t.commodity()) {
+
+ MyMoneySecurity fromCurrency;
+ MyMoneyMoney fromValue, toValue;
+ fromCurrency = file->security(t.commodity());
+ // display only positive values to the user
+ fromValue = s.value().abs();
+
+ // if we had a price info in the beginning, we use it here
+ if(priceInfo.find(cat.currencyId()) != priceInfo.end()) {
+ toValue = (fromValue * priceInfo[cat.currencyId()]).convert(fract);
+ }
+
+ // if the shares are still 0, we need to change that
+ if(toValue.isZero()) {
+ MyMoneyPrice price = file->price(fromCurrency.id(), toCurrency.id());
+ // if the price is valid calculate the shares. If it is invalid
+ // assume a conversion rate of 1.0
+ if(price.isValid()) {
+ toValue = (price.rate(toCurrency.id()) * fromValue).convert(fract);
+ } else {
+ toValue = fromValue;
+ }
+ }
+
+ // now present all that to the user
+ KCurrencyCalculator calc(fromCurrency,
+ toCurrency,
+ fromValue,
+ toValue,
+ t.postDate(),
+ fract,
+ parentWidget, "currencyCalculator");
+
+ if(calc.exec() == QDialog::Rejected) {
+ rc = false;
+ } else
+ shares = (s.value() * calc.price()).convert(fract);
+
+ } else {
+ shares = s.value().convert(fract);
+ }
+ } else
+ shares = s.value();
+
+ return rc;
+}
+
+KCurrencyCalculator::KCurrencyCalculator(const MyMoneySecurity& from, const MyMoneySecurity& to, const MyMoneyMoney& value, const MyMoneyMoney& shares, const QDate& date, const signed64 resultFraction, QWidget *parent, const char *name ) :
+ KCurrencyCalculatorDecl(parent, name),
+ m_fromCurrency(from),
+ m_toCurrency(to),
+ m_result(shares.abs()),
+ m_value(value.abs()),
+ m_resultFraction(resultFraction)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ m_dateFrame->hide();
+ if(date.isValid())
+ m_dateEdit->setDate(date);
+ else
+ m_dateEdit->setDate(QDate::currentDate());
+
+ m_fromCurrencyText->setText(m_fromCurrency.isCurrency() ? m_fromCurrency.id() : m_fromCurrency.tradingSymbol());
+ m_toCurrencyText->setText(m_toCurrency.isCurrency() ? m_toCurrency.id() : m_toCurrency.tradingSymbol());
+
+ m_fromAmount->setText(m_value.formatMoney("", MyMoneyMoney::denomToPrec(m_fromCurrency.smallestAccountFraction())));
+
+ m_dateText->setText(KGlobal::locale()->formatDate(date, true));
+
+ m_fromType->setText(KMyMoneyUtils::securityTypeToString(m_fromCurrency.securityType()));
+ m_toType->setText(KMyMoneyUtils::securityTypeToString(m_toCurrency.securityType()));
+
+ // load button icons
+ m_cancelButton->setGuiItem(KStdGuiItem::cancel());
+ m_okButton->setGuiItem(KStdGuiItem::ok());
+
+ m_updateButton->setChecked(KMyMoneyGlobalSettings::priceHistoryUpdate());
+
+ // setup initial result
+ if(m_result == MyMoneyMoney() && !m_value.isZero()) {
+ MyMoneyPrice pr = file->price(m_fromCurrency.id(), m_toCurrency.id(), date);
+ if(pr.isValid()) {
+ m_result = m_value * pr.rate(m_fromCurrency.id());
+ }
+ }
+
+ // fill in initial values
+ m_toAmount->loadText(m_result.formatMoney("", MyMoneyMoney::denomToPrec(m_resultFraction)));
+ m_toAmount->setPrecision(MyMoneyMoney::denomToPrec(m_resultFraction));
+
+ m_conversionRate->setPrecision(KMyMoneyGlobalSettings::pricePrecision());
+
+ connect(m_amountButton, SIGNAL(clicked()), this, SLOT(slotSetToAmount()));
+ connect(m_rateButton, SIGNAL(clicked()), this, SLOT(slotSetExchangeRate()));
+
+ connect(m_toAmount, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateResult(const QString&)));
+ connect(m_conversionRate, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateRate(const QString&)));
+ connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_okButton, SIGNAL(clicked()), this, SLOT(accept()));
+
+ // use this as the default
+ m_amountButton->animateClick();
+ slotUpdateResult(m_toAmount->text());
+
+ // If the from security is not a currency, we only allow entering a price
+ if(!m_fromCurrency.isCurrency()) {
+ m_rateButton->animateClick();
+ m_amountButton->hide();
+ m_toAmount->hide();
+ }
+ m_okButton->setFocus();
+}
+
+KCurrencyCalculator::~KCurrencyCalculator()
+{
+}
+
+void KCurrencyCalculator::setupPriceEditor(void)
+{
+ m_dateFrame->show();
+ m_amountDateFrame->hide();
+ m_updateButton->setChecked(true);
+ m_updateButton->hide();
+}
+
+void KCurrencyCalculator::slotSetToAmount(void)
+{
+ m_rateButton->setChecked(false);
+ m_toAmount->setEnabled(true);
+ m_conversionRate->setEnabled(false);
+}
+
+void KCurrencyCalculator::slotSetExchangeRate(void)
+{
+ m_amountButton->setChecked(false);
+ m_toAmount->setEnabled(false);
+ m_conversionRate->setEnabled(true);
+}
+
+void KCurrencyCalculator::slotUpdateResult(const QString& /*txt*/)
+{
+ MyMoneyMoney result = m_toAmount->value();
+ MyMoneyMoney price(0, 1);
+
+ if(result.isNegative()) {
+ m_toAmount->setValue(-result);
+ slotUpdateResult(QString());
+ return;
+ }
+
+ if(!result.isZero()) {
+ price = result / m_value;
+
+ m_conversionRate->loadText(price.formatMoney("", KMyMoneyGlobalSettings::pricePrecision()));
+ m_result = (m_value * price).convert(m_resultFraction);
+ m_toAmount->loadText(m_result.formatMoney("", MyMoneyMoney::denomToPrec(m_resultFraction)));
+ }
+ updateExample(price);
+}
+
+void KCurrencyCalculator::slotUpdateRate(const QString& /*txt*/)
+{
+ MyMoneyMoney price = m_conversionRate->value();
+
+ if(price.isNegative()) {
+ m_conversionRate->setValue(-price);
+ slotUpdateRate(QString());
+ return;
+ }
+
+ if(!price.isZero()) {
+ m_conversionRate->loadText(price.formatMoney("", KMyMoneyGlobalSettings::pricePrecision()));
+ m_result = (m_value * price).convert(m_resultFraction);
+ m_toAmount->loadText(m_result.formatMoney("", MyMoneyMoney::denomToPrec(m_resultFraction)));
+ }
+ updateExample(price);
+}
+
+void KCurrencyCalculator::updateExample(const MyMoneyMoney& price)
+{
+ QString msg;
+ if(price.isZero()) {
+ msg = QString("1 %1 = ? %2").arg(m_fromCurrency.tradingSymbol())
+ .arg(m_toCurrency.tradingSymbol());
+ if(m_fromCurrency.isCurrency()) {
+ msg += QString("\n");
+ msg += QString("1 %1 = ? %2").arg(m_toCurrency.tradingSymbol())
+ .arg(m_fromCurrency.tradingSymbol());
+ }
+ } else {
+ msg = QString("1 %1 = %2 %3").arg(m_fromCurrency.tradingSymbol())
+ .arg(price.formatMoney("", KMyMoneyGlobalSettings::pricePrecision()))
+ .arg(m_toCurrency.tradingSymbol());
+ if(m_fromCurrency.isCurrency()) {
+ msg += QString("\n");
+ msg += QString("1 %1 = %2 %3").arg(m_toCurrency.tradingSymbol())
+ .arg((MyMoneyMoney(1,1)/price).formatMoney("", KMyMoneyGlobalSettings::pricePrecision()))
+ .arg(m_fromCurrency.tradingSymbol());
+ }
+ }
+ m_conversionExample->setText(msg);
+ m_okButton->setEnabled(!price.isZero());
+}
+
+void KCurrencyCalculator::accept(void)
+{
+ if(m_conversionRate->isEnabled())
+ slotUpdateRate(QString());
+ else
+ slotUpdateResult(QString());
+
+ if(m_updateButton->isChecked()) {
+ MyMoneyPrice pr = MyMoneyFile::instance()->price(m_fromCurrency.id(), m_toCurrency.id(), m_dateEdit->date());
+ if(!pr.isValid()
+ || pr.date() != m_dateEdit->date()
+ || (pr.date() == m_dateEdit->date() && pr.rate(m_fromCurrency.id()) != price())) {
+ pr = MyMoneyPrice(m_fromCurrency.id(), m_toCurrency.id(), m_dateEdit->date(), price(), i18n("User"));
+ MyMoneyFileTransaction ft;
+ try {
+ MyMoneyFile::instance()->addPrice(pr);
+ ft.commit();
+ } catch(MyMoneyException *e) {
+ qDebug("Cannot add price");
+ delete e;
+ }
+ }
+ }
+
+ // remember setting for next round
+ KMyMoneyGlobalSettings::setPriceHistoryUpdate(m_updateButton->isChecked());
+
+ KCurrencyCalculatorDecl::accept();
+}
+
+const MyMoneyMoney KCurrencyCalculator::price(void) const
+{
+ // This should fix https://bugs.kde.org/show_bug.cgi?id=205254 but
+ // I am not sure about any side effects when dealing with multi-
+ // currency transactions.
+ //
+ // The following line is the original version of this code
+ // which causes some rounding issues (see the above bug entry)
+ // return m_result / m_value;
+ return m_conversionRate->value();
+}
+
+
+#include "kcurrencycalculator.moc"
diff --git a/kmymoney2/dialogs/kcurrencycalculator.h b/kmymoney2/dialogs/kcurrencycalculator.h
new file mode 100644
index 0000000..d9934da
--- /dev/null
+++ b/kmymoney2/dialogs/kcurrencycalculator.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ kcurrencycalculator.h - description
+ -------------------
+ begin : Thu Apr 8 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KCURRENCYCALCULATOR_H
+#define KCURRENCYCALCULATOR_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/kcurrencycalculatordecl.h"
+#include <kmymoney/mymoneyfile.h>
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KCurrencyCalculator : public KCurrencyCalculatorDecl
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @param from the @p from currency
+ * @param to the @p to currency
+ * @param value the value to be converted
+ * @param shares the number of foreign currency units
+ * @param date the date when the conversion took place
+ * @param resultFraction the smallest fraction of the result (default 100)
+ * @param parent see QWidget constructor
+ * @param name see QWidget constructor
+ *
+ * @note @p value must not be 0!
+ */
+ KCurrencyCalculator(const MyMoneySecurity& from, const MyMoneySecurity& to, const MyMoneyMoney& value, const MyMoneyMoney& shares, const QDate& date, const signed64 resultFraction = 100, QWidget *parent=0, const char *name=0);
+ ~KCurrencyCalculator();
+
+ const MyMoneyMoney price(void) const;
+
+ void setupPriceEditor(void);
+
+ static bool setupSplitPrice(MyMoneyMoney& shares, const MyMoneyTransaction& t, const MyMoneySplit& s, const QMap<QString, MyMoneyMoney>& priceInfo, QWidget* parentWidget);
+
+protected:
+ void updateExample(const MyMoneyMoney& price);
+
+protected slots:
+ void slotSetToAmount(void);
+ void slotSetExchangeRate(void);
+ void slotUpdateResult(const QString& txt);
+ void slotUpdateRate(const QString& txt);
+ virtual void accept(void);
+
+private:
+ MyMoneySecurity m_fromCurrency;
+ MyMoneySecurity m_toCurrency;
+ MyMoneyMoney m_result;
+ MyMoneyMoney m_value;
+ signed64 m_resultFraction;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kcurrencycalculatordecl.ui b/kmymoney2/dialogs/kcurrencycalculatordecl.ui
new file mode 100644
index 0000000..688a282
--- /dev/null
+++ b/kmymoney2/dialogs/kcurrencycalculatordecl.ui
@@ -0,0 +1,414 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KCurrencyCalculatorDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KCurrencyCalculatorDecl</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>387</width>
+ <height>368</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Exchange Rate/Price Editor</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_amountDateFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Amount</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_fromAmount</cstring>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Date</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_dateText</cstring>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>145</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2_2</cstring>
+ </property>
+ <property name="title">
+ <string>Convert from</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_fromType</cstring>
+ </property>
+ <property name="text">
+ <string>Currency</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_fromCurrencyText</cstring>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Convert to</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_toType</cstring>
+ </property>
+ <property name="text">
+ <string>Currency</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_toCurrencyText</cstring>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_conversionRate</cstring>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_amountButton</cstring>
+ </property>
+ <property name="text">
+ <string>To amount</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_rateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Exchange rate / Price</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QFrame" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_dateFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Date</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_dateEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_conversionExample</cstring>
+ </property>
+ <property name="text">
+ <string>xx
+xx</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_toAmount</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_updateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Update price history</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_okButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<tabstops>
+ <tabstop>m_amountButton</tabstop>
+ <tabstop>m_rateButton</tabstop>
+ <tabstop>m_updateButton</tabstop>
+ <tabstop>m_okButton</tabstop>
+ <tabstop>m_cancelButton</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kcurrencyeditdlg.cpp b/kmymoney2/dialogs/kcurrencyeditdlg.cpp
new file mode 100644
index 0000000..55bac30
--- /dev/null
+++ b/kmymoney2/dialogs/kcurrencyeditdlg.cpp
@@ -0,0 +1,291 @@
+/***************************************************************************
+ kcurrencyeditdlg.cpp - description
+ -------------------
+ begin : Wed Mar 24 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <locale.h>
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qheader.h>
+#include <qtimer.h>
+
+#include <qpixmap.h>
+#include <qbitmap.h>
+#include <qlabel.h>
+#include <qgroupbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+#include <kinputdialog.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kcurrencyeditdlg.h"
+
+#include <kmymoney/mymoneysecurity.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneylistviewitem.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kmymoneylineedit.h>
+
+#include "../widgets/kmymoneypriceview.h"
+
+KCurrencyEditDlg::KCurrencyEditDlg(QWidget *parent, const char *name ) :
+ KCurrencyEditDlgDecl(parent,name)
+{
+ m_currencyList->addColumn(i18n("Currency"));
+ m_currencyList->header()->hide();
+
+ // FIXME: the online source table currently has no functionality
+ m_onlineSourceTable->hide();
+
+ connect(m_currencyList, SIGNAL(rightButtonPressed(QListViewItem* , const QPoint&, int)),
+ this, SLOT(slotListClicked(QListViewItem*, const QPoint&, int)));
+ connect(m_currencyList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelectCurrency(QListViewItem*)));
+
+
+ connect(m_currencyList, SIGNAL(itemRenamed(QListViewItem*,int,const QString&)), this, SIGNAL(renameCurrency(QListViewItem*,int,const QString&)));
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadCurrencies()));
+
+ slotLoadCurrencies();
+
+ connect(m_baseCurrencyButton, SIGNAL(clicked()), this, SLOT(slotSelectBaseCurrency()));
+ connect(buttonClose, SIGNAL(clicked()), this, SLOT(slotClose()));
+
+ // FIXME: currently, no online help available
+ buttonHelp->hide();
+
+ // FIXME this is currently unused so we hide it also
+ m_description->hide();
+
+ resize(width()-1, height()-1);
+ QTimer::singleShot(10, this, SLOT(timerDone()));
+}
+
+void KCurrencyEditDlg::timerDone(void)
+{
+ if(!m_currency.id().isEmpty()) {
+ QListViewItemIterator it(m_currencyList);
+ QListViewItem* q;
+ while((q = it.current()) != 0) {
+ KMyMoneyListViewItem* p = static_cast<KMyMoneyListViewItem *>(q);
+ if(p->id() == m_currency.id()) {
+ m_currencyList->ensureItemVisible(q);
+ break;
+ }
+ ++it;
+ }
+ }
+ // the resize operation does the trick to adjust
+ // all widgets in the view to the size they should
+ // have and show up correctly. Don't ask me, why
+ // this is, but it cured the problem (ipwizard).
+ resize(width()+1, height()+1);
+}
+
+KCurrencyEditDlg::~KCurrencyEditDlg()
+{
+}
+
+void KCurrencyEditDlg::resizeEvent(QResizeEvent* /* e*/)
+{
+ int w = m_currencyList->visibleWidth();
+
+ m_currencyList->setColumnWidth(0, w);
+}
+
+void KCurrencyEditDlg::slotLoadCurrencies(void)
+{
+ QValueList<MyMoneySecurity> list = MyMoneyFile::instance()->currencyList();
+ QValueList<MyMoneySecurity>::ConstIterator it;
+ QListViewItem *first = 0;
+
+ QString localCurrency(localeconv()->int_curr_symbol);
+ localCurrency.truncate(3);
+
+ QString baseCurrency = MyMoneyFile::instance()->baseCurrency().id();
+ // construct a transparent 16x16 pixmap
+ QPixmap empty(16, 16);
+ empty.setMask(QBitmap(16, 16, true));
+
+ m_currencyList->clear();
+ for(it = list.begin(); it != list.end(); ++it) {
+ KMyMoneyListViewItem* p = new KMyMoneyListViewItem(m_currencyList, (*it).name(), QString(), (*it).id());
+ p->setRenameEnabled(0, true);
+
+ if((*it).id() == baseCurrency) {
+ p->setPixmap(0, QPixmap( locate("icon","hicolor/16x16/apps/kmymoney2.png")));
+ if(m_currency.id().isEmpty())
+ first = p;
+ } else {
+ p->setPixmap(0, empty);
+ }
+
+ // if we had a previously selected
+ if(!m_currency.id().isEmpty()) {
+ if(m_currency.id() == p->id())
+ first = p;
+ } else if ((*it).id() == localCurrency && !first)
+ first = p;
+ }
+
+ if(first == 0)
+ first = m_currencyList->firstChild();
+ if(first != 0) {
+ m_currencyList->setSelected(first, true);
+ m_currencyList->ensureItemVisible(first);
+ }
+
+ slotSelectCurrency(first);
+}
+
+void KCurrencyEditDlg::updateCurrency(void)
+{
+ if(!m_currency.id().isEmpty()) {
+ if(m_symbolEdit->text() != m_currency.tradingSymbol()) {
+ m_currency.setTradingSymbol(m_symbolEdit->text());
+ MyMoneyFileTransaction ft;
+ try {
+ MyMoneyFile::instance()->modifyCurrency(m_currency);
+ ft.commit();
+ } catch(MyMoneyException *e) {
+ qWarning("Updateing the currency failed!");
+ delete e;
+ }
+ }
+ }
+}
+
+void KCurrencyEditDlg::slotSelectCurrency(const QString& id)
+{
+ QListViewItemIterator it(m_currencyList);
+
+ while(it.current()) {
+ KMyMoneyListViewItem* p = static_cast<KMyMoneyListViewItem*>(it.current());
+ if(p->id() == id) {
+ slotSelectCurrency(p);
+ m_currencyList->setSelected(p, true);
+ m_currencyList->ensureItemVisible(p);
+ break;
+ }
+ ++it;
+ }
+}
+
+void KCurrencyEditDlg::slotSelectCurrency(QListViewItem *item)
+{
+ QMap<QDate, MyMoneyMoney> history;
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ updateCurrency();
+
+ m_detailGroup->setEnabled(item != 0);
+ m_onlineSourceTable->clear();
+ m_idLabel->setText(QString());
+ m_symbolEdit->setText(QString());
+
+ if(item) {
+ try {
+ KMyMoneyListViewItem* p = static_cast<KMyMoneyListViewItem *>(item);
+ m_currency = file->security(p->id());
+ m_idLabel->setText(m_currency.id());
+ m_symbolEdit->setText(m_currency.tradingSymbol());
+
+ } catch(MyMoneyException *e) {
+ delete e;
+ m_currency = MyMoneySecurity();
+ m_onlineSourceTable->clear();
+ m_idLabel->setText(QString());
+ m_symbolEdit->setText(QString());
+ }
+ m_baseCurrencyButton->setDisabled(m_currency.id() == file->baseCurrency().id());
+ emit selectObject(m_currency);
+ }
+}
+
+void KCurrencyEditDlg::slotClose(void)
+{
+ updateCurrency();
+ accept();
+}
+
+void KCurrencyEditDlg::slotStartRename(void)
+{
+ QListViewItemIterator it_l(m_currencyList, QListViewItemIterator::Selected);
+ QListViewItem* it_v;
+ if((it_v = it_l.current()) != 0) {
+ it_v->startRename(0);
+ }
+}
+
+void KCurrencyEditDlg::slotListClicked(QListViewItem* item, const QPoint&, int)
+{
+ slotSelectCurrency(item);
+ emit openContextMenu(m_currency);
+}
+
+void KCurrencyEditDlg::slotRenameCurrency(QListViewItem* item, int /* col */, const QString& txt)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+ KMyMoneyListViewItem* p = static_cast<KMyMoneyListViewItem *>(item);
+
+ try {
+ if(txt != m_currency.name()) {
+ qDebug("Renaming");
+ MyMoneySecurity currency = file->currency(p->id());
+ currency.setName(txt);
+ MyMoneyFileTransaction ft;
+ try {
+ file->modifyCurrency(currency);
+ m_currency = currency;
+ ft.commit();
+ } catch(MyMoneyException* e) {
+ qDebug("Renaming currency failed");
+ delete e;
+ }
+ }
+ } catch(MyMoneyException *e) {
+ delete e;
+ updateCurrency();
+ }
+}
+
+void KCurrencyEditDlg::slotSelectBaseCurrency(void)
+{
+ if(!m_currency.id().isEmpty()) {
+ QListViewItem* p = m_currencyList->selectedItem();
+ emit selectBaseCurrency(m_currency);
+ // in case the dataChanged() signal was not sent out (nested FileTransaction)
+ // we update the list manually
+ if(p == m_currencyList->selectedItem())
+ slotLoadCurrencies();
+ }
+}
+
+#include "kcurrencyeditdlg.moc"
diff --git a/kmymoney2/dialogs/kcurrencyeditdlg.h b/kmymoney2/dialogs/kcurrencyeditdlg.h
new file mode 100644
index 0000000..f1a4871
--- /dev/null
+++ b/kmymoney2/dialogs/kcurrencyeditdlg.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ kcurrencyeditdlg.h - description
+ -------------------
+ begin : Wed Mar 24 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KCURRENCYEDITDLG_H
+#define KCURRENCYEDITDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+class KPopupMenu;
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/kcurrencyeditdlgdecl.h"
+#include "../mymoney/mymoneysecurity.h"
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KCurrencyEditDlg : public KCurrencyEditDlgDecl
+{
+ Q_OBJECT
+public:
+ KCurrencyEditDlg(QWidget *parent=0, const char *name=0);
+ ~KCurrencyEditDlg();
+
+public slots:
+ void slotSelectCurrency(const QString& id);
+
+protected:
+ /// the resize event
+ virtual void resizeEvent(QResizeEvent*);
+ void updateCurrency(void);
+
+protected slots:
+ void slotSelectCurrency(QListViewItem *);
+
+ void slotClose(void);
+ void slotStartRename(void);
+ void slotListClicked(QListViewItem* item, const QPoint&, int);
+ void slotRenameCurrency(QListViewItem* item, int col, const QString& txt);
+ void slotLoadCurrencies(void);
+
+private slots:
+ void timerDone(void);
+ void slotSelectBaseCurrency(void);
+
+signals:
+ void selectObject(const MyMoneySecurity& currency);
+ void openContextMenu(const MyMoneySecurity& currency);
+ void renameCurrency(QListViewItem* item, int, const QString& txt);
+ void selectBaseCurrency(const MyMoneySecurity& currency);
+
+private:
+ MyMoneySecurity m_currency;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kcurrencyeditdlgdecl.ui b/kmymoney2/dialogs/kcurrencyeditdlgdecl.ui
new file mode 100644
index 0000000..4a0a740
--- /dev/null
+++ b/kmymoney2/dialogs/kcurrencyeditdlgdecl.ui
@@ -0,0 +1,304 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KCurrencyEditDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KCurrencyEditDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>666</width>
+ <height>516</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Currencies</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>m_currencyList</cstring>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_baseCurrencyFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_baseCurrencyButton</cstring>
+ </property>
+ <property name="text">
+ <string>Select as base currency</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_detailGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Details</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Symbol</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_idLabel</cstring>
+ </property>
+ <property name="text">
+ <string>real ID</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_symbolEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>ID</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_description</cstring>
+ </property>
+ <property name="text">
+ <string>X</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Currency</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Online Source</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_onlineSourceTable</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonClose</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If this button is not activated, select the base currency first.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press this button to close the dialog. If the button is not activated, select your base currency.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyLineEdit</class>
+ <header location="local">../widgets/kmymoneylineedit.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1114">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042149444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d096e8b11261871837bc8e282ac7ac82187e049a317e32d37110992bf42123c694eea414c0e0bf1b0ec6c402139485a54e8810c54c10e741146fa110bd643f74c12bd642e4d75f77cf5d5ef7dafdfc2ce7087d9eff32fdfdff74e5114104011e489d6e952cce5cfbe5998692dec0c77b87aedd3fddd9f2b3efce02291082209aa3504685022e4ffd7a000a82a765c515615ce95acae659c3f7765c100ec6e575cf8f822e991025f3b6a6f890c484f181ccfc1583428f5d4e2fe84da039aa04121b40eb32483a0ec6e5bce9f8385d36fa7fb9b1b17c8f31cbfe7a95c45be94520c72b2141a1caa160d1666e24ea94aa11ee7685054159d2ada34d41387c40dc63b8844f0b5c73a4bb19cb3f9de001f2aac1fa23aa209168c004224902e29d22ff1e38abbdb275055c4800610233867311a1491847a62c98f66ac6f14d8e99072f22daa15b68a8108424d6422e24c88e3966fbce4c9d786945b27f0be0103ed13c16004d59a2c4d58df28a87548e9aee2274ab95d60c7193c9a0281fc959ae2a4450364a9e2572c7a2b43438374ef2dd2154012d050514dbec7396578a3130d9d6850066f0ad9d186f2d78cdbbb799b0a202f2c48d3aebbb418310240b112637588574bf54b8efaa4fd9b691dacbf5b305813542bae63a9eee4c4694d967b5494eca8c7ef0933bdc5d90e6a2caa0e3f013b7adce9fa5b03d637561113a30106a71d18c5fd9677058338ad01e91c0b8b743b880182ce19cd9c0e5e2b583fbdda565d3d04cfedad180942133af201b2bc3588e111c680068f489780ce69b192b279768088524f2b3458ea694d3de99a4323bc976ed34eb86b98c51993f6be10f77240c99685cd731991f1582df15aa15a213d583f5313a7806988fb8a0640e336359d9e9933568bf44062214ba19e2a7652a13d8b068ff596b807182189234e9da9f1ceb78c81b28c3ac6fe21e306c58e41d5118952acd6a0c2f56b9e6a5c72f346cdcd6b19a3bf8010010d714f89533b674c90c7189b598eab12a45fb5c75b8253672b863fbcccf5af93b6904119fe9851bf5153ac3a746ae7b9d5698c1dc58f313e70e4707ce9d84bafa2f79fc23fb8c7c1438ef04031a2642fee21060ec69ee47020796ecaa12313ccd333d1b67935047acf2be3bb11aa010dbe656cc755dbe3b772084a7ebc6d5711253b593dfcc0cc8fcd3cafda455512c7f200ec56cbfac0f1d7d34b7fdf0f98fd88a92a7e9cb0e70cc933c0b38a2c823ea0bd76c70c016adb67f47bc2a117a6d40abeea33fa23c2fb867edfb413e4a34fded94ffb3991c46dc7754cd3634ad2af490b857f5a5137126a97e02a8120a485235b6a28ef80bd077ee2b9f2d54fed04595dcbd8ddb6c4bd87334c10cadb2064e856177e7864e669fbe1df154a0142839f7ad2e5b6880bff1da66eece78e315d959f609da670f98befe6c3f45fb42672c9acff7f660000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/keditequityentrydecl.ui b/kmymoney2/dialogs/keditequityentrydecl.ui
new file mode 100644
index 0000000..4acf703
--- /dev/null
+++ b/kmymoney2/dialogs/keditequityentrydecl.ui
@@ -0,0 +1,306 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KEditEquityEntryDecl</class>
+<author>Kevin Tambascio </author>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KEditEquityEntryDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>380</width>
+ <height>482</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Equity</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>edtEquityName</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>Stock</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mutual Fund</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Bond</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cmbInvestmentType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Smallest fraction:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="1">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>1 /</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>edtFraction</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblType</cstring>
+ </property>
+ <property name="text">
+ <string>Investment Type:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblEquityName</cstring>
+ </property>
+ <property name="text">
+ <string>Equity Name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>edtMarketSymbol</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblSymbol</cstring>
+ </property>
+ <property name="text">
+ <string>Market Symbol:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Price History</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneyPriceView">
+ <property name="name">
+ <cstring>kpvPriceHistory</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnAddEntry</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnEditEntry</cstring>
+ </property>
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnRemoveEntry</cstring>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>238</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnOK</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyEdit</class>
+ <header location="local">../widgets/kmymoneyedit.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>1</hordata>
+ <verdata>1</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>KMyMoneyPriceView</class>
+ <header location="local">../widgets/kmymoneypriceview.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="256">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154789cad55db1184200c4c180bb005eab1cd6b8112b40d4bf1bee2486ef3006fbf1c93ece605f07eece4e1a4ed42ff2b35f6e2961132e46309941952ed8f628a761a21f56217cb20b04a45fe276d97f8ffb422431ad96e62a4ee057a83131bcc38431a6d057f8eb5cb36438afcb5cded719614011e9088308374c61aa9adb0e0651b5552b4b29efaacb099312ad5da5b2d50a93124463b2adf516fbb8cbd1354a9b1b667c8a787674144f9f982bcb93635ba8cb3fd1b2616f251013403fee763fabce8bff0aa6c989d7e67440000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="826">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000030149444154789cb59531681b5718c77f0e377c070e3c810a3a70e0041eac51852e0a19e45134830a1d9a4c69a04bc8928e990a693a640e1d0c8642b08742321894c1507991b484c890902bb8701a047760c3bd21701fe4201dde49b6a41a32b8df72dcbbeffdbefffbbfefbd5b1b0c07cce266ebe667ae2006c3c1dada0cdc3be87d6e6c35b0d692a409d9c7ec8b20d65ae29398d19b1114e7e3de4ce98b3f5e10dc0053cf0951b4506496e1b964bf7ce6c585d9054c62d01d617ca48be0596553cf496d8f2c8b01c5f795fc93904e85ec4c01a152857a5d9175d0b2805c872080f18595ccc1499a10a225d4e2fbc2877786fe81253ab6c04c8d106e09db5d43ab0d146e5c64d1a23938fb98a185cea1c33eecfd9eba49eb427dcb201e245365f2b7b2fb5b4a3a31dcb927178afe07d86901df870fefa4842aed6f6b74ba42e52b4014d580e1eb9cbd9d94de7e4aad16d2f9be02d805f0b5e532f927a1ffcacea1777f122a8105b164a7c25faf323a5d9f1f1fd600e1e5bec59e2d4b5c7ef5209d0ad17b8b31864e57c0b3e0815ac3ee33253ab664a770ff5185d1a1cb8d2267d3e58aa1dc7d2508cbe597d0e74fdd269aaaf0f52d414c4ea3e9762c996869e42560d7a72e41c4799a2586e74f95e8d8151481fa86efbe7b3398ac58b1a2b8527589f15451ad303ac2293542ad6648a796278f13a27185e4c4754310facb98c53a79e19a3fdc1426ff28c3d7399d1f7cb25343eb96106cf83c790ce9c4f2eb831855c55485663327992eb6dc8a6259874ed700b0b793323cccb9ffa842b30d6133e3e75fea989ac15a8b16ca76b746b0b92278d919774c5b6d48a78697fb29bbcf52468742a32120909c24e899ce67beed5be2db01e22d1e9485bb620e47f9ee9e606a21bd3f5d3744c7e7c54d55e87443867d8b554515ac5db4620e8e4f62263170fd1cdee90aad7640141992891b0f367c9adfe4049bb07d3b7022bd8c687c0978f46684ee084150b65ac1fcca94591b7a90a496e4c095164fb016a2b192a497795cc0f84817aebe25f7bf70ccc54a575c555c03f78ffa5fc0570d1f0c076bff0232285a0901e2257b0000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/keditequityentrydlg.cpp b/kmymoney2/dialogs/keditequityentrydlg.cpp
new file mode 100644
index 0000000..854ce9a
--- /dev/null
+++ b/kmymoney2/dialogs/keditequityentrydlg.cpp
@@ -0,0 +1,138 @@
+/***************************************************************************
+ keditequityentrydlg.cpp - description
+ -------------------
+ begin : Sat Mar 6 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qtimer.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kglobal.h>
+#include <kpushbutton.h>
+#include <kiconloader.h>
+#include <kcombobox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "keditequityentrydlg.h"
+#include "kupdatestockpricedlg.h"
+#include "../widgets/kmymoneypriceview.h"
+
+KEditEquityEntryDlg::KEditEquityEntryDlg(const MyMoneySecurity& selectedSecurity, QWidget *parent, const char *name)
+ : KEditEquityEntryDecl(parent, name, true)
+{
+ m_selectedSecurity = selectedSecurity;
+
+ connect(btnOK, SIGNAL(clicked()), this, SLOT(slotOKClicked()));
+ connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(edtEquityName, SIGNAL(textChanged(const QString &)), this, SLOT(slotDataChanged()));
+ connect(edtMarketSymbol, SIGNAL(textChanged(const QString &)), this, SLOT(slotDataChanged()));
+ connect(edtFraction, SIGNAL(textChanged(const QString&)), this, SLOT(slotDataChanged()));
+ connect(btnAddEntry, SIGNAL(clicked()), kpvPriceHistory, SLOT(slotAddPrice()));
+ connect(btnEditEntry, SIGNAL(clicked()), kpvPriceHistory, SLOT(slotEditPrice()));
+ connect(btnRemoveEntry, SIGNAL(clicked()), kpvPriceHistory, SLOT(slotDeletePrice()));
+ connect(kpvPriceHistory, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelectionChanged(QListViewItem*)));
+
+ //fill in the fields with what we know.
+ edtEquityName->setText(m_selectedSecurity.name());
+ edtMarketSymbol->setText(m_selectedSecurity.tradingSymbol());
+ edtFraction->setPrecision(0);
+ edtFraction->setCalculatorButtonVisible(false);
+ edtFraction->loadText(QString::number(m_selectedSecurity.smallestAccountFraction()));
+ cmbInvestmentType->setCurrentItem((int)m_selectedSecurity.securityType());
+ // FIXME PRICE
+ // kpvPriceHistory->setHistory(m_selectedSecurity.priceHistory());
+
+ // add icons to buttons
+ KIconLoader *il = KGlobal::iconLoader();
+ btnOK->setGuiItem(KStdGuiItem::ok());
+ btnCancel->setGuiItem(KStdGuiItem::cancel());
+ btnRemoveEntry->setGuiItem(KStdGuiItem::remove());
+ btnAddEntry->setGuiItem(KStdGuiItem::add());
+
+ KGuiItem editButtenItem( i18n( "&Edit" ),
+ QIconSet(il->loadIcon("edit", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Modify the selected entry"),
+ i18n("Change the price information of the selected entry."));
+ btnEditEntry->setGuiItem(editButtenItem);
+
+ slotSelectionChanged(0); // make sure buttons are disabled in the beginning
+ slotDataChanged();
+ m_changes = false;
+
+ // force a resize to optimize the layout of all widgets
+ resize(width()-1, height()-1);
+ QTimer::singleShot(10, this, SLOT(slotTimerDone()));
+}
+
+KEditEquityEntryDlg::~KEditEquityEntryDlg()
+{
+}
+
+void KEditEquityEntryDlg::slotTimerDone(void)
+{
+ // the resize operation does the trick to adjust
+ // all widgets in the view to the size they should
+ // have and show up correctly. Don't ask me, why
+ // this is, but it cured the problem (ipwizard).
+ resize(width()+1, height()+1);
+}
+
+/** No descriptions */
+void KEditEquityEntryDlg::slotOKClicked()
+{
+ if(m_changes /* || kpvPriceHistory->dirty() */)
+ {
+ m_selectedSecurity.setName(edtEquityName->text());
+ m_selectedSecurity.setTradingSymbol(edtMarketSymbol->text());
+ m_selectedSecurity.setSmallestAccountFraction(edtFraction->value().abs());
+ // FIXME PRICE
+ // m_selectedSecurity.setPriceHistory(kpvPriceHistory->history());
+ }
+
+ accept();
+}
+
+void KEditEquityEntryDlg::slotSelectionChanged(QListViewItem* item)
+{
+ btnEditEntry->setEnabled(item != 0);
+ btnRemoveEntry->setEnabled(item != 0);
+}
+
+void KEditEquityEntryDlg::slotDataChanged(void)
+{
+ bool okEnabled = true;
+
+ if(!edtFraction->value().isPositive()
+ || edtMarketSymbol->text().isEmpty()
+ || edtEquityName->text().isEmpty())
+ okEnabled = false;
+
+ btnOK->setEnabled(okEnabled);
+
+ m_changes = true;
+}
+
+#include "keditequityentrydlg.moc"
diff --git a/kmymoney2/dialogs/keditequityentrydlg.h b/kmymoney2/dialogs/keditequityentrydlg.h
new file mode 100644
index 0000000..0fdf40e
--- /dev/null
+++ b/kmymoney2/dialogs/keditequityentrydlg.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ keditequityentrydlg.h - description
+ -------------------
+ begin : Sat Mar 6 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KEDITEQUITYENTRYDLG_H
+#define KEDITEQUITYENTRYDLG_H
+
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qdialog.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <klistview.h>
+#include <klocale.h>
+#include <klineedit.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/keditequityentrydecl.h"
+#include "../mymoney/mymoneysecurity.h"
+
+/**
+ * @author Kevin Tambascio
+ */
+
+class KEditEquityEntryDlg : public KEditEquityEntryDecl
+{
+ Q_OBJECT
+public:
+ KEditEquityEntryDlg(const MyMoneySecurity& selectedSecurity, QWidget *parent = NULL, const char *name = NULL);
+ ~KEditEquityEntryDlg();
+
+ void updatedEquity(MyMoneySecurity& security) { security = m_selectedSecurity; }
+
+protected slots:
+ void slotOKClicked();
+ void slotDataChanged(void);
+ void slotSelectionChanged(QListViewItem* item);
+
+private slots:
+ void slotTimerDone(void);
+
+private:
+ MyMoneySecurity m_selectedSecurity;
+ bool m_changes;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/keditloanwizard.cpp b/kmymoney2/dialogs/keditloanwizard.cpp
new file mode 100644
index 0000000..6054cec
--- /dev/null
+++ b/kmymoney2/dialogs/keditloanwizard.cpp
@@ -0,0 +1,514 @@
+/***************************************************************************
+ keditloanwizard.cpp - description
+ -------------------
+ begin : Wed Nov 12 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <knuminput.h>
+#include <kpushbutton.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <../dialogs/knewloanwizard.h>
+#include "keditloanwizard.h"
+#include "../widgets/kmymoneylineedit.h"
+#include "../widgets/kmymoneyedit.h"
+#include "../widgets/kmymoneycombo.h"
+#include "../widgets/kmymoneyaccountselector.h"
+#include "../widgets/kmymoneydateinput.h"
+#include "../mymoney/mymoneyfile.h"
+#include "../kmymoneyutils.h"
+
+KEditLoanWizard::KEditLoanWizard(const MyMoneyAccount& account, QWidget *parent, const char *name ) :
+ KNewLoanWizard(parent, name)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ setCaption(i18n("Edit loan wizard"));
+ m_effectiveDateLabel->setText(QString("\n") + i18n(
+ "Please enter the date from which on the following changes will be effective. "
+ "The date entered must be later than the opening date of this account (%1), but must "
+ "not be in the future. The default will be today.").arg(KGlobal::locale()->formatDate(account.openingDate(), true)));
+ m_account = account;
+ try {
+ QString id = m_account.value("schedule");
+ m_schedule = file->schedule(id);
+ } catch (MyMoneyException *e) {
+ delete e;
+ }
+
+ m_lastSelection = -1;
+ m_editInterestRateButton->animateClick();
+
+ loadWidgets(m_account);
+
+ if(m_account.openingDate() > QDate::currentDate()) {
+ m_effectiveDateNoteLabel->setText(QString("\n") + i18n(
+ "Note: you will not be able to modify this account today, because the opening date \"%1\" is in the future. "
+ "Please revisit this dialog when the time has come."
+ ).arg(KGlobal::locale()->formatDate(m_account.openingDate(), true)));
+ } else {
+ m_effectiveDateNoteLabel->hide();
+ }
+ // turn off all pages that are contained here for derived classes
+ setAppropriate(m_newIntroPage, false);
+ setAppropriate(m_newGeneralInfoPage, false);
+ setAppropriate(m_lendBorrowPage, false);
+ setAppropriate(m_namePage, false);
+ setAppropriate(m_newCalculateLoanPage, false);
+ setAppropriate(m_newPaymentsPage, false);
+ removePage(m_assetAccountPage);
+ m_assetAccountPage = 0;
+
+ // turn on all pages that are contained here for derived classes
+ setAppropriate(m_editIntroPage, true);
+ setAppropriate(m_editSelectionPage, true);
+
+ // setup connections
+ connect(m_effectiveChangeDateEdit, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotCheckPageFinished()));
+ connect(m_newPaymentEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished()));
+ connect(m_newInterestRateEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished()));
+
+ // make sure, we show the correct start page
+ showPage(m_editIntroPage);
+}
+
+KEditLoanWizard::~KEditLoanWizard()
+{
+}
+
+void KEditLoanWizard::loadWidgets(const MyMoneyAccount& /* account */)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+ QString paymentAccountId, interestAccountId;
+
+ m_nameEdit->loadText(m_account.name());
+ m_loanAmountEdit->loadText(m_account.loanAmount().formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()))));
+ m_finalPaymentEdit->loadText(m_account.finalPayment().formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()))));
+ m_firstDueDateEdit->setDate(m_account.openingDate());
+
+ if(m_account.fixedInterestRate()) {
+ m_fixedInterestButton->animateClick();
+ } else {
+ m_variableInterestButton->animateClick();
+ }
+
+ MyMoneyMoney ir;
+ if(m_schedule.startDate() > QDate::currentDate()) {
+ ir = m_account.interestRate(m_schedule.startDate());
+ } else {
+ ir = m_account.interestRate(QDate::currentDate());
+ }
+ m_interestRateEdit->loadText(ir.formatMoney("", 3));
+ m_newInterestRateEdit->loadText(ir.formatMoney("", 3));
+ m_newInterestRateEdit->setPrecision(3);
+ m_interestRateLabel->setText(QString(" ") + ir.formatMoney("", 3) + QString("%"));
+
+ m_paymentFrequencyUnitEdit->setCurrentItem(i18n(m_schedule.occurenceToString()));
+ updateTermWidgets(m_account.term());
+
+ // the base payment (amortization and interest) is determined
+ // by adding all splits that are not automatically calculated.
+ // If the loan is a liability, we reverse the sign at the end
+ MyMoneyMoney basePayment;
+ MyMoneyMoney addPayment;
+
+ m_transaction = m_schedule.transaction();
+
+ QValueList<MyMoneySplit>::ConstIterator it_s;
+ for(it_s = m_schedule.transaction().splits().begin();
+ it_s != m_schedule.transaction().splits().end();
+ ++it_s) {
+ MyMoneyAccount acc = file->account((*it_s).accountId());
+ // if it's the split that references the source/dest
+ // of the money, we check if we borrow or loan money
+ if(paymentAccountId.isEmpty()
+ && acc.isAssetLiability() && !acc.isLoan()
+ && (*it_s).value() != MyMoneyMoney::autoCalc) {
+ if((*it_s).value().isNegative()) {
+ m_lendButton->setChecked(false);
+ m_borrowButton->setChecked(true);
+ } else {
+ m_lendButton->setChecked(true);
+ m_borrowButton->setChecked(false);
+ }
+ // we keep the amount of the full payment and subtract the
+ // base payment later to get information about the additional payment
+ addPayment = (*it_s).value();
+ paymentAccountId = (*it_s).accountId();
+ MyMoneyPayee payee;
+ if(!(*it_s).payeeId().isEmpty()) {
+ try {
+ payee = file->payee((*it_s).payeeId());
+ m_payeeEdit->setSelectedItem(payee.id());
+ } catch(MyMoneyException *e) {
+ delete e;
+ qWarning("Payee for schedule has been deleted");
+ }
+ }
+
+ // remove this split with one that will be replaced
+ // later and has a phony id
+ m_transaction.removeSplit(*it_s);
+ m_split.clearId();
+ m_transaction.addSplit(m_split);
+ }
+
+ if((*it_s).action() == MyMoneySplit::ActionInterest) {
+ interestAccountId = (*it_s).accountId();
+ }
+
+ if((*it_s).value() != MyMoneyMoney::autoCalc) {
+ basePayment += (*it_s).value();
+ } else {
+ // remove the splits which should not show up
+ // for additional fees
+ m_transaction.removeSplit(*it_s);
+ }
+
+ }
+ if(m_borrowButton->isChecked()) {
+ basePayment = -basePayment;
+ addPayment = -addPayment;
+ }
+ // now make adjustment to get the amount of the additional fees
+ addPayment -= basePayment;
+
+ // load account selection widgets now that we know if
+ // we borrow or lend money
+ loadAccountList();
+
+ int fraction = m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()));
+ m_paymentEdit->loadText(basePayment.formatMoney(fraction));
+ m_newPaymentEdit->loadText(basePayment.formatMoney(fraction));
+ m_paymentLabel->setText(QString(" ") + basePayment.formatMoney(fraction));
+
+ m_additionalCost->setText(addPayment.formatMoney(fraction));
+ m_interestAccountEdit->setSelected(interestAccountId);
+ m_paymentAccountEdit->setSelected(paymentAccountId);
+ m_nextDueDateEdit->setDate(m_schedule.nextPayment());
+
+ int changeFrequencyUnit;
+ int amt = m_account.interestChangeFrequency(&changeFrequencyUnit);
+ if(amt != -1) {
+ m_interestFrequencyAmountEdit->setValue(amt);
+ m_interestFrequencyUnitEdit->setCurrentItem(changeFrequencyUnit);
+ }
+
+ // keep track, if the loan should be fully repayed
+ m_fullyRepayLoan = m_account.finalPayment() < basePayment;
+
+ updateLoanInfo();
+ updateSummary();
+}
+
+void KEditLoanWizard::next()
+{
+ bool dontLeavePage = false;
+ QButton* button = m_selectionButtonGroup->find(m_lastSelection);
+
+ if(currentPage() == m_editSelectionPage) {
+
+ if(button != 0
+ && m_lastSelection != m_selectionButtonGroup->id(m_selectionButtonGroup->selected())) {
+ QString errMsg = i18n(
+ "Your previous selection was \"%1\". If you select another option, "
+ "KMyMoney will dismiss the changes you have just entered. "
+ "Do you wish to proceed?").arg(button->text());
+
+ if(KMessageBox::questionYesNo(this, errMsg) == KMessageBox::No) {
+ dontLeavePage = true;
+ } else {
+ loadWidgets(m_account);
+ }
+ }
+
+ if(!dontLeavePage) {
+ button = m_selectionButtonGroup->selected();
+
+ // turn off all pages except the summary at the end
+ // and the one's we need for the selected option
+ // and load the widgets with the current values
+
+ // general info
+ setAppropriate(m_namePage, false);
+ setAppropriate(m_interestTypePage, false);
+ setAppropriate(m_previousPaymentsPage, false);
+ setAppropriate(m_recordPaymentPage, false);
+ setAppropriate(m_variableInterestDatePage, false);
+ setAppropriate(m_firstPaymentPage, false);
+ // loan calculation
+ setAppropriate(m_paymentEditPage, false);
+ setAppropriate(m_interestEditPage, false);
+ setAppropriate(m_paymentFrequencyPage, false);
+ setAppropriate(m_interestCalculationPage, false);
+ setAppropriate(m_loanAmountPage, false);
+ setAppropriate(m_interestPage, false);
+ setAppropriate(m_durationPage, false);
+ setAppropriate(m_paymentPage, false);
+ setAppropriate(m_finalPaymentPage, false);
+ setAppropriate(m_calculationOverviewPage, false);
+ // payment
+ setAppropriate(m_interestCategoryPage, false);
+ setAppropriate(m_additionalFeesPage, false);
+ setAppropriate(m_schedulePage, false);
+ setAppropriate(m_summaryPage, true);
+
+ setAppropriate(m_effectiveDatePage, true);
+ if(indexOf(m_summaryPage) != -1) {
+ removePage(m_summaryPage);
+ setFinishEnabled(m_summaryEditPage, true);
+ }
+
+ if(button == m_editInterestRateButton) {
+ setAppropriate(m_interestTypePage, true);
+ setAppropriate(m_variableInterestDatePage, true);
+ setAppropriate(m_paymentEditPage, true);
+ setAppropriate(m_interestEditPage, true);
+ setAppropriate(m_summaryEditPage, true);
+
+ } else if(button == m_editOtherCostButton) {
+ setAppropriate(m_additionalFeesPage, true);
+ setAppropriate(m_summaryEditPage, true);
+
+ } else if(button == m_editOtherInfoButton) {
+ setAppropriate(m_namePage, true);
+ setAppropriate(m_interestCalculationPage, true);
+ setAppropriate(m_interestPage, true);
+ setAppropriate(m_durationPage, true);
+ setAppropriate(m_paymentPage, true);
+ setAppropriate(m_finalPaymentPage, true);
+ setAppropriate(m_calculationOverviewPage, true);
+ setAppropriate(m_interestCategoryPage, true);
+ setAppropriate(m_additionalFeesPage, true);
+ setAppropriate(m_schedulePage, true);
+ setAppropriate(m_summaryEditPage, false);
+ addPage(m_summaryPage, i18n("Summary"));
+ setAppropriate(m_summaryPage, true);
+ setFinishEnabled(m_summaryEditPage, false);
+ setFinishEnabled(m_summaryPage, true);
+
+ } else {
+ qFatal("%s,%d: This should never happen", __FILE__, __LINE__);
+ }
+
+ m_lastSelection = m_selectionButtonGroup->id(m_selectionButtonGroup->selected());
+ } // if(!dontLeavePage)
+
+ } else if(currentPage() == m_additionalFeesPage) {
+ button = m_selectionButtonGroup->selected();
+ if(button == m_editOtherCostButton) {
+ updateLoanInfo();
+ updateEditSummary();
+ }
+
+ } else if(currentPage() == m_interestEditPage) {
+ // copy the necessary data to the widgets used for calculation
+ m_interestRateEdit->setValue(m_newInterestRateEdit->value());
+ m_paymentEdit->setValue(m_newPaymentEdit->value());
+
+ // if interest rate and payment amount is given, then force
+ // the term to be recalculated. The final payment is adjusted to
+ // 0 if the loan was ment to be fully repayed
+ updateTermWidgets(m_account.term());
+ if(!m_interestRateEdit->lineedit()->text().isEmpty()
+ && !m_paymentEdit->lineedit()->text().isEmpty()) {
+ // if there's an amortization going on, we can evaluate
+ // the new term. If the amortization is 0 (interest only
+ // payments) then we keep the term as entered by the user.
+ if(m_loanAmountEdit->value() != m_finalPaymentEdit->value()) {
+ m_durationValueEdit->setValue(0);
+ }
+ if(m_fullyRepayLoan)
+ m_finalPaymentEdit->loadText(MyMoneyMoney(0).formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()))));
+ }
+
+/*
+ // we need to calculate the balance at the time of the change
+ // in order to accurately recalculate the term. A special
+ // situation arises, when we keep track of all payments and
+ // the full loan is not yet paid out. In this case, we take the
+ // the loan amount minus all amortization payments as the current
+ // balance.
+ // FIXME: This needs some more thoughts. We leave it out for
+ // now and always calculate with the full loan amount.
+ MyMoneyMoney balance = m_account.openingBalance();
+
+ QValueList<MyMoneyTransaction> list;
+ QValueList<MyMoneyTransaction>::ConstIterator it;
+ MyMoneySplit split;
+ MyMoneyTransactionFilter filter(m_account.id());
+
+ filter.setDateFilter(QDate(), m_effectiveChangeDateEdit->date().addDays(-1));
+ list = MyMoneyFile::instance()->transactionList(filter);
+
+ for(it = list.begin(); it != list.end(); ++it) {
+ try {
+ split = (*it).splitByAccount(m_account.id());
+ balance += split.value();
+
+ } catch(MyMoneyException *e) {
+ // account is not referenced within this transaction
+ delete e;
+ }
+ }
+ m_loanAmountEdit->setText(balance.formatMoney());
+*/
+
+ // now re-calculate the figures
+ dontLeavePage = !calculateLoan();
+
+ // reset the original loan amount to the widget
+ m_loanAmountEdit->setValue(m_account.loanAmount());
+
+ if(!dontLeavePage) {
+ updateLoanInfo();
+ updateEditSummary();
+ }
+ }
+
+ if(!dontLeavePage)
+ KNewLoanWizard::next();
+
+ // These might have been set by KNewLoanWizard::next()
+ setAppropriate(m_previousPaymentsPage, false);
+ setAppropriate(m_recordPaymentPage, false);
+ // we never need to show this page
+ if(currentPage() == m_previousPaymentsPage)
+ KNewLoanWizard::next();
+}
+
+void KEditLoanWizard::slotCheckPageFinished(void)
+{
+ KNewLoanWizard::slotCheckPageFinished();
+
+ // if we're on one of the specific edit pages, the next button
+ // is enabled. If the values in the edit widgets are not
+ // appropriate, we just have to disable it.
+
+ if(currentPage() == m_effectiveDatePage) {
+ if(m_effectiveChangeDateEdit->date() < m_account.openingDate()
+ || m_effectiveChangeDateEdit->date() > QDate::currentDate())
+ nextButton()->setEnabled(false);
+
+ } else if(currentPage() == m_interestEditPage) {
+ if(!m_newPaymentEdit->isValid()
+ && !m_newInterestRateEdit->isValid())
+ nextButton()->setEnabled(false);
+ }
+}
+
+void KEditLoanWizard::updateEditSummary(void)
+{
+ updateSummary();
+ m_payment7->setText(m_summaryPeriodicPayment->text());
+ m_additionalFees7->setText(m_summaryAdditionalFees->text());
+ m_totalPayment7->setText(m_summaryTotalPeriodicPayment->text());
+ m_interestRate7->setText(m_summaryInterestRate->text());
+ m_startDateChanges->setText(KGlobal::locale()->formatDate(m_effectiveChangeDateEdit->date(), true));
+
+ // calculate the number of affected transactions
+ MyMoneyTransactionFilter filter(m_account.id());
+ filter.setDateFilter(m_effectiveChangeDateEdit->date(), QDate());
+
+ int count = 0;
+ QValueList<MyMoneyTransaction> list;
+ QValueList<MyMoneyTransaction>::ConstIterator it;
+ list = MyMoneyFile::instance()->transactionList(filter);
+
+ for(it = list.begin(); it != list.end(); ++it) {
+ QValueList<MyMoneySplit>::ConstIterator it_s;
+ int match = 0;
+ for(it_s = (*it).splits().begin(); it_s != (*it).splits().end(); ++it_s) {
+ // we only count those transactions that have an interest
+ // and amortization part
+ if((*it_s).action() == MyMoneySplit::ActionInterest)
+ match |= 0x01;
+ if((*it_s).action() == MyMoneySplit::ActionAmortization)
+ match |= 0x02;
+ }
+ if(match == 0x03)
+ count++;
+ }
+
+ m_affectedPayments->setText(QString().sprintf("%d", count));
+}
+
+const MyMoneySchedule KEditLoanWizard::schedule(void) const
+{
+ MyMoneySchedule sched = m_schedule;
+ sched.setTransaction(transaction());
+ sched.setOccurence(MyMoneySchedule::stringToOccurence(m_paymentFrequencyUnitEdit->currentText()));
+ if(m_nextDueDateEdit->date() < m_schedule.startDate())
+ sched.setStartDate(m_nextDueDateEdit->date());
+
+ return sched;
+}
+
+const MyMoneyAccount KEditLoanWizard::account(void) const
+{
+ MyMoneyAccountLoan acc(m_account);
+
+ if(m_interestOnReceptionButton->isChecked())
+ acc.setInterestCalculation(MyMoneyAccountLoan::paymentReceived);
+ else
+ acc.setInterestCalculation(MyMoneyAccountLoan::paymentDue);
+
+ acc.setFixedInterestRate(m_fixedInterestButton->isChecked());
+ acc.setFinalPayment(MyMoneyMoney(m_finalPaymentEdit->text()));
+ acc.setTerm(term());
+ acc.setPeriodicPayment(m_paymentEdit->value());
+ acc.setInterestRate(m_effectiveChangeDateEdit->date(), m_interestRateEdit->value());
+
+ acc.setPayee(m_payeeEdit->selectedItem());
+
+ if(m_variableInterestButton->isChecked()) {
+ acc.setNextInterestChange(m_interestChangeDateEdit->date());
+ acc.setInterestChangeFrequency(m_interestFrequencyAmountEdit->value(),
+ m_interestFrequencyUnitEdit->currentItem());
+ }
+
+ return acc;
+}
+
+const MyMoneyTransaction KEditLoanWizard::transaction() const
+{
+ MyMoneyTransaction t = KNewLoanWizard::transaction();
+ MyMoneySplit s = t.splitByAccount(QString("Phony-ID"));
+
+ s.setAccountId(m_account.id());
+ t.modifySplit(s);
+
+ return t;
+}
+
+#include "keditloanwizard.moc"
diff --git a/kmymoney2/dialogs/keditloanwizard.h b/kmymoney2/dialogs/keditloanwizard.h
new file mode 100644
index 0000000..0598248
--- /dev/null
+++ b/kmymoney2/dialogs/keditloanwizard.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ keditloanwizard.h - description
+ -------------------
+ begin : Wed Nov 12 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KEDITLOANWIZARD_H
+#define KEDITLOANWIZARD_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+
+#include <kmymoney/mymoneyaccount.h>
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KEditLoanWizard : public KNewLoanWizard
+{
+ Q_OBJECT
+public:
+ KEditLoanWizard(const MyMoneyAccount& account, QWidget *parent=0, const char *name=0);
+ ~KEditLoanWizard();
+
+ /**
+ * This method returns the schedule for the payments. The account
+ * where the amortization should be transferred to is the one
+ * we currently edited with this wizard.
+ *
+ * @return MyMoneySchedule object for payments
+ */
+ const MyMoneySchedule schedule(void) const;
+
+ /**
+ * This method returns a MyMoneyAccount object with all data
+ * filled out as provided by the wizard.
+ *
+ * @return updated MyMoneyAccount object
+ */
+ const MyMoneyAccount account(void) const;
+
+
+ void loadWidgets(const MyMoneyAccount& acc);
+
+ const MyMoneyTransaction transaction() const;
+
+public slots:
+ void next();
+
+protected slots:
+ virtual void slotCheckPageFinished(void);
+
+protected:
+ void updateEditSummary(void);
+
+private:
+ //MyMoneyAccountLoan m_account;
+ MyMoneySchedule m_schedule;
+ int m_lastSelection;
+ bool m_fullyRepayLoan;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/keditscheduledlg.cpp b/kmymoney2/dialogs/keditscheduledlg.cpp
new file mode 100644
index 0000000..635d564
--- /dev/null
+++ b/kmymoney2/dialogs/keditscheduledlg.cpp
@@ -0,0 +1,558 @@
+/***************************************************************************
+ keditscheduledlg.cpp - description
+ -------------------
+ begin : Mon Sep 3 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qtimer.h>
+#include <qwidgetlist.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qvaluevector.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+#include <klineedit.h>
+#include <knuminput.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/register.h>
+#include <kmymoney/transactionform.h>
+#include <kmymoney/transaction.h>
+#include <kmymoney/transactioneditor.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneycombo.h>
+#include <kmymoney/kguiutils.h>
+#include <kmymoney/kmymoneyutils.h>
+
+#include "keditscheduledlg.h"
+#include "../kmymoney2.h"
+
+class KEditScheduleDlg::Private {
+public:
+ MyMoneySchedule m_schedule;
+ KMyMoneyRegister::Transaction* m_item;
+ QWidgetList m_tabOrderWidgets;
+ TransactionEditor* m_editor;
+ kMandatoryFieldGroup* m_requiredFields;
+};
+
+KEditScheduleDlg::KEditScheduleDlg(const MyMoneySchedule& schedule, QWidget *parent, const char *name) :
+ KEditScheduleDlgDecl(parent, name, true),
+ d(new Private)
+{
+ d->m_schedule = schedule;
+ d->m_editor = 0;
+
+ buttonOk->setGuiItem(KStdGuiItem::ok());
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+ buttonHelp->setGuiItem(KStdGuiItem::help());
+
+ d->m_requiredFields = new kMandatoryFieldGroup (this);
+ d->m_requiredFields->setOkButton(buttonOk); // button to be enabled when all fields present
+
+ // make sure, we have a tabbar with the form
+ // insert it after the horizontal line
+ m_paymentInformationLayout->insertWidget(2, m_form->tabBar(m_form->parentWidget()));
+
+ // we never need to see the register
+ m_register->hide();
+
+ // ... setup the form ...
+ m_form->setupForm(d->m_schedule.account());
+
+ // ... and the register ...
+ m_register->clear();
+
+ // ... now add the transaction to register and form ...
+ MyMoneyTransaction t = transaction();
+ d->m_item = KMyMoneyRegister::Register::transactionFactory(m_register, t, d->m_schedule.transaction().splits()[0], 0);
+ m_register->selectItem(d->m_item);
+ // show the account row
+ d->m_item->setShowRowInForm(0, true);
+
+ m_form->slotSetTransaction(d->m_item);
+
+ // setup widget contents
+ m_nameEdit->setText(d->m_schedule.name());
+
+ m_frequencyEdit->setCurrentItem(d->m_schedule.occurencePeriod());
+ if(m_frequencyEdit->currentItem() == -1)
+ m_frequencyEdit->setCurrentItem(MyMoneySchedule::OCCUR_MONTHLY);
+ slotFrequencyChanged(m_frequencyEdit->currentItem());
+ m_frequencyNoEdit->setValue(d->m_schedule.occurenceMultiplier());
+
+ // load option widgets
+ m_paymentMethodEdit->insertItem(i18n("Direct deposit"), MyMoneySchedule::STYPE_DIRECTDEPOSIT);
+ m_paymentMethodEdit->insertItem(i18n("Manual deposit"), MyMoneySchedule::STYPE_MANUALDEPOSIT);
+ m_paymentMethodEdit->insertItem(i18n("Direct debit"), MyMoneySchedule::STYPE_DIRECTDEBIT);
+ m_paymentMethodEdit->insertItem(i18n("Standing order"), MyMoneySchedule::STYPE_STANDINGORDER);
+ m_paymentMethodEdit->insertItem(i18n("Bank transfer"), MyMoneySchedule::STYPE_BANKTRANSFER);
+ m_paymentMethodEdit->insertItem(i18n("Write check"), MyMoneySchedule::STYPE_WRITECHEQUE);
+ m_paymentMethodEdit->insertItem(i18n("Other"), MyMoneySchedule::STYPE_OTHER);
+
+ MyMoneySchedule::paymentTypeE method = d->m_schedule.paymentType();
+ if(method == MyMoneySchedule::STYPE_ANY)
+ method = MyMoneySchedule::STYPE_OTHER;
+ m_paymentMethodEdit->setCurrentItem(method);
+
+ switch(d->m_schedule.weekendOption()) {
+ case MyMoneySchedule::MoveNothing:
+ m_weekendOptionEdit->setCurrentItem(0);
+ break;
+ case MyMoneySchedule::MoveFriday:
+ m_weekendOptionEdit->setCurrentItem(1);
+ break;
+ case MyMoneySchedule::MoveMonday:
+ m_weekendOptionEdit->setCurrentItem(2);
+ break;
+ }
+ m_estimateEdit->setChecked(!d->m_schedule.isFixed());
+ m_autoEnterEdit->setChecked(d->m_schedule.autoEnter());
+ m_endSeriesEdit->setChecked(d->m_schedule.willEnd());
+
+ m_endOptionsFrame->setEnabled(d->m_schedule.willEnd());
+ if(d->m_schedule.willEnd()) {
+ m_RemainingEdit->setValue(d->m_schedule.transactionsRemaining());
+ m_FinalPaymentEdit->setDate(d->m_schedule.endDate());
+ }
+
+ connect(m_RemainingEdit, SIGNAL(valueChanged(int)),
+ this, SLOT(slotRemainingChanged(int)));
+ connect(m_FinalPaymentEdit, SIGNAL(dateChanged(const QDate&)),
+ this, SLOT(slotEndDateChanged(const QDate&)));
+ connect(m_frequencyEdit, SIGNAL(itemSelected(int)),
+ this, SLOT(slotFrequencyChanged(int)));
+ connect(m_frequencyNoEdit, SIGNAL(valueChanged(int)),
+ this, SLOT(slotOccurenceMultiplierChanged(int)));
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(slotShowHelp()));
+
+ // force the initial height to be as small as possible
+ QTimer::singleShot(0, this, SLOT(slotSetupSize()));
+
+ // we just hide the variation field for now and enable the logic
+ // once we have a respective member in the MyMoneySchedule object
+ m_variation->hide();
+}
+
+KEditScheduleDlg::~KEditScheduleDlg()
+{
+ delete d;
+}
+
+void KEditScheduleDlg::slotSetupSize(void)
+{
+ resize(width(), minimumSizeHint().height());
+}
+
+TransactionEditor* KEditScheduleDlg::startEdit(void)
+{
+ KMyMoneyRegister::SelectedTransactions list(m_register);
+ TransactionEditor* editor = d->m_item->createEditor(m_form, list, QDate());
+
+ // check that we use the same transaction commodity in all selected transactions
+ // if not, we need to update this in the editor's list. The user can also bail out
+ // of this operation which means that we have to stop editing here.
+ if(editor && !d->m_schedule.account().id().isEmpty()) {
+ if(!editor->fixTransactionCommodity(d->m_schedule.account())) {
+ // if the user wants to quit, we need to destroy the editor
+ // and bail out
+ delete editor;
+ editor = 0;
+ }
+ }
+
+ if(editor) {
+ connect(editor, SIGNAL(transactionDataSufficient(bool)), buttonOk, SLOT(setEnabled(bool)));
+ connect(editor, SIGNAL(escapePressed()), buttonCancel, SLOT(animateClick()));
+ connect(editor, SIGNAL(returnPressed()), buttonOk, SLOT(animateClick()));
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), editor, SLOT(slotReloadEditWidgets()));
+ // connect(editor, SIGNAL(finishEdit(const KMyMoneyRegister::SelectedTransactions&)), this, SLOT(slotLeaveEditMode(const KMyMoneyRegister::SelectedTransactions&)));
+ connect(editor, SIGNAL(createPayee(const QString&, QString&)), kmymoney2, SLOT(slotPayeeNew(const QString&, QString&)));
+ connect(editor, SIGNAL(createCategory(MyMoneyAccount&, const MyMoneyAccount&)), kmymoney2, SLOT(slotCategoryNew(MyMoneyAccount&, const MyMoneyAccount&)));
+ connect(editor, SIGNAL(createSecurity(MyMoneyAccount&, const MyMoneyAccount&)), kmymoney2, SLOT(slotInvestmentNew(MyMoneyAccount&, const MyMoneyAccount&)));
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), editor, SLOT(slotReloadEditWidgets()));
+
+ // create the widgets, place them in the parent and load them with data
+ // setup tab order
+ d->m_tabOrderWidgets.clear();
+ KMyMoneyRegister::Action action = KMyMoneyRegister::ActionWithdrawal;
+ switch(d->m_schedule.type()) {
+ case MyMoneySchedule::TYPE_DEPOSIT:
+ action = KMyMoneyRegister::ActionDeposit;
+ break;
+ case MyMoneySchedule::TYPE_BILL:
+ action = KMyMoneyRegister::ActionWithdrawal;
+ break;
+ case MyMoneySchedule::TYPE_TRANSFER:
+ action = KMyMoneyRegister::ActionTransfer;
+ break;
+ default:
+ // if we end up here, we don't have a known schedule type (yet). in this case, we just glimpse
+ // into the transaction and determine the type. in case we don't have a transaction with splits
+ // we stick with the default action already set up
+ if(d->m_schedule.transaction().splits().count() > 0) {
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ bool isDeposit = false;
+ bool isTransfer = false;
+ for(it_s = d->m_schedule.transaction().splits().begin(); it_s != d->m_schedule.transaction().splits().end(); ++it_s) {
+ if((*it_s).accountId() == d->m_schedule.account().id()) {
+ isDeposit = !((*it_s).shares().isNegative());
+ } else {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId());
+ if(acc.isAssetLiability() && d->m_schedule.transaction().splits().count() == 2) {
+ isTransfer = true;
+ }
+ }
+ }
+
+ if(isTransfer)
+ action = KMyMoneyRegister::ActionTransfer;
+ else if(isDeposit)
+ action = KMyMoneyRegister::ActionDeposit;
+ }
+ break;
+ }
+ editor->setup(d->m_tabOrderWidgets, d->m_schedule.account(), action);
+
+ // if it's not a check, then we need to clear
+ // a possibly assigned check number
+ if(d->m_schedule.paymentType() != MyMoneySchedule::STYPE_WRITECHEQUE) {
+ QWidget* w = editor->haveWidget("number");
+ if(w)
+ dynamic_cast<kMyMoneyLineEdit*>(w)->loadText(QString());
+ }
+
+ Q_ASSERT(!d->m_tabOrderWidgets.isEmpty());
+
+ // don't forget our three buttons and additional widgets
+ d->m_tabOrderWidgets.append(m_weekendOptionEdit);
+ d->m_tabOrderWidgets.append(m_estimateEdit);
+ d->m_tabOrderWidgets.append(m_variation);
+ d->m_tabOrderWidgets.append(m_autoEnterEdit);
+ d->m_tabOrderWidgets.append(m_endSeriesEdit);
+ d->m_tabOrderWidgets.append(m_RemainingEdit);
+ d->m_tabOrderWidgets.append(m_FinalPaymentEdit);
+
+ d->m_tabOrderWidgets.append(buttonOk);
+ d->m_tabOrderWidgets.append(buttonCancel);
+ d->m_tabOrderWidgets.append(buttonHelp);
+ d->m_tabOrderWidgets.append(m_nameEdit);
+ d->m_tabOrderWidgets.append(m_frequencyNoEdit);
+ d->m_tabOrderWidgets.append(m_frequencyEdit);
+ d->m_tabOrderWidgets.append(m_paymentMethodEdit);
+ d->m_tabOrderWidgets.append(m_form);
+
+ // install event filter in all taborder widgets
+ QWidget* w;
+ for(w = d->m_tabOrderWidgets.first(); w; w = d->m_tabOrderWidgets.next()) {
+ w->installEventFilter(this);
+ w->installEventFilter(editor);
+ }
+
+ // connect the postdate modification signal to our update routine
+ kMyMoneyDateInput* dateEdit = dynamic_cast<kMyMoneyDateInput*>(editor->haveWidget("postdate"));
+ if(dateEdit)
+ connect(dateEdit, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotPostDateChanged(const QDate&)));
+
+
+ m_nameEdit->setFocus();
+
+ // add the required fields to the mandatory group
+ d->m_requiredFields->add(m_nameEdit);
+ d->m_requiredFields->add(editor->haveWidget("account"));
+ d->m_requiredFields->add(editor->haveWidget("category"));
+
+ // fix labels
+ QLabel* label = dynamic_cast<QLabel*>(editor->haveWidget("date-label"));
+ if(label) {
+ label->setText(i18n("Next due date"));
+ }
+
+ d->m_editor = editor;
+ slotSetPaymentMethod(d->m_schedule.paymentType());
+
+ connect(m_paymentMethodEdit, SIGNAL(itemSelected(int)), this, SLOT(slotSetPaymentMethod(int)));
+ }
+
+ return editor;
+}
+
+void KEditScheduleDlg::accept(void)
+{
+ // Force the focus to be on the OK button. This will trigger creation
+ // of any unknown objects (payees, categories etc.)
+ buttonOk->setFocus();
+
+ // only accept if the button is really still enabled. We could end
+ // up here, if the user filled all fields, the focus is on the category
+ // field, but the category is not yet existant. When the user presses the
+ // OK button in this context, he will be asked if he wants to create
+ // the category or not. In case he decides no, we end up here with no
+ // category filled in, so we don't run through the final acceptance.
+ if(buttonOk->isEnabled())
+ KEditScheduleDlgDecl::accept();
+}
+
+const MyMoneySchedule& KEditScheduleDlg::schedule(void) const
+{
+ if(d->m_editor) {
+ MyMoneyTransaction t = transaction();
+ if(d->m_schedule.nextDueDate() != t.postDate())
+ d->m_schedule.setNextDueDate(t.postDate());
+ d->m_schedule.setTransaction(t);
+ d->m_schedule.setName(m_nameEdit->text());
+ d->m_schedule.setFixed(!m_estimateEdit->isChecked());
+ d->m_schedule.setOccurencePeriod(static_cast<MyMoneySchedule::occurenceE>(m_frequencyEdit->currentItem()));
+ d->m_schedule.setOccurenceMultiplier( m_frequencyNoEdit->value() );
+
+ switch(m_weekendOptionEdit->currentItem()) {
+ case 0:
+ d->m_schedule.setWeekendOption(MyMoneySchedule::MoveNothing);
+ break;
+ case 1:
+ d->m_schedule.setWeekendOption(MyMoneySchedule::MoveFriday);
+ break;
+ case 2:
+ d->m_schedule.setWeekendOption(MyMoneySchedule::MoveMonday);
+ break;
+ }
+
+ d->m_schedule.setType(MyMoneySchedule::TYPE_BILL);
+ KMyMoneyTransactionForm::TabBar* tabbar = dynamic_cast<KMyMoneyTransactionForm::TabBar*>(d->m_editor->haveWidget("tabbar"));
+ if(tabbar) {
+ switch(static_cast<KMyMoneyRegister::Action>(tabbar->currentTab())) {
+ case KMyMoneyRegister::ActionDeposit:
+ d->m_schedule.setType(MyMoneySchedule::TYPE_DEPOSIT);
+ break;
+ default:
+ case KMyMoneyRegister::ActionWithdrawal:
+ d->m_schedule.setType(MyMoneySchedule::TYPE_BILL);
+ break;
+ case KMyMoneyRegister::ActionTransfer:
+ d->m_schedule.setType(MyMoneySchedule::TYPE_TRANSFER);
+ break;
+ }
+ } else {
+ qDebug("No tabbar found in KEditScheduleDlg::schedule(). Defaulting type to BILL");
+ }
+
+ d->m_schedule.setAutoEnter(m_autoEnterEdit->isChecked());
+ d->m_schedule.setPaymentType(static_cast<MyMoneySchedule::paymentTypeE>(m_paymentMethodEdit->currentItem()));
+ if(m_endSeriesEdit->isEnabled() && m_endSeriesEdit->isChecked()) {
+ d->m_schedule.setEndDate(m_FinalPaymentEdit->date());
+ } else {
+ d->m_schedule.setEndDate(QDate());
+ }
+ }
+ return d->m_schedule;
+}
+
+MyMoneyTransaction KEditScheduleDlg::transaction(void) const
+{
+ MyMoneyTransaction t = d->m_schedule.transaction();
+
+ if(d->m_editor) {
+ d->m_editor->createTransaction(t, d->m_schedule.transaction(), d->m_schedule.transaction().splits()[0], false);
+ }
+
+ t.clearId();
+ t.setEntryDate(QDate());
+ return t;
+}
+
+bool KEditScheduleDlg::focusNextPrevChild(bool next)
+{
+ bool rc = false;
+
+ // qDebug("KEditScheduleDlg::focusNextPrevChild(editmode=%s)", m_inEditMode ? "true" : "false");
+ QWidget *w = 0;
+ QWidget *currentWidget;
+
+ w = qApp->focusWidget();
+ while(w && d->m_tabOrderWidgets.find(w) == -1) {
+ // qDebug("'%s' not in list, use parent", w->className());
+ w = w->parentWidget();
+ }
+ // if(w) qDebug("tab order is at '%s'", w->className());
+ currentWidget = d->m_tabOrderWidgets.current();
+ w = next ? d->m_tabOrderWidgets.next() : d->m_tabOrderWidgets.prev();
+
+ do {
+ if(!w) {
+ w = next ? d->m_tabOrderWidgets.first() : d->m_tabOrderWidgets.last();
+ }
+
+ if(w != currentWidget
+ && ((w->focusPolicy() & TabFocus) == TabFocus)
+ && w->isVisible() && w->isEnabled()) {
+ // qDebug("Selecting '%s' as focus", w->className());
+ w->setFocus();
+ rc = true;
+ break;
+ }
+ w = next ? d->m_tabOrderWidgets.next() : d->m_tabOrderWidgets.prev();
+ } while(w != currentWidget);
+
+ return rc;
+}
+
+void KEditScheduleDlg::resizeEvent(QResizeEvent* ev)
+{
+ m_register->resize(KMyMoneyRegister::DetailColumn);
+ m_form->resize(KMyMoneyTransactionForm::ValueColumn1);
+ KEditScheduleDlgDecl::resizeEvent(ev);
+}
+
+
+void KEditScheduleDlg::slotRemainingChanged(int value)
+{
+ // Make sure the required fields are set
+ kMyMoneyDateInput* dateEdit = dynamic_cast<kMyMoneyDateInput*>(d->m_editor->haveWidget("postdate"));
+ d->m_schedule.setNextDueDate(dateEdit->date());
+ d->m_schedule.setOccurencePeriod(static_cast<MyMoneySchedule::occurenceE>(m_frequencyEdit->currentItem()));
+ d->m_schedule.setOccurenceMultiplier(m_frequencyNoEdit->value());
+
+ if(d->m_schedule.transactionsRemaining() != value) {
+ m_FinalPaymentEdit->blockSignals(true);
+ m_FinalPaymentEdit->setDate(d->m_schedule.dateAfter(value));
+ m_FinalPaymentEdit->blockSignals(false);
+ }
+}
+
+void KEditScheduleDlg::slotEndDateChanged(const QDate& date)
+{
+ // Make sure the required fields are set
+ kMyMoneyDateInput* dateEdit = dynamic_cast<kMyMoneyDateInput*>(d->m_editor->haveWidget("postdate"));
+ d->m_schedule.setNextDueDate(dateEdit->date());
+ d->m_schedule.setOccurencePeriod(static_cast<MyMoneySchedule::occurenceE>(m_frequencyEdit->currentItem()));
+ d->m_schedule.setOccurenceMultiplier(m_frequencyNoEdit->value());
+
+ if(d->m_schedule.endDate() != date) {
+ d->m_schedule.setEndDate(date);
+ updateTransactionsRemaining();
+ }
+}
+
+void KEditScheduleDlg::slotPostDateChanged(const QDate& date)
+{
+ if(d->m_schedule.nextDueDate() != date) {
+ if (m_endOptionsFrame->isEnabled()) {
+ d->m_schedule.setNextDueDate(date);
+ d->m_schedule.setOccurenceMultiplier(m_frequencyNoEdit->value());
+ d->m_schedule.setOccurencePeriod(static_cast<MyMoneySchedule::occurenceE>(m_frequencyEdit->currentItem()));
+ d->m_schedule.setEndDate(m_FinalPaymentEdit->date());
+ updateTransactionsRemaining();
+ }
+ }
+}
+
+void KEditScheduleDlg::slotSetPaymentMethod(int item)
+{
+ kMyMoneyLineEdit* dateEdit = dynamic_cast<kMyMoneyLineEdit*>(d->m_editor->haveWidget("number"));
+ if(dateEdit) {
+ dateEdit->setShown(item == MyMoneySchedule::STYPE_WRITECHEQUE);
+
+ // hiding the label does not work, because the label underneath will shine
+ // through. So we either write the label or a blank
+ QLabel* label = dynamic_cast<QLabel *>(d->m_editor->haveWidget("number-label"));
+ if(label) {
+ label->setText((item == MyMoneySchedule::STYPE_WRITECHEQUE) ? i18n("Number") : " ");
+ }
+ }
+}
+
+void KEditScheduleDlg::slotFrequencyChanged(int item)
+{
+ m_endSeriesEdit->setEnabled(item != MyMoneySchedule::OCCUR_ONCE);
+ bool isEndSeries = m_endSeriesEdit->isChecked();
+ if(isEndSeries )
+ m_endOptionsFrame->setEnabled(item != MyMoneySchedule::OCCUR_ONCE);
+ switch( item )
+ {
+ case MyMoneySchedule::OCCUR_DAILY:
+ case MyMoneySchedule::OCCUR_WEEKLY:
+ case MyMoneySchedule::OCCUR_EVERYHALFMONTH:
+ case MyMoneySchedule::OCCUR_MONTHLY:
+ case MyMoneySchedule::OCCUR_YEARLY:
+ // Supports Frequency Number
+ m_frequencyNoEdit->setEnabled(true);
+ break;
+ default:
+ // Multiplier is always 1
+ m_frequencyNoEdit->setEnabled(false);
+ m_frequencyNoEdit->setValue(1);
+ break;
+ }
+ if ( isEndSeries && ( item != MyMoneySchedule::OCCUR_ONCE ) )
+ {
+ // Changing the frequency changes the number
+ // of remaining transactions
+ kMyMoneyDateInput* dateEdit = dynamic_cast<kMyMoneyDateInput*>(d->m_editor->haveWidget("postdate"));
+ d->m_schedule.setNextDueDate(dateEdit->date());
+ d->m_schedule.setOccurenceMultiplier(m_frequencyNoEdit->value());
+ d->m_schedule.setOccurencePeriod(static_cast<MyMoneySchedule::occurenceE>(item));
+ d->m_schedule.setEndDate(m_FinalPaymentEdit->date());
+ updateTransactionsRemaining();
+ }
+}
+
+void KEditScheduleDlg::slotOccurenceMultiplierChanged(int multiplier)
+{
+ // Make sure the required fields are set
+ int oldOccurenceMultiplier = d->m_schedule.occurenceMultiplier();
+ if ( multiplier != oldOccurenceMultiplier )
+ {
+ if (m_endOptionsFrame->isEnabled())
+ {
+ kMyMoneyDateInput* dateEdit = dynamic_cast<kMyMoneyDateInput*>(d->m_editor->haveWidget("postdate"));
+ d->m_schedule.setNextDueDate(dateEdit->date());
+ d->m_schedule.setOccurenceMultiplier(multiplier);
+ d->m_schedule.setOccurencePeriod(static_cast<MyMoneySchedule::occurenceE>(m_frequencyEdit->currentItem()));
+ d->m_schedule.setEndDate(m_FinalPaymentEdit->date());
+ updateTransactionsRemaining();
+ }
+ }
+}
+
+void KEditScheduleDlg::updateTransactionsRemaining(void)
+{
+ int remain = d->m_schedule.transactionsRemaining();
+ if ( remain != m_RemainingEdit->value() )
+ {
+ m_RemainingEdit->blockSignals(true);
+ m_RemainingEdit->setValue(remain);
+ m_RemainingEdit->blockSignals(false);
+ }
+}
+
+void KEditScheduleDlg::slotShowHelp(void)
+{
+ kapp->invokeHelp("details.schedules.intro");
+}
+
+#include <keditscheduledlg.moc>
diff --git a/kmymoney2/dialogs/keditscheduledlg.h b/kmymoney2/dialogs/keditscheduledlg.h
new file mode 100644
index 0000000..94c3101
--- /dev/null
+++ b/kmymoney2/dialogs/keditscheduledlg.h
@@ -0,0 +1,103 @@
+/***************************************************************************
+ keditscheduledlg.h - description
+ -------------------
+ begin : Mon Sep 3 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KEDITSCHEDULEDLG_H
+#define KEDITSCHEDULEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/mymoneyscheduled.h>
+#include "../dialogs/keditscheduledlgdecl.h"
+
+class TransactionEditor;
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KEditScheduleDlg : public KEditScheduleDlgDecl
+{
+ Q_OBJECT
+public:
+ /**
+ * Standard QWidget constructor.
+ **/
+ KEditScheduleDlg(const MyMoneySchedule& schedule, QWidget *parent=0, const char *name=0);
+
+ /**
+ * Standard destructor.
+ **/
+ ~KEditScheduleDlg();
+
+ TransactionEditor* startEdit(void);
+
+ /**
+ * Returns the edited schedule.
+ *
+ * @return MyMoneySchedule The schedule details.
+ **/
+ const MyMoneySchedule& schedule(void) const;
+
+protected:
+ MyMoneyTransaction transaction(void) const;
+ /**
+ * This method adjusts @a _date according to the rules specified by
+ * the schedule's weekend option.
+ */
+ QDate adjustDate(const QDate& _date) const;
+
+ /// Overridden for internal reasons. No API changes.
+ bool focusNextPrevChild(bool next);
+
+ /// Overridden for internal reasons. No API changes.
+ void resizeEvent(QResizeEvent* ev);
+
+private slots:
+ void slotSetupSize(void);
+ void slotRemainingChanged(int);
+ void slotEndDateChanged(const QDate& date);
+ void slotPostDateChanged(const QDate& date);
+ void slotSetPaymentMethod(int);
+ void slotFrequencyChanged(int item);
+ void slotShowHelp(void);
+ void slotOccurenceMultiplierChanged(int mult);
+
+ /// Overridden for internal reasons. No API changes.
+ void accept(void);
+
+private:
+ /**
+ * Helper method to recalculate and update Transactions Remaining
+ * when other values are changed
+ */
+ void updateTransactionsRemaining(void);
+
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/keditscheduledlgdecl.ui b/kmymoney2/dialogs/keditscheduledlgdecl.ui
new file mode 100644
index 0000000..8555c58
--- /dev/null
+++ b/kmymoney2/dialogs/keditscheduledlgdecl.ui
@@ -0,0 +1,532 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KEditScheduleDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KEditScheduleDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>798</width>
+ <height>640</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Scheduled transaction</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Schedule name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>m_nameEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Frequency:</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>m_frequencyNoEdit</cstring>
+ </property>
+ <property name="maxValue">
+ <number>999</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Number of selected periods between entries</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyOccurencePeriodCombo">
+ <property name="name">
+ <cstring>m_frequencyEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_paymentInformation</cstring>
+ </property>
+ <property name="title">
+ <string>Payment information</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Payment method</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo">
+ <property name="name">
+ <cstring>m_paymentMethodEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="KMyMoneyRegister::Register">
+ <column>
+ <property name="text">
+ <string>Security</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Details</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>C</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Payment</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Deposit</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Quantity</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Balance</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_register</cstring>
+ </property>
+ <property name="numRows">
+ <number>0</number>
+ </property>
+ <property name="numCols">
+ <number>12</number>
+ </property>
+ </widget>
+ <widget class="KMyMoneyTransactionForm::TransactionForm">
+ <property name="name">
+ <cstring>m_form</cstring>
+ </property>
+ <property name="numRows">
+ <number>5</number>
+ </property>
+ <property name="numCols">
+ <number>1</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Do nothing</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Change the date to the previous Friday</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Change the date to the next Monday</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_weekendOptionEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>If this schedule occurs on the weekend:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_estimateEdit</cstring>
+ </property>
+ <property name="text">
+ <string>The amount is an estimate because it varies for each payment</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>m_variation</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_autoEnterEdit</cstring>
+ </property>
+ <property name="text">
+ <string>Enter this schedule into the register automatically when it is due</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_endSeriesEdit</cstring>
+ </property>
+ <property name="text">
+ <string>This schedule will end at some time</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_endOptionsFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_endLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Number of transactions remaining:</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>m_RemainingEdit</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>9999</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_endLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Date of final transaction:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_FinalPaymentEdit</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10_3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>280</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KEditScheduleDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>m_endSeriesEdit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_endOptionsFrame</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KEditScheduleDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>m_estimateEdit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_variation</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kendingbalancedlg.cpp b/kmymoney2/dialogs/kendingbalancedlg.cpp
new file mode 100644
index 0000000..0760cc2
--- /dev/null
+++ b/kmymoney2/dialogs/kendingbalancedlg.cpp
@@ -0,0 +1,611 @@
+/***************************************************************************
+ kendingbalancedlg.cpp
+ -------------------
+ copyright : (C) 2000,2003 by Michael Edwardes, Thomas Baumgart
+ email : mte@users.sourceforge.net
+ ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qpixmap.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <kapplication.h>
+#include <kactivelabel.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kendingbalancedlg.h"
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/mymoneysplit.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+
+#include "../dialogs/kcurrencycalculator.h"
+
+class KEndingBalanceDlg::Private
+{
+public:
+ MyMoneyTransaction m_tInterest;
+ MyMoneyTransaction m_tCharges;
+ MyMoneyAccount m_account;
+ QMap<QWidget*, QString> m_helpAnchor;
+};
+
+class KEndingBalanceLoanDlg::Private
+{
+public:
+ MyMoneyTransaction m_tInterest;
+ MyMoneyTransaction m_tCharges;
+ MyMoneyAccountLoan m_account;
+ QMap<QWidget*, QString> m_helpAnchor;
+};
+
+KEndingBalanceDlg::KEndingBalanceDlg(const MyMoneyAccount& account, QWidget *parent, const char *name) :
+ KEndingBalanceDlgDecl(parent, name, true),
+ d(new Private)
+{
+ QString value;
+ MyMoneyMoney endBalance, startBalance;
+
+ d->m_account = account;
+
+ MyMoneySecurity currency = MyMoneyFile::instance()->security(account.currencyId());
+ m_enterInformationLabel->setText(QString("<qt>")+i18n("Please enter the following fields with the information as you find them on your statement. Make sure to enter all values in <b>%1</b>.").arg(currency.name())+QString("</qt>"));
+
+ m_statementDate->setDate(QDate::currentDate());
+
+ // If the previous reconciliation was postponed,
+ // we show a different first page
+ value = account.value("lastReconciledBalance");
+ if(value.isEmpty()) {
+ // if the last statement has been entered long enough ago (more than one month),
+ // then take the last statement date and add one month and use that as statement
+ // date.
+ QDate lastStatementDate = account.lastReconciliationDate();
+ if(lastStatementDate.addMonths(1) < QDate::currentDate()) {
+ m_statementDate->setDate(lastStatementDate.addMonths(1));
+ }
+
+ slotUpdateBalances();
+
+ setAppropriate(m_startPageCheckings, true);
+ setAppropriate(m_pagePreviousPostpone, false);
+ setAppropriate(m_interestChargeCheckings, true);
+ setFinishEnabled(m_interestChargeCheckings, true);
+ } else {
+ setAppropriate(m_startPageCheckings, false);
+ setAppropriate(m_pagePreviousPostpone, true);
+ removePage(m_interestChargeCheckings);
+ setFinishEnabled(m_statementInfoPageCheckings, true);
+ // make sure, we show the correct start page
+ showPage(m_pagePreviousPostpone);
+
+ MyMoneyMoney factor(1,1);
+ if(d->m_account.accountGroup() == MyMoneyAccount::Liability)
+ factor = -factor;
+
+ startBalance = MyMoneyMoney(value)*factor;
+ value = account.value("statementBalance");
+ endBalance = MyMoneyMoney(value)*factor;
+
+ m_previousBalance->setValue(startBalance);
+ m_endingBalance->setValue(endBalance);
+ }
+
+ // We don't need to add the default into the list (see ::help() why)
+ // m_helpAnchor[m_startPageCheckings] = QString("");
+ d->m_helpAnchor[m_interestChargeCheckings] = QString("details.reconcile.wizard.interest");
+ d->m_helpAnchor[m_statementInfoPageCheckings] = QString("details.reconcile.wizard.statement");
+
+ value = account.value("statementDate");
+ if(!value.isEmpty())
+ m_statementDate->setDate(QDate::fromString(value, Qt::ISODate));
+
+ m_lastStatementDate->setText(QString());
+ if(account.lastReconciliationDate().isValid()) {
+ m_lastStatementDate->setText(i18n("Last reconciled statement: %1")
+ .arg(KGlobal::locale()->formatDate(account.lastReconciliationDate(), true)));
+ }
+
+ // remove all unwanted pages
+ removePage(m_startPageLoan);
+ removePage(m_checkPaymentsPage);
+ removePage(m_adjustmentTransactionPage);
+
+ // connect the signals with the slots
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotReloadEditWidgets()));
+ connect(m_payeeEdit, SIGNAL(createItem(const QString&, QString&)), this, SIGNAL(createPayee(const QString&, QString&)));
+ connect(m_interestCategoryEdit, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateInterestCategory(const QString&, QString&)));
+ connect(m_chargesCategoryEdit, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateChargesCategory(const QString&, QString&)));
+
+ connect(m_interestEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_interestCategoryEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_chargesEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_chargesCategoryEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_statementDate, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotUpdateBalances()));
+
+ slotReloadEditWidgets();
+
+ // preset payee if possible
+ try {
+ // if we find a payee with the same name as the institution,
+ // than this is what we use as payee.
+ if(!d->m_account.institutionId().isEmpty()) {
+ MyMoneyInstitution inst = MyMoneyFile::instance()->institution(d->m_account.institutionId());
+ MyMoneyPayee payee = MyMoneyFile::instance()->payeeByName(inst.name());
+ m_payeeEdit->setSelectedItem(payee.id());
+ }
+ } catch(MyMoneyException *e) {
+ delete e;
+ }
+}
+
+KEndingBalanceDlg::~KEndingBalanceDlg()
+{
+ delete d;
+}
+
+void KEndingBalanceDlg::slotUpdateBalances(void)
+{
+ MYMONEYTRACER(tracer);
+
+ // determine the beginning balance and ending balance based on the following
+ // forumulas:
+ //
+ // end balance = current balance - sum(all non cleared transactions)
+ // - sum(all cleared transactions posted
+ // after statement date)
+ // start balance = end balance - sum(all cleared transactions
+ // up to statement date)
+ MyMoneyTransactionFilter filter(d->m_account.id());
+ filter.addState(MyMoneyTransactionFilter::notReconciled);
+ filter.addState(MyMoneyTransactionFilter::cleared);
+ filter.setReportAllSplits(true);
+
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> > transactionList;
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> >::const_iterator it;
+
+ // retrieve the list from the engine
+ MyMoneyFile::instance()->transactionList(transactionList, filter);
+
+ MyMoneyMoney balance = MyMoneyFile::instance()->balance(d->m_account.id());
+ MyMoneyMoney factor(1,1);
+ if(d->m_account.accountGroup() == MyMoneyAccount::Liability)
+ factor = -factor;
+
+ MyMoneyMoney endBalance, startBalance;
+ balance = balance * factor;
+ endBalance = startBalance = balance;
+
+ tracer.printf("total balance = %s", endBalance.formatMoney("", 2).data());
+
+ for(it = transactionList.begin(); it != transactionList.end(); ++it) {
+ const MyMoneySplit& split = (*it).second;
+ balance -= split.shares() * factor;
+ if((*it).first.postDate() > m_statementDate->date()) {
+ tracer.printf("Reducing balances by %s because postdate of %s/%s(%s) is past statement date", (split.shares() * factor).formatMoney("", 2).data(), (*it).first.id().data(),split.id().data(), (*it).first.postDate().toString(Qt::ISODate).data());
+ endBalance -= split.shares() * factor;
+ startBalance -= split.shares() * factor;
+ } else {
+ switch(split.reconcileFlag()) {
+ case MyMoneySplit::NotReconciled:
+ tracer.printf("Reducing balances by %s because %s/%s(%s) is not reconciled", (split.shares() * factor).formatMoney("", 2).data(), (*it).first.id().data(), split.id().data(), (*it).first.postDate().toString(Qt::ISODate).data());
+ endBalance -= split.shares() * factor;
+ startBalance -= split.shares() * factor;
+ break;
+ case MyMoneySplit::Cleared:
+ tracer.printf("Reducing start balance by %s because %s/%s(%s) is cleared", (split.shares() * factor).formatMoney("", 2).data(), (*it).first.id().data(), split.id().data(), (*it).first.postDate().toString(Qt::ISODate).data());
+ startBalance -= split.shares() * factor;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ m_previousBalance->setValue(startBalance);
+ m_endingBalance->setValue(endBalance);
+ tracer.printf("total balance = %s", endBalance.formatMoney("", 2).data());
+ tracer.printf("start balance = %s", startBalance.formatMoney("", 2).data());
+
+ m_interestDateEdit->setDate(m_statementDate->date());
+ m_chargesDateEdit->setDate(m_statementDate->date());
+}
+
+void KEndingBalanceDlg::accept(void)
+{
+ if(createTransaction(d->m_tInterest, -1, m_interestEdit, m_interestCategoryEdit, m_interestDateEdit)
+ && createTransaction(d->m_tCharges, 1, m_chargesEdit, m_chargesCategoryEdit, m_chargesDateEdit))
+ KEndingBalanceDlgDecl::accept();
+}
+
+void KEndingBalanceDlg::slotCreateInterestCategory(const QString& txt, QString& id)
+{
+ createCategory(txt, id, MyMoneyFile::instance()->income());
+}
+
+void KEndingBalanceDlg::slotCreateChargesCategory(const QString& txt, QString& id)
+{
+ createCategory(txt, id, MyMoneyFile::instance()->expense());
+}
+
+void KEndingBalanceDlg::createCategory(const QString& txt, QString& id, const MyMoneyAccount& parent)
+{
+ MyMoneyAccount acc;
+ acc.setName(txt);
+
+ emit createCategory(acc, parent);
+
+ id = acc.id();
+}
+
+const MyMoneyMoney KEndingBalanceDlg::endingBalance(void) const
+{
+ return adjustedReturnValue(m_endingBalance->value());
+}
+
+const MyMoneyMoney KEndingBalanceDlg::previousBalance(void) const
+{
+ return adjustedReturnValue(m_previousBalance->value());
+}
+
+const MyMoneyMoney KEndingBalanceDlg::adjustedReturnValue(const MyMoneyMoney& v) const
+{
+ return d->m_account.accountGroup() == MyMoneyAccount::Liability ? -v : v;
+}
+
+void KEndingBalanceDlg::slotReloadEditWidgets(void)
+{
+ QString payeeId, interestId, chargesId;
+
+ // keep current selected items
+ payeeId = m_payeeEdit->selectedItem();
+ interestId = m_interestCategoryEdit->selectedItem();
+ chargesId = m_chargesCategoryEdit->selectedItem();
+
+ // load the payee and category widgets with data from the engine
+ m_payeeEdit->loadPayees(MyMoneyFile::instance()->payeeList());
+
+ // a user request to show all categories in both selectors due to a valid use case.
+ AccountSet aSet;
+ aSet.addAccountGroup(MyMoneyAccount::Expense);
+ aSet.addAccountGroup(MyMoneyAccount::Income);
+ aSet.load(m_interestCategoryEdit->selector());
+ aSet.load(m_chargesCategoryEdit->selector());
+
+ // reselect currently selected items
+ if(!payeeId.isEmpty())
+ m_payeeEdit->setSelectedItem(payeeId);
+ if(!interestId.isEmpty())
+ m_interestCategoryEdit->setSelectedItem(interestId);
+ if(!chargesId.isEmpty())
+ m_chargesCategoryEdit->setSelectedItem(chargesId);
+}
+
+void KEndingBalanceDlg::slotCheckPageFinished(void)
+{
+ nextButton()->setEnabled(true);
+ finishButton()->setEnabled(true);
+
+ if(currentPage() == m_interestChargeCheckings) {
+ int cnt1, cnt2;
+ cnt1 = !m_interestEdit->value().isZero() + !m_interestCategoryEdit->selectedItem().isEmpty();
+ cnt2 = !m_chargesEdit->value().isZero() + !m_chargesCategoryEdit->selectedItem().isEmpty();
+ if(cnt1 == 1 || cnt2 == 1) {
+ finishButton()->setEnabled(false);
+ nextButton()->setEnabled(false);
+ }
+ }
+}
+
+const MyMoneyTransaction KEndingBalanceDlg::interestTransaction(void)
+{
+ return d->m_tInterest;
+}
+
+const MyMoneyTransaction KEndingBalanceDlg::chargeTransaction(void)
+{
+ return d->m_tCharges;
+}
+
+bool KEndingBalanceDlg::createTransaction(MyMoneyTransaction &t, const int sign, kMyMoneyEdit *amountEdit, KMyMoneyCategory *categoryEdit, kMyMoneyDateInput* dateEdit)
+{
+ t = MyMoneyTransaction();
+
+ if(!amountEdit->isValid() || categoryEdit->selectedItem().isEmpty() || !dateEdit->date().isValid())
+ return true;
+
+ MyMoneySplit s1, s2;
+ MyMoneyMoney val = amountEdit->value() * MyMoneyMoney(sign, 1);
+ try {
+ t.setPostDate(dateEdit->date());
+ t.setCommodity(d->m_account.currencyId());
+
+ s1.setPayeeId(m_payeeEdit->selectedItem());
+ s1.setReconcileFlag(MyMoneySplit::Cleared);
+ s1.setAccountId(d->m_account.id());
+ s1.setValue(-val);
+ s1.setShares(-val);
+
+ s2 = s1;
+ s2.setAccountId(categoryEdit->selectedItem());
+ s2.setValue(val);
+
+ t.addSplit(s1);
+ t.addSplit(s2);
+
+ QMap<QString, MyMoneyMoney> priceInfo; // just empty
+ MyMoneyMoney shares;
+ if(!KCurrencyCalculator::setupSplitPrice(shares, t, s2, priceInfo, this)) {
+ t = MyMoneyTransaction();
+ return false;
+ }
+
+ s2.setShares(shares);
+ t.modifySplit(s2);
+
+ } catch(MyMoneyException *e) {
+ qDebug("%s", e->what().data());
+ delete e;
+ t = MyMoneyTransaction();
+ return false;
+ }
+
+ return true;
+}
+
+void KEndingBalanceDlg::help(void)
+{
+ QString anchor = d->m_helpAnchor[currentPage()];
+ if(anchor.isEmpty())
+ anchor = QString("details.reconcile.whatis");
+
+ kapp->invokeHelp(anchor);
+}
+
+KEndingBalanceLoanDlg::KEndingBalanceLoanDlg(const MyMoneyAccount& account, QWidget *parent, const char *name) :
+ KEndingBalanceDlgDecl(parent, name, true),
+ d(new Private)
+{
+ d->m_account = account;
+ QDate value = account.lastReconciliationDate();
+ if(value.isValid())
+ m_startDateEdit->setDate(value.addDays(1));
+ else
+ m_startDateEdit->setDate(d->m_account.openingDate());
+
+ // make sure, we show the correct start page
+ showPage(m_startPageLoan);
+
+ // enable the finish button on the last page
+ setAppropriate(m_checkPaymentsPage, true);
+
+ // remove all unwanted pages
+ removePage(m_startPageCheckings);
+ removePage(m_statementInfoPageCheckings);
+ removePage(m_pagePreviousPostpone);
+ removePage(m_interestChargeCheckings);
+
+ // connect the signals with the slots
+ connect(m_amortizationTotalEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_interestTotalEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_accountEdit, SIGNAL(stateChanged(void)), this, SLOT(slotCheckPageFinished(void)));
+ connect(m_categoryEdit, SIGNAL(stateChanged(void)), this, SLOT(slotCheckPageFinished(void)));
+}
+
+KEndingBalanceLoanDlg::~KEndingBalanceLoanDlg()
+{
+}
+
+void KEndingBalanceLoanDlg::slotCheckPageFinished(void)
+{
+ nextButton()->setEnabled(true);
+ finishButton()->setEnabled(true);
+
+ if(currentPage() == m_checkPaymentsPage) {
+ MyMoneyMoney interest = totalInterest(m_startDateEdit->date(), m_endDateEdit->date());
+ MyMoneyMoney amortization = totalAmortization(m_startDateEdit->date(), m_endDateEdit->date());
+
+ if(interest == m_interestTotalEdit->value()
+ && amortization == m_amortizationTotalEdit->value()) {
+ if(indexOf(m_adjustmentTransactionPage) != -1) {
+ removePage(m_adjustmentTransactionPage);
+ // the following line forces to update the buttons
+ showPage(m_checkPaymentsPage);
+ nextButton()->setEnabled(true);
+ finishButton()->setEnabled(true);
+ }
+ } else {
+ if(indexOf(m_adjustmentTransactionPage) == -1) {
+ addPage(m_adjustmentTransactionPage, i18n("Adjustment transaction"));
+ // the following line forces to update the buttons
+ showPage(m_checkPaymentsPage);
+ }
+ }
+ } else if(currentPage() == m_adjustmentTransactionPage) {
+ if(m_accountEdit->selectedItems().count() == 0) {
+ nextButton()->setEnabled(false);
+ finishButton()->setEnabled(false);
+
+ } else if(m_categoryEdit->isEnabled()
+ && m_categoryEdit->selectedItems().count() == 0) {
+ nextButton()->setEnabled(false);
+ finishButton()->setEnabled(false);
+ }
+ }
+}
+
+const MyMoneyMoney KEndingBalanceLoanDlg::totalInterest(const QDate& start, const QDate& end) const
+{
+ MyMoneyMoney interest;
+ MyMoneyTransactionFilter filter(d->m_account.id());
+ filter.setDateFilter(start, end);
+
+ QValueList<MyMoneyTransaction> list = MyMoneyFile::instance()->transactionList(filter);
+ QValueList<MyMoneyTransaction>::ConstIterator it_t;
+
+ for(it_t = list.begin(); it_t != list.end(); ++it_t) {
+ QValueList<MyMoneySplit>::ConstIterator it_s;
+ for(it_s = (*it_t).splits().begin(); it_s != (*it_t).splits().end(); ++it_s) {
+ if((*it_s).action() == MyMoneySplit::ActionInterest) {
+ interest += (*it_s).value();
+ }
+ }
+ }
+ return interest;
+}
+
+const MyMoneyMoney KEndingBalanceLoanDlg::totalAmortization(const QDate& start, const QDate& end) const
+{
+ MyMoneyMoney amortization;
+ MyMoneyMoney adjust(1,1);
+ MyMoneyTransactionFilter filter(d->m_account.id());
+ filter.setDateFilter(start, end);
+
+ if(d->m_account.accountType() == MyMoneyAccount::AssetLoan)
+ adjust = -adjust;
+
+ QValueList<MyMoneyTransaction> list = MyMoneyFile::instance()->transactionList(filter);
+ QValueList<MyMoneyTransaction>::ConstIterator it_t;
+
+ for(it_t = list.begin(); it_t != list.end(); ++it_t) {
+ QValueList<MyMoneySplit>::ConstIterator it_s;
+ for(it_s = (*it_t).splits().begin(); it_s != (*it_t).splits().end(); ++it_s) {
+ if((*it_s).accountId() == d->m_account.id()
+ && (*it_s).action() == MyMoneySplit::ActionAmortization
+ && ((*it_s).value() * MyMoneyMoney(adjust, 1)).isPositive()) {
+ amortization += (*it_s).value();
+ }
+ }
+ }
+ // make sure to return a positive number
+ return amortization * adjust;
+}
+
+void KEndingBalanceLoanDlg::next(void)
+{
+ bool dontLeavePage = false;
+
+ if(currentPage() == m_startPageLoan) {
+ MyMoneyMoney interest = totalInterest(m_startDateEdit->date(), m_endDateEdit->date());
+ MyMoneyMoney amortization = totalAmortization(m_startDateEdit->date(), m_endDateEdit->date());
+
+ m_loanOverview->setText(i18n("KMyMoney has calculated the following amounts for "
+ "interest and amortization according to recorded payments "
+ "between %1 and %2.")
+ .arg(KGlobal::locale()->formatDate(m_startDateEdit->date(), true))
+ .arg(KGlobal::locale()->formatDate(m_endDateEdit->date(), true)));
+
+ // preload widgets with calculated values if they are empty
+ if(m_amortizationTotalEdit->value().isZero() && !amortization.isZero())
+ m_amortizationTotalEdit->setValue(amortization);
+ if(m_interestTotalEdit->value().isZero() && !interest.isZero())
+ m_interestTotalEdit->setValue(interest);
+
+ } else if(currentPage() == m_checkPaymentsPage) {
+ AccountSet assetSet, incomeSet;
+ assetSet.addAccountGroup(MyMoneyAccount::Asset);
+ incomeSet.addAccountGroup(MyMoneyAccount::Income);
+ assetSet.load(m_accountEdit);
+ incomeSet.load(m_categoryEdit);
+#if 0
+ m_accountEdit->loadList(static_cast<KMyMoneyUtils::categoryTypeE>(KMyMoneyUtils::asset | KMyMoneyUtils::liability));
+ m_categoryEdit->loadList(static_cast<KMyMoneyUtils::categoryTypeE>(KMyMoneyUtils::income | KMyMoneyUtils::expense));
+#endif
+ m_categoryEdit->setEnabled(false);
+
+ MyMoneyMoney interest = totalInterest(m_startDateEdit->date(), m_endDateEdit->date());
+ if(interest != m_interestTotalEdit->value()) {
+ m_categoryEdit->setEnabled(true);
+ }
+ }
+
+ if(!dontLeavePage)
+ KEndingBalanceDlgDecl::next();
+
+ slotCheckPageFinished();
+}
+
+const MyMoneyTransaction KEndingBalanceLoanDlg::adjustmentTransaction(void) const
+{
+ MyMoneyTransaction t;
+
+ MyMoneyMoney interest = totalInterest(m_startDateEdit->date(), m_endDateEdit->date());
+ MyMoneyMoney amortization = totalAmortization(m_startDateEdit->date(), m_endDateEdit->date());
+
+ if(interest != m_interestTotalEdit->value()
+ || amortization != m_amortizationTotalEdit->value()) {
+ MyMoneySplit sAccount, sAmortization, sInterest;
+ int adjust = 1;
+
+ if(d->m_account.accountType() == MyMoneyAccount::AssetLoan)
+ adjust = -1;
+
+ // fix sign if asset
+ interest = interest * MyMoneyMoney(adjust,1);
+ amortization = amortization * MyMoneyMoney(adjust,1);
+
+ sAmortization.setValue((m_amortizationTotalEdit->value() - amortization) * MyMoneyMoney(adjust,1));
+ sInterest.setValue((m_interestTotalEdit->value() - interest) * MyMoneyMoney(adjust,1));
+ sAccount.setValue( -(sAmortization.value() + sInterest.value()));
+
+ try {
+ sAmortization.setAccountId(d->m_account.id());
+ sAmortization.setPayeeId(d->m_account.payee());
+ sAccount.setAccountId(m_accountEdit->selectedItems()[0]);
+ sAccount.setPayeeId(d->m_account.payee());
+ if(m_categoryEdit->isEnabled())
+ sInterest.setAccountId(m_categoryEdit->selectedItems()[0]);
+
+ sAccount.setMemo(i18n("Adjustment transaction"));
+ sAmortization.setMemo(sAccount.memo());
+ sInterest.setMemo(sAccount.memo());
+
+ sAccount.setAction(MyMoneySplit::ActionAmortization);
+ sAmortization.setAction(MyMoneySplit::ActionAmortization);
+ sInterest.setAction(MyMoneySplit::ActionInterest);
+
+ t.addSplit(sAccount);
+ t.addSplit(sAmortization);
+ if(!sInterest.value().isZero())
+ t.addSplit(sInterest);
+
+ t.setPostDate(m_endDateEdit->date());
+
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to create adjustment transaction for loan reconciliation: %s", e->what().data());
+ delete e;
+ return MyMoneyTransaction();
+ }
+ }
+ return t;
+}
+
+void KEndingBalanceLoanDlg::help(void)
+{
+ QString anchor = d->m_helpAnchor[currentPage()];
+ if(anchor.isEmpty())
+ anchor = QString("details.reconcile.whatis");
+
+ kapp->invokeHelp(anchor);
+}
+
+#include "kendingbalancedlg.moc"
+
diff --git a/kmymoney2/dialogs/kendingbalancedlg.h b/kmymoney2/dialogs/kendingbalancedlg.h
new file mode 100644
index 0000000..3b9de00
--- /dev/null
+++ b/kmymoney2/dialogs/kendingbalancedlg.h
@@ -0,0 +1,147 @@
+/***************************************************************************
+ kendingbalancedlg.h
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KENDINGBALANCEDLG_H
+#define KENDINGBALANCEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qdialog.h>
+#include <qdatetime.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class kMyMoneyEdit;
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/mymoneyaccount.h>
+#include "../dialogs/kendingbalancedlgdecl.h"
+
+/**
+ * This dialog is wizard based and used to enter additional
+ * information required to start the reconciliation process.
+ * This version implements the behaviour for checkings,
+ * savings and credit card accounts.
+ *
+ * @author Thomas Baumgart
+ */
+class KEndingBalanceDlg : public KEndingBalanceDlgDecl
+{
+ Q_OBJECT
+public:
+ KEndingBalanceDlg(const MyMoneyAccount& account, QWidget *parent=0, const char *name=0);
+ ~KEndingBalanceDlg();
+
+ const MyMoneyMoney endingBalance(void) const;
+ const MyMoneyMoney previousBalance(void) const;
+ const QDate statementDate(void) const { return m_statementDate->date(); };
+
+ const MyMoneyTransaction interestTransaction(void);
+ const MyMoneyTransaction chargeTransaction(void);
+
+protected:
+ bool createTransaction(MyMoneyTransaction& t, const int sign, kMyMoneyEdit *amountEdit, KMyMoneyCategory *categoryEdit, kMyMoneyDateInput* dateEdit);
+ const MyMoneyMoney adjustedReturnValue(const MyMoneyMoney& v) const;
+ void createCategory(const QString& txt, QString& id, const MyMoneyAccount& parent);
+
+protected slots:
+ void slotCheckPageFinished(void);
+ void slotReloadEditWidgets(void);
+ void help(void);
+ void slotCreateInterestCategory(const QString& txt, QString& id);
+ void slotCreateChargesCategory(const QString& txt, QString& id);
+ void accept(void);
+ void slotUpdateBalances(void);
+
+signals:
+ /**
+ * proxy signal for KMyMoneyPayeeCombo::createItem(const QString&, QString&)
+ */
+ void createPayee(const QString&, QString&);
+
+ /**
+ * emit when a category is about to be created
+ */
+ void createCategory(MyMoneyAccount& acc, const MyMoneyAccount& parent);
+
+private:
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+/**
+ * This dialog is wizard based and used to enter additional
+ * information required to start the reconciliation process.
+ * This version is implements the behaviour for loan accounts.
+ */
+class KEndingBalanceLoanDlg : public KEndingBalanceDlgDecl
+{
+ Q_OBJECT
+public:
+ KEndingBalanceLoanDlg(const MyMoneyAccount& account, QWidget *parent=0, const char *name=0);
+ ~KEndingBalanceLoanDlg();
+
+ /**
+ * This method returns the adjustment transaction if one
+ * has been created. If not, an empty transaction will be returned.
+ */
+ const MyMoneyTransaction adjustmentTransaction(void) const;
+
+ /**
+ * This method returns the starting date of the statement as provided
+ * by the user. The value returned is only valid if the dialog returned
+ * with QDialog::accept.
+ */
+ const QDate startDate(void) const { return m_startDateEdit->date(); };
+
+ /**
+ * This method returns the ending date of the statement as provided
+ * by the user. The value returned is only valid if the dialog returned
+ * with QDialog::accept.
+ */
+ const QDate endDate(void) const { return m_endDateEdit->date(); };
+
+protected:
+ const MyMoneyMoney totalInterest(const QDate& start, const QDate& end) const;
+ const MyMoneyMoney totalAmortization(const QDate& start, const QDate& end) const;
+
+public slots:
+ void next();
+
+protected slots:
+ void slotCheckPageFinished(void);
+ void help(void);
+
+private:
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kendingbalancedlgdecl.ui b/kmymoney2/dialogs/kendingbalancedlgdecl.ui
new file mode 100644
index 0000000..0f77810
--- /dev/null
+++ b/kmymoney2/dialogs/kendingbalancedlgdecl.ui
@@ -0,0 +1,980 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KEndingBalanceDlgDecl</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>KEndingBalanceDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>589</width>
+ <height>465</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Reconciliation Wizard</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_startPageCheckings</cstring>
+ </property>
+ <attribute name="title">
+ <string>General Information</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Reconciling your account assures, that your recordings match those of your institution and that there are no mistakes on either side. You should reconcile your account whenever you receive a statement from your institution.
+
+All relevant information necessary for this process is usually printed on your statement.
+
+On the next page you will verify, that the starting and ending balance are matching those on your statement. If not, please modify the figures.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_startPageLoan</cstring>
+ </property>
+ <attribute name="title">
+ <string>General Information</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>KMyMoney calculates your loan payments automatically. The amounts can deviate from those calculated by the creditor. Therefore, you possibly have to adjust amortization, interest and other costs according to your statement.
+
+Please enter the following information found on your statement:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>19</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>42</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="kMyMoneyDateInput" row="0" column="1">
+ <property name="name">
+ <cstring>m_startDateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Ending date of statement</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="1" column="1">
+ <property name="name">
+ <cstring>m_endDateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Starting date of statement</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>44</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_checkPaymentsPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Verify payments</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_loanOverview</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Amortization</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_amortizationTotalEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Interest</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestTotalEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>If your statement shows different amounts, please cancel this dialog and correct the false transactions or correct the values in this dialog. In the later case, KMyMoney will create an adjustment transaction and add it to the ledger.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>19</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_adjustmentTransactionPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Adjustment transaction</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel5_2</cstring>
+ </property>
+ <property name="text">
+ <string>In order to create the adjustment transaction, KMyMoney requires an account and possibly an interest category to assign the differences to. Please select an account and - if necessary - a category.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout19</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout16</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel7_2</cstring>
+ </property>
+ <property name="text">
+ <string>Account</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_accountEdit</cstring>
+ </property>
+ </widget>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_accountEdit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout18</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel6_2</cstring>
+ </property>
+ <property name="text">
+ <string>Interest-Category</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_categoryEdit</cstring>
+ </property>
+ </widget>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_categoryEdit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_pagePreviousPostpone</cstring>
+ </property>
+ <attribute name="title">
+ <string>Restarting postponed reconciliation</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>You have previously postponed the reconciliation of this account. If you have entered charges or interests the last time you started reconciling this account you can modify these in the ledger later on.
+
+It is important, that you continue with the same statement you used when you postponed the reconciliation.
+
+All information you have entered into this wizard will be shown and all transactions that you already cleared are marked with a 'C'.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_statementInfoPageCheckings</cstring>
+ </property>
+ <attribute name="title">
+ <string>Statement Information</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>m_enterInformationLabel</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>42</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Statement date:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="0" column="1">
+ <property name="name">
+ <cstring>m_statementDate</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Starting balance of this statement:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_previousBalance</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Ending balance of this statement:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_endingBalance</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>46</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>87</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_lastStatementDate</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_interestChargeCheckings</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interest / Charges</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>If necessary, enter information about interest or charges here. KMyMoney will create transactions and clear them directly for you.</string>
+ </property>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Payee</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyPayeeCombo">
+ <property name="name">
+ <cstring>m_payeeEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Interest</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <widget class="KMyMoneyCategory">
+ <property name="name">
+ <cstring>m_interestCategoryEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_interestEdit</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_interestDateEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Charges</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <widget class="KMyMoneyCategory">
+ <property name="name">
+ <cstring>m_chargesCategoryEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout19</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_chargesEdit</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_chargesDateEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyAccountSelector</class>
+ <header location="global">../widgets/kmymoneyaccountselector.h</header>
+ <sizehint>
+ <width>80</width>
+ <height>80</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1114">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042149444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d096e8b11261871837bc8e282ac7ac82187e049a317e32d37110992bf42123c694eea414c0e0bf1b0ec6c402139485a54e8810c54c10e741146fa110bd643f74c12bd642e4d75f77cf5d5ef7dafdfc2ce7087d9eff32fdfdff74e5114104011e489d6e952cce5cfbe5998692dec0c77b87aedd3fddd9f2b3efce02291082209aa3504685022e4ffd7a000a82a765c515615ce95acae659c3f7765c100ec6e575cf8f822e991025f3b6a6f890c484f181ccfc1583428f5d4e2fe84da039aa04121b40eb32483a0ec6e5bce9f8385d36fa7fb9b1b17c8f31cbfe7a95c45be94520c72b2141a1caa160d1666e24ea94aa11ee7685054159d2ada34d41387c40dc63b8844f0b5c73a4bb19cb3f9de001f2aac1fa23aa209168c004224902e29d22ff1e38abbdb275055c4800610233867311a1491847a62c98f66ac6f14d8e99072f22daa15b68a8108424d6422e24c88e3966fbce4c9d786945b27f0be0103ed13c16004d59a2c4d58df28a87548e9aee2274ab95d60c7193c9a0281fc959ae2a4450364a9e2572c7a2b43438374ef2dd2154012d050514dbec7396578a3130d9d6850066f0ad9d186f2d78cdbbb799b0a202f2c48d3aebbb418310240b112637588574bf54b8efaa4fd9b691dacbf5b305813542bae63a9eee4c4694d967b5494eca8c7ef0933bdc5d90e6a2caa0e3f013b7adce9fa5b03d637561113a30106a71d18c5fd9677058338ad01e91c0b8b743b880182ce19cd9c0e5e2b583fbdda565d3d04cfedad180942133af201b2bc3588e111c680068f489780ce69b192b279768088524f2b3458ea694d3de99a4323bc976ed34eb86b98c51993f6be10f77240c99685cd731991f1582df15aa15a213d583f5313a7806988fb8a0640e336359d9e9933568bf44062214ba19e2a7652a13d8b068ff596b807182189234e9da9f1ceb78c81b28c3ac6fe21e306c58e41d5118952acd6a0c2f56b9e6a5c72f346cdcd6b19a3bf8010010d714f89533b674c90c7189b598eab12a45fb5c75b8253672b863fbcccf5af93b6904119fe9851bf5153ac3a746ae7b9d5698c1dc58f313e70e4707ce9d84bafa2f79fc23fb8c7c1438ef04031a2642fee21060ec69ee47020796ecaa12313ccd333d1b67935047acf2be3bb11aa010dbe656cc755dbe3b772084a7ebc6d5711253b593dfcc0cc8fcd3cafda455512c7f200ec56cbfac0f1d7d34b7fdf0f98fd88a92a7e9cb0e70cc933c0b38a2c823ea0bd76c70c016adb67f47bc2a117a6d40abeea33fa23c2fb867edfb413e4a34fded94ffb3991c46dc7754cd3634ad2af490b857f5a5137126a97e02a8120a485235b6a28ef80bd077ee2b9f2d54fed04595dcbd8ddb6c4bd87334c10cadb2064e856177e7864e669fbe1df154a0142839f7ad2e5b6880bff1da66eece78e315d959f609da670f98befe6c3f45fb42672c9acff7f660000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kenterscheduledlg.cpp b/kmymoney2/dialogs/kenterscheduledlg.cpp
new file mode 100644
index 0000000..f39f003
--- /dev/null
+++ b/kmymoney2/dialogs/kenterscheduledlg.cpp
@@ -0,0 +1,327 @@
+/***************************************************************************
+ kenterscheduledlg.cpp
+ -------------------
+ begin : Sat Apr 7 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qtimer.h>
+#include <qwidgetlist.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+#include <kiconloader.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kenterscheduledlg.h"
+#include "../dialogs/kcurrencycalculator.h"
+#include <kmymoney/register.h>
+#include <kmymoney/transactionform.h>
+#include <kmymoney/transaction.h>
+#include <kmymoney/transactioneditor.h>
+#include <kmymoney/kmymoneyutils.h>
+#include <kmymoney/mymoneyfinancialcalculator.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kmymoneydateinput.h>
+
+#include "../kmymoney2.h"
+
+class KEnterScheduleDlg::Private
+{
+public:
+ Private() : m_item(0), m_showWarningOnce(true) {}
+ ~Private() {}
+
+ MyMoneySchedule m_schedule;
+ KMyMoneyRegister::Transaction* m_item;
+ QWidgetList m_tabOrderWidgets;
+ bool m_showWarningOnce;
+ KMyMoneyUtils::EnterScheduleResultCodeE m_extendedReturnCode;
+};
+
+KEnterScheduleDlg::KEnterScheduleDlg(QWidget *parent, const MyMoneySchedule& schedule) :
+ KEnterScheduleDlgDecl(parent, "kenterscheduledlg"),
+ d(new Private)
+{
+ d->m_schedule = schedule;
+ d->m_extendedReturnCode = KMyMoneyUtils::Enter;
+ buttonOk->setIconSet(KGlobal::iconLoader()->loadIconSet("key_enter", KIcon::NoGroup, KIcon::SizeSmall, true));
+ buttonSkip->setIconSet(KGlobal::iconLoader()->loadIconSet("player_fwd", KIcon::NoGroup, KIcon::SizeSmall, true));
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+ buttonHelp->setGuiItem(KStdGuiItem::help());
+ buttonIgnore->setHidden(true);
+ buttonSkip->setHidden(true);
+
+ // make sure, we have a tabbar with the form
+ KMyMoneyTransactionForm::TabBar* tabbar = m_form->tabBar(m_form->parentWidget());
+
+ // we never need to see the register
+ m_register->hide();
+
+ // ... setup the form ...
+ m_form->setupForm(d->m_schedule.account());
+
+ // ... and the register ...
+ m_register->clear();
+
+ // ... now add the transaction to register and form ...
+ MyMoneyTransaction t = transaction();
+ d->m_item = KMyMoneyRegister::Register::transactionFactory(m_register, t, d->m_schedule.transaction().splits()[0], 0);
+ m_register->selectItem(d->m_item);
+ // show the account row
+ d->m_item->setShowRowInForm(0, true);
+
+ m_form->slotSetTransaction(d->m_item);
+
+ // no need to see the tabbar
+ tabbar->hide();
+
+ // setup name and type
+ m_scheduleName->setText(d->m_schedule.name());
+ m_type->setText(KMyMoneyUtils::scheduleTypeToString(d->m_schedule.type()));
+
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(slotShowHelp()));
+ connect(buttonIgnore, SIGNAL(clicked()), this, SLOT(slotIgnore()));
+ connect(buttonSkip, SIGNAL(clicked()), this, SLOT(slotSkip()));
+
+ // force the initial height to be as small as possible
+ QTimer::singleShot(0, this, SLOT(slotSetupSize()));
+}
+
+KEnterScheduleDlg::~KEnterScheduleDlg()
+{
+ delete d;
+}
+
+KMyMoneyUtils::EnterScheduleResultCodeE KEnterScheduleDlg::resultCode(void) const
+{
+ if(result() == QDialog::Accepted)
+ return d->m_extendedReturnCode;
+ return KMyMoneyUtils::Cancel;
+}
+
+void KEnterScheduleDlg::showExtendedKeys(bool visible)
+{
+ buttonIgnore->setShown(visible);
+ buttonSkip->setShown(visible);
+}
+
+void KEnterScheduleDlg::slotIgnore(void)
+{
+ d->m_extendedReturnCode = KMyMoneyUtils::Ignore;
+ accept();
+}
+
+void KEnterScheduleDlg::slotSkip(void)
+{
+ d->m_extendedReturnCode = KMyMoneyUtils::Skip;
+ accept();
+}
+
+MyMoneyTransaction KEnterScheduleDlg::transaction(void)
+{
+ MyMoneyTransaction t = d->m_schedule.transaction();
+
+ try {
+ if (d->m_schedule.type() == MyMoneySchedule::TYPE_LOANPAYMENT) {
+ KMyMoneyUtils::calculateAutoLoan(d->m_schedule, t, QMap<QString, MyMoneyMoney>());
+ }
+ } catch (MyMoneyException* e) {
+ KMessageBox::detailedError(this, i18n("Unable to load schedule details"), e->what());
+ delete e;
+ }
+
+ t.clearId();
+ t.setEntryDate(QDate());
+ return t;
+}
+
+QDate KEnterScheduleDlg::date(const QDate& _date) const
+{
+ QDate date(_date);
+ return d->m_schedule.adjustedDate(date, d->m_schedule.weekendOption());
+}
+
+void KEnterScheduleDlg::resizeEvent(QResizeEvent* ev)
+{
+ m_register->resize(KMyMoneyRegister::DetailColumn);
+ m_form->resize(KMyMoneyTransactionForm::ValueColumn1);
+ KEnterScheduleDlgDecl::resizeEvent(ev);
+}
+
+
+void KEnterScheduleDlg::slotSetupSize(void)
+{
+ resize(width(), minimumSizeHint().height());
+}
+
+int KEnterScheduleDlg::exec(void)
+{
+ if(d->m_showWarningOnce) {
+ d->m_showWarningOnce = false;
+ KMessageBox::information(this, QString("<qt>")+i18n("<p>Please check that all the details in the following dialog are correct and press OK.</p><p>Editable data can be changed and can either be applied to just this occurence or for all subsequent occurences for this schedule. (You will be asked what you intend after pressing OK in the following dialog)</p>")+QString("</qt>"), i18n("Enter scheduled transaction"), "EnterScheduleDlgInfo");
+ }
+
+ return KEnterScheduleDlgDecl::exec();
+}
+
+TransactionEditor* KEnterScheduleDlg::startEdit(void)
+{
+ KMyMoneyRegister::SelectedTransactions list(m_register);
+ TransactionEditor* editor = d->m_item->createEditor(m_form, list, QDate());
+
+ // check that we use the same transaction commodity in all selected transactions
+ // if not, we need to update this in the editor's list. The user can also bail out
+ // of this operation which means that we have to stop editing here.
+ if(editor) {
+ if(!editor->fixTransactionCommodity(d->m_schedule.account())) {
+ // if the user wants to quit, we need to destroy the editor
+ // and bail out
+ delete editor;
+ editor = 0;
+ }
+ }
+
+ if(editor) {
+ connect(editor, SIGNAL(transactionDataSufficient(bool)), buttonOk, SLOT(setEnabled(bool)));
+ connect(editor, SIGNAL(escapePressed()), buttonCancel, SLOT(animateClick()));
+ connect(editor, SIGNAL(returnPressed()), buttonOk, SLOT(animateClick()));
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), editor, SLOT(slotReloadEditWidgets()));
+ // connect(editor, SIGNAL(finishEdit(const KMyMoneyRegister::SelectedTransactions&)), this, SLOT(slotLeaveEditMode(const KMyMoneyRegister::SelectedTransactions&)));
+ connect(editor, SIGNAL(createPayee(const QString&, QString&)), kmymoney2, SLOT(slotPayeeNew(const QString&, QString&)));
+ connect(editor, SIGNAL(createCategory(MyMoneyAccount&, const MyMoneyAccount&)), kmymoney2, SLOT(slotCategoryNew(MyMoneyAccount&, const MyMoneyAccount&)));
+ connect(editor, SIGNAL(createSecurity(MyMoneyAccount&, const MyMoneyAccount&)), kmymoney2, SLOT(slotInvestmentNew(MyMoneyAccount&, const MyMoneyAccount&)));
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), editor, SLOT(slotReloadEditWidgets()));
+
+ // create the widgets, place them in the parent and load them with data
+ // setup tab order
+ d->m_tabOrderWidgets.clear();
+ KMyMoneyRegister::Action action = KMyMoneyRegister::ActionWithdrawal;
+ switch(d->m_schedule.type()) {
+ case MyMoneySchedule::TYPE_DEPOSIT:
+ action = KMyMoneyRegister::ActionDeposit;
+ break;
+ case MyMoneySchedule::TYPE_TRANSFER:
+ action = KMyMoneyRegister::ActionTransfer;
+ break;
+ case MyMoneySchedule::TYPE_LOANPAYMENT:
+ switch(d->m_schedule.paymentType()) {
+ case MyMoneySchedule::STYPE_DIRECTDEPOSIT:
+ case MyMoneySchedule::STYPE_MANUALDEPOSIT:
+ action = KMyMoneyRegister::ActionDeposit;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ editor->setup(d->m_tabOrderWidgets, d->m_schedule.account(), action);
+
+ // if it's not a check, then we need to clear
+ // a possibly assigned check number
+ if(d->m_schedule.paymentType() != MyMoneySchedule::STYPE_WRITECHEQUE) {
+ QWidget* w = editor->haveWidget("number");
+ if(w)
+ dynamic_cast<kMyMoneyLineEdit*>(w)->loadText(QString());
+ }
+
+ Q_ASSERT(!d->m_tabOrderWidgets.isEmpty());
+
+ // don't forget our three buttons
+ d->m_tabOrderWidgets.append(buttonOk);
+ d->m_tabOrderWidgets.append(buttonCancel);
+ d->m_tabOrderWidgets.append(buttonHelp);
+
+ // install event filter in all taborder widgets
+ for(QWidget* w = d->m_tabOrderWidgets.first(); w; w = d->m_tabOrderWidgets.next()) {
+ w->installEventFilter(this);
+ w->installEventFilter(editor);
+ }
+
+ // Check if the editor has some preference on where to set the focus
+ // If not, set the focus to the first widget in the tab order
+ QWidget* focusWidget = editor->firstWidget();
+ if(!focusWidget)
+ focusWidget = d->m_tabOrderWidgets.first();
+ focusWidget->setFocus();
+
+ // Make sure, we use the adjusted date
+ kMyMoneyDateInput* dateEdit = dynamic_cast<kMyMoneyDateInput*>(editor->haveWidget("postdate"));
+ if(dateEdit) {
+ dateEdit->setDate(d->m_schedule.adjustedNextDueDate());
+ }
+ }
+
+ return editor;
+}
+
+bool KEnterScheduleDlg::focusNextPrevChild(bool next)
+{
+ bool rc = false;
+
+ // qDebug("KGlobalLedgerView::focusNextPrevChild(editmode=%s)", m_inEditMode ? "true" : "false");
+ QWidget *w = 0;
+ QWidget *currentWidget;
+
+ w = qApp->focusWidget();
+ while(w && d->m_tabOrderWidgets.find(w) == -1) {
+ // qDebug("'%s' not in list, use parent", w->className());
+ w = w->parentWidget();
+ }
+ // if(w) qDebug("tab order is at '%s'", w->className());
+ currentWidget = d->m_tabOrderWidgets.current();
+ w = next ? d->m_tabOrderWidgets.next() : d->m_tabOrderWidgets.prev();
+
+ do {
+ if(!w) {
+ w = next ? d->m_tabOrderWidgets.first() : d->m_tabOrderWidgets.last();
+ }
+
+ if(w != currentWidget
+ && ((w->focusPolicy() & TabFocus) == TabFocus)
+ && w->isVisible() && w->isEnabled()) {
+ // qDebug("Selecting '%s' as focus", w->className());
+ w->setFocus();
+ rc = true;
+ break;
+ }
+ w = next ? d->m_tabOrderWidgets.next() : d->m_tabOrderWidgets.prev();
+ } while(w != currentWidget);
+
+ return rc;
+}
+
+void KEnterScheduleDlg::slotShowHelp(void)
+{
+ kapp->invokeHelp("details.schedules.entering");
+}
+
+
+#include "kenterscheduledlg.moc"
+
diff --git a/kmymoney2/dialogs/kenterscheduledlg.h b/kmymoney2/dialogs/kenterscheduledlg.h
new file mode 100644
index 0000000..0e14ad4
--- /dev/null
+++ b/kmymoney2/dialogs/kenterscheduledlg.h
@@ -0,0 +1,91 @@
+/***************************************************************************
+ kenterscheduledlg.h - description
+ -------------------
+ begin : Sat Apr 7 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KENTERSCHEDULEDLG_H
+#define KENTERSCHEDULEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class TransactionEditor;
+
+#include "../dialogs/kenterscheduledlgdecl.h"
+#include <kmymoney/mymoneyscheduled.h>
+#include <kmymoney/kmymoneyutils.h>
+
+/**
+ * @author Thomas Baumgart
+ */
+class KEnterScheduleDlg : public KEnterScheduleDlgDecl
+{
+ Q_OBJECT
+public:
+ KEnterScheduleDlg(QWidget *parent, const MyMoneySchedule& schedule);
+ ~KEnterScheduleDlg();
+
+ TransactionEditor* startEdit(void);
+ MyMoneyTransaction transaction(void);
+
+ /**
+ * Show (or hide) the extended dialog keys for 'Skip' and 'Ignore'
+ * depending on the value of the parameter @a visible which defaults
+ * to @a true.
+ */
+ void showExtendedKeys(bool visible = true);
+
+ /**
+ * Return the extended result code. Usage of the returned
+ * value only makes sense, once the dialog has been executed.
+ * Before execution it returns @a Cancel.
+ */
+ KMyMoneyUtils::EnterScheduleResultCodeE resultCode(void) const;
+
+protected:
+ /// Overridden for internal reasons. No API changes.
+ bool focusNextPrevChild(bool next);
+
+ /**
+ * This method returns the adjusts @a _date according to
+ * the setting of the schedule's weekend option.
+ */
+ QDate date(const QDate& _date) const;
+
+ void resizeEvent(QResizeEvent* ev);
+
+public slots:
+ int exec(void);
+
+private slots:
+ void slotSetupSize(void);
+ void slotShowHelp(void);
+ void slotIgnore(void);
+ void slotSkip(void);
+
+private:
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kenterscheduledlgdecl.ui b/kmymoney2/dialogs/kenterscheduledlgdecl.ui
new file mode 100644
index 0000000..3efed94
--- /dev/null
+++ b/kmymoney2/dialogs/kenterscheduledlgdecl.ui
@@ -0,0 +1,330 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KEnterScheduleDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KEnterScheduleDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>679</width>
+ <height>410</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Enter Schedule</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Schedule Details</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>70</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_scheduleName</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>70</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>m_type</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="KMyMoneyRegister::Register">
+ <column>
+ <property name="text">
+ <string>Security</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Details</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>C</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Payment</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Deposit</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Quantity</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Balance</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_register</cstring>
+ </property>
+ <property name="numRows">
+ <number>0</number>
+ </property>
+ <property name="numCols">
+ <number>12</number>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame4</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KMyMoneyTransactionForm::TransactionForm">
+ <property name="name">
+ <cstring>m_form</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>5</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="numRows">
+ <number>5</number>
+ </property>
+ <property name="numCols">
+ <number>1</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>190</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>Enter</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter the transaction and advance the next due date of this schedule to the next payment date.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonSkip</cstring>
+ </property>
+ <property name="text">
+ <string>Skip</string>
+ </property>
+ <property name="isDragEnabled" stdset="0">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Do not enter the transaction but advance the next due date of this schedule to the next payment date.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonIgnore</cstring>
+ </property>
+ <property name="text">
+ <string>Ignore</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Do not enter or skip payments for this schedule but continue with the next schedule.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Cancel processing of schedule entry.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KEnterScheduleDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KEnterScheduleDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kequitypriceupdatedlg.cpp b/kmymoney2/dialogs/kequitypriceupdatedlg.cpp
new file mode 100644
index 0000000..4111bfa
--- /dev/null
+++ b/kmymoney2/dialogs/kequitypriceupdatedlg.cpp
@@ -0,0 +1,588 @@
+/***************************************************************************
+ kequitypriceupdatedlg.cpp - description
+ -------------------
+ begin : Mon Sep 1 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ Ace Jones <acejones@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qtimer.h>
+#include <qlayout.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <ktextedit.h>
+#include <klistview.h>
+#include <kdebug.h>
+#include <kprogress.h>
+#include <kglobal.h>
+#include <kconfig.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kequitypriceupdatedlg.h"
+#include "../mymoney/mymoneyfile.h"
+#include "../mymoney/mymoneysecurity.h"
+#include "../mymoney/mymoneyprice.h"
+#include "../kmymoneyglobalsettings.h"
+
+#define SYMBOL_COL 0
+#define NAME_COL 1
+#define PRICE_COL 2
+#define DATE_COL 3
+#define ID_COL 4
+#define SOURCE_COL 5
+
+KEquityPriceUpdateDlg::KEquityPriceUpdateDlg(QWidget *parent, const QString& securityId) :
+ KEquityPriceUpdateDlgDecl(parent),
+ m_fUpdateAll(false)
+{
+ lvEquityList->setRootIsDecorated(false);
+ lvEquityList->setColumnText(0, i18n("Symbol"));
+ lvEquityList->addColumn(i18n("Symbol"));
+ lvEquityList->addColumn(i18n("Name"),125);
+ lvEquityList->addColumn(i18n("Price"));
+ lvEquityList->addColumn(i18n("Date"));
+
+ // This is a "get it up and running" hack. Will replace this in the future.
+ lvEquityList->addColumn("ID");
+ lvEquityList->addColumn("Source");
+ lvEquityList->setColumnWidth(ID_COL, 0);
+
+ lvEquityList->setMultiSelection(true);
+ lvEquityList->setColumnWidthMode(SYMBOL_COL, QListView::Maximum);
+ lvEquityList->setColumnWidthMode(ID_COL, QListView::Manual);
+ lvEquityList->setAllColumnsShowFocus(true);
+
+ btnUpdateAll->setEnabled(false);
+
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ //
+ // Add each price pair that we know about
+ //
+
+ // send in securityId == "XXX YYY" to get a single-shot update for XXX to YYY.
+ // for consistency reasons, this accepts the same delimiters as WebPriceQuote::launch()
+ QRegExp splitrx("([0-9a-z\\.]+)[^a-z0-9]+([0-9a-z\\.]+)",false /*case sensitive*/);
+ MyMoneySecurityPair currencyIds;
+ if ( splitrx.search(securityId) != -1 )
+ currencyIds = MyMoneySecurityPair(splitrx.cap(1).utf8(),splitrx.cap(2).utf8());
+
+ MyMoneyPriceList prices = file->priceList();
+ for(MyMoneyPriceList::ConstIterator it_price = prices.begin(); it_price != prices.end(); ++it_price)
+ {
+ const MyMoneySecurityPair& pair = it_price.key();
+ if ( file->security( pair.first ).isCurrency() && ( securityId.isEmpty() || ( pair == currencyIds ) ) )
+ {
+ const MyMoneyPriceEntries& entries = (*it_price);
+ if(entries.count() > 0 && entries.begin().key() <= QDate::currentDate()) {
+ addPricePair(pair);
+ btnUpdateAll->setEnabled(true);
+ }
+ }
+ }
+
+ //
+ // Add each investment
+ //
+
+ QValueList<MyMoneySecurity> securities = file->securityList();
+ for(QValueList<MyMoneySecurity>::ConstIterator it = securities.begin(); it != securities.end(); ++it)
+ {
+ if ( !(*it).isCurrency()
+ && ( securityId.isEmpty() || ( (*it).id() == securityId ) )
+ && !(*it).value("kmm-online-source").isEmpty()
+ )
+ {
+ addInvestment(*it);
+ btnUpdateAll->setEnabled(true);
+ }
+ }
+
+ // if list is empty, add the request price pair
+ if(lvEquityList->firstChild() == 0) {
+ addPricePair(currencyIds, true);
+ }
+
+ connect(btnOK, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(btnUpdateSelected, SIGNAL(clicked()), this, SLOT(slotUpdateSelectedClicked()));
+ connect(btnUpdateAll, SIGNAL(clicked()), this, SLOT(slotUpdateAllClicked()));
+
+ connect(&m_webQuote,SIGNAL(quote(const QString&, const QString&,const QDate&, const double&)),
+ this,SLOT(slotReceivedQuote(const QString&, const QString&,const QDate&, const double&)));
+ connect(&m_webQuote,SIGNAL(failed(const QString&, const QString&)),
+ this,SLOT(slotQuoteFailed(const QString&, const QString&)));
+ connect(&m_webQuote,SIGNAL(status(const QString&)),
+ this,SLOT(logStatusMessage(const QString&)));
+ connect(&m_webQuote,SIGNAL(error(const QString&)),
+ this,SLOT(logErrorMessage(const QString&)));
+
+ connect(lvEquityList, SIGNAL(selectionChanged()), this, SLOT(slotUpdateSelection()));
+
+ // Not implemented yet.
+ btnConfigure->hide();
+ //connect(btnConfigure, SIGNAL(clicked()), this, SLOT(slotConfigureClicked()));
+
+ if ( !securityId.isEmpty() )
+ {
+ btnUpdateSelected->hide();
+ btnUpdateAll->hide();
+ // delete layout1;
+
+ QTimer::singleShot(100,this,SLOT(slotUpdateAllClicked()));
+ }
+
+ // Hide OK button until we have received the first update
+ btnOK->setEnabled(false);
+
+ slotUpdateSelection();
+
+ // previous versions of this dialog allowed to store a "Don't ask again" switch.
+ // Since we don't support it anymore, we just get rid of it
+ KConfig* config = KGlobal::config();
+ config->setGroup("Notification Messages");
+ config->deleteEntry("KEquityPriceUpdateDlg::slotQuoteFailed::Price Update Failed");
+}
+
+KEquityPriceUpdateDlg::~KEquityPriceUpdateDlg()
+{
+
+}
+
+void KEquityPriceUpdateDlg::addPricePair(const MyMoneySecurityPair& pair, bool dontCheckExistance)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ QString symbol = QString("%1 > %2").arg(pair.first,pair.second);
+ QString id = QString("%1 %2").arg(pair.first,pair.second);
+ if ( ! lvEquityList->findItem(id,ID_COL,Qt::ExactMatch) )
+ {
+ MyMoneyPrice pr = file->price(pair.first,pair.second);
+ if(pr.source() != "KMyMoney") {
+ bool keep = true;
+ if((pair.first == file->baseCurrency().id())
+ || (pair.second == file->baseCurrency().id())) {
+ const QString& foreignCurrency = file->foreignCurrency(pair.first, pair.second);
+ // check that the foreign currency is still in use
+ QValueList<MyMoneyAccount>::const_iterator it_a;
+ QValueList<MyMoneyAccount> list;
+ file->accountList(list);
+ for(it_a = list.begin(); !dontCheckExistance && it_a != list.end(); ++it_a) {
+ // if it's an account denominated in the foreign currency
+ // keep it
+ if(((*it_a).currencyId() == foreignCurrency)
+ && !(*it_a).isClosed())
+ break;
+ // if it's an investment traded in the foreign currency
+ // keep it
+ if((*it_a).isInvest() && !(*it_a).isClosed()) {
+ MyMoneySecurity sec = file->security((*it_a).currencyId());
+ if(sec.tradingCurrency() == foreignCurrency)
+ break;
+ }
+ }
+ // if it is in use, it_a is not equal to list.end()
+ if(it_a == list.end() && !dontCheckExistance)
+ keep = false;
+ }
+
+ if(keep) {
+ KListViewItem* item = new KListViewItem(lvEquityList,
+ symbol,
+ i18n("%1 units in %2").arg(pair.first,pair.second));
+ if(pr.isValid()) {
+ item->setText(PRICE_COL, pr.rate(pair.second).formatMoney(file->currency(pair.second).tradingSymbol(), KMyMoneyGlobalSettings::pricePrecision()));
+ item->setText(DATE_COL, pr.date().toString(Qt::ISODate));
+ }
+ item->setText(ID_COL,id);
+ item->setText(SOURCE_COL, "Yahoo Currency"); // This string value should not be localized
+ }
+ }
+ }
+}
+
+void KEquityPriceUpdateDlg::addInvestment(const MyMoneySecurity& inv)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ QString symbol = inv.tradingSymbol();
+ QString id = inv.id();
+ if ( ! lvEquityList->findItem(id, ID_COL, Qt::ExactMatch) )
+ {
+ // check that the security is still in use
+ QValueList<MyMoneyAccount>::const_iterator it_a;
+ QValueList<MyMoneyAccount> list;
+ file->accountList(list);
+ for(it_a = list.begin(); it_a != list.end(); ++it_a) {
+ if((*it_a).isInvest()
+ && ((*it_a).currencyId() == inv.id())
+ && !(*it_a).isClosed())
+ break;
+ }
+ // if it is in use, it_a is not equal to list.end()
+ if(it_a != list.end()) {
+ KListViewItem* item = new KListViewItem(lvEquityList, symbol, inv.name());
+ MyMoneySecurity currency = file->currency(inv.tradingCurrency());
+ MyMoneyPrice pr = file->price(id.utf8(), inv.tradingCurrency());
+ if(pr.isValid()) {
+ item->setText(PRICE_COL, pr.rate(currency.id()).formatMoney(currency.tradingSymbol(), KMyMoneyGlobalSettings::pricePrecision()));
+ item->setText(DATE_COL, pr.date().toString(Qt::ISODate));
+ }
+ item->setText(ID_COL,id);
+ if (inv.value("kmm-online-quote-system") == "Finance::Quote")
+ item->setText(SOURCE_COL, QString("Finance::Quote %1").arg( inv.value("kmm-online-source")));
+ else
+ item->setText(SOURCE_COL, inv.value("kmm-online-source"));
+
+ // If this investment is denominated in a foreign currency, ensure that
+ // the appropriate price pair is also on the list
+
+ if ( currency.id() != file->baseCurrency().id() )
+ {
+ addPricePair(MyMoneySecurityPair(currency.id(),file->baseCurrency().id()));
+ }
+ }
+ }
+}
+
+void KEquityPriceUpdateDlg::logErrorMessage(const QString& message)
+{
+ logStatusMessage(QString("<font color=\"red\"><b>") + message + QString("</b></font>"));
+}
+
+void KEquityPriceUpdateDlg::logStatusMessage(const QString& message)
+{
+ lbStatus->append(message);
+}
+
+MyMoneyPrice KEquityPriceUpdateDlg::price(const QString& id) const
+{
+ MyMoneyPrice price;
+ QListViewItem* item;
+
+ if((item = lvEquityList->findItem(id, ID_COL, Qt::ExactMatch)) != 0) {
+ MyMoneyMoney rate(item->text(PRICE_COL));
+ if ( !rate.isZero() )
+ {
+ QString id = item->text(ID_COL).utf8();
+
+ // if the ID has a space, then this is TWO ID's, so it's a currency quote
+ if ( QString(id).contains(" ") )
+ {
+ QStringList ids = QStringList::split(" ",QString(id));
+ QString fromid = ids[0].utf8();
+ QString toid = ids[1].utf8();
+ price = MyMoneyPrice(fromid,toid,QDate().fromString(item->text(DATE_COL), Qt::ISODate),rate,item->text(SOURCE_COL));
+ }
+ else
+ // otherwise, it's a security quote
+ {
+ MyMoneySecurity security = MyMoneyFile::instance()->security(id);
+ price = MyMoneyPrice(id, security.tradingCurrency(), QDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
+ }
+ }
+ }
+ return price;
+}
+
+void KEquityPriceUpdateDlg::storePrices(void)
+{
+ // update the new prices into the equities
+
+ MyMoneyFile* file = MyMoneyFile::instance();
+ QValueList<MyMoneySecurity> equities = file->securityList();
+
+ QListViewItem* item = lvEquityList->firstChild();
+ MyMoneyFileTransaction ft;
+ QString name;
+ try {
+ while ( item )
+ {
+ // turn on signals before we modify the last entry in the list
+ MyMoneyFile::instance()->blockSignals(item->nextSibling() != 0);
+
+ MyMoneyMoney rate(item->text(PRICE_COL));
+ if ( !rate.isZero() )
+ {
+ QString id = item->text(ID_COL).utf8();
+
+ // if the ID has a space, then this is TWO ID's, so it's a currency quote
+ if ( QString(id).contains(" ") )
+ {
+ QStringList ids = QStringList::split(" ",QString(id));
+ QString fromid = ids[0].utf8();
+ QString toid = ids[1].utf8();
+ name = QString("%1 --> %2").arg(fromid).arg(toid);
+ MyMoneyPrice price(fromid,toid,QDate().fromString(item->text(DATE_COL), Qt::ISODate),rate,item->text(SOURCE_COL));
+ file->addPrice(price);
+ }
+ else
+ // otherwise, it's a security quote
+ {
+ MyMoneySecurity security = MyMoneyFile::instance()->security(id);
+ name = security.name();
+ MyMoneyPrice price(id, security.tradingCurrency(), QDate().fromString(item->text(DATE_COL), Qt::ISODate), rate, item->text(SOURCE_COL));
+
+ // TODO (Ace) Better handling of the case where there is already a price
+ // for this date. Currently, it just overrides the old value. Really it
+ // should check to see if the price is the same and prompt the user.
+ MyMoneyFile::instance()->addPrice(price);
+ }
+
+ }
+ item = item->nextSibling();
+ }
+ ft.commit();
+
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to add price information for %s", name.data());
+ delete e;
+ }
+}
+
+void KEquityPriceUpdateDlg::slotUpdateSelection(void)
+{
+ btnUpdateSelected->setEnabled(false);
+
+ QListViewItem* item = lvEquityList->firstChild();
+ while ( item && !item->isSelected())
+ item = item->nextSibling();
+
+ if(item)
+ btnUpdateSelected->setEnabled(true);
+}
+
+void KEquityPriceUpdateDlg::slotUpdateSelectedClicked(void)
+{
+ QListViewItem* item = lvEquityList->firstChild();
+ int skipCnt = 1;
+ while ( item && !item->isSelected())
+ {
+ skipCnt++;
+ item = item->nextSibling();
+ }
+
+ if(item) {
+ prgOnlineProgress->setTotalSteps(1+lvEquityList->childCount());
+ prgOnlineProgress->setProgress(skipCnt);
+ m_webQuote.launch(item->text(SYMBOL_COL),item->text(ID_COL),item->text(SOURCE_COL));
+ }
+ else
+ logErrorMessage("No security selected.");
+}
+
+void KEquityPriceUpdateDlg::slotUpdateAllClicked(void)
+{
+ QListViewItem* item = lvEquityList->firstChild();
+ if ( item )
+ {
+ prgOnlineProgress->setTotalSteps(1+lvEquityList->childCount());
+ prgOnlineProgress->setProgress(1);
+ m_fUpdateAll = true;
+ m_webQuote.launch(item->text(SYMBOL_COL),item->text(ID_COL),item->text(SOURCE_COL));
+ }
+ else
+ logErrorMessage("Security list is empty.");
+}
+
+void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _symbol)
+{
+ QListViewItem* item = lvEquityList->findItem(_id,ID_COL,Qt::ExactMatch);
+
+ // Give the user some options
+ int result;
+ if(_id.contains(" ")) {
+ result = KMessageBox::warningContinueCancel(this, i18n("Failed to retrieve an exchange rate for %1 from %2. It will be skipped this time.").arg(_symbol, item->text(SOURCE_COL)), i18n("Price Update Failed"));
+ } else {
+ result = KMessageBox::questionYesNoCancel(this, QString("<qt>%1</qt>").arg(i18n("Failed to retrieve a quote for %1 from %2. Press <b>No</b> to remove the online price source from this security permanently, <b>Yes</b> to continue updating this security during future price updates or <b>Cancel</b> to stop the current update operation.").arg(_symbol, item->text(SOURCE_COL))), i18n("Price Update Failed"), KStdGuiItem::yes(), KStdGuiItem::no());
+ }
+
+ if ( result == KMessageBox::No )
+ {
+ // Disable price updates for this security
+
+ MyMoneyFileTransaction ft;
+ try {
+ // Get this security (by ID)
+ MyMoneySecurity security = MyMoneyFile::instance()->security(_id.utf8());
+
+ // Set the quote source to blank
+ security.setValue("kmm-online-source",QString());
+ security.setValue("kmm-online-quote-system",QString());
+
+ // Re-commit the security
+ MyMoneyFile::instance()->modifySecurity(security);
+ ft.commit();
+ } catch(MyMoneyException* e) {
+ KMessageBox::error(this, QString("<qt>")+i18n("Cannot update security <b>%1</b>: %2").arg(_symbol, e->what())+QString("</qt>"), i18n("Price Update Failed"));
+ delete e;
+ }
+ }
+
+ // As long as the user doesn't want to cancel, move on!
+ if ( result != KMessageBox::Cancel )
+ {
+ QListViewItem* next = NULL;
+ prgOnlineProgress->advance(1);
+ item->listView()->setSelected(item, false);
+
+ // launch the NEXT one ... in case of m_fUpdateAll == false, we
+ // need to parse the list to find the next selected one
+ next = item->nextSibling();
+ if ( !m_fUpdateAll )
+ {
+ while(next && !next->isSelected())
+ {
+ prgOnlineProgress->advance(1);
+ next = next->nextSibling();
+ }
+ }
+ if (next)
+ {
+ m_webQuote.launch(next->text(SYMBOL_COL),next->text(ID_COL),next->text(SOURCE_COL));
+ }
+ else
+ {
+ finishUpdate();
+ }
+ }
+ else
+ {
+ finishUpdate();
+ }
+}
+
+void KEquityPriceUpdateDlg::slotReceivedQuote(const QString& _id, const QString& _symbol,const QDate& _date, const double& _price)
+{
+ QListViewItem* item = lvEquityList->findItem(_id,ID_COL,Qt::ExactMatch);
+ QListViewItem* next = NULL;
+
+ if ( item )
+ {
+ if ( _price > 0.0f && _date.isValid() )
+ {
+ QDate date = _date;
+ if ( date > QDate::currentDate() )
+ date = QDate::currentDate();
+
+ double price = _price;
+ QString id = _id.utf8();
+ MyMoneySecurity sec;
+ if ( _id.contains(" ") == 0) {
+ MyMoneySecurity security = MyMoneyFile::instance()->security(id);
+ QString factor = security.value("kmm-online-factor");
+ if(!factor.isEmpty()) {
+ price *= MyMoneyMoney(factor).toDouble();
+ }
+ try {
+ sec = MyMoneyFile::instance()->security(id);
+ sec = MyMoneyFile::instance()->security(sec.tradingCurrency());
+ } catch(MyMoneyException *e) {
+ sec = MyMoneySecurity();
+ delete e;
+ }
+
+ } else {
+ QRegExp splitrx("([0-9a-z\\.]+)[^a-z0-9]+([0-9a-z\\.]+)",false /*case sensitive*/);
+ if ( splitrx.search(_id) != -1 ) {
+ try {
+ sec = MyMoneyFile::instance()->security(splitrx.cap(2).utf8());
+ } catch(MyMoneyException *e) {
+ sec = MyMoneySecurity();
+ delete e;
+ }
+ }
+ }
+ item->setText(PRICE_COL, KGlobal::locale()->formatMoney(price, sec.tradingSymbol(), KMyMoneyGlobalSettings::pricePrecision()));
+ item->setText(DATE_COL, date.toString(Qt::ISODate));
+ logStatusMessage(i18n("Price for %1 updated (id %2)").arg(_symbol,_id));
+ // make sure to make OK button available
+ btnOK->setEnabled(true);
+ }
+ else
+ {
+ logErrorMessage(i18n("Received an invalid price for %1, unable to update.").arg(_symbol));
+ }
+
+ prgOnlineProgress->advance(1);
+ item->listView()->setSelected(item, false);
+
+ // launch the NEXT one ... in case of m_fUpdateAll == false, we
+ // need to parse the list to find the next selected one
+ next = item->nextSibling();
+ if ( !m_fUpdateAll )
+ {
+ while(next && !next->isSelected())
+ {
+ prgOnlineProgress->advance(1);
+ next = next->nextSibling();
+ }
+ }
+ }
+ else
+ {
+ logErrorMessage(i18n("Received a price for %1 (id %2), but this symbol is not on the list! Aborting entire update.").arg(_symbol,_id));
+ }
+
+ if (next)
+ {
+ m_webQuote.launch(next->text(SYMBOL_COL),next->text(ID_COL),next->text(SOURCE_COL));
+ }
+ else
+ {
+ finishUpdate();
+ }
+}
+
+void KEquityPriceUpdateDlg::finishUpdate(void)
+{
+ // we've run past the end, reset to the default value.
+ m_fUpdateAll = false;
+ // force progress bar to show 100%
+ prgOnlineProgress->setProgress(prgOnlineProgress->totalSteps());
+}
+
+// Make sure, that these definitions are only used within this file
+// this does not seem to be necessary, but when building RPMs the
+// build option 'final' is used and all CPP files are concatenated.
+// So it could well be, that in another CPP file these definitions
+// are also used.
+#undef SYMBOL_COL
+#undef NAME_COL
+#undef PRICE_COL
+#undef DATE_COL
+#undef ID_COL
+#undef SOURCE_COL
+
+#include "kequitypriceupdatedlg.moc"
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kequitypriceupdatedlg.h b/kmymoney2/dialogs/kequitypriceupdatedlg.h
new file mode 100644
index 0000000..7dbc6a5
--- /dev/null
+++ b/kmymoney2/dialogs/kequitypriceupdatedlg.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ kequitypriceupdatedlg.h - description
+ -------------------
+ begin : Tuesday June 22nd, 2004
+ copyright : (C) 2000-2004 by Kevin Tambascio
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KEQUITYPRICEUPDATEDIALOG_H
+#define KEQUITYPRICEUPDATEDIALOG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+#include <qpair.h>
+#include <qdatastream.h>
+class QListViewItem;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kprocess.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../converter/webpricequote.h"
+#include "../mymoney/mymoneysecurity.h"
+#include "../mymoney/mymoneyprice.h"
+#include "../dialogs/kequitypriceupdatedlgdecl.h"
+
+/**
+ * @author Kevin Tambascio & Ace Jones
+ */
+
+class KEquityPriceUpdateDlg : public KEquityPriceUpdateDlgDecl
+{
+ Q_OBJECT
+public:
+ KEquityPriceUpdateDlg(QWidget *parent, const QString& securityId = QString());
+ ~KEquityPriceUpdateDlg();
+ void storePrices(void);
+ MyMoneyPrice price(const QString& id) const;
+
+protected slots:
+ void slotUpdateSelectedClicked(void);
+ void slotUpdateAllClicked(void);
+ void slotUpdateSelection(void);
+
+ void logStatusMessage(const QString&);
+ void logErrorMessage(const QString&);
+ void slotReceivedQuote(const QString&, const QString&,const QDate&, const double&);
+ void slotQuoteFailed(const QString& _id, const QString& _symbol);
+
+protected:
+ void addPricePair(const MyMoneySecurityPair& pair, bool dontCheckExistance = false);
+ void addInvestment(const MyMoneySecurity& inv);
+ void finishUpdate(void);
+
+private:
+ bool m_fUpdateAll;
+ WebPriceQuote m_webQuote;
+};
+
+#endif
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kequitypriceupdatedlgdecl.ui b/kmymoney2/dialogs/kequitypriceupdatedlgdecl.ui
new file mode 100644
index 0000000..a06c44d
--- /dev/null
+++ b/kmymoney2/dialogs/kequitypriceupdatedlgdecl.ui
@@ -0,0 +1,179 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KEquityPriceUpdateDlgDecl</class>
+<author>Kevin Tambascio &lt;ktambascio@users.sourceforge.net&gt;</author>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kequitypriceupdatedlgdecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>537</width>
+ <height>482</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Update Stock and Currency Prices</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>lvEquityList</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>350</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="itemsMovable">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of known Equities, and the date they were last updated on.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnConfigure</cstring>
+ </property>
+ <property name="text">
+ <string>Configure</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnUpdateAll</cstring>
+ </property>
+ <property name="text">
+ <string>Update All</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnUpdateSelected</cstring>
+ </property>
+ <property name="text">
+ <string>Update Selected</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Status:</string>
+ </property>
+ </widget>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>lbStatus</cstring>
+ </property>
+ <property name="textFormat">
+ <enum>LogText</enum>
+ </property>
+ </widget>
+ <widget class="KProgress">
+ <property name="name">
+ <cstring>prgOnlineProgress</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnOK</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>2</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kexportdlg.cpp b/kmymoney2/dialogs/kexportdlg.cpp
new file mode 100644
index 0000000..c00e3cf
--- /dev/null
+++ b/kmymoney2/dialogs/kexportdlg.cpp
@@ -0,0 +1,284 @@
+/***************************************************************************
+ kexportdlg.cpp - description
+ -------------------
+ begin : Tue May 22 2001
+ copyright : (C) 2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@ctv.es>
+ Felix Rodriguez <frodriguez@mail.wesleyan.edu>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Headers
+
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#include <kglobal.h>
+#include <klocale.h>
+#if QT_VERSION > 300
+#include <kstandarddirs.h>
+#else
+#include <kstddirs.h>
+#endif
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <kpushbutton.h>
+#include <kiconloader.h>
+
+// ----------------------------------------------------------------------------
+// Project Headers
+
+#include "kexportdlg.h"
+#include "../mymoney/mymoneycategory.h"
+#include "../dialogs/mymoneyqifprofileeditor.h"
+#include "../mymoney/mymoneyfile.h"
+#include "../widgets/kmymoneyaccountcombo.h"
+#include "../kmymoneyutils.h"
+
+KExportDlg::KExportDlg(QWidget *parent)
+ : KExportDlgDecl(parent, 0, true)
+{
+ // Set (almost) all the last used options
+ readConfig();
+
+ loadProfiles(true);
+ loadAccounts();
+
+ // load button icons
+ KIconLoader* il = KGlobal::iconLoader();
+ m_qbuttonCancel->setGuiItem(KStdGuiItem::cancel());
+
+ KGuiItem okButtenItem( i18n( "&Export" ),
+ QIconSet(il->loadIcon("fileexport", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Start operation"),
+ i18n("Use this to start the export operation"));
+ m_qbuttonOk->setGuiItem(okButtenItem);
+
+ KGuiItem browseButtenItem( i18n( "&Browse..." ),
+ QIconSet(il->loadIcon("fileopen", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Select filename"),
+ i18n("Use this to select a filename to export to"));
+ m_qbuttonBrowse->setGuiItem(browseButtenItem);
+
+ KGuiItem newButtenItem( i18n( "&New..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new profile"),
+ i18n("Use this to open the profile editor"));
+ m_profileEditorButton->setGuiItem(newButtenItem);
+
+
+ // connect the buttons to their functionality
+ connect(m_qbuttonBrowse, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
+ connect(m_profileEditorButton, SIGNAL(clicked()), this, SLOT(slotNewProfile()));
+ connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
+ connect(m_qbuttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+
+ // connect the change signals to the check slot and perform initial check
+ connect(m_qlineeditFile, SIGNAL(textChanged(const QString&)), this, SLOT(checkData()));
+ connect(m_qcheckboxAccount, SIGNAL(toggled(bool)), this, SLOT(checkData()));
+ connect(m_qcheckboxCategories, SIGNAL(toggled(bool)), this, SLOT(checkData()));
+ connect(m_accountComboBox, SIGNAL(accountSelected(const QString&)), this, SLOT(checkData(const QString&)));
+ connect(m_profileComboBox, SIGNAL(highlighted(int)), this, SLOT(checkData()));
+ connect(m_kmymoneydateStart, SIGNAL(dateChanged(const QDate&)), this, SLOT(checkData()));
+ connect(m_kmymoneydateEnd, SIGNAL(dateChanged(const QDate&)), this, SLOT(checkData()));
+
+ checkData(QString());
+}
+
+KExportDlg::~KExportDlg()
+{
+}
+
+void KExportDlg::slotBrowse()
+{
+ QString newName(KFileDialog::getSaveFileName(QString::null,"*.QIF"));
+ KMyMoneyUtils::appendCorrectFileExt(newName, QString("qif"));
+ if (!newName.isEmpty())
+ m_qlineeditFile->setText(newName);
+}
+
+void KExportDlg::slotNewProfile(void)
+{
+ MyMoneyQifProfileEditor* editor = new MyMoneyQifProfileEditor(true, this, "QIF Profile Editor");
+ if(editor->exec()) {
+ m_profileComboBox->setCurrentText(editor->selectedProfile());
+ loadProfiles();
+ }
+ delete editor;
+}
+
+void KExportDlg::loadProfiles(const bool selectLast)
+{
+ // Creating an editor object here makes sure that
+ // we have at least the default profile available
+ MyMoneyQifProfileEditor* edit = new MyMoneyQifProfileEditor(true, 0, 0);
+ edit->slotOk();
+ delete edit;
+
+ QString current = m_profileComboBox->currentText();
+
+ m_profileComboBox->clear();
+
+ QStringList list;
+ KConfig* config = KGlobal::config();
+ config->setGroup("Profiles");
+
+ list = config->readListEntry("profiles");
+ list.sort();
+ m_profileComboBox->insertStringList(list);
+
+ if(selectLast == true) {
+ config->setGroup("Last Use Settings");
+ current = config->readEntry("KExportDlg_LastProfile");
+ }
+
+ m_profileComboBox->setCurrentItem(0);
+ if(list.contains(current) > 0)
+ m_profileComboBox->setCurrentText(current);
+}
+
+void KExportDlg::slotOkClicked()
+{
+ // Make sure we save the last used settings for use next time,
+ writeConfig();
+ accept();
+}
+
+void KExportDlg::readConfig(void)
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup("Last Use Settings");
+ m_qlineeditFile->setText(kconfig->readEntry("KExportDlg_LastFile"));
+ m_qcheckboxAccount->setChecked(kconfig->readBoolEntry("KExportDlg_AccountOpt", true));
+ m_qcheckboxCategories->setChecked(kconfig->readBoolEntry("KExportDlg_CatOpt", true));
+ m_kmymoneydateStart->setDate(kconfig->readDateTimeEntry("KExportDlg_StartDate").date());
+ m_kmymoneydateEnd->setDate(kconfig->readDateTimeEntry("KExportDlg_EndDate").date());
+ // m_profileComboBox is loaded in loadProfiles(), so we don't worry here
+ // m_accountComboBox is loaded in loadAccounts(), so we don't worry here
+}
+
+void KExportDlg::writeConfig(void)
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup("Last Use Settings");
+ kconfig->writeEntry("KExportDlg_LastFile", m_qlineeditFile->text());
+ kconfig->writeEntry("KExportDlg_AccountOpt", m_qcheckboxAccount->isChecked());
+ kconfig->writeEntry("KExportDlg_CatOpt", m_qcheckboxCategories->isChecked());
+ kconfig->writeEntry("KExportDlg_StartDate", QDateTime(m_kmymoneydateStart->date()));
+ kconfig->writeEntry("KExportDlg_EndDate", QDateTime(m_kmymoneydateEnd->date()));
+ kconfig->writeEntry("KExportDlg_LastProfile", m_profileComboBox->currentText());
+ kconfig->sync();
+}
+
+void KExportDlg::checkData(const QString& accountId)
+{
+ bool okEnabled = false;
+
+ if(!m_qlineeditFile->text().isEmpty()) {
+ QString strFile(m_qlineeditFile->text());
+ if(KMyMoneyUtils::appendCorrectFileExt(strFile, QString("qif")))
+ m_qlineeditFile->setText(strFile);
+ }
+
+ MyMoneyAccount account;
+ if(!accountId.isEmpty()) {
+ MyMoneyFile* file = MyMoneyFile::instance();
+ account = file->account(accountId);
+ if(m_lastAccount != accountId) {
+ MyMoneyTransactionFilter filter(accountId);
+ QValueList<MyMoneyTransaction> list = file->transactionList(filter);
+ QValueList<MyMoneyTransaction>::Iterator it;
+
+ if(!list.isEmpty()) {
+ it = list.begin();
+ m_kmymoneydateStart->loadDate((*it).postDate());
+ it = list.end();
+ --it;
+ m_kmymoneydateEnd->loadDate((*it).postDate());
+ }
+ m_lastAccount = accountId;
+ m_accountComboBox->setSelected(account);
+ }
+ }
+
+ if(!m_qlineeditFile->text().isEmpty()
+ && m_accountComboBox->selectedAccounts().count() != 0
+ && !m_profileComboBox->currentText().isEmpty()
+ && m_kmymoneydateStart->date() <= m_kmymoneydateEnd->date()
+ && (m_qcheckboxAccount->isChecked() || m_qcheckboxCategories->isChecked()))
+ okEnabled = true;
+
+ m_qbuttonOk->setEnabled(okEnabled);
+}
+
+void KExportDlg::loadAccounts(void)
+{
+/*
+ QStringList strList;
+
+ try {
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ // read all account items from the MyMoneyFile objects and add them to the listbox
+ addCategories(strList, file->liability().id(), QString());
+ addCategories(strList, file->asset().id(), QString());
+
+ } catch (MyMoneyException *e) {
+ qDebug("Exception '%s' thrown in %s, line %ld caught in KExportDlg::loadAccounts:%d",
+ e->what().latin1(), e->file().latin1(), e->line(), __LINE__);
+ delete e;
+ }
+*/
+ m_accountComboBox->loadList((KMyMoneyUtils::categoryTypeE)(KMyMoneyUtils::asset | KMyMoneyUtils::liability));
+
+/*
+ m_accountComboBox->setCurrentItem(0);
+ if(strList.contains(current) > 0)
+ m_accountComboBox->setCurrentText(current);
+*/
+}
+
+QString KExportDlg::accountId() const
+{
+ return m_lastAccount;
+}
+
+/*
+void KExportDlg::addCategories(QStringList& strList, const QString& id, const QString& leadIn) const
+{
+ MyMoneyFile *file = MyMoneyFile::instance();
+ QString name;
+
+ MyMoneyAccount account = file->account(id);
+
+ QStringList accList = account.accountList();
+ QStringList::ConstIterator it_a;
+
+ for(it_a = accList.begin(); it_a != accList.end(); ++it_a) {
+ account = file->account(*it_a);
+ strList << leadIn + account.name();
+ addCategories(strList, *it_a, leadIn + account.name() + ":");
+ }
+}
+
+QString KExportDlg::accountId(const QString& account) const
+{
+ return MyMoneyFile::instance()->nameToAccount(account);
+}
+*/
+
+#include "kexportdlg.moc"
diff --git a/kmymoney2/dialogs/kexportdlg.h b/kmymoney2/dialogs/kexportdlg.h
new file mode 100644
index 0000000..cad5091
--- /dev/null
+++ b/kmymoney2/dialogs/kexportdlg.h
@@ -0,0 +1,180 @@
+/***************************************************************************
+ kexportdlg.h - description
+ -------------------
+ begin : Tue May 22 2001
+ copyright : (C) 2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@ctv.es>
+ Felix Rodriguez <frodriguez@mail.wesleyan.edu>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef KEXPORTDLG_H
+#define KEXPORTDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Headers
+
+#include <qstring.h>
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#include <kcombobox.h>
+
+// ----------------------------------------------------------------------------
+// Project Headers
+
+#include "../widgets/kmymoneydateinput.h"
+#include "../dialogs/kexportdlgdecl.h"
+
+/**
+ * This class is used to select the required user input to export
+ * a specified account to the popular QIF format.
+ * It relies upon the QIF file handling routines in MyMoneyQifProfile and
+ * MyMoneyQifWriter to do the actual writing of QIF files.
+ *
+ * It uses the global KConfig object to read and write the application
+ * settings.
+ *
+ * @see MyMoneyAccount, MyMoneyQifProfile, MyMoneyQifProfileEditor
+ *
+ * @author Felix Rodriguez, Michael Edwardes, Thomas Baumgart 2000-2003
+ *
+ * @short A class to select user data required to export a specified account to the popular QIF format.
+ **/
+class KExportDlg : public KExportDlgDecl
+{
+ Q_OBJECT
+
+public:
+ KExportDlg(QWidget *parent);
+ ~KExportDlg();
+
+ /**
+ * This method returns the filename entered into the edit field
+ *
+ * @return QString with filename
+ */
+ const QString filename(void) const { return m_qlineeditFile->text(); };
+
+ /**
+ * This method returns the account id that has been selected for export
+ *
+ * @return QString with account id
+ */
+ QString accountId(void) const;
+
+ /**
+ * This method returns the name of the profile that has been selected
+ * for the export operation
+ *
+ * @return QString with profile name
+ */
+ const QString profile(void) const { return m_profileComboBox->currentText(); };
+
+ /**
+ * This method returns the start date of the export dialog
+ */
+ const QDate startDate(void) const { return m_kmymoneydateStart->date(); };
+
+ /**
+ * This method returns the end date of the export dialog
+ */
+ const QDate endDate(void) const { return m_kmymoneydateEnd->date(); };
+
+ /**
+ * This method returns the state of the account checkbox
+ */
+ bool accountSelected(void) const { return m_qcheckboxAccount->isChecked(); };
+
+ /**
+ * This method returns the state of the account checkbox
+ */
+ bool categorySelected(void) const { return m_qcheckboxCategories->isChecked(); };
+
+protected slots:
+ /**
+ * Called when the user clicked on the OK button
+ */
+ void slotOkClicked();
+
+ /**
+ * Called when the user needs to browse the filesystem for a QIF file
+ */
+ void slotBrowse();
+
+ /**
+ * Called when the user needs a new profile
+ */
+ void slotNewProfile(void);
+
+ /**
+ * This slot checks whether all data is correct to enable
+ * the 'Export' button. The enable state of the 'Export' button
+ * is updated appropriately.
+ *
+ * If the parameter @p account is not empty, then it is assumed
+ * a new account is selected and the date fields will be loaded
+ * with the date of the first and last transaction within this
+ * account.
+ *
+ * @param account The id of the selected account.
+ */
+ void checkData(const QString& account = QString());
+
+private:
+ void readConfig(void);
+ void writeConfig(void);
+
+ /**
+ * This method loads the available profiles into
+ * the combo box. The parameter @p selectLast controls if
+ * the last profile used is preset or not. If preset is not
+ * selected, the current selection remains. If the currently selected
+ * text is not present in the list anymore, the first item will be
+ * selected.
+ *
+ * @param selectLast If true, the last used profile is selected. The
+ * default is false.
+ */
+ void loadProfiles(const bool selectLast = false);
+
+ /**
+ * This method is used to load the available accounts into the
+ * combo box for selection.
+ */
+ void loadAccounts(void);
+
+ /**
+ * This method is used to load an account hierarchy into a string list
+ *
+ * @param strList Reference to the string list to setup
+ * @param id Account id to add
+ * @param leadIn constant leadin to be added in front of the account name
+ */
+ // void addCategories(QStringList& strList, const QString& id, const QString& leadIn) const;
+
+ /**
+ * This method is used to return the account id of a given account name
+ *
+ * @param account name of the account
+ * @return the ID of the account will be returned.
+ * See MyMoneyFile::nameToAccount() for details.
+ */
+ // QString accountId(const QString& account) const;
+
+private:
+ QString m_lastAccount;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kexportdlgdecl.ui b/kmymoney2/dialogs/kexportdlgdecl.ui
new file mode 100644
index 0000000..5425210
--- /dev/null
+++ b/kmymoney2/dialogs/kexportdlgdecl.ui
@@ -0,0 +1,507 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KExportDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KExportDlgDecl</cstring>
+ </property>
+ <property name="caption">
+ <string>QIF Export</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="text">
+ <string>From this dialog you are able to export transactions to a quicken compatible file, (known as a QIF file, because of the extension). Please enter the path to the QIF file or select it by clicking on the Browse button.
+
+You can choose the file's path, the account and the format of the QIF file (profile). Choose Account to export all the transactions between the specified dates or just categories. You can also limit the transactions that are exported by start and ending date. Once you have pressed the Export button a message box will appear when the export has completed detailing how many transactions, categories and payees were exported.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop|AlignLeft</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout45</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>lblFileExport</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>File to export to:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>m_qlineeditFile</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>LineEditPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonBrowse</cstring>
+ </property>
+ <property name="text">
+ <string>Browse...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Account to export</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyAccountCombo">
+ <property name="name">
+ <cstring>m_accountComboBox</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout47</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>QIF Profile</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout46</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>m_profileComboBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_profileEditorButton</cstring>
+ </property>
+ <property name="text">
+ <string>New...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_qgroupboxContents</cstring>
+ </property>
+ <property name="title">
+ <string>Contents to Export</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_qcheckboxAccount</cstring>
+ </property>
+ <property name="text">
+ <string>Account</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_qcheckboxCategories</cstring>
+ </property>
+ <property name="text">
+ <string>Categories</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_qgroupboxDates</cstring>
+ </property>
+ <property name="title">
+ <string>Date Range</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyDateInput" row="0" column="1">
+ <property name="name">
+ <cstring>m_kmymoneydateStart</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblEndDate</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>End on:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblStartDate</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Start on:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="1" column="1">
+ <property name="name">
+ <cstring>m_kmymoneydateEnd</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>230</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout49</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>451</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>Export</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyDateInput</class>
+ <header location="local">../widgets/kmymoneydateinput.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>1</hordata>
+ <verdata>1</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <slot access="protected" specifier="">slotDateChosen(QDate date)</slot>
+ </customwidget>
+ <customwidget>
+ <class>KMyMoneyAccountCombo</class>
+ <header location="local">../widgets/kmymoneyaccountcombo.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>3</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="3368">789c9595c94eeb581086f73c4544ed50ab6eecd889ad562f1802843961a6d58b632764228c616cf5bb77f9d45fe75e11165c4c703e55d55fc319f8b152bb38daafadfc587a9abbf9b8ac9523f7585be93fcf66ef7ffff3d7bf4bcb715c93df2891d7f21f4bcb5cd4cadac1ddedc003fd02ddf9af16274075ffe3b91738f33c01276aa722b0b753ec390b7c0cce107f092e238d7fa838aa578fe713b0c5bf1aabdddd8033e49f1923be052e11df31867dc77366fe1c81cdbeab1c5b3d4d30f2d351c571dd988fc196ffda731e43cf811b98a79b06d6fa5e8c11ff1458e775054ec0dd8a1b91f9731d9ca9dd0d9513d35ff79c9b9dc7c68ddcdbf7c125ecefca16cf7e9e4994987dcfb34b73d86363e41f559cc6691ff93f8c119f2a3723b5bb8931faffc91abf691cabfd0e9c42ffd21876bf9ea90bf946c6a9f37ca66cf16e0c463fb46a8cf95e0456bb3346be3ad8fa3d34463fcf153763b33b678cf853e516e6415bc688bf31567fde04a7e8cffcd13ffbf56f4afea6ef971265f157bdd218f9d7c0e8878fc0a88ffdfe6f355a51abe1b9ad9c59ff0781fd7e62afdf2a5a79abf0f63765f377857123f2f67bb0e5f3e7256bb4f24cf3ed83fbcad4530efe99e722373e5476981faf05d679ad1aa3fe0b63ad8737c0982fed19c33ea8384ff2284f3c1f283b9be746609dc79bb19e37877837403d3bca458cf3531a23de9fdfbc147fed673bb0d6f7688cfc5960cdd737c6bc87caa2affe8dc09aefc338d17e3be026f291b1fad318ecb0bf38b0f677628cf5f1f7ab4b4c8f7363d4731b58eb2763d43f02231f9f0656bd8631f44cdfe6d535c67afaf9b8d245aef43c05a7e04439c44f8d511f2b9736cf79609d0ff44b9bd719d8ea7b0763fdd89f8742ea6beabfed73e53206df05d6fbecd618e7f311dc84ff0bd82993df7f453fd81f02abdecc58f737a56087fbf3d518f14f81f5bed17afb7dac07b58dd19fbfcfcab418383d3f73e550df36d8fa7f0eacfa57ca03ccbb3b67928ffbc6435eaf10ef92fb3ce06b1e7ef18c78cc138d80bee329dff08c6ff98eeff9811ff989e7fcecdf2ffcca6ffcfed39f0bf93610ef0f5ee5355ee70d6ef3266fc9df6deec8b3c3bbbcf7497f5fb40ff8503c8eb8cb3d6fedf1b1d0099f4accd927fd219f7bef0bf1eaf1255f719d23ff3de606279c7ed26f4addeba25629b738e39c98881c891695d45fd4a7016fd075e54d431ad1980f684253bae11ecde896ee16f41fe95e6c0f9c55def4484f92ab4573afd1a6e785fa5f65264ebc72effd22b1aff446eff421d60b5a5dd09fd39af8af134b254fbe8f8836a84d958aa3ad85fab765de3dea48979b555db4237ebbb447fbf23ea0c3c5fa799b643ea2d595ba7ba2bd2b9e0f744c27dca0d32feaef5029fe056f499767744e173413cb842ee98aea5fe877a4d7a85a577aa148a6b94fb1ecb3091d5183924ffa234a659f9c4ae61b8e6cffd2896837a945d9c2fa8e650fcadea2bc72e3b69399b842a2afe41eebbb81bbfea43f7143d983a91b714a776e4cab74e89f3a6db9899bba9b4ffadf7c82fe6ff857e7f7f7f425e25b39baf3e5fffe5cfa1fdc4beba0</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kfindtransactiondlg.cpp b/kmymoney2/dialogs/kfindtransactiondlg.cpp
new file mode 100644
index 0000000..f122ba2
--- /dev/null
+++ b/kmymoney2/dialogs/kfindtransactiondlg.cpp
@@ -0,0 +1,843 @@
+/***************************************************************************
+ kfindtransactiondlg.cpp
+ -------------------
+ copyright : (C) 2003, 2007 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qtimer.h>
+#include <qtabwidget.h>
+#include <qlayout.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kapplication.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kpushbutton.h>
+#include <klineedit.h>
+#include <klistview.h>
+#include <kcombobox.h>
+#include <kstdguiitem.h>
+#include <kiconloader.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kfindtransactiondlg.h"
+
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneychecklistitem.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+#include <kmymoney/register.h>
+#include <kmymoney/transaction.h>
+#include <kmymoney/kmymoneycombo.h>
+
+#include "ksortoptiondlg.h"
+
+KFindTransactionDlg::KFindTransactionDlg(QWidget *parent, const char *name) :
+ KFindTransactionDlgDecl(parent, name, false),
+ m_needReload(false)
+{
+ m_register->installEventFilter(this);
+ m_tabWidget->setTabEnabled(m_resultPage, false);
+
+ // 'cause we don't have a separate setupTextPage
+ connect(m_textEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+
+ setupAccountsPage();
+ setupCategoriesPage();
+ setupDatePage();
+ setupAmountPage();
+ setupPayeesPage();
+ setupDetailsPage();
+
+ // We don't need to add the default into the list (see ::slotShowHelp() why)
+ // m_helpAnchor[m_textTab] = QString("details.search");
+ m_helpAnchor[m_accountTab] = QString("details.search.account");
+ m_helpAnchor[m_dateTab] = QString("details.search.date");
+ m_helpAnchor[m_amountTab] = QString("details.search.amount");
+ m_helpAnchor[m_categoryTab] = QString("details.search.category");
+ m_helpAnchor[m_payeeTab] = QString("details.search.payee");
+ m_helpAnchor[m_detailsTab] = QString("details.search.details");
+
+ // setup the register
+ QValueList<KMyMoneyRegister::Column> cols;
+ cols << KMyMoneyRegister::DateColumn;
+ cols << KMyMoneyRegister::AccountColumn;
+ cols << KMyMoneyRegister::DetailColumn;
+ cols << KMyMoneyRegister::ReconcileFlagColumn;
+ cols << KMyMoneyRegister::PaymentColumn;
+ cols << KMyMoneyRegister::DepositColumn;
+ m_register->setupRegister(MyMoneyAccount(), cols);
+ m_register->setSelectionMode(QTable::Single);
+
+ connect(m_register, SIGNAL(editTransaction()), this, SLOT(slotSelectTransaction()));
+ connect(m_register, SIGNAL(headerClicked()), this, SLOT(slotSortOptions()));
+
+ slotUpdateSelections();
+
+ // setup the connections
+ connect(m_searchButton, SIGNAL(clicked()), this, SLOT(slotSearch()));
+ connect(m_resetButton, SIGNAL(clicked()), this, SLOT(slotReset()));
+ connect(m_resetButton, SIGNAL(clicked()), m_accountsView, SLOT(slotSelectAllAccounts()));
+ connect(m_resetButton, SIGNAL(clicked()), m_categoriesView, SLOT(slotSelectAllAccounts()));
+ connect(m_closeButton, SIGNAL(clicked()), this, SLOT(deleteLater()));
+ connect(m_helpButton, SIGNAL(clicked()), this, SLOT(slotShowHelp()));
+
+ // only allow searches when a selection has been made
+ connect(this, SIGNAL(selectionEmpty(bool)), m_searchButton, SLOT(setDisabled(bool)));
+
+ // get signal about engine changes
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotRefreshView()));
+
+ slotUpdateSelections();
+
+ m_textEdit->setFocus();
+}
+
+void KFindTransactionDlg::slotReset(void)
+{
+ m_textEdit->setText(QString());
+ m_regExp->setChecked(false);
+ m_caseSensitive->setChecked(false);
+ m_textNegate->setCurrentItem(0);
+
+ m_amountEdit->setEnabled(true);
+ m_amountFromEdit->setEnabled(false);
+ m_amountToEdit->setEnabled(false);
+ m_amountEdit->loadText(QString());
+ m_amountFromEdit->loadText(QString());
+ m_amountToEdit->loadText(QString());
+ m_amountButton->setChecked(true);
+ m_amountRangeButton->setChecked(false);
+
+ m_emptyPayeesButton->setChecked(false);
+ selectAllItems(m_payeesView, true);
+
+ m_typeBox->setCurrentItem(MyMoneyTransactionFilter::allTypes);
+ m_stateBox->setCurrentItem(MyMoneyTransactionFilter::allStates);
+ m_validityBox->setCurrentItem(MyMoneyTransactionFilter::anyValidity);
+
+ m_nrEdit->setEnabled(true);
+ m_nrFromEdit->setEnabled(false);
+ m_nrToEdit->setEnabled(false);
+ m_nrEdit->setText(QString());
+ m_nrFromEdit->setText(QString());
+ m_nrToEdit->setText(QString());
+ m_nrButton->setChecked(true);
+ m_nrRangeButton->setChecked(false);
+
+ m_tabWidget->setTabEnabled(m_resultPage, false);
+ m_tabWidget->setCurrentPage(m_tabWidget->indexOf(m_criteriaTab));
+
+ // the following call implies a call to slotUpdateSelections,
+ // that's why we call it last
+ m_dateRange->setCurrentItem(MyMoneyTransactionFilter::allDates);
+ slotDateRangeChanged(MyMoneyTransactionFilter::allDates);
+}
+
+void KFindTransactionDlg::slotUpdateSelections(void)
+{
+ QString txt;
+
+ // Text tab
+ if(!m_textEdit->text().isEmpty()) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Text");
+ m_regExp->setEnabled(QRegExp(m_textEdit->text()).isValid());
+ } else
+ m_regExp->setEnabled(false);
+
+ m_caseSensitive->setEnabled(!m_textEdit->text().isEmpty());
+ m_textNegate->setEnabled(!m_textEdit->text().isEmpty());
+
+ // Account tab
+ if(!m_accountsView->allItemsSelected()) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Account");
+ }
+
+ // Date tab
+ if(m_dateRange->currentItem() != 0) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Date");
+ }
+
+ // Amount tab
+ if((m_amountButton->isChecked() && m_amountEdit->isValid())
+ || (m_amountRangeButton->isChecked()
+ && (m_amountFromEdit->isValid() || m_amountToEdit->isValid()))) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Amount");
+ }
+
+ // Categories tab
+ if(!m_categoriesView->allItemsSelected()) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Category");
+ }
+
+ // Payees tab
+ if(!allItemsSelected(m_payeesView)
+ || m_emptyPayeesButton->isChecked()) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Payees");
+ }
+ m_payeesView->setEnabled(!m_emptyPayeesButton->isChecked());
+
+ // Details tab
+ if(m_typeBox->currentItem() != 0
+ || m_stateBox->currentItem() != 0
+ || m_validityBox->currentItem() != 0
+ || (m_nrButton->isChecked() && m_nrEdit->text().length() != 0)
+ || (m_nrRangeButton->isChecked()
+ && (m_nrFromEdit->text().length() != 0 || m_nrToEdit->text().length() != 0))) {
+ if(!txt.isEmpty())
+ txt += ", ";
+ txt += i18n("Details");
+ }
+
+ //Show a warning about transfers if Categories are filtered - bug #1523508
+ if(!m_categoriesView->allItemsSelected()) {
+ m_transferWarning->setText( i18n("Warning: Filtering by Category will exclude all transfers from the results.") );
+ } else {
+ m_transferWarning->setText("");
+ }
+
+ // disable the search button if no selection is made
+ emit selectionEmpty(txt.isEmpty());
+
+ if(txt.isEmpty()) {
+ txt = i18n("(None)");
+ }
+ m_selectedCriteria->setText(i18n("Current selections: ") + txt);
+}
+
+bool KFindTransactionDlg::allItemsSelected(const QListViewItem *item) const
+{
+ QListViewItem* it_v;
+
+ for(it_v = item->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ if(it_v->rtti() == 1) {
+ QCheckListItem* it_c = static_cast<QCheckListItem*>(it_v);
+ if(!(it_c->isOn() && allItemsSelected(it_v)))
+ return false;
+ }
+ }
+ return true;
+}
+
+bool KFindTransactionDlg::allItemsSelected(const QListView* view) const
+{
+ QListViewItem* it_v;
+
+ for(it_v = view->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ if(it_v->rtti() == 1) {
+ QCheckListItem* it_c = static_cast<QCheckListItem*>(it_v);
+ if(it_c->type() == QCheckListItem::CheckBox) {
+ if(!(it_c->isOn() && allItemsSelected(it_v)))
+ return false;
+ } else {
+ if(!allItemsSelected(it_v))
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void KFindTransactionDlg::setupAccountsPage(void)
+{
+ m_accountsView->setSelectionMode(QListView::Multi);
+ AccountSet accountSet;
+ accountSet.addAccountGroup(MyMoneyAccount::Asset);
+ accountSet.addAccountGroup(MyMoneyAccount::Liability);
+ //set the accountset to show closed account if the settings say so
+ accountSet.setHideClosedAccounts(KMyMoneyGlobalSettings::hideClosedAccounts());
+ accountSet.load(m_accountsView);
+ connect(m_accountsView, SIGNAL(stateChanged()), this, SLOT(slotUpdateSelections()));
+}
+
+void KFindTransactionDlg::selectAllItems(QListView* view, const bool state)
+{
+ QListViewItem* it_v;
+
+ for(it_v = view->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ QCheckListItem* it_c = static_cast<QCheckListItem*>(it_v);
+ if(it_c->type() == QCheckListItem::CheckBox) {
+ it_c->setOn(state);
+ }
+ selectAllSubItems(it_v, state);
+ }
+
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::selectItems(QListView* view, const QStringList& list, const bool state)
+{
+ QListViewItem* it_v;
+
+ for(it_v = view->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ KMyMoneyCheckListItem* it_c = static_cast<KMyMoneyCheckListItem*>(it_v);
+ if(it_c->type() == QCheckListItem::CheckBox && list.contains(it_c->id())) {
+ it_c->setOn(state);
+ }
+ selectSubItems(it_v, list, state);
+ }
+
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::setupCategoriesPage(void)
+{
+ m_categoriesView->setSelectionMode(QListView::Multi);
+ AccountSet categorySet;
+ categorySet.addAccountGroup(MyMoneyAccount::Income);
+ categorySet.addAccountGroup(MyMoneyAccount::Expense);
+ categorySet.load(m_categoriesView);
+ connect(m_categoriesView, SIGNAL(stateChanged()), this, SLOT(slotUpdateSelections()));
+}
+
+void KFindTransactionDlg::selectAllSubItems(QListViewItem* item, const bool state)
+{
+ QListViewItem* it_v;
+
+ for(it_v = item->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ static_cast<QCheckListItem*>(it_v)->setOn(state);
+ selectAllSubItems(it_v, state);
+ }
+}
+
+void KFindTransactionDlg::selectSubItems(QListViewItem* item, const QStringList& list, const bool state)
+{
+ QListViewItem* it_v;
+
+ for(it_v = item->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ KMyMoneyCheckListItem* it_c = static_cast<KMyMoneyCheckListItem*>(it_v);
+ if(list.contains(it_c->id()))
+ it_c->setOn(state);
+ selectSubItems(it_v, list, state);
+ }
+}
+
+void KFindTransactionDlg::setupDatePage(void)
+{
+ int i;
+ for(i = MyMoneyTransactionFilter::allDates; i < MyMoneyTransactionFilter::dateOptionCount; ++i) {
+ MyMoneyTransactionFilter::translateDateRange(static_cast<MyMoneyTransactionFilter::dateOptionE>(i), m_startDates[i], m_endDates[i]);
+ }
+
+ connect(m_dateRange, SIGNAL(itemSelected(int)), this, SLOT(slotDateRangeChanged(int)));
+ connect(m_fromDate, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotDateChanged()));
+ connect(m_toDate, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotDateChanged()));
+
+ slotDateRangeChanged(MyMoneyTransactionFilter::allDates);
+}
+
+void KFindTransactionDlg::slotDateRangeChanged(int idx)
+{
+ switch(idx) {
+ case MyMoneyTransactionFilter::allDates:
+ case MyMoneyTransactionFilter::userDefined:
+ m_fromDate->loadDate(QDate());
+ m_toDate->loadDate(QDate());
+ break;
+ default:
+ m_fromDate->loadDate(m_startDates[idx]);
+ m_toDate->loadDate(m_endDates[idx]);
+ break;
+ }
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::slotDateChanged(void)
+{
+ int idx;
+ for(idx = MyMoneyTransactionFilter::asOfToday; idx < MyMoneyTransactionFilter::dateOptionCount; ++idx) {
+ if(m_fromDate->date() == m_startDates[idx]
+ && m_toDate->date() == m_endDates[idx]) {
+ break;
+ }
+ }
+ //if no filter matched, set to user defined
+ if(idx == MyMoneyTransactionFilter::dateOptionCount)
+ idx = MyMoneyTransactionFilter::userDefined;
+
+ m_dateRange->blockSignals(true);
+ m_dateRange->setCurrentItem(static_cast<MyMoneyTransactionFilter::dateOptionE>(idx));
+ m_dateRange->blockSignals(false);
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::setupAmountPage(void)
+{
+ connect(m_amountButton, SIGNAL(clicked()), this, SLOT(slotAmountSelected()));
+ connect(m_amountRangeButton, SIGNAL(clicked()), this, SLOT(slotAmountRangeSelected()));
+
+ connect(m_amountEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+ connect(m_amountFromEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+ connect(m_amountToEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+
+ m_amountButton->setChecked(true);
+ slotAmountSelected();
+}
+
+void KFindTransactionDlg::slotAmountSelected(void)
+{
+ m_amountEdit->setEnabled(true);
+ m_amountFromEdit->setEnabled(false);
+ m_amountToEdit->setEnabled(false);
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::slotAmountRangeSelected(void)
+{
+ m_amountEdit->setEnabled(false);
+ m_amountFromEdit->setEnabled(true);
+ m_amountToEdit->setEnabled(true);
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::setupPayeesPage(void)
+{
+ m_payeesView->setSelectionMode(QListView::Single);
+ m_payeesView->header()->hide();
+
+ loadPayees();
+ m_emptyPayeesButton->setChecked(false);
+
+ connect(m_allPayeesButton, SIGNAL(clicked()), this, SLOT(slotSelectAllPayees()));
+ connect(m_clearPayeesButton, SIGNAL(clicked()), this, SLOT(slotDeselectAllPayees()));
+ connect(m_emptyPayeesButton, SIGNAL(stateChanged(int)), this, SLOT(slotUpdateSelections()));
+}
+
+void KFindTransactionDlg::loadPayees(void)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+ QValueList<MyMoneyPayee> list;
+ QValueList<MyMoneyPayee>::Iterator it_l;
+
+ list = file->payeeList();
+ // load view
+ for(it_l = list.begin(); it_l != list.end(); ++it_l) {
+ KMyMoneyCheckListItem* item = new KMyMoneyCheckListItem(m_payeesView, (*it_l).name(), QString(), (*it_l).id());
+ connect(item, SIGNAL(stateChanged(bool)), this, SLOT(slotUpdateSelections()));
+ item->setOn(true);
+ }
+}
+void KFindTransactionDlg::slotSelectAllPayees(void)
+{
+ selectAllItems(m_payeesView, true);
+}
+
+void KFindTransactionDlg::slotDeselectAllPayees(void)
+{
+ selectAllItems(m_payeesView, false);
+}
+
+void KFindTransactionDlg::setupDetailsPage(void)
+{
+ connect(m_typeBox, SIGNAL(activated(int)), this, SLOT(slotUpdateSelections()));
+ connect(m_stateBox, SIGNAL(activated(int)), this, SLOT(slotUpdateSelections()));
+ connect(m_validityBox, SIGNAL(activated(int)), this, SLOT(slotUpdateSelections()));
+
+ connect(m_nrButton, SIGNAL(clicked()), this, SLOT(slotNrSelected()));
+ connect(m_nrRangeButton, SIGNAL(clicked()), this, SLOT(slotNrRangeSelected()));
+ connect(m_nrEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+ connect(m_nrFromEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+ connect(m_nrToEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateSelections()));
+
+ m_nrButton->setChecked(true);
+ slotNrSelected();
+}
+
+void KFindTransactionDlg::slotNrSelected(void)
+{
+ m_nrEdit->setEnabled(true);
+ m_nrFromEdit->setEnabled(false);
+ m_nrToEdit->setEnabled(false);
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::slotNrRangeSelected(void)
+{
+ m_nrEdit->setEnabled(false);
+ m_nrFromEdit->setEnabled(true);
+ m_nrToEdit->setEnabled(true);
+ slotUpdateSelections();
+}
+
+void KFindTransactionDlg::addItemToFilter(const opTypeE op, const QString& id)
+{
+ switch(op) {
+ case addAccountToFilter:
+ m_filter.addAccount(id);
+ break;
+ case addCategoryToFilter:
+ m_filter.addCategory(id);
+ break;
+ case addPayeeToFilter:
+ m_filter.addPayee(id);
+ break;
+ }
+}
+
+void KFindTransactionDlg::scanCheckListItems(const QListViewItem* item, const opTypeE op)
+{
+ QListViewItem* it_v;
+
+ for(it_v = item->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ if(it_v->rtti() == 1) {
+ KMyMoneyCheckListItem* it_c = static_cast<KMyMoneyCheckListItem*>(it_v);
+ if(it_c->type() == QCheckListItem::CheckBox) {
+ if(it_c->isOn())
+ addItemToFilter(op, (*it_c).id());
+ }
+ scanCheckListItems(it_v, op);
+ }
+ }
+}
+
+void KFindTransactionDlg::scanCheckListItems(const QListView* view, const opTypeE op)
+{
+ QListViewItem* it_v;
+
+ for(it_v = view->firstChild(); it_v != 0; it_v = it_v->nextSibling()) {
+ if(it_v->rtti() == 1) {
+ KMyMoneyCheckListItem* it_c = static_cast<KMyMoneyCheckListItem*>(it_v);
+ if(it_c->type() == QCheckListItem::CheckBox) {
+ if(it_c->isOn())
+ addItemToFilter(op, (*it_c).id());
+ }
+ scanCheckListItems(it_v, op);
+ }
+ }
+}
+
+void KFindTransactionDlg::setupFilter(void)
+{
+ m_filter.clear();
+
+ // Text tab
+ if(!m_textEdit->text().isEmpty()) {
+ QRegExp exp(m_textEdit->text(), m_caseSensitive->isChecked(), !m_regExp->isChecked());
+ m_filter.setTextFilter(exp, m_textNegate->currentItem() != 0);
+ }
+
+ // Account tab
+ if(!m_accountsView->allItemsSelected()) {
+ // retrieve a list of selected accounts
+ QStringList list;
+ m_accountsView->selectedItems(list);
+
+ // if we're not in expert mode, we need to make sure
+ // that all stock accounts for the selected investment
+ // account are also selected
+ if(!KMyMoneyGlobalSettings::expertMode()) {
+ QStringList missing;
+ QStringList::const_iterator it_a, it_b;
+ for(it_a = list.begin(); it_a != list.end(); ++it_a) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(*it_a);
+ if(acc.accountType() == MyMoneyAccount::Investment) {
+ for(it_b = acc.accountList().begin(); it_b != acc.accountList().end(); ++it_b) {
+ if(!list.contains(*it_b)) {
+ missing.append(*it_b);
+ }
+ }
+ }
+ }
+ list += missing;
+ }
+
+ m_filter.addAccount(list);
+ }
+
+ // Date tab
+ if(m_dateRange->currentItem() != 0) {
+ m_filter.setDateFilter(m_fromDate->date(), m_toDate->date());
+ }
+
+ // Amount tab
+ if((m_amountButton->isChecked() && m_amountEdit->isValid())) {
+ m_filter.setAmountFilter(m_amountEdit->value(), m_amountEdit->value());
+
+ } else if((m_amountRangeButton->isChecked()
+ && (m_amountFromEdit->isValid() || m_amountToEdit->isValid()))) {
+
+ MyMoneyMoney from(MyMoneyMoney::minValue), to(MyMoneyMoney::maxValue);
+ if(m_amountFromEdit->isValid())
+ from = m_amountFromEdit->value();
+ if(m_amountToEdit->isValid())
+ to = m_amountToEdit->value();
+
+ m_filter.setAmountFilter(from, to);
+ }
+
+ // Categories tab
+ if(!m_categoriesView->allItemsSelected()) {
+ m_filter.addCategory(m_categoriesView->selectedItems());
+ }
+
+ // Payees tab
+ if(m_emptyPayeesButton->isChecked()) {
+ m_filter.addPayee(QString());
+
+ } else if(!allItemsSelected(m_payeesView)) {
+ scanCheckListItems(m_payeesView, addPayeeToFilter);
+ }
+
+ // Details tab
+ if(m_typeBox->currentItem() != 0)
+ m_filter.addType(m_typeBox->currentItem());
+
+ if(m_stateBox->currentItem() != 0)
+ m_filter.addState(m_stateBox->currentItem());
+
+ if(m_validityBox->currentItem() != 0)
+ m_filter.addValidity(m_validityBox->currentItem());
+
+ if(m_nrButton->isChecked() && !m_nrEdit->text().isEmpty())
+ m_filter.setNumberFilter(m_nrEdit->text(), m_nrEdit->text());
+
+ if(m_nrRangeButton->isChecked()
+ && (!m_nrFromEdit->text().isEmpty() || !m_nrToEdit->text().isEmpty())) {
+ m_filter.setNumberFilter(m_nrFromEdit->text(), m_nrToEdit->text());
+ }
+}
+
+void KFindTransactionDlg::slotSearch(void)
+{
+ // setup the filter from the dialog widgets
+ setupFilter();
+
+ // filter is setup, now fill the register
+ slotRefreshView();
+
+ m_register->setFocus();
+}
+
+void KFindTransactionDlg::slotRefreshView(void)
+{
+ m_needReload = true;
+ if(isVisible()) {
+ loadView();
+ m_needReload = false;
+ }
+}
+
+void KFindTransactionDlg::show(void)
+{
+ if(m_needReload) {
+ loadView();
+ m_needReload = false;
+ }
+ KFindTransactionDlgDecl::show();
+}
+
+void KFindTransactionDlg::loadView(void)
+{
+ // setup sort order
+ m_register->setSortOrder(KMyMoneyGlobalSettings::sortSearchView());
+
+ // clear out old data
+ m_register->clear();
+
+ // retrieve the list from the engine
+ MyMoneyFile::instance()->transactionList(m_transactionList, m_filter);
+
+ // create the elements for the register
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> >::const_iterator it;
+ QMap<QString, int>uniqueMap;
+ MyMoneyMoney deposit, payment;
+
+ int splitCount = 0;
+ for(it = m_transactionList.begin(); it != m_transactionList.end(); ++it) {
+ const MyMoneySplit& split = (*it).second;
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(split.accountId());
+ ++splitCount;
+ uniqueMap[(*it).first.id()]++;
+
+ KMyMoneyRegister::Register::transactionFactory(m_register, (*it).first, (*it).second, uniqueMap[(*it).first.id()]);
+ { // debug stuff
+ if(split.shares().isNegative()) {
+ payment += split.shares().abs();
+ } else {
+ deposit += split.shares().abs();
+ }
+ }
+ }
+
+ // add the group markers
+ m_register->addGroupMarkers();
+
+ // sort the transactions according to the sort setting
+ m_register->sortItems();
+
+ // remove trailing and adjacent markers
+ m_register->removeUnwantedGroupMarkers();
+
+ // turn on the ledger lens for the register
+ m_register->setLedgerLensForced();
+
+ m_register->updateRegister(true);
+
+ m_register->setFocusToTop();
+ m_register->selectItem(m_register->focusItem());
+
+#if KMM_DEBUG
+ m_foundText->setText(i18n("Found %1 matching transactions (D %2 / P %3 = %4)")
+ .arg(splitCount).arg(deposit.formatMoney("", 2)).arg(payment.formatMoney("", 2)).arg((deposit-payment).formatMoney("", 2)));
+#else
+ m_foundText->setText(i18n("Found %1 matching transactions") .arg(splitCount));
+#endif
+
+ m_tabWidget->setTabEnabled(m_resultPage, true);
+ m_tabWidget->setCurrentPage(m_tabWidget->indexOf(m_resultPage));
+
+ QTimer::singleShot(10, this, SLOT(slotRightSize()));
+}
+
+void KFindTransactionDlg::slotRightSize(void)
+{
+ m_register->updateContents();
+}
+
+void KFindTransactionDlg::resizeEvent(QResizeEvent* ev)
+{
+ // Columns
+ // 1 = Date
+ // 2 = Account
+ // 4 = Detail
+ // 5 = C
+ // 6 = Payment
+ // 7 = Deposit
+
+ // don't forget the resizer
+ KFindTransactionDlgDecl::resizeEvent(ev);
+
+ if(!m_register->isVisible())
+ return;
+
+ // resize the register
+ int w = m_register->visibleWidth();
+
+ int m_debitWidth = 80;
+ int m_creditWidth = 80;
+
+ m_register->adjustColumn(1);
+ m_register->adjustColumn(2);
+ m_register->adjustColumn(5);
+
+ m_register->setColumnWidth(6, m_debitWidth);
+ m_register->setColumnWidth(7, m_creditWidth);
+
+ for(int i = 0; i < m_register->numCols(); ++i) {
+ switch(i) {
+ case 4: // skip the one, we want to set
+ break;
+ default:
+ w -= m_register->columnWidth(i);
+ break;
+ }
+ }
+
+ m_register->setColumnWidth(4, w);
+}
+
+
+void KFindTransactionDlg::slotSelectTransaction(void)
+{
+ QValueList<KMyMoneyRegister::RegisterItem*> list = m_register->selectedItems();
+ if(!list.isEmpty()) {
+ KMyMoneyRegister::Transaction* t = dynamic_cast<KMyMoneyRegister::Transaction*>(list[0]);
+ if(t) {
+ emit transactionSelected(t->split().accountId(), t->transaction().id());
+ hide();
+ }
+ }
+}
+
+bool KFindTransactionDlg::eventFilter(QObject* o, QEvent* e)
+{
+ bool rc = false;
+
+ if(o->isWidgetType()) {
+ if(e->type() == QEvent::KeyPress) {
+ const QWidget* w = dynamic_cast<const QWidget*>(o);
+ QKeyEvent *k = static_cast<QKeyEvent *> (e);
+ if(w == m_register) {
+ switch(k->key()) {
+ default:
+ break;
+
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ rc = true;
+ slotSelectTransaction();
+ break;
+ }
+ }
+ }
+ }
+ return rc;
+}
+
+void KFindTransactionDlg::slotShowHelp(void)
+{
+ QString anchor = m_helpAnchor[m_criteriaTab->currentPage()];
+ if(anchor.isEmpty())
+ anchor = QString("details.search");
+
+ kapp->invokeHelp(anchor);
+}
+
+void KFindTransactionDlg::slotSortOptions(void)
+{
+ KSortOptionDlg* dlg = new KSortOptionDlg(this);
+
+ dlg->setSortOption(KMyMoneyGlobalSettings::sortSearchView(), QString());
+ dlg->hideDefaultButton();
+
+ if(dlg->exec() == QDialog::Accepted) {
+ QString sortOrder = dlg->sortOption();
+ if(sortOrder != KMyMoneyGlobalSettings::sortSearchView()) {
+ KMyMoneyGlobalSettings::setSortSearchView(sortOrder);
+ slotRefreshView();
+ }
+ }
+ delete dlg;
+}
+
+
+// vim:cin:si:ai:et:ts=2:sw=2:
+
+
+#include "kfindtransactiondlg.moc"
diff --git a/kmymoney2/dialogs/kfindtransactiondlg.h b/kmymoney2/dialogs/kfindtransactiondlg.h
new file mode 100644
index 0000000..edf9504
--- /dev/null
+++ b/kmymoney2/dialogs/kfindtransactiondlg.h
@@ -0,0 +1,203 @@
+/***************************************************************************
+ kfindtransactiondlg.h
+ -------------------
+ copyright : (C) 2003 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KFINDTRANSACTIONDLG_H
+#define KFINDTRANSACTIONDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlistview.h>
+#include <qdatetime.h>
+#include <qmap.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+// #include "../views/kledgerview.h"
+#include <kmymoney/mymoneyutils.h>
+#include <kmymoney/mymoneytransactionfilter.h>
+
+#include "../dialogs/kfindtransactiondlgdecl.h"
+
+class QListView;
+class QListViewItem;
+
+/**
+ * @author Thomas Baumgart
+ */
+class KFindTransactionDlg : public KFindTransactionDlgDecl
+{
+ Q_OBJECT
+public:
+
+ /*
+ // Make sure to keep the following enum valus in sync with the values
+ // used by the GUI in kfindtransactiondlgdecl.ui
+ enum dateOptionE {
+ allDates = 0,
+ asOfToday,
+ currentMonth,
+ currentYear,
+ monthToDate,
+ yearToDate,
+ yearToMonth,
+ lastMonth,
+ lastYear,
+ last7Days,
+ last30Days,
+ last3Months,
+ last6Months,
+ last12Months,
+ next7Days,
+ next30Days,
+ next3Months,
+ next6Months,
+ next12Months,
+ userDefined,
+ last3ToNext3Months,
+ last11Months,
+ // insert new constants above of this line
+ dateOptionCount
+ };
+*/
+ KFindTransactionDlg(QWidget *parent=0, const char *name=0);
+ ~KFindTransactionDlg() {}
+
+ virtual bool eventFilter( QObject *o, QEvent *e );
+
+public slots:
+ void show(void);
+
+protected:
+ void resizeEvent(QResizeEvent*);
+
+protected slots:
+ virtual void slotReset(void);
+ virtual void slotSearch(void);
+
+ /**
+ * This slot opens the detailed help page in khelpcenter. The
+ * anchor for the information is taken from m_helpAnchor.
+ */
+ virtual void slotShowHelp(void);
+
+
+ void slotUpdateSelections(void);
+
+ virtual void slotDateRangeChanged(int);
+ virtual void slotDateChanged(void);
+
+ virtual void slotAmountSelected(void);
+ virtual void slotAmountRangeSelected(void);
+
+ virtual void slotSelectAllPayees(void);
+ virtual void slotDeselectAllPayees(void);
+
+ virtual void slotNrSelected(void);
+ virtual void slotNrRangeSelected(void);
+
+ void slotRefreshView(void);
+
+ /**
+ * This slot selects the current selected transaction/split and emits
+ * the signal @a transactionSelected(const QString& accountId, const QString& transactionId)
+ */
+ void slotSelectTransaction(void);
+
+ void slotRightSize(void);
+
+ void slotSortOptions(void);
+
+signals:
+ void transactionSelected(const QString& accountId, const QString& transactionId);
+
+ /**
+ * This signal is sent out when no selection has been made. It is
+ * used to control the state of the Search button.
+ */
+ void selectionEmpty(bool);
+
+protected:
+ enum opTypeE {
+ addAccountToFilter = 0,
+ addCategoryToFilter,
+ addPayeeToFilter
+ };
+
+ void setupCategoriesPage(void);
+ void setupDatePage(void);
+ void setupAccountsPage(void);
+ void setupAmountPage(void);
+ void setupPayeesPage(void);
+ void setupDetailsPage(void);
+
+ void setupFilter(void);
+
+ void selectAllItems(QListView* view, const bool state);
+ void selectAllSubItems(QListViewItem* item, const bool state);
+ void selectItems(QListView* view, const QStringList& list, const bool state);
+ void selectSubItems(QListViewItem* item, const QStringList& list, const bool state);
+
+ /**
+ * This method loads the m_payeesView with the payees name
+ * found in the engine.
+ */
+ void loadPayees(void);
+
+ /**
+ * This method loads the register with the matching transactions
+ */
+ void loadView(void);
+
+ /**
+ * This method returns information about the selection state
+ * of the items in the m_accountsView.
+ *
+ * @param view pointer to the listview to scan
+ *
+ * @retval true if all items in the view are marked
+ * @retval false if at least one item is not marked
+ *
+ * @note If the view contains no items the method returns @p true.
+ */
+ bool allItemsSelected(const QListView* view) const;
+ bool allItemsSelected(const QListViewItem *item) const;
+
+ void scanCheckListItems(const QListView* view, const opTypeE op);
+ void scanCheckListItems(const QListViewItem* item, const opTypeE op);
+ void addItemToFilter(const opTypeE op, const QString& id);
+
+protected:
+ QDate m_startDates[MyMoneyTransactionFilter::dateOptionCount];
+ QDate m_endDates[MyMoneyTransactionFilter::dateOptionCount];
+
+ /**
+ * This member holds a list of all transactions matching the filter criteria
+ */
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> > m_transactionList;
+
+ MyMoneyTransactionFilter m_filter;
+
+ QMap<QWidget*, QString> m_helpAnchor;
+
+ bool m_needReload;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kfindtransactiondlgdecl.ui b/kmymoney2/dialogs/kfindtransactiondlgdecl.ui
new file mode 100644
index 0000000..3340afd
--- /dev/null
+++ b/kmymoney2/dialogs/kfindtransactiondlgdecl.ui
@@ -0,0 +1,1101 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KFindTransactionDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KFindTransactionDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>771</width>
+ <height>481</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Search transactions</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>m_tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_criteriaPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Criteria</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Define your search criteria</string>
+ </property>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>m_criteriaTab</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>3</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_textTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Text</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="3" column="2">
+ <property name="name">
+ <cstring>Spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>83</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_textEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="0">
+ <item>
+ <property name="text">
+ <string>Contains</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Does not contain</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_textNegate</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_regExp</cstring>
+ </property>
+ <property name="text">
+ <string>Treat text as regular expression</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_caseSensitive</cstring>
+ </property>
+ <property name="text">
+ <string>Case sensitive</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_accountTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Account</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_accountsView</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_dateTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Date</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneyPeriodCombo" row="0" column="1">
+ <property name="name">
+ <cstring>m_dateRange</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Range</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="1" column="1">
+ <property name="name">
+ <cstring>m_fromDate</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>To</string>
+ <comment>To (Date)</comment>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>From</string>
+ <comment>From (Date)</comment>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="2" column="1">
+ <property name="name">
+ <cstring>m_toDate</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer25</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer22</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_amountTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Amount</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_amountButton</cstring>
+ </property>
+ <property name="text">
+ <string>Search this amount</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_amountRangeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Search amount in the range</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_amountToEdit</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel9</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>to</string>
+ <comment>to (amount)</comment>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_amountEdit</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>from</string>
+ <comment>from (amount)</comment>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_amountFromEdit</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer28</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>75</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_categoryTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Category</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_categoriesView</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_payeeTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Payee</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout46</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Payee</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_payeesView</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_emptyPayeesButton</cstring>
+ </property>
+ <property name="text">
+ <string>Select transactions without payees</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout45</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_allPayeesButton</cstring>
+ </property>
+ <property name="text">
+ <string>Select all</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_clearPayeesButton</cstring>
+ </property>
+ <property name="text">
+ <string>Select none</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer29</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>42</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_detailsTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Details</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout19</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel11_2</cstring>
+ </property>
+ <property name="text">
+ <string>Validity</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>All states</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Not reconciled</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Cleared</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Reconciled</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_stateBox</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>All types</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Payments</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Deposits</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Transfers</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_typeBox</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>Any transaction</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Valid transaction</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Invalid transaction</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_validityBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>State</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer30</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>130</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout21</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_nrButton</cstring>
+ </property>
+ <property name="text">
+ <string>Search this number</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_nrRangeButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search number in range</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel12</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel14</cstring>
+ </property>
+ <property name="text">
+ <string>to</string>
+ <comment>to (number)</comment>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_nrToEdit</cstring>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_nrEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel13</cstring>
+ </property>
+ <property name="text">
+ <string>from</string>
+ <comment>from (number)</comment>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_nrFromEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer31</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer32</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_selectedCriteria</cstring>
+ </property>
+ <property name="text">
+ <string>text</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_transferWarning</cstring>
+ </property>
+ <property name="paletteForegroundColor">
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>warning</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>24</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_resultPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Result</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneyRegister::Register">
+ <column>
+ <property name="text">
+ <string>Security</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Details</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>C</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Payment</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Deposit</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Quantity</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Balance</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_register</cstring>
+ </property>
+ <property name="numRows">
+ <number>0</number>
+ </property>
+ <property name="numCols">
+ <number>12</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_foundText</cstring>
+ </property>
+ <property name="text">
+ <string>F</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_helpButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>11</number>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>13</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_resetButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Reset</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>21</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_searchButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Find</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>25</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyLineEdit</class>
+ <header location="local">../widgets/kmymoneylineedit.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>kMyMoneyAccountSelector</class>
+ <header location="global">../widgets/kmymoneyaccountselector.h</header>
+ <sizehint>
+ <width>80</width>
+ <height>80</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1110">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041d49444154388d8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d09a6c508138cb8c13d647141163de49043bca9f1628eb9294810f24f88c15b728b07617358888785d980427290b4a8d00b19a8821da8228cf42316ac87eed9247ac95c9aeaeef9eaabdffb5ebf85f178ccfcf7f5b79fec07a7280a08a008f25ceb7c29e5da573716e65a0be3f198ef6f5ededff9b9e1b34faf90882092a1ea21428b9220ffbf46054055b19386ba6970ae6665b5e0d2c5eb0b066067bbe1f21757c88f5504eff0c192189081303a5582b16854fccce2fe041f00cdd0a8103b874556405476b62d972ec2c2b90ff3fd8df5cb946549d80b34aea15ccaa94625450e2d0e558b460b7371a734b5e027251a155545678ab62d7eea90b4c504078908c107acb354cb251b1f8f08b1c18631aabbb4d18211404804f22545863561d2f060fb34aa8a18d0086204e72c46a32292e1a796f278c1da7a859d8da9a737506db04d0a24103d8949480b214d3bbee952a05c1d536f9d2684160c744f048311543d459eb1b65ee1754cedae13a64abd5d6127053c9d0281f22d4f75c6a2118a5c09272d7ab740638bf4ef2dd2174032d0d8d04c6fe19c32bedd8bc65e342aa3f785e2784bfd6bc1bd9db24b05505616a4edd67d5a8c1801a03a9962754c504bf34b8986acfb9be91cac7d54315a15541b36b134f74bd2dc53940115a5381e087bc25c6f71be831a8baa234cc1ee3eeb74ed83116beb2b8849d108a3730e8ce27e2bfb82419a7b407ac7c222fd0e6280a8078ce64e47ef54ac9d5be9aaae0162e0de568a44a18d3df90845d919c4f01463406340a44f40efb43a99b371618488e2670d1a2d7ee6f1d3be39342104e937ed85fb86599c33e9ee0be9a004946259d8b858909880d59aa00daa0d3280b5f39e34074c4b3a5434029a76a9e9f5cc0163b5c80024158a1cfc4cb1d3061d5834066cb0a403c008599a70f6bc27b8d03106ea3ae91987278c5b143b015547224ab5e24185cd9b81665273e7b6e7cecd82ddbf8098002de94049737bc09828cf3036f31c3735c8b0e98eb704672f348c7f7c93cd1fb2ae905119ff54e0dff3542b0e9dd983dcea2cc5eea6cf303e74ec687af5c41b6fa38f5e203c7ec8e1238ef85831a214afef21060ea781ec68247b65c6916353cc8b73d1ae79354606af2a930709aa118da1636c274dd7e3774b884a79aa6b5711a538d33cf9c01c1c9b83bc6a1f55c91ccb23b05b1deb43a7decdaffefd2862f61366aa8449c69e33642f012f2bb208fa98eeda1f3346f076c8eeef19475e9be115423364f78f84105a8643d34d90cfbfdcd8cf872589a45dc7f54cf3134a36f4e495c23f9da8db15bccb708d4014f2ca512cb5d4f7c13e84300d5cff6eb39b202bab053bdb9674f0648609427d0f8402ddeac30f4fcd3ced3efc3b422d406c09b340bedc1571e1bfc3d44dc281634c5fe5e758e7395cfbe6d6c130fd17d92372d277c159b70000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kgncimportoptionsdlg.cpp b/kmymoney2/dialogs/kgncimportoptionsdlg.cpp
new file mode 100644
index 0000000..e11ff69
--- /dev/null
+++ b/kmymoney2/dialogs/kgncimportoptionsdlg.cpp
@@ -0,0 +1,128 @@
+/***************************************************************************
+ kgncimportoptions.cpp
+ -------------------
+ copyright : (C) 2005 by Ace Jones
+ author : Tony Bloomfield
+ email : tonybloom@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qlayout.h>
+#include <qapplication.h>
+#include <qcombobox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <kapplication.h>
+#include <kurlrequester.h>
+#include <ktextbrowser.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "kgncimportoptionsdlg.h"
+
+// dialog constructor
+KGncImportOptionsDlg::KGncImportOptionsDlg(QWidget *parent, const char *name)
+ : KGncImportOptionsDlgDecl(parent, name)
+{
+ buttonInvestGroup->setRadioButtonExclusive (true);
+ buttonInvestGroup->setButton (0);
+ checkFinanceQuote->setChecked(true);
+ checkSchedules->setChecked (false);
+ buildCodecList (); // build list of codecs and insert into combo box
+ checkDecode->setChecked (false);
+ comboDecode->setEnabled (false);
+ checkTxNotes->setChecked (false);
+ checkDebugGeneral->setChecked (false);
+ checkDebugXML->setChecked (false);
+ checkAnonymize->setChecked (false);
+
+ connect (checkDecode, SIGNAL(toggled(bool)), this, SLOT(slotDecodeOptionChanged(bool)));
+}
+
+KGncImportOptionsDlg::~KGncImportOptionsDlg()
+{
+}
+
+// enable the combo box for selection if required
+void KGncImportOptionsDlg::slotDecodeOptionChanged(bool isOn) {
+ if (isOn) {
+ comboDecode->setEnabled (true);
+ comboDecode->setCurrentItem (0);
+ } else {
+ comboDecode->setEnabled (false);
+ }
+}
+
+// build a list of known codecs and sort it so that the locale codec is first
+// try to get the others in some sort of order of likelihood
+void KGncImportOptionsDlg::buildCodecList () {
+
+ m_localeCodec = QTextCodec::codecForLocale();
+ m_codecList.setAutoDelete (true);
+ // retrieve all codec pointers
+ QTextCodec *codec;
+ unsigned int i;
+ for (i = 0; (codec = QTextCodec::codecForIndex(i)); i++) {
+ int rank;
+ if (codec == m_localeCodec) rank = 999; // ensure locale rank comes first
+ else rank = codec->heuristicNameMatch(m_localeCodec->name());
+
+ codecData *p = new codecData(rank, codec);
+ m_codecList.append (p);
+ }
+ m_codecList.sort();
+ for (i = 0; i < m_codecList.count(); i++) {
+ QString name (m_codecList.at(i)->second->name());
+ comboDecode->insertItem (name);
+ }
+}
+
+// this routine sorts the codec list on 1) rank descending 2) codec name ascending
+int codecDataList::compareItems (void *a, void *b) {
+ codecData *pa = reinterpret_cast<codecData *>(a);
+ codecData *pb = reinterpret_cast<codecData *>(b);
+
+ if (pa->first > pb->first) {
+ return (-1); // greater rank is treated as less-than so gets sorted first
+ } else { if (pb->first > pa->first)
+ return (1);
+ }
+ // ranks are equal, sort on name, case insensitive
+ QString sa(pa->second->name());
+ QString sb(pb->second->name());
+ if (sa.lower() > sb.lower()) {
+ return (1);
+ } else {
+ return (-1);
+ }
+}
+
+// return selected codec or 0
+QTextCodec* KGncImportOptionsDlg::decodeOption(void) {
+ if (!checkDecode->isChecked()) {
+ return (0);
+ } else {
+ return (m_codecList.at(comboDecode->currentItem())->second);
+ }
+}
+
+void KGncImportOptionsDlg::slotHelp(void)
+{
+ kapp->invokeHelp ("details.impexp.gncoptions");
+}
+
+#include "kgncimportoptionsdlg.moc"
diff --git a/kmymoney2/dialogs/kgncimportoptionsdlg.h b/kmymoney2/dialogs/kgncimportoptionsdlg.h
new file mode 100644
index 0000000..5ab6202
--- /dev/null
+++ b/kmymoney2/dialogs/kgncimportoptionsdlg.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ kgncimportoptions.h
+ -------------------
+ copyright : (C) 2005 by Ace Jones
+ author : Tony Bloomfield
+ email : tonybloom@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KGNCIMPORTOPTIONSDLG_H
+#define KGNCIMPORTOPTIONSDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qtextcodec.h>
+#include <qptrlist.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "../dialogs/kgncimportoptionsdlgdecl.h"
+
+typedef QPair<int, QTextCodec*> codecData;
+
+// class to sort codec list
+class codecDataList : public QPtrList<codecData> {
+ int compareItems (QPtrCollection::Item a, QPtrCollection::Item b);
+};
+
+class KGncImportOptionsDlg : public KGncImportOptionsDlgDecl
+{
+Q_OBJECT
+public:
+ KGncImportOptionsDlg(QWidget *parent = 0, const char *name = 0);
+ ~KGncImportOptionsDlg();
+
+ int investmentOption () const {return (buttonInvestGroup->selectedId());};
+ bool quoteOption() const {return (checkFinanceQuote->isChecked());};
+ bool scheduleOption () const {return (checkSchedules->isChecked());};
+ QTextCodec* decodeOption ();
+ bool txNotesOption () const {return (checkTxNotes->isChecked());};
+ bool generalDebugOption () const {return (checkDebugGeneral->isChecked());};
+ bool xmlDebugOption () const {return (checkDebugXML->isChecked());};
+ bool anonymizeOption () const {return (checkAnonymize->isChecked());};
+
+public slots:
+ void slotDecodeOptionChanged (bool);
+ void slotHelp();
+
+private:
+ void buildCodecList ();
+
+ QTextCodec* m_localeCodec;
+ codecDataList m_codecList;
+
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kgncimportoptionsdlgdecl.ui b/kmymoney2/dialogs/kgncimportoptionsdlgdecl.ui
new file mode 100644
index 0000000..e32197b
--- /dev/null
+++ b/kmymoney2/dialogs/kgncimportoptionsdlgdecl.ui
@@ -0,0 +1,383 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KGncImportOptionsDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KGncImportOptionsDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>526</width>
+ <height>638</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>GnuCash Import Options</string>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>9</y>
+ <width>442</width>
+ <height>636</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Use 'Help' for more information on these options</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonInvestGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Investment Handling</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioInvest1</cstring>
+ </property>
+ <property name="text">
+ <string>One investment account for each stock</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioInvest2</cstring>
+ </property>
+ <property name="text">
+ <string>One investment account for all stocks</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioInvest3</cstring>
+ </property>
+ <property name="text">
+ <string>Prompt for an investment account for each stock</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup5</cstring>
+ </property>
+ <property name="title">
+ <string>Online price quotes</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkFinanceQuote</cstring>
+ </property>
+ <property name="text">
+ <string>Use Finance::Quote for share price quotes</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string>Scheduled Transactions</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkSchedules</cstring>
+ </property>
+ <property name="text">
+ <string>Drop suspect scheduled transactions</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4</cstring>
+ </property>
+ <property name="title">
+ <string>Decoding option</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkDecode</cstring>
+ </property>
+ <property name="text">
+ <string>Decode using</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>140</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>comboDecode</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup18</cstring>
+ </property>
+ <property name="title">
+ <string>Transaction Notes option</string>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkTxNotes</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>420</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Use transaction notes on non-split transactions</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup3</cstring>
+ </property>
+ <property name="title">
+ <string>Debug Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkDebugGeneral</cstring>
+ </property>
+ <property name="text">
+ <string>General debug data</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkDebugXML</cstring>
+ </property>
+ <property name="text">
+ <string>Display XML data</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkAnonymize</cstring>
+ </property>
+ <property name="text">
+ <string>Anonymize data</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>200</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KGncImportOptionsDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KGncImportOptionsDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonHelp</sender>
+ <signal>clicked()</signal>
+ <receiver>KGncImportOptionsDlgDecl</receiver>
+ <slot>slotHelp()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot access="protected">slotHelp()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kgncpricesourcedlg.cpp b/kmymoney2/dialogs/kgncpricesourcedlg.cpp
new file mode 100644
index 0000000..2246e01
--- /dev/null
+++ b/kmymoney2/dialogs/kgncpricesourcedlg.cpp
@@ -0,0 +1,106 @@
+/***************************************************************************
+ kgncpricesourcedlg.cpp
+ -------------------
+ copyright : (C) 2005 by Ace Jones
+ author : Tony Bloomfield
+ email : tonybloom@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qlineedit.h>
+#include <qbuttongroup.h>
+#include <qlayout.h>
+#include <qapplication.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <kapplication.h>
+#include <kurlrequester.h>
+#include <ktextbrowser.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "kgncpricesourcedlg.h"
+#include "../converter/webpricequote.h"
+
+KGncPriceSourceDlg::KGncPriceSourceDlg(QWidget *parent, const char *name)
+ : KGncPriceSourceDlgDecl(parent, name)
+{
+}
+KGncPriceSourceDlg::KGncPriceSourceDlg(const QString &stockName, const QString &gncSource){
+ // signals and slots connections
+ connect( buttonGroup5, SIGNAL( released(int) ), this, SLOT( buttonPressed(int) ) );
+ connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
+ // initialize data fields
+ textStockName->setText (i18n ("Investment: %1").arg(stockName));
+ textGncSource->setText (i18n ("Quote source: %1").arg(gncSource));
+ listKnownSource->insertStringList (WebPriceQuote::quoteSources());
+ lineUserSource->setText (gncSource);
+ checkAlwaysUse->setChecked(true);
+ buttonGroup5->setButton (0);
+ buttonPressed (0);
+ return;
+}
+
+KGncPriceSourceDlg::~KGncPriceSourceDlg()
+{
+}
+
+enum ButtonIds {NOSOURCE = 0, KMMSOURCE, USERSOURCE};
+
+void KGncPriceSourceDlg::buttonPressed (int buttonId) {
+ m_currentButton = buttonId;
+ switch (m_currentButton) {
+ case NOSOURCE:
+ listKnownSource->clearSelection();
+ listKnownSource->setEnabled (false);
+ lineUserSource->deselect();
+ lineUserSource->setEnabled (false);
+ break;
+ case KMMSOURCE:
+ lineUserSource->deselect ();
+ lineUserSource->setEnabled (false);
+ listKnownSource->setEnabled (true);
+ listKnownSource->setFocus();
+ listKnownSource->setSelected (0, true);
+ break;
+ case USERSOURCE:
+ listKnownSource->clearSelection();
+ listKnownSource->setEnabled (false);
+ lineUserSource->setEnabled (true);
+ lineUserSource->selectAll();
+ lineUserSource->setFocus ();
+ break;
+ }
+}
+
+QString KGncPriceSourceDlg::selectedSource() const {
+ QString s;
+ switch (m_currentButton) {
+ case NOSOURCE: s = ""; break;
+ case KMMSOURCE: s = listKnownSource->currentText(); break;
+ case USERSOURCE: s = lineUserSource->text(); break;
+ }
+ return (s);
+}
+
+void KGncPriceSourceDlg::slotHelp(void)
+{
+ kapp->invokeHelp ("details.impexp.gncquotes");
+}
+
+#include "kgncpricesourcedlg.moc"
+
diff --git a/kmymoney2/dialogs/kgncpricesourcedlg.h b/kmymoney2/dialogs/kgncpricesourcedlg.h
new file mode 100644
index 0000000..6351b02
--- /dev/null
+++ b/kmymoney2/dialogs/kgncpricesourcedlg.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ kgncpricesourcedlg.h
+ -------------------
+ copyright : (C) 2005 by Ace Jones
+ author : Tony Bloomfield
+ email : tonybloom@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KGNCPRICESOURCEDLG_H
+#define KGNCPRICESOURCEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/kgncpricesourcedlgdecl.h"
+
+class KGncPriceSourceDlg : public KGncPriceSourceDlgDecl
+{
+ Q_OBJECT
+public:
+ KGncPriceSourceDlg(QWidget *parent = 0, const char *name = 0);
+ KGncPriceSourceDlg(const QString &stockName, const QString &gncSource);
+ ~KGncPriceSourceDlg();
+
+ QString selectedSource () const;
+ bool alwaysUse() const { return (checkAlwaysUse->isChecked()); }
+
+public slots:
+ void buttonPressed(int);
+ void slotHelp();
+
+private:
+ int m_currentButton;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kgncpricesourcedlgdecl.ui b/kmymoney2/dialogs/kgncpricesourcedlgdecl.ui
new file mode 100644
index 0000000..c781f81
--- /dev/null
+++ b/kmymoney2/dialogs/kgncpricesourcedlgdecl.ui
@@ -0,0 +1,248 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KGncPriceSourceDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KGncPriceSourceDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>619</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Online Quotes - Select price source</string>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>400</y>
+ <width>496</width>
+ <height>50</height>
+ </rect>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOK</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>171</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>1</y>
+ <width>525</width>
+ <height>370</height>
+ </rect>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textStockName</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textGncSource</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>This price source is not known to KMyMoney. Please select an option below.</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup5</cstring>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>buttonNoSource</cstring>
+ </property>
+ <property name="text">
+ <string>Do not perform online quotes for this investment</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>buttonSelectSource</cstring>
+ </property>
+ <property name="text">
+ <string>Select a known KMyMoney source from the list below</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>listKnownSource</cstring>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>buttonUserSource</cstring>
+ </property>
+ <property name="text">
+ <string>Use the following name for the price source.
+(Click Help for further information.)</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>lineUserSource</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkAlwaysUse</cstring>
+ </property>
+ <property name="text">
+ <string>Always use this selection for this price source.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>370</height>
+ </size>
+ </property>
+ </spacer>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOK</sender>
+ <signal>released()</signal>
+ <receiver>KGncPriceSourceDlgDecl</receiver>
+ <slot>close()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kgpgkeyselectiondlg.cpp b/kmymoney2/dialogs/kgpgkeyselectiondlg.cpp
new file mode 100644
index 0000000..37ddcc5
--- /dev/null
+++ b/kmymoney2/dialogs/kgpgkeyselectiondlg.cpp
@@ -0,0 +1,149 @@
+/***************************************************************************
+ kgpgkeyselectiondlg.cpp
+ -------------------
+ copyright : (C) 2008 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qwhatsthis.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <keditlistbox.h>
+#include <kled.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kgpgkeyselectiondlg.h"
+#include <kmymoney/kgpgfile.h>
+
+KGpgKeySelectionDlg::KGpgKeySelectionDlg(QWidget *parent, const char *name) :
+ KDialogBase(parent, name, true, i18n("Select additional keys"), Ok | Cancel),
+ m_needCheckList(true),
+ m_listOk(false),
+ m_checkCount(0)
+{
+ QWidget* page = new QWidget(this);
+ setMainWidget(page);
+ QVBoxLayout* topLayout = new QVBoxLayout(page, 0, spacingHint());
+
+ m_listBox = new KEditListBox(page);
+ m_listBox->setTitle(i18n("User identification"));
+ m_listBox->setButtons( int( KEditListBox::Remove | KEditListBox::Add ) );
+ QWhatsThis::add( m_listBox, i18n( "Enter the id of the key you want to use for data encryption. This can either be an e-mail address or the hexadecimal key id. In case of the key id don't forget the leading 0x." ) );
+
+ topLayout->addWidget(m_listBox);
+
+ // add a LED for the availability of all keys
+ QHBoxLayout* ledBox = new QHBoxLayout(0, 0, 6, "ledBoxLayout");
+ m_keyLed = new KLed(page);
+ m_keyLed->setShape( KLed::Circular );
+ m_keyLed->setLook( KLed::Sunken );
+
+ ledBox->addWidget(m_keyLed);
+ ledBox->addWidget(new QLabel(i18n("Keys for all of the above user ids found"), page));
+ ledBox->addItem(new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ));
+
+ topLayout->addLayout(ledBox);
+
+ connect(m_listBox, SIGNAL(changed()), this, SLOT(slotIdChanged()));
+ connect(m_listBox, SIGNAL(added(const QString&)), this, SLOT(slotKeyListChanged()));
+ connect(m_listBox, SIGNAL(removed(const QString&)), this, SLOT(slotKeyListChanged()));
+}
+
+void KGpgKeySelectionDlg::setKeys(const QStringList& list)
+{
+ m_listBox->clear();
+ m_listBox->insertStringList(list);
+ slotKeyListChanged();
+}
+
+#if 0
+void KGpgKeySelectionDlg::slotShowHelp(void)
+{
+ QString anchor = m_helpAnchor[m_criteriaTab->currentPage()];
+ if(anchor.isEmpty())
+ anchor = QString("details.search");
+
+ kapp->invokeHelp(anchor);
+}
+#endif
+
+void KGpgKeySelectionDlg::slotKeyListChanged(void)
+{
+ m_needCheckList = true;
+ slotIdChanged();
+}
+
+void KGpgKeySelectionDlg::slotIdChanged(void)
+{
+ // this looks a bit awkward. Here's why: KGPGFile::keyAvailable() starts
+ // an external task and processes UI events while it waits for the external
+ // process to finish. Thus, the first time we get here, the external process
+ // is started and the user may press a second key which calls this routine
+ // again.
+ //
+ // The second invocation is counted, but the check is not started until the
+ // first one finishes. Once the external process finishes, we check if we
+ // were called in the meantime and restart the check.
+ if(++m_checkCount == 1) {
+ while(1) {
+ // first we check the current edit field if filled
+ bool keysOk = true;
+ if(!m_listBox->currentText().isEmpty()) {
+ keysOk = KGPGFile::keyAvailable(m_listBox->currentText());
+ }
+
+ // if it is available, then scan the current list if we need to
+ if(keysOk) {
+ if(m_needCheckList) {
+ QStringList keys = m_listBox->items();
+ QStringList::const_iterator it_s;
+ for(it_s = keys.begin(); keysOk && it_s != keys.end(); ++it_s) {
+ if(!KGPGFile::keyAvailable(*it_s))
+ keysOk = false;
+ }
+ m_listOk = keysOk;
+ m_needCheckList = false;
+
+ } else {
+ keysOk = m_listOk;
+ }
+ }
+
+ // did we receive some more requests to check?
+ if(m_checkCount > 1) {
+ m_checkCount = 1;
+ continue;
+ }
+
+ m_keyLed->setState(static_cast<KLed::State>(keysOk && (m_listBox->items().count() != 0) ? KLed::On : KLed::Off));
+ enableButtonOK((m_listBox->items().count() == 0) || (m_keyLed->state() == KLed::On));
+ break;
+ }
+
+ --m_checkCount;
+ }
+}
+
+
+#include "kgpgkeyselectiondlg.moc"
+
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kgpgkeyselectiondlg.h b/kmymoney2/dialogs/kgpgkeyselectiondlg.h
new file mode 100644
index 0000000..4355478
--- /dev/null
+++ b/kmymoney2/dialogs/kgpgkeyselectiondlg.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ kgpgkeyselectiondlg.h
+ -------------------
+ copyright : (C) 2008 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KGPGKEYSELECTIONDLG_H
+#define KGPGKEYSELECTIONDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdialogbase.h>
+class KEditListBox;
+class KLed;
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+/**
+ * @author Thomas Baumgart
+ */
+class KGpgKeySelectionDlg : public KDialogBase
+{
+ Q_OBJECT
+public:
+
+ KGpgKeySelectionDlg(QWidget *parent=0, const char *name=0);
+ virtual ~KGpgKeySelectionDlg() {}
+
+ /**
+ * preset the key list with the given key ids in @a list
+ */
+ void setKeys(const QStringList& list);
+
+ /**
+ * Returns the list of keys currently listed in the KEditListBox
+ */
+ const QStringList keys(void) const { return m_listBox->items(); }
+
+protected slots:
+ void slotIdChanged(void);
+ void slotKeyListChanged(void);
+
+private:
+ KEditListBox* m_listBox;
+ KLed* m_keyLed;
+ bool m_needCheckList;
+ bool m_listOk;
+ int m_checkCount;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kimportdlg.cpp b/kmymoney2/dialogs/kimportdlg.cpp
new file mode 100644
index 0000000..c9cc2d5
--- /dev/null
+++ b/kmymoney2/dialogs/kimportdlg.cpp
@@ -0,0 +1,228 @@
+/***************************************************************************
+ kimportdlg.cpp - description
+ -------------------
+ begin : Wed May 16 2001
+ copyright : (C) 2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@ctv.es>
+ Felix Rodriguez <frodriguez@mail.wesleyan.edu>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Headers
+
+#include <qlineedit.h>
+#include <qtextstream.h>
+#include <qprogressbar.h>
+#include <qlabel.h>
+#include <qbuttongroup.h>
+#include <qpixmap.h>
+#include <qapplication.h>
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#include <kglobalsettings.h>
+#include <kpushbutton.h>
+#include <kcombobox.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <kio/netaccess.h>
+#include <kstandarddirs.h>
+
+// ----------------------------------------------------------------------------
+// Project Headers
+
+#include "kimportdlg.h"
+#include <kmymoney/mymoneyfile.h>
+#include "mymoneyqifprofileeditor.h"
+#include "../converter/mymoneyqifprofile.h"
+
+KImportDlg::KImportDlg(QWidget *parent, const char * name)
+ : KImportDlgDecl(parent, name, TRUE)
+{
+ // Set all the last used options
+ readConfig();
+
+ loadProfiles(true);
+
+ // load button icons
+ m_qbuttonCancel->setGuiItem(KStdGuiItem::cancel());
+
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem okButtenItem( i18n( "&Import" ),
+ QIconSet(il->loadIcon("fileimport", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Start operation"),
+ i18n("Use this to start the import operation"));
+ m_qbuttonOk->setGuiItem(okButtenItem);
+
+ KGuiItem browseButtenItem( i18n( "&Browse..." ),
+ QIconSet(il->loadIcon("fileopen", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Select filename"),
+ i18n("Use this to select a filename to export to"));
+ m_qbuttonBrowse->setGuiItem(browseButtenItem);
+
+ KGuiItem newButtenItem( i18n( "&New..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new profile"),
+ i18n("Use this to open the profile editor"));
+ m_profileEditorButton->setGuiItem(newButtenItem);
+
+ // connect the buttons to their functionality
+ connect(m_qbuttonBrowse, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
+ connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
+ connect(m_qbuttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_profileEditorButton, SIGNAL(clicked()), this, SLOT(slotNewProfile()));
+
+ // connect the change signals to the check slot and perform initial check
+ connect(m_qlineeditFile, SIGNAL(textChanged(const QString&)), this,
+ SLOT(slotFileTextChanged(const QString&)));
+
+ // setup button enable status
+ slotFileTextChanged(m_qlineeditFile->text());
+}
+
+KImportDlg::~KImportDlg()
+{
+}
+
+void KImportDlg::slotBrowse()
+{
+ // determine what the browse prefix should be from the current profile
+
+ MyMoneyQifProfile tmpprofile;
+ tmpprofile.loadProfile("Profile-" + profile());
+
+ KFileDialog dialog(KGlobalSettings::documentPath(),
+ i18n("%1|Import files\n%2|All files (*.*)").arg(tmpprofile.filterFileType()).arg("*"),
+ this, i18n("Import File..."), true);
+ dialog.setMode(KFile::File | KFile::ExistingOnly);
+
+ if(dialog.exec() == QDialog::Accepted) {
+#if KDE_IS_VERSION(3,4,0)
+ m_qlineeditFile->setText(dialog.selectedURL().pathOrURL());
+#else
+ m_qlineeditFile->setText(dialog.selectedURL().prettyURL(0, KURL::StripFileProtocol));
+#endif
+ }
+}
+
+void KImportDlg::slotOkClicked()
+{
+ // Save the used options.
+ writeConfig();
+ // leave dialog directly
+ accept();
+}
+
+void KImportDlg::readConfig(void)
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup("Last Use Settings");
+ m_qlineeditFile->setText(kconfig->readEntry("KImportDlg_LastFile"));
+}
+
+void KImportDlg::writeConfig(void)
+{
+ KConfig *kconfig = KGlobal::config();
+ kconfig->setGroup("Last Use Settings");
+ kconfig->writeEntry("KImportDlg_LastFile", m_qlineeditFile->text());
+ kconfig->writeEntry("KImportDlg_LastProfile", m_profileComboBox->currentText());
+ kconfig->sync();
+}
+
+/** Make sure the text input is ok */
+void KImportDlg::slotFileTextChanged(const QString& text)
+{
+ if (!text.isEmpty() && KIO::NetAccess::exists(text, true, qApp->mainWidget())) {
+ // m_qcomboboxDateFormat->setEnabled(true);
+ m_qbuttonOk->setEnabled(true);
+ m_qlineeditFile->setText(text);
+ } else {
+ // m_qcomboboxDateFormat->setEnabled(false);
+ m_qbuttonOk->setEnabled(false);
+ }
+}
+
+void KImportDlg::slotNewProfile(void)
+{
+ MyMoneyQifProfileEditor* editor = new MyMoneyQifProfileEditor(true, this, "QIF Profile Editor");
+
+ if(editor->exec()) {
+ m_profileComboBox->setCurrentText(editor->selectedProfile());
+ loadProfiles();
+ }
+
+ delete editor;
+}
+
+void KImportDlg::slotSelectProfile(const QString& profile)
+{
+ m_profileComboBox->setCurrentText(profile);
+ loadProfiles();
+}
+
+void KImportDlg::loadProfiles(const bool selectLast)
+{
+ // Creating an editor object here makes sure that
+ // we have at least the default profile available
+ MyMoneyQifProfileEditor* edit = new MyMoneyQifProfileEditor(true, 0, 0);
+ edit->slotOk();
+ delete edit;
+
+ QString current = m_profileComboBox->currentText();
+
+ m_profileComboBox->clear();
+
+ QStringList list;
+ KConfig* config = KGlobal::config();
+ config->setGroup("Profiles");
+
+ list = config->readListEntry("profiles");
+ list.sort();
+ m_profileComboBox->insertStringList(list);
+
+ if(selectLast == true) {
+ config->setGroup("Last Use Settings");
+ current = config->readEntry("KImportDlg_LastProfile");
+ }
+
+ m_profileComboBox->setCurrentItem(0);
+ if(list.contains(current) > 0) {
+ m_profileComboBox->setCurrentText(current);
+ }
+}
+
+void KImportDlg::addCategories(QStringList& strList, const QString& id, const QString& leadIn) const
+{
+ MyMoneyFile *file = MyMoneyFile::instance();
+ QString name;
+
+ MyMoneyAccount account = file->account(id);
+
+ QStringList accList = account.accountList();
+ QStringList::ConstIterator it_a;
+
+ for(it_a = accList.begin(); it_a != accList.end(); ++it_a) {
+ account = file->account(*it_a);
+ strList << leadIn + account.name();
+ addCategories(strList, *it_a, leadIn + account.name() + MyMoneyFile::AccountSeperator);
+ }
+}
+
+
+#include "kimportdlg.moc"
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kimportdlg.h b/kmymoney2/dialogs/kimportdlg.h
new file mode 100644
index 0000000..06f1003
--- /dev/null
+++ b/kmymoney2/dialogs/kimportdlg.h
@@ -0,0 +1,118 @@
+/***************************************************************************
+ kimportdlg.h - description
+ -------------------
+ begin : Wed May 16 2001
+ copyright : (C) 2001 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@ctv.es>
+ Felix Rodriguez <frodriguez@mail.wesleyan.edu>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef KIMPORTDLG_H
+#define KIMPORTDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Headers
+
+#include <qstring.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#include <kurl.h>
+#include <kcombobox.h>
+
+// ----------------------------------------------------------------------------
+// Project Headers
+
+#include "../dialogs/kimportdlgdecl.h"
+
+/**
+ * This class is used to import a qif file to an account.
+ * It relies upon the QIF file handling routines in MyMoneyAccount to do
+ * the actual writing of QIF files.
+ *
+ * It uses the global KConfig object to read and write the application
+ * settings.
+ *
+ * @see MyMoneyAccount
+ *
+ * @author Felix Rodriguez, Michael Edwardes 2000-2001
+ *
+ * @short A class to import a qif file to an account.
+**/
+class KImportDlg : public KImportDlgDecl
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Standard constructor
+ */
+ KImportDlg(QWidget *parent, const char *name = 0);
+
+ /** Standard destructor */
+ ~KImportDlg();
+
+ /**
+ */
+ const QString filename(void) const { return m_qlineeditFile->text(); };
+
+ /**
+ */
+ const QString profile(void) const { return m_profileComboBox->currentText(); };
+
+protected slots:
+ /** Called to let the user browse for a QIF file to import from. */
+ void slotBrowse();
+
+ /** Test whether to enable the buttons */
+ void slotFileTextChanged(const QString& text);
+
+ /**
+ * Called when the user needs a new profile
+ */
+ void slotNewProfile(void);
+
+ void slotOkClicked(void);
+
+ void slotSelectProfile(const QString& text);
+
+private:
+ /**
+ * This method loads the available profiles into
+ * the combo box. The parameter @p selectLast controls if
+ * the last profile used is preset or not. If preset is not
+ * selected, the current selection remains. If the currently selected
+ * text is not present in the list anymore, the first item will be
+ * selected.
+ *
+ * @param selectLast If true, the last used profile is selected. The
+ * default is false.
+ */
+ void loadProfiles(const bool selectLast = false);
+
+ /**
+ * This method is used to load an account hierarchy into a string list
+ *
+ * @param strList Reference to the string list to setup
+ * @param id Account id to add
+ * @param leadIn constant leadin to be added in front of the account name
+ */
+ void addCategories(QStringList& strList, const QString& id, const QString& leadIn) const;
+
+ void readConfig(void);
+ void writeConfig(void);
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kimportdlgdecl.ui b/kmymoney2/dialogs/kimportdlgdecl.ui
new file mode 100644
index 0000000..c915f12
--- /dev/null
+++ b/kmymoney2/dialogs/kimportdlgdecl.ui
@@ -0,0 +1,246 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KImportDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KImportDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>476</width>
+ <height>303</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>QIF Import</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="resizePolicy">
+ <enum>Manual</enum>
+ </property>
+ <property name="text">
+ <string>From this dialog you are able to import transactions from a Quicken&lt;b&gt;&amp;trade;&lt;/b&gt; compatible file, (known as a QIF file, because of the extension).&lt;p&gt;
+
+Please enter the path to the QIF file or select it by clicking on the Browse button. Once you have the file's path press the Import button and KMyMoney will import all the transactions, categories and payees it finds.</string>
+ </property>
+ <property name="wordWrap">
+ <enum>WidgetWidth</enum>
+ </property>
+ <property name="autoFormatting">
+ <set>AutoAll</set>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblImportFile</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>QIF File to Import:</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_optionGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Import options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Bank statement</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Other application</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_typeComboBox</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select &lt;b&gt;Bank statement&lt;/b&gt; turns on automatic category matching which is turned off in case of &lt;b&gt;Historic data&lt;/b&gt;. Use the latter if you import files from other Personal Finance Management software.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Source of QIF</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>QIF Profile</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>m_profileComboBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>m_profileEditorButton</cstring>
+ </property>
+ <property name="text">
+ <string>New...</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="KPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>m_qbuttonBrowse</cstring>
+ </property>
+ <property name="text">
+ <string>Browse...</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_qlineeditFile</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout90</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>411</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>Import</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_qbuttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kloadtemplatedlg.cpp b/kmymoney2/dialogs/kloadtemplatedlg.cpp
new file mode 100644
index 0000000..d765f8a
--- /dev/null
+++ b/kmymoney2/dialogs/kloadtemplatedlg.cpp
@@ -0,0 +1,55 @@
+/***************************************************************************
+ kloadtemplatedlg.cpp
+ -------------------
+ copyright : (C) 2008 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kstdguiitem.h>
+#include <kpushbutton.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kloadtemplatedlg.h"
+#include "../widgets/kaccounttemplateselector.h"
+
+KLoadTemplateDlg::KLoadTemplateDlg(QWidget* parent, const char* name) :
+ KLoadTemplateDlgDecl(parent, name)
+{
+ buttonOk->setGuiItem(KStdGuiItem::ok());
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+ buttonHelp->setGuiItem(KStdGuiItem::help());
+
+ connect(buttonHelp, SIGNAL(clicked()), this, SLOT(slotHelp()));
+}
+
+QValueList<MyMoneyTemplate> KLoadTemplateDlg::templates(void) const
+{
+ return m_templateSelector->selectedTemplates();
+}
+
+void KLoadTemplateDlg::slotHelp(void)
+{
+}
+
+#include "kloadtemplatedlg.moc"
diff --git a/kmymoney2/dialogs/kloadtemplatedlg.h b/kmymoney2/dialogs/kloadtemplatedlg.h
new file mode 100644
index 0000000..44fdfee
--- /dev/null
+++ b/kmymoney2/dialogs/kloadtemplatedlg.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ kloadtemplatedlg.h
+ -------------------
+ copyright : (C) 2008 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KLOADTEMPLATEDLG_H
+#define KLOADTEMPLATEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneytemplate.h>
+#include "../dialogs/kloadtemplatedlgdecl.h"
+
+/// This dialog lets the user load more account templates
+class KLoadTemplateDlg : public KLoadTemplateDlgDecl
+{
+ Q_OBJECT
+
+ public:
+ KLoadTemplateDlg(QWidget *parent = 0, const char *name = 0);
+
+ QValueList<MyMoneyTemplate> templates(void) const;
+
+ private slots:
+ void slotHelp(void);
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kloadtemplatedlgdecl.ui b/kmymoney2/dialogs/kloadtemplatedlgdecl.ui
new file mode 100644
index 0000000..4790de9
--- /dev/null
+++ b/kmymoney2/dialogs/kloadtemplatedlgdecl.ui
@@ -0,0 +1,106 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KLoadTemplateDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KLoadTemplateDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>636</width>
+ <height>509</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KAccountTemplateSelector">
+ <property name="name">
+ <cstring>m_templateSelector</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>228</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KLoadTemplateDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KLoadTemplateDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kmergetransactionsdlg.cpp b/kmymoney2/dialogs/kmergetransactionsdlg.cpp
new file mode 100644
index 0000000..692c88f
--- /dev/null
+++ b/kmymoney2/dialogs/kmergetransactionsdlg.cpp
@@ -0,0 +1,55 @@
+/***************************************************************************
+ kmergetransactionsdlg.cpp
+ -------------------
+ begin : Sun Aug 20 2006
+ copyright : (C) 2006 by Ace Jones
+ email : <acejones@users.sf.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <kapplication.h>
+#include <kactivelabel.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmergetransactionsdlg.h"
+
+KMergeTransactionsDlg::KMergeTransactionsDlg(const MyMoneyAccount& account, QWidget* parent, const char* name) :
+ KSelectTransactionsDlg(account, parent, name)
+{
+
+ // setup descriptive texts
+ setCaption(i18n("Merge Transactions"));
+ m_description->setText(i18n("Are you sure you wish to merge these transactions?"));
+
+ // no selection possible
+ m_register->setSelectionMode(QTable::NoSelection);
+
+ // override default and enable ok button right away
+ buttonOk->setEnabled(true);
+}
+
+void KMergeTransactionsDlg::slotHelp(void)
+{
+ kapp->invokeHelp("details.ledgers.match");
+}
+
+#include "kmergetransactionsdlg.moc"
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kmergetransactionsdlg.h b/kmymoney2/dialogs/kmergetransactionsdlg.h
new file mode 100644
index 0000000..ebbfd82
--- /dev/null
+++ b/kmymoney2/dialogs/kmergetransactionsdlg.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ kmergetransactionsdlg.h
+ -------------------
+ begin : Sun Aug 20 2006
+ copyright : (C) 2006 by Ace Jones
+ email : <acejones@users.sf.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KMERGETRANSACTIONSDLG_H
+#define KMERGETRANSACTIONSDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QResizeEvent;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdebug.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/register.h>
+#include <kmymoney/mymoneyaccount.h>
+
+#include "../dialogs/kselecttransactionsdlg.h"
+
+class KMergeTransactionsDlg: public KSelectTransactionsDlg
+{
+ Q_OBJECT
+public:
+ KMergeTransactionsDlg(const MyMoneyAccount& account, QWidget* parent = 0, const char* name = 0);
+
+ bool eventFilter(QObject* , QEvent* ) { return false; }
+
+public slots:
+ void slotHelp();
+};
+
+#endif // KMERGETRANSACTIONSDLG_H
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kmymoneyfileinfodlg.cpp b/kmymoney2/dialogs/kmymoneyfileinfodlg.cpp
new file mode 100644
index 0000000..108c776
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneyfileinfodlg.cpp
@@ -0,0 +1,92 @@
+/***************************************************************************
+ kmymoneyfileinfodlg.cpp - description
+ -------------------
+ begin : Sun Oct 9 2005
+ copyright : (C) 2005 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <klistview.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoneyfileinfodlg.h"
+#include <kmymoney/imymoneystorage.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneyutils.h>
+
+KMyMoneyFileInfoDlg::KMyMoneyFileInfoDlg(QWidget *parent, const char *name )
+ : KMyMoneyFileInfoDlgDecl(parent, name)
+{
+ // Hide the unused buttons.
+ buttonCancel->hide();
+ buttonHelp->hide();
+
+ // Now fill the fields with data
+ IMyMoneyStorage* storage = MyMoneyFile::instance()->storage();
+
+ m_creationDate->setText(storage->creationDate().toString(Qt::ISODate));
+ m_lastModificationDate->setText(storage->lastModificationDate().toString(Qt::ISODate));
+ m_baseCurrency->setText(storage->value("kmm-baseCurrency"));
+
+ m_payeeCount->setText(QString("%1").arg(storage->payeeList().count()));
+ m_institutionCount->setText(QString("%1").arg(storage->institutionList().count()));
+
+ QValueList<MyMoneyAccount> a_list;
+ storage->accountList(a_list);
+ m_accountCount->setText(QString("%1").arg(a_list.count()));
+
+ QMap<MyMoneyAccount::accountTypeE, int> accountMap;
+ QMap<MyMoneyAccount::accountTypeE, int> accountMapClosed;
+ QValueList<MyMoneyAccount>::const_iterator it_a;
+ for(it_a = a_list.begin(); it_a != a_list.end(); ++it_a) {
+ accountMap[(*it_a).accountType()] = accountMap[(*it_a).accountType()] + 1;
+ accountMapClosed[(*it_a).accountType()] = accountMapClosed[(*it_a).accountType()] + 0;
+ if((*it_a).isClosed())
+ accountMapClosed[(*it_a).accountType()] = accountMapClosed[(*it_a).accountType()] + 1;
+ }
+
+ QMap<MyMoneyAccount::accountTypeE, int>::const_iterator it_m;
+ for(it_m = accountMap.begin(); it_m != accountMap.end(); ++it_m) {
+ new KListViewItem(m_accountView, KMyMoneyUtils::accountTypeToString(it_m.key()), QString("%1").arg(*it_m), QString("%1").arg(accountMapClosed[it_m.key()]));
+ }
+
+
+ MyMoneyTransactionFilter filter;
+ filter.setReportAllSplits(false);
+ m_transactionCount->setText(QString("%1").arg(storage->transactionList(filter).count()));
+ filter.setReportAllSplits(true);
+ m_splitCount->setText(QString("%1").arg(storage->transactionList(filter).count()));
+ m_scheduleCount->setText(QString("%1").arg(storage->scheduleList().count()));
+ MyMoneyPriceList list = storage->priceList();
+ MyMoneyPriceList::const_iterator it_p;
+ int pCount = 0;
+ for(it_p = list.begin(); it_p != list.end(); ++it_p)
+ pCount += (*it_p).count();
+ m_priceCount->setText(QString("%1").arg(pCount));
+}
+
+KMyMoneyFileInfoDlg::~KMyMoneyFileInfoDlg()
+{
+}
+
+#include "kmymoneyfileinfodlg.moc"
diff --git a/kmymoney2/dialogs/kmymoneyfileinfodlg.h b/kmymoney2/dialogs/kmymoneyfileinfodlg.h
new file mode 100644
index 0000000..9ba7f56
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneyfileinfodlg.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ kmymoneyfileinfodlg.h - description
+ -------------------
+ begin : Sun Oct 9 2005
+ copyright : (C) 2005 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KMYMONEYFILEINFODLG_H
+#define KMYMONEYFILEINFODLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/kmymoneyfileinfodlgdecl.h"
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KMyMoneyFileInfoDlg : public KMyMoneyFileInfoDlgDecl
+{
+ Q_OBJECT
+public:
+ KMyMoneyFileInfoDlg(QWidget *parent=0, const char *name=0);
+ virtual ~KMyMoneyFileInfoDlg();
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kmymoneyfileinfodlgdecl.ui b/kmymoney2/dialogs/kmymoneyfileinfodlgdecl.ui
new file mode 100644
index 0000000..fe2cd18
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneyfileinfodlgdecl.ui
@@ -0,0 +1,358 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KMyMoneyFileInfoDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KMyMoneyFileInfoDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>521</width>
+ <height>471</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File Information</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_baseCurrency</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="9" column="1">
+ <property name="name">
+ <cstring>m_scheduleCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="KListView" row="6" column="0" rowspan="1" colspan="2">
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Total</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Closed</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_accountView</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Accounts/Categories</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="10" column="0">
+ <property name="name">
+ <cstring>textLabel19</cstring>
+ </property>
+ <property name="text">
+ <string>Prices</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Created on</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="10" column="1">
+ <property name="name">
+ <cstring>m_priceCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="9" column="0">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Schedules</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Transactions</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Splits</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payeeCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_institutionCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Institutions</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_creationDate</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="1">
+ <property name="name">
+ <cstring>m_transactionCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="1">
+ <property name="name">
+ <cstring>m_accountCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Payees</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Base currency</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Last modified on</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="1">
+ <property name="name">
+ <cstring>m_splitCount</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_lastModificationDate</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>120</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>2</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyMoneyFileInfoDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KMyMoneyFileInfoDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kmymoneypricedlg.cpp b/kmymoney2/dialogs/kmymoneypricedlg.cpp
new file mode 100644
index 0000000..cd8d66f
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneypricedlg.cpp
@@ -0,0 +1,258 @@
+/***************************************************************************
+ kmymoneypricedlg.cpp
+ -------------------
+ begin : Wed Nov 24 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoneypricedlg.h"
+#include "kupdatestockpricedlg.h"
+#include "kcurrencycalculator.h"
+#include "../widgets/kmymoneypriceview.h"
+#include "kequitypriceupdatedlg.h"
+#include <kmymoney/kmymoneycurrencyselector.h>
+#include <kmymoney/mymoneyfile.h>
+
+#include "../kmymoneyglobalsettings.h"
+
+#define COMMODITY_COL 0
+#define CURRENCY_COL 1
+#define DATE_COL 2
+#define PRICE_COL 3
+#define SOURCE_COL 4
+
+KMyMoneyPriceDlg::KMyMoneyPriceDlg(QWidget* parent, const char *name) :
+ KMyMoneyPriceDlgDecl(parent, name)
+{
+ KIconLoader *il = KGlobal::iconLoader();
+ KGuiItem removeButtenItem( i18n( "&Delete" ),
+ QIconSet(il->loadIcon("delete", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Delete this entry"),
+ i18n("Remove this price item from the file"));
+ m_deleteButton->setGuiItem(removeButtenItem);
+
+ KGuiItem newButtenItem( i18n( "&New" ),
+ QIconSet(il->loadIcon("file_new", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Add a new entry"),
+ i18n("Create a new price entry."));
+ m_newButton->setGuiItem(newButtenItem);
+
+ KGuiItem editButtenItem( i18n( "&Edit" ),
+ QIconSet(il->loadIcon("edit", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Modify the selected entry"),
+ i18n("Change the details of selected price information."));
+ m_editButton->setGuiItem(editButtenItem);
+
+ KGuiItem okButtenItem( i18n("&Close" ),
+ QIconSet(il->loadIcon("button_ok", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Close the dialog"),
+ i18n("Use this to close the dialog and return to the application."));
+ m_closeButton->setGuiItem(okButtenItem);
+
+ connect(m_closeButton, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditPrice()));
+ connect(m_priceList, SIGNAL(editPrice()), this, SLOT(slotEditPrice()));
+ connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(slotDeletePrice()));
+ connect(m_priceList, SIGNAL(deletePrice()), this, SLOT(slotDeletePrice()));
+ connect(m_newButton, SIGNAL(clicked()), this, SLOT(slotNewPrice()));
+ connect(m_priceList, SIGNAL(newPrice()), this, SLOT(slotNewPrice()));
+ connect(m_priceList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelectPrice(QListViewItem*)));
+ connect(m_onlineQuoteButton, SIGNAL(clicked()), this, SLOT(slotOnlinePriceUpdate()));
+ connect(m_priceList, SIGNAL(onlinePriceUpdate()), this, SLOT(slotOnlinePriceUpdate()));
+
+ connect(m_showAllPrices, SIGNAL(toggled(bool)), this, SLOT(slotLoadWidgets()));
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+
+ slotLoadWidgets();
+ slotSelectPrice(0);
+
+ // FIXME: for now, we don't have the logic to delete all prices in a given date range
+ m_deleteRangeButton->setEnabled(false);
+}
+
+KMyMoneyPriceDlg::~KMyMoneyPriceDlg()
+{
+}
+
+void KMyMoneyPriceDlg::slotLoadWidgets(void)
+{
+ m_priceList->clear();
+
+ MyMoneyPriceList list = MyMoneyFile::instance()->priceList();
+ MyMoneyPriceList::ConstIterator it_l;
+ for(it_l = list.begin(); it_l != list.end(); ++it_l) {
+ MyMoneyPriceEntries::ConstIterator it_e;
+ if(m_showAllPrices->isChecked()) {
+ for(it_e = (*it_l).begin(); it_e != (*it_l).end(); ++it_e) {
+ new KMyMoneyPriceItem(m_priceList, *it_e);
+ }
+ } else {
+ if((*it_l).count() > 0) {
+ it_e = (*it_l).end();
+ --it_e;
+ new KMyMoneyPriceItem(m_priceList, *it_e);
+ }
+ }
+ }
+}
+
+void KMyMoneyPriceDlg::slotSelectPrice(QListViewItem * item)
+{
+ m_currentItem = item;
+ m_editButton->setEnabled(item != 0);
+ m_deleteButton->setEnabled(item != 0);
+
+ // Modification of automatically added entries is not allowed
+ if(item) {
+ KMyMoneyPriceItem* priceitem = dynamic_cast<KMyMoneyPriceItem*>(item);
+ if(priceitem && (priceitem->price().source() == "KMyMoney")) {
+ m_editButton->setEnabled(false);
+ m_deleteButton->setEnabled(false);
+ }
+ }
+}
+
+void KMyMoneyPriceDlg::slotNewPrice(void)
+{
+ KUpdateStockPriceDlg dlg(this);
+ KMyMoneyPriceItem* item = dynamic_cast<KMyMoneyPriceItem*>(m_priceList->selectedItem());
+ if(item) {
+ MyMoneySecurity security;
+ security = MyMoneyFile::instance()->security(item->price().from());
+ dlg.m_security->setSecurity(security);
+ security = MyMoneyFile::instance()->security(item->price().to());
+ dlg.m_currency->setSecurity(security);
+ }
+
+ if(dlg.exec()) {
+ MyMoneyPrice price(dlg.m_security->security().id(), dlg.m_currency->security().id(), dlg.date(), MyMoneyMoney(1,1));
+ KMyMoneyPriceItem* p = new KMyMoneyPriceItem(m_priceList, price);
+ m_priceList->setSelected(p, true);
+ // If the user cancels the following operation, we delete the new item
+ // and re-select any previously selected one
+ if(slotEditPrice() == QDialog::Rejected) {
+ delete p;
+ if(item)
+ m_priceList->setSelected(item, true);
+ }
+ }
+}
+
+int KMyMoneyPriceDlg::slotEditPrice(void)
+{
+ int rc = QDialog::Rejected;
+ KMyMoneyPriceItem* item = dynamic_cast<KMyMoneyPriceItem*>(m_priceList->selectedItem());
+ if(item) {
+ MyMoneySecurity from(MyMoneyFile::instance()->security(item->price().from()));
+ MyMoneySecurity to(MyMoneyFile::instance()->security(item->price().to()));
+ signed64 fract = MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision());
+
+ KCurrencyCalculator calc(from,
+ to,
+ MyMoneyMoney(1,1),
+ item->price().rate(to.id()),
+ item->price().date(),
+ fract,
+ this, "currencyCalculator");
+ calc.setupPriceEditor();
+
+ rc = calc.exec();
+ }
+ return rc;
+}
+
+
+void KMyMoneyPriceDlg::slotDeletePrice(void)
+{
+ KMyMoneyPriceItem* item = dynamic_cast<KMyMoneyPriceItem*>(m_priceList->selectedItem());
+ if(item) {
+ if(KMessageBox::questionYesNo(this, i18n("Do you really want to delete the selected price entry?"), i18n("Delete price information"), KStdGuiItem::yes(), KStdGuiItem::no(), "DeletePrice") == KMessageBox::Yes) {
+ MyMoneyFileTransaction ft;
+ try {
+ MyMoneyFile::instance()->removePrice(item->price());
+ ft.commit();
+ } catch(MyMoneyException *e) {
+ qDebug("Cannot delete price");
+ delete e;
+ }
+ }
+ }
+}
+
+void KMyMoneyPriceDlg::slotOnlinePriceUpdate(void)
+{
+ KMyMoneyPriceItem* item = dynamic_cast<KMyMoneyPriceItem*>(m_priceList->selectedItem());
+ if(item)
+ {
+ KEquityPriceUpdateDlg dlg(this, (item->text(COMMODITY_COL)+" "+item->text(CURRENCY_COL)).utf8());
+ if(dlg.exec() == QDialog::Accepted)
+ dlg.storePrices();
+ } else {
+ KEquityPriceUpdateDlg dlg(this);
+ if(dlg.exec() == QDialog::Accepted)
+ dlg.storePrices();
+ }
+}
+
+#if 0
+// This function is not needed. However, removing the KUpdateStockPriceDlg
+// instantiation below causes link failures:
+
+// This seems to be fixed, so I #if 0'ed it out. Let's see, if someone
+// complains and if not, we get rid of this whole block one day. (2007-06-22 ipwizard)
+//
+// kmymoney2/widgets/kmymoneypriceview.cpp:179: undefined reference to
+// `KUpdateStockPriceDlg::KUpdateStockPriceDlg[in-charge](QWidget*, char const*)'
+// kmymoney2/widgets/kmymoneypriceview.cpp:204: undefined reference to
+// `KUpdateStockPriceDlg::KUpdateStockPriceDlg[in-charge](QDate const&, QString const&, QWidget*, char const*)'
+void KEditEquityEntryDlg_useless(void)
+{
+ delete new KUpdateStockPriceDlg();
+}
+#endif
+
+// Make sure, that these definitions are only used within this file
+// this does not seem to be necessary, but when building RPMs the
+// build option 'final' is used and all CPP files are concatenated.
+// So it could well be, that in another CPP file these definitions
+// are also used.
+#undef COMMODITY_COL
+#undef CURRENCY_COL
+#undef DATE_COL
+#undef PRICE_COL
+#undef SOURCE_COL
+
+
+#include "kmymoneypricedlg.moc"
diff --git a/kmymoney2/dialogs/kmymoneypricedlg.h b/kmymoney2/dialogs/kmymoneypricedlg.h
new file mode 100644
index 0000000..c7e7c99
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneypricedlg.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ kmymoneypricedlg.h
+ -------------------
+ begin : Wed Nov 24 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KMYMONEYPRICEDLG_H
+#define KMYMONEYPRICEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QListViewItem;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoneypricedlgdecl.h"
+#include "kmymoney/mymoneyprice.h"
+
+class KMyMoneyPriceDlg : public KMyMoneyPriceDlgDecl
+{
+ Q_OBJECT
+public:
+ KMyMoneyPriceDlg(QWidget* parent, const char *name);
+ ~KMyMoneyPriceDlg();
+
+protected slots:
+ void slotSelectPrice(QListViewItem* item);
+ void slotNewPrice(void);
+ void slotDeletePrice(void);
+ int slotEditPrice(void);
+ void slotLoadWidgets(void);
+ void slotOnlinePriceUpdate(void);
+
+private:
+ QListViewItem* m_currentItem;
+};
+
+#endif // KMYMONEYPRICEDLG_H
diff --git a/kmymoney2/dialogs/kmymoneypricedlgdecl.ui b/kmymoney2/dialogs/kmymoneypricedlgdecl.ui
new file mode 100644
index 0000000..27895e3
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneypricedlgdecl.ui
@@ -0,0 +1,220 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KMyMoneyPriceDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KMyMoneyPriceDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>806</width>
+ <height>440</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Price Editor</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout23</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneyPriceView">
+ <property name="name">
+ <cstring>m_priceList</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_showAllPrices</cstring>
+ </property>
+ <property name="text">
+ <string>Show all stored prices</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_newButton</cstring>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_editButton</cstring>
+ </property>
+ <property name="text">
+ <string>Modify</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_deleteButton</cstring>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_deleteRangeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Delete Range...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>150</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_onlineQuoteButton</cstring>
+ </property>
+ <property name="text">
+ <string>Online Quotes</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>560</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>KMyMoneyPriceView</class>
+ <header location="local">../widgets/kmymoneypriceview.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="826">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000030149444154789cb59531681b5718c77f0e377c070e3c810a3a70e0041eac51852e0a19e45134830a1d9a4c69a04bc8928e990a693a640e1d0c8642b08742321894c1507991b484c890902bb8701a047760c3bd21701fe4201dde49b6a41a32b8df72dcbbeffdbefffbbfefbd5b1b0c07cce266ebe667ae2006c3c1dada0cdc3be87d6e6c35b0d692a409d9c7ec8b20d65ae29398d19b1114e7e3de4ce98b3f5e10dc0053cf0951b4506496e1b964bf7ce6c585d9054c62d01d617ca48be0596553cf496d8f2c8b01c5f795fc93904e85ec4c01a152857a5d9175d0b2805c872080f18595ccc1499a10a225d4e2fbc2877786fe81253ab6c04c8d106e09db5d43ab0d146e5c64d1a23938fb98a185cea1c33eecfd9eba49eb427dcb201e245365f2b7b2fb5b4a3a31dcb927178afe07d86901df870fefa4842aed6f6b74ba42e52b4014d580e1eb9cbd9d94de7e4aad16d2f9be02d805f0b5e532f927a1ffcacea1777f122a8105b164a7c25faf323a5d9f1f1fd600e1e5bec59e2d4b5c7ef5209d0ad17b8b31864e57c0b3e0815ac3ee33253ab664a770ff5185d1a1cb8d2267d3e58aa1dc7d2508cbe597d0e74fdd269aaaf0f52d414c4ea3e9762c996869e42560d7a72e41c4799a2586e74f95e8d8151481fa86efbe7b3398ac58b1a2b8527589f15451ad303ac2293542ad6648a796278f13a27185e4c4754310facb98c53a79e19a3fdc1426ff28c3d7399d1f7cb25343eb96106cf83c790ce9c4f2eb831855c55485663327992eb6dc8a6259874ed700b0b793323cccb9ffa842b30d6133e3e75fea989ac15a8b16ca76b746b0b92278d919774c5b6d48a78697fb29bbcf52468742a32120909c24e899ce67beed5be2db01e22d1e9485bb620e47f9ee9e606a21bd3f5d3744c7e7c54d55e87443867d8b554515ac5db4620e8e4f62263170fd1cdee90aad7640141992891b0f367c9adfe4049bb07d3b7022bd8c687c0978f46684ee084150b65ac1fcca94591b7a90a496e4c095164fb016a2b192a497795cc0f84817aebe25f7bf70ccc54a575c555c03f78ffa5fc0570d1f0c076bff0232285a0901e2257b0000000049454e44ae426082</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>m_newButton</tabstop>
+ <tabstop>m_editButton</tabstop>
+ <tabstop>m_deleteButton</tabstop>
+ <tabstop>m_onlineQuoteButton</tabstop>
+ <tabstop>m_closeButton</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kmymoneysplittable.cpp b/kmymoney2/dialogs/kmymoneysplittable.cpp
new file mode 100644
index 0000000..5b5f1af
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneysplittable.cpp
@@ -0,0 +1,999 @@
+/***************************************************************************
+ kmymoneysplittable.cpp - description
+ -------------------
+ begin : Thu Jan 10 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kdecompat.h>
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qglobal.h>
+#include <qpainter.h>
+#include <qcursor.h>
+#include <qapplication.h>
+#include <qtimer.h>
+#include <qlayout.h>
+#include <qeventloop.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <kcompletionbox.h>
+#include <kpushbutton.h>
+#include <kpopupmenu.h>
+#include <kstdaccel.h>
+#include <kshortcut.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoneysplittable.h"
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/mymoneysecurity.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+
+#include "../dialogs/kcurrencycalculator.h"
+
+#include "../mymoney/mymoneyutils.h"
+
+kMyMoneySplitTable::kMyMoneySplitTable(QWidget *parent, const char *name ) :
+ QTable(parent,name),
+ m_currentRow(0),
+ m_maxRows(0),
+ m_editMode(false),
+ m_amountWidth(80),
+ m_editCategory(0),
+ m_editMemo(0),
+ m_editAmount(0)
+{
+ // setup the transactions table
+ setNumRows(1);
+ setNumCols(3);
+ horizontalHeader()->setLabel(0, i18n("Category"));
+ horizontalHeader()->setLabel(1, i18n("Memo"));
+ horizontalHeader()->setLabel(2, i18n("Amount"));
+ setSelectionMode(QTable::NoSelection);
+ setLeftMargin(0);
+ verticalHeader()->hide();
+ setColumnStretchable(0, false);
+ setColumnStretchable(1, false);
+ setColumnStretchable(2, false);
+ horizontalHeader()->setResizeEnabled(false);
+ horizontalHeader()->setMovingEnabled(false);
+ horizontalHeader()->setFont(KMyMoneyGlobalSettings::listHeaderFont());
+
+ setVScrollBarMode(QScrollView::AlwaysOn);
+ // never show a horizontal scroll bar
+ setHScrollBarMode(QScrollView::AlwaysOff);
+
+ // setup the context menu
+ m_contextMenu = new KPopupMenu(this);
+ KIconLoader *il = KGlobal::iconLoader();
+ m_contextMenu->insertTitle(il->loadIcon("transaction", KIcon::MainToolbar), i18n("Split Options"));
+ m_contextMenu->insertItem(il->loadIcon("edit", KIcon::Small), i18n("Edit..."), this, SLOT(slotStartEdit()));
+ m_contextMenuDuplicate = m_contextMenu->insertItem(il->loadIcon("editcopy", KIcon::Small), i18n("Duplicate"), this, SLOT(slotDuplicateSplit()));
+ m_contextMenuDelete = m_contextMenu->insertItem(il->loadIcon("delete", KIcon::Small),
+ i18n("Delete ..."),
+ this, SLOT(slotDeleteSplit()));
+
+ connect(this, SIGNAL(clicked(int, int, int, const QPoint&)),
+ this, SLOT(slotSetFocus(int, int, int, const QPoint&)));
+
+ connect(this, SIGNAL(transactionChanged(const MyMoneyTransaction&)),
+ this, SLOT(slotUpdateData(const MyMoneyTransaction&)));
+}
+
+kMyMoneySplitTable::~kMyMoneySplitTable()
+{
+}
+
+void kMyMoneySplitTable::setup(const QMap<QString, MyMoneyMoney>& priceInfo)
+{
+ m_priceInfo = priceInfo;
+}
+
+const QColor kMyMoneySplitTable::rowBackgroundColor(const int row) const
+{
+ return (row % 2) ? KMyMoneyGlobalSettings::listColor() : KMyMoneyGlobalSettings::listBGColor();
+}
+
+void kMyMoneySplitTable::paintCell(QPainter *p, int row, int col, const QRect& r, bool /*selected*/)
+{
+ QColorGroup g = colorGroup();
+ QColor textColor;
+
+ g.setColor(QColorGroup::Base, rowBackgroundColor(row));
+
+ p->setFont(KMyMoneyGlobalSettings::listCellFont());
+
+ QString firsttext = text(row, col);
+ QString qstringCategory;
+ QString qstringMemo;
+
+ int intPos = firsttext.find("|");
+ if(intPos > -1)
+ {
+ qstringCategory = firsttext.left(intPos);
+ qstringMemo = firsttext.mid(intPos + 1);
+ }
+
+ QRect rr = r;
+ QRect rr2 = r;
+ rr.setX(0);
+ rr.setY(0);
+ rr.setWidth(columnWidth(col));
+ rr.setHeight(rowHeight(row));
+
+ rr2.setX(2);
+ rr2.setY(0);
+ rr2.setWidth(columnWidth(col)-4);
+ rr2.setHeight(rowHeight(row));
+
+
+ if(row == m_currentRow) {
+ QBrush backgroundBrush(g.highlight());
+ textColor = g.highlightedText();
+ p->fillRect(rr,backgroundBrush);
+
+ } else {
+ QBrush backgroundBrush(g.base());
+ textColor = g.text();
+ p->fillRect(rr,backgroundBrush);
+ }
+
+ if (KMyMoneyGlobalSettings::showGrid()) {
+ p->setPen(KMyMoneyGlobalSettings::listGridColor());
+ if(col != 0)
+ p->drawLine(rr.x(), 0, rr.x(), rr.height()-1); // left frame
+ p->drawLine(rr.x(), rr.y(), rr.width(), 0); // bottom frame
+ p->setPen(textColor);
+ }
+
+ switch (col) {
+ case 0: // category
+ case 1: // memo
+ p->drawText(rr2, Qt::AlignLeft | Qt::AlignVCenter, text(row, col));
+ break;
+
+ case 2: // amount
+ p->drawText(rr2, Qt::AlignRight | Qt::AlignVCenter,firsttext);
+ break;
+ }
+}
+
+/** Override the QTable member function to avoid display of focus */
+void kMyMoneySplitTable::paintFocus(QPainter * /* p */, const QRect & /*cr*/)
+{
+}
+
+void kMyMoneySplitTable::columnWidthChanged(int col)
+{
+ for (int i=0; i<numRows(); i++)
+ updateCell(i, col);
+}
+
+/** Override the QTable member function to avoid confusion with our own functionality */
+void kMyMoneySplitTable::endEdit(int /*row*/, int /*col*/, bool /*accept*/, bool /*replace*/ )
+{
+}
+
+bool kMyMoneySplitTable::eventFilter(QObject *o, QEvent *e)
+{
+ // MYMONEYTRACER(tracer);
+ QKeyEvent *k = static_cast<QKeyEvent *> (e);
+ bool rc = false;
+ int row = currentRow();
+ int lines = visibleHeight()/rowHeight(0);
+ QWidget* w;
+
+ if(e->type() == QEvent::KeyPress && !isEditMode()) {
+ rc = true;
+ switch(k->key()) {
+ case Qt::Key_Up:
+ if(row)
+ slotSetFocus(row-1);
+ break;
+
+ case Qt::Key_Down:
+ if(row < static_cast<int> (m_transaction.splits().count()-1))
+ slotSetFocus(row+1);
+ break;
+
+ case Qt::Key_Home:
+ slotSetFocus(0);
+ break;
+
+ case Qt::Key_End:
+ slotSetFocus(m_transaction.splits().count()-1);
+ break;
+
+ case Qt::Key_PageUp:
+ if(lines) {
+ while(lines-- > 0 && row)
+ row--;
+ slotSetFocus(row);
+ }
+ break;
+
+ case Qt::Key_PageDown:
+ if(row < static_cast<int> (m_transaction.splits().count()-1)) {
+ while(lines-- > 0 && row < static_cast<int> (m_transaction.splits().count()-1))
+ row++;
+ slotSetFocus(row);
+ }
+ break;
+
+ case Qt::Key_Delete:
+ slotDeleteSplit();
+ break;
+
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ if(row < static_cast<int> (m_transaction.splits().count()-1)
+ && KMyMoneyGlobalSettings::enterMovesBetweenFields()) {
+ slotStartEdit();
+ } else
+ emit returnPressed();
+ break;
+
+ case Qt::Key_Escape:
+ emit escapePressed();
+ break;
+
+ case Qt::Key_F2:
+ slotStartEdit();
+ break;
+
+ default:
+ rc = true;
+ KShortcut copySplit(i18n("Duplicate split", "CTRL+c"));
+ KShortcut newSplit(QKeySequence(Qt::CTRL | Qt::Key_Insert));
+ if(copySplit.contains(KKey(k))) {
+ slotDuplicateSplit();
+
+ } else if(newSplit.contains(KKey(k))) {
+ slotSetFocus(m_transaction.splits().count()-1);
+ slotStartEdit();
+
+ } else if ( k->text()[ 0 ].isPrint() ) {
+ w = slotStartEdit();
+ // make sure, the widget receives the key again
+ QApplication::sendEvent(w, e);
+ }
+ break;
+ }
+
+ } else if(e->type() == QEvent::KeyPress && isEditMode()) {
+ bool terminate = true;
+ rc = true;
+ switch(k->key()) {
+ // suppress the F2 functionality to start editing in inline edit mode
+ case Qt::Key_F2:
+ // suppress the cursor movement in inline edit mode
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_PageUp:
+ case Qt::Key_PageDown:
+ break;
+
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ // we cannot call the slot directly, as it destroys the caller of
+ // this method :-( So we let the event handler take care of calling
+ // the respective slot using a timeout. For a KLineEdit derived object
+ // it could be, that at this point the user selected a value from
+ // a completion list. In this case, we close the completion list and
+ // do not end editing of the transaction.
+ if(o->inherits("KLineEdit")) {
+ KLineEdit* le = dynamic_cast<KLineEdit*> (o);
+ KCompletionBox* box = le->completionBox(false);
+ if(box && box->isVisible()) {
+ terminate = false;
+ le->completionBox(false)->hide();
+ }
+ }
+
+ // in case we have the 'enter moves focus between fields', we need to simulate
+ // a TAB key when the object 'o' points to the category or memo field.
+ if(KMyMoneyGlobalSettings::enterMovesBetweenFields()) {
+ if(o == m_editCategory->lineEdit() || o == m_editMemo) {
+ terminate = false;
+ QKeyEvent evt(e->type(),
+ Key_Tab, 0, k->state(), QString::null,
+ k->isAutoRepeat(), k->count());
+
+ QApplication::sendEvent( o, &evt );
+ }
+ }
+
+ if(terminate) {
+ QTimer::singleShot(0, this, SLOT(slotEndEditKeyboard()));
+ }
+ break;
+
+ case Qt::Key_Escape:
+ // we cannot call the slot directly, as it destroys the caller of
+ // this method :-( So we let the event handler take care of calling
+ // the respective slot using a timeout.
+ QTimer::singleShot(0, this, SLOT(slotCancelEdit()));
+ break;
+
+ default:
+ rc = false;
+ break;
+ }
+ } else if(e->type() == QEvent::KeyRelease && !isEditMode()) {
+ // for some reason, we only see a KeyRelease event of the Menu key
+ // here. In other locations (e.g. Register::eventFilter()) we see
+ // a KeyPress event. Strange. (ipwizard - 2008-05-10)
+ switch(k->key()) {
+ case Qt::Key_Menu:
+ // if the very last entry is selected, the delete
+ // operation is not available otherwise it is
+ m_contextMenu->setItemEnabled(m_contextMenuDelete,
+ row < static_cast<int> (m_transaction.splits().count()-1));
+ m_contextMenu->setItemEnabled(m_contextMenuDuplicate,
+ row < static_cast<int> (m_transaction.splits().count()-1));
+
+ m_contextMenu->exec(QCursor::pos());
+ rc = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ // if the event has not been processed here, forward it to
+ // the base class implementation if it's not a key event
+ if(rc == false) {
+ if(e->type() != QEvent::KeyPress
+ && e->type() != QEvent::KeyRelease) {
+ rc = QTable::eventFilter(o, e);
+ }
+ }
+
+ return rc;
+}
+
+void kMyMoneySplitTable::slotSetFocus(int realrow, int /* col */, int button, const QPoint& /* point */)
+{
+ MYMONEYTRACER(tracer);
+ int row = realrow;
+
+ // adjust row to used area
+ if(row > static_cast<int> (m_transaction.splits().count()-1))
+ row = m_transaction.splits().count()-1;
+ if(row < 0)
+ row = 0;
+
+ // make sure the row will be on the screen
+ ensureCellVisible(row, 0);
+
+ if(button == Qt::LeftButton) { // left mouse button
+ if(isEditMode()) { // in edit mode?
+ if(KMyMoneyGlobalSettings::focusChangeIsEnter())
+ slotEndEdit();
+ else
+ slotCancelEdit();
+ }
+ if(row != static_cast<int> (currentRow())) {
+ // setup new current row and update visible selection
+ setCurrentCell(row, 0);
+ slotUpdateData(m_transaction);
+ }
+ } else if(button == Qt::RightButton) {
+ // context menu is only available when cursor is on
+ // an existing transaction or the first line after this area
+ if(row == realrow) {
+ // setup new current row and update visible selection
+ setCurrentCell(row, 0);
+ slotUpdateData(m_transaction);
+
+ // if the very last entry is selected, the delete
+ // operation is not available otherwise it is
+ m_contextMenu->setItemEnabled(m_contextMenuDelete,
+ row < static_cast<int> (m_transaction.splits().count()-1));
+ m_contextMenu->setItemEnabled(m_contextMenuDuplicate,
+ row < static_cast<int> (m_transaction.splits().count()-1));
+
+ m_contextMenu->exec(QCursor::pos());
+ }
+ }
+}
+
+void kMyMoneySplitTable::contentsMousePressEvent( QMouseEvent* e )
+{
+ slotSetFocus( rowAt(e->pos().y()), columnAt(e->pos().x()), e->button(), e->pos() );
+}
+
+/* turn off QTable behaviour */
+void kMyMoneySplitTable::contentsMouseReleaseEvent( QMouseEvent* /* e */ )
+{
+}
+
+void kMyMoneySplitTable::contentsMouseDoubleClickEvent( QMouseEvent *e )
+{
+ MYMONEYTRACER(tracer);
+
+ int col = columnAt(e->pos().x());
+ slotSetFocus( rowAt(e->pos().y()), col, e->button(), e->pos() );
+ slotStartEdit();
+
+ KLineEdit* editWidget = 0;
+ switch(col) {
+ case 1:
+ editWidget = m_editMemo;
+ break;
+
+ case 2:
+ editWidget = dynamic_cast<KLineEdit*> (m_editAmount->focusWidget());
+ break;
+
+ default:
+ break;
+ }
+ if(editWidget) {
+ editWidget->setFocus();
+ editWidget->selectAll();
+ // we need to call setFocus on the edit widget from the
+ // main loop again to get the keyboard focus to the widget also
+ QTimer::singleShot(0, editWidget, SLOT(setFocus()));
+ }
+}
+
+void kMyMoneySplitTable::setCurrentCell(int row, int /* col */)
+{
+ MYMONEYTRACER(tracer);
+
+ if(row > m_maxRows)
+ row = m_maxRows;
+ m_currentRow = row;
+ QTable::setCurrentCell(row, 0);
+ QValueList<MyMoneySplit> list = getSplits(m_transaction);
+ if(row < static_cast<int>(list.count()))
+ m_split = list[row];
+ else
+ m_split = MyMoneySplit();
+}
+
+void kMyMoneySplitTable::setNumRows(int irows)
+{
+ QTable::setNumRows(irows);
+
+ // determine row height according to the edit widgets
+ // we use the category widget as the base
+ QFontMetrics fm( KMyMoneyGlobalSettings::listCellFont() );
+ int height = fm.lineSpacing()+6;
+#if 0
+ // recalculate row height hint
+ KMyMoneyCategory cat;
+ height = QMAX(cat.sizeHint().height(), height);
+#endif
+
+ verticalHeader()->setUpdatesEnabled(false);
+
+ for(int i = 0; i < irows; ++i)
+ verticalHeader()->resizeSection(i, height);
+
+ verticalHeader()->setUpdatesEnabled(true);
+
+ // add or remove scrollbars as required
+ updateScrollBars();
+}
+
+void kMyMoneySplitTable::setTransaction(const MyMoneyTransaction& t, const MyMoneySplit& s, const MyMoneyAccount& acc)
+{
+ MYMONEYTRACER(tracer);
+ m_transaction = t;
+ m_account = acc;
+ m_hiddenSplit = s;
+ setCurrentCell(0, 0);
+ slotUpdateData(m_transaction);
+}
+
+const QValueList<MyMoneySplit> kMyMoneySplitTable::getSplits(const MyMoneyTransaction& t) const
+{
+ QValueList<MyMoneySplit> list;
+ QValueList<MyMoneySplit>::Iterator it;
+
+ // get list of splits
+ list = t.splits();
+
+ // and ignore the one that should be hidden
+
+ for(it = list.begin(); it != list.end(); ++it) {
+ if((*it).id() == m_hiddenSplit.id()) {
+ list.remove(it);
+ break;
+ }
+ }
+ return list;
+}
+
+void kMyMoneySplitTable::slotUpdateData(const MyMoneyTransaction& t)
+{
+ MYMONEYTRACER(tracer);
+ unsigned long rowCount=0;
+
+ QValueList<MyMoneySplit> list = getSplits(t);
+ updateTransactionTableSize();
+
+ // fill the part that is used by transactions
+ QValueList<MyMoneySplit>::Iterator it;
+ kMyMoneyEdit* valfield = new kMyMoneyEdit();
+ for(it = list.begin(); it != list.end(); ++it) {
+ QString colText;
+ MyMoneyMoney value = (*it).value();
+ if(!(*it).accountId().isEmpty()) {
+ try {
+ colText = MyMoneyFile::instance()->accountToCategory((*it).accountId());
+ } catch(MyMoneyException *e) {
+ qDebug("Unexpected exception in kMyMoneySplitTable::slotUpdateData()");
+ delete e;
+ }
+ }
+ QString amountTxt = value.formatMoney(m_account.fraction());
+ if(value == MyMoneyMoney::autoCalc) {
+ amountTxt = i18n("will be calculated");
+ }
+
+ if(colText.isEmpty() && (*it).memo().isEmpty() && value.isZero())
+ amountTxt = QString();
+
+ unsigned width = fontMetrics().width(amountTxt);
+ valfield->setMinimumWidth(width);
+ width = valfield->minimumSizeHint().width();
+
+ if(width > m_amountWidth)
+ m_amountWidth = width;
+
+ setText(rowCount, 0, colText);
+ setText(rowCount, 1, (*it).memo());
+ setText(rowCount, 2, amountTxt);
+
+ rowCount++;
+ }
+ delete valfield;
+
+ // now clean out the remainder of the table
+ while(rowCount < static_cast<unsigned long> (numRows())) {
+ setText(rowCount, 0, "");
+ setText(rowCount, 1, "");
+ setText(rowCount, 2, "");
+ ++rowCount;
+ }
+}
+
+void kMyMoneySplitTable::updateTransactionTableSize(void)
+{
+ // get current size of transactions table
+ int rowHeight = cellGeometry(0, 0).height();
+
+ // add half a row to the height to avoid unnecessary toggling when
+ // changing the number of rows
+ int tableHeight = (height() + rowHeight/2);
+ int splitCount = m_transaction.splits().count()-1;
+
+ if(splitCount < 0)
+ splitCount = 0;
+
+ // see if we need some extra lines to fill the current size with the grid
+ int numExtraLines = (tableHeight / rowHeight) - splitCount;
+ if(numExtraLines < 2)
+ numExtraLines = 2;
+
+ setNumRows(splitCount + numExtraLines);
+ // setMaxRows(splitCount);
+ m_maxRows = splitCount;
+}
+
+void kMyMoneySplitTable::resizeEvent(QResizeEvent* /* ev */)
+{
+ int w = visibleWidth() - m_amountWidth;
+
+ // resize the columns
+ setColumnWidth(0, w/2);
+ setColumnWidth(1, w/2);
+ setColumnWidth(2, m_amountWidth);
+
+ updateTransactionTableSize();
+}
+
+void kMyMoneySplitTable::slotDuplicateSplit(void)
+{
+ MYMONEYTRACER(tracer);
+ QValueList<MyMoneySplit> list = getSplits(m_transaction);
+ if(m_currentRow < static_cast<int> (list.count())) {
+ MyMoneySplit split = list[m_currentRow];
+ split.clearId();
+ try {
+ m_transaction.addSplit(split);
+ emit transactionChanged(m_transaction);
+ } catch(MyMoneyException *e) {
+ qDebug("Cannot duplicate split: %s", e->what().latin1());
+ delete e;
+ }
+ }
+}
+
+void kMyMoneySplitTable::slotDeleteSplit(void)
+{
+ MYMONEYTRACER(tracer);
+ QValueList<MyMoneySplit> list = getSplits(m_transaction);
+ if(m_currentRow < static_cast<int> (list.count())) {
+ if(KMessageBox::warningContinueCancel (this,
+ i18n("You are about to delete the selected split. "
+ "Do you really want to continue?"),
+ i18n("KMyMoney"),
+ i18n("Continue")
+ ) == KMessageBox::Continue) {
+ try {
+ m_transaction.removeSplit(list[m_currentRow]);
+ // if we removed the last split, select the previous
+ if(m_currentRow && m_currentRow == static_cast<int>(list.count())-1)
+ setCurrentCell(m_currentRow-1, 0);
+ else
+ setCurrentCell(m_currentRow, 0);
+ emit transactionChanged(m_transaction);
+ } catch(MyMoneyException *e) {
+ qDebug("Cannot remove split: %s", e->what().latin1());
+ delete e;
+ }
+ }
+ }
+}
+
+QWidget* kMyMoneySplitTable::slotStartEdit(void)
+{
+ MYMONEYTRACER(tracer);
+ return createEditWidgets();
+}
+
+void kMyMoneySplitTable::slotEndEdit(void)
+{
+ endEdit(false);
+}
+
+void kMyMoneySplitTable::slotEndEditKeyboard(void)
+{
+ endEdit(true);
+}
+
+void kMyMoneySplitTable::endEdit(bool keyBoardDriven)
+{
+ // Don't proceed, if we're not in edit mode
+ if(!m_editCategory)
+ return;
+
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ MYMONEYTRACER(tracer);
+ MyMoneySplit s1 = m_split;
+
+ if (m_editCategory->selectedItem().isEmpty()) {
+ KMessageBox::information(this, i18n("You need to assign a category to this split before it can be entered."), i18n("Enter split"), "EnterSplitWithEmptyCategory");
+ m_editCategory->setFocus();
+ return;
+ }
+
+ bool needUpdate = false;
+ if(m_editCategory->selectedItem() != m_split.accountId()) {
+ s1.setAccountId(m_editCategory->selectedItem());
+ needUpdate = true;
+ }
+ if(m_editMemo->text() != m_split.memo()) {
+ s1.setMemo(m_editMemo->text());
+ needUpdate = true;
+ }
+ if(m_editAmount->value() != m_split.value()) {
+ s1.setValue(m_editAmount->value());
+ needUpdate = true;
+ }
+
+ if(needUpdate) {
+ if(!s1.value().isZero()) {
+ MyMoneyAccount cat = file->account(s1.accountId());
+ if(cat.currencyId() != m_transaction.commodity()) {
+
+ MyMoneySecurity fromCurrency, toCurrency;
+ MyMoneyMoney fromValue, toValue;
+ fromCurrency = file->security(m_transaction.commodity());
+ toCurrency = file->security(cat.currencyId());
+
+ // determine the fraction required for this category
+ int fract = toCurrency.smallestAccountFraction();
+ if(cat.accountType() == MyMoneyAccount::Cash)
+ fract = toCurrency.smallestCashFraction();
+
+ // display only positive values to the user
+ fromValue = s1.value().abs();
+
+ // if we had a price info in the beginning, we use it here
+ if(m_priceInfo.find(cat.currencyId()) != m_priceInfo.end()) {
+ toValue = (fromValue * m_priceInfo[cat.currencyId()]).convert(fract);
+ }
+
+ // if the shares are still 0, we need to change that
+ if(toValue.isZero()) {
+ MyMoneyPrice price = MyMoneyFile::instance()->price(fromCurrency.id(), toCurrency.id());
+ // if the price is valid calculate the shares. If it is invalid
+ // assume a conversion rate of 1.0
+ if(price.isValid()) {
+ toValue = (price.rate(toCurrency.id()) * fromValue).convert(fract);
+ } else {
+ toValue = fromValue;
+ }
+ }
+
+ // now present all that to the user
+ KCurrencyCalculator calc(fromCurrency,
+ toCurrency,
+ fromValue,
+ toValue,
+ m_transaction.postDate(),
+ fract,
+ this, "currencyCalculator");
+
+ if(calc.exec() == QDialog::Rejected) {
+ return;
+ } else {
+ s1.setShares((s1.value() * calc.price()).convert(fract));
+ }
+
+ } else {
+ s1.setShares(s1.value());
+ }
+ } else
+ s1.setShares(s1.value());
+
+ m_split = s1;
+ try {
+ if(m_split.id().isEmpty()) {
+ m_transaction.addSplit(m_split);
+ } else {
+ m_transaction.modifySplit(m_split);
+ }
+ emit transactionChanged(m_transaction);
+ } catch(MyMoneyException *e) {
+ qDebug("Cannot add/modify split: %s", e->what().latin1());
+ delete e;
+ }
+ }
+ this->setFocus();
+ destroyEditWidgets();
+ slotSetFocus(currentRow()+1);
+
+ // if we still have more splits, we start editing right away
+ // in case we have selected 'enter moves betweeen fields'
+ if(keyBoardDriven
+ && currentRow() < static_cast<int> (m_transaction.splits().count()-1)
+ && KMyMoneyGlobalSettings::enterMovesBetweenFields()) {
+ slotStartEdit();
+ }
+
+}
+
+void kMyMoneySplitTable::slotCancelEdit(void)
+{
+ MYMONEYTRACER(tracer);
+ if(isEditMode()) {
+ destroyEditWidgets();
+ this->setFocus();
+ }
+}
+
+bool kMyMoneySplitTable::isEditMode(void) const
+{
+ return m_editMode;
+}
+
+void kMyMoneySplitTable::destroyEditWidgets(void)
+{
+ MYMONEYTRACER(tracer);
+
+ disconnect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadEditWidgets()));
+
+ clearCellWidget(m_currentRow, 0);
+ clearCellWidget(m_currentRow, 1);
+ clearCellWidget(m_currentRow, 2);
+ clearCellWidget(m_currentRow+1, 0);
+ m_editMode = false;
+
+ QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 100);
+}
+
+QWidget* kMyMoneySplitTable::createEditWidgets(void)
+{
+ MYMONEYTRACER(tracer);
+
+ QFont cellFont = KMyMoneyGlobalSettings::listCellFont();
+ m_tabOrderWidgets.clear();
+
+ // create the widgets
+ m_editAmount = new kMyMoneyEdit(0);
+ m_editAmount->setFont(cellFont);
+ m_editAmount->setResetButtonVisible(false);
+
+ m_editCategory = new KMyMoneyCategory();
+ m_editCategory->setHint(i18n("Category"));
+ m_editCategory->setFont(cellFont);
+ connect(m_editCategory, SIGNAL(createItem(const QString&, QString&)), this, SIGNAL(createCategory(const QString&, QString&)));
+ connect(m_editCategory, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+
+ m_editMemo = new kMyMoneyLineEdit(0, 0, false, AlignLeft|AlignVCenter);
+ m_editMemo->setHint(i18n("Memo"));
+ m_editMemo->setFont(cellFont);
+
+ // create buttons for the mouse users
+ KIconLoader *il = KGlobal::iconLoader();
+ m_registerButtonFrame = new QFrame(this, "buttonFrame");
+ QPalette palette = m_registerButtonFrame->palette();
+ palette.setColor(QColorGroup::Background, rowBackgroundColor(m_currentRow+1) );
+ m_registerButtonFrame->setPalette(palette);
+
+ QHBoxLayout* l = new QHBoxLayout(m_registerButtonFrame);
+ m_registerEnterButton = new KPushButton(il->loadIcon("button_ok", KIcon::Small, KIcon::SizeSmall), QString(), m_registerButtonFrame, "EnterButton");
+
+ m_registerCancelButton = new KPushButton(il->loadIcon("button_cancel", KIcon::Small, KIcon::SizeSmall), QString(), m_registerButtonFrame, "CancelButton");
+
+ l->addWidget(m_registerEnterButton);
+ l->addWidget(m_registerCancelButton);
+ l->addStretch(2);
+
+ connect(m_registerEnterButton, SIGNAL(clicked()), this, SLOT(slotEndEdit()));
+ connect(m_registerCancelButton, SIGNAL(clicked()), this, SLOT(slotCancelEdit()));
+
+ // setup tab order
+ addToTabOrder(m_editCategory);
+ addToTabOrder(m_editMemo);
+ addToTabOrder(m_editAmount);
+ addToTabOrder(m_registerEnterButton);
+ addToTabOrder(m_registerCancelButton);
+
+ if(!m_split.accountId().isEmpty()) {
+ m_editCategory->setSelectedItem(m_split.accountId());
+ } else {
+ // check if the transaction is balanced or not. If not,
+ // assign the remainder to the amount.
+ MyMoneyMoney diff;
+ QValueList<MyMoneySplit> list = m_transaction.splits();
+ QValueList<MyMoneySplit>::ConstIterator it_s;
+ for(it_s = list.begin(); it_s != list.end(); ++it_s) {
+ if(!(*it_s).accountId().isEmpty())
+ diff += (*it_s).value();
+ }
+ m_split.setValue(-diff);
+ }
+
+ m_editMemo->loadText(m_split.memo());
+ // don't allow automatically calculated values to be modified
+ if(m_split.value() == MyMoneyMoney::autoCalc) {
+ m_editAmount->setEnabled(false);
+ m_editAmount->loadText("will be calculated");
+ } else
+ m_editAmount->setValue(m_split.value());
+
+ setCellWidget(m_currentRow, 0, m_editCategory);
+ setCellWidget(m_currentRow, 1, m_editMemo);
+ setCellWidget(m_currentRow, 2, m_editAmount);
+ setCellWidget(m_currentRow+1, 0, m_registerButtonFrame);
+
+ // load e.g. the category widget with the account list
+ slotLoadEditWidgets();
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadEditWidgets()));
+
+ // setup the keyboard filter for all widgets
+ for(QWidget* w = m_tabOrderWidgets.first(); w; w = m_tabOrderWidgets.next()) {
+ w->installEventFilter(this);
+ }
+
+ m_editCategory->setFocus();
+ m_editCategory->lineEdit()->selectAll();
+ m_editMode = true;
+
+ return m_editCategory->lineEdit();
+}
+
+void kMyMoneySplitTable::slotLoadEditWidgets(void)
+{
+ // reload category widget
+ QString categoryId = m_editCategory->selectedItem();
+
+ AccountSet aSet;
+ aSet.addAccountGroup(MyMoneyAccount::Asset);
+ aSet.addAccountGroup(MyMoneyAccount::Liability);
+ aSet.addAccountGroup(MyMoneyAccount::Income);
+ aSet.addAccountGroup(MyMoneyAccount::Expense);
+ if(KMyMoneyGlobalSettings::expertMode())
+ aSet.addAccountGroup(MyMoneyAccount::Equity);
+
+ // remove the accounts with invalid types at this point
+ aSet.removeAccountType(MyMoneyAccount::CertificateDep);
+ aSet.removeAccountType(MyMoneyAccount::Investment);
+ aSet.removeAccountType(MyMoneyAccount::Stock);
+ aSet.removeAccountType(MyMoneyAccount::MoneyMarket);
+
+ aSet.load(m_editCategory->selector());
+
+ // if an account is specified then remove it from the widget so that the user
+ // cannot create a transfer with from and to account being the same account
+ if(!m_account.id().isEmpty())
+ m_editCategory->selector()->removeItem(m_account.id());
+
+ if(!categoryId.isEmpty())
+ m_editCategory->setSelectedItem(categoryId);
+
+}
+
+void kMyMoneySplitTable::addToTabOrder(QWidget* w)
+{
+ if(w) {
+ while(w->focusProxy())
+ w = w->focusProxy();
+ m_tabOrderWidgets.append(w);
+ }
+}
+
+bool kMyMoneySplitTable::focusNextPrevChild(bool next)
+{
+ MYMONEYTRACER(tracer);
+ bool rc = false;
+
+ if(m_editCategory) {
+ QWidget *w = 0;
+ QWidget *currentWidget;
+
+ m_tabOrderWidgets.find(qApp->focusWidget());
+ currentWidget = m_tabOrderWidgets.current();
+ w = next ? m_tabOrderWidgets.next() : m_tabOrderWidgets.prev();
+
+ do {
+ if(!w) {
+ w = next ? m_tabOrderWidgets.first() : m_tabOrderWidgets.last();
+ }
+
+ if(w != currentWidget
+ && ((w->focusPolicy() & TabFocus) == TabFocus)
+ && w->isVisible() && w->isEnabled()) {
+ w->setFocus();
+ rc = true;
+ break;
+ }
+ w = next ? m_tabOrderWidgets.next() : m_tabOrderWidgets.prev();
+ } while(w != currentWidget);
+
+ } else
+ rc = QTable::focusNextPrevChild(next);
+
+ return rc;
+}
+
+
+
+#include "kmymoneysplittable.moc"
diff --git a/kmymoney2/dialogs/kmymoneysplittable.h b/kmymoney2/dialogs/kmymoneysplittable.h
new file mode 100644
index 0000000..023660f
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneysplittable.h
@@ -0,0 +1,264 @@
+/***************************************************************************
+ kmymoneysplittable.h - description
+ -------------------
+ begin : Thu Jan 10 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KMYMONEYSPLITTABLE_H
+#define KMYMONEYSPLITTABLE_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+#include <qtable.h>
+#include <qwidgetlist.h>
+#include <qguardedptr.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+class KPopupMenu;
+class KPushButton;
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../mymoney/mymoneytransaction.h"
+#include "../mymoney/mymoneyaccount.h"
+
+class KMyMoneyCategory;
+class kMyMoneyLineEdit;
+class kMyMoneyEdit;
+
+/**
+ * @author Thomas Baumgart
+ */
+class kMyMoneySplitTable : public QTable
+{
+ Q_OBJECT
+public:
+ kMyMoneySplitTable(QWidget *parent=0, const char *name=0);
+ virtual ~kMyMoneySplitTable();
+
+ void paintCell(QPainter *p, int row, int col, const QRect& r, bool /*selected*/);
+ void paintFocus(QPainter *p, const QRect &cr);
+
+ /**
+ * This method is used to load the widget with the information about
+ * the transaction @p t. The split referencing the account @p acc is
+ * not shown in the widget.
+ *
+ * @param t reference to transaction to be shown/modified
+ * @param s reference to split that is to be hidden
+ * @param acc reference to account
+ */
+ void setTransaction(const MyMoneyTransaction& t, const MyMoneySplit& s, const MyMoneyAccount& acc);
+
+ /**
+ * This method is used to retrieve the transaction from the widget.
+ */
+ const MyMoneyTransaction& transaction(void) const { return m_transaction; }
+
+ /**
+ * Returns a list of MyMoneySplit objects. It contains all but the one
+ * referencing the account passed in setTransaction().
+ *
+ * @param t reference to transaction
+ * @return list of splits
+ */
+ const QValueList<MyMoneySplit> getSplits(const MyMoneyTransaction& t) const;
+
+ void setup(const QMap<QString, MyMoneyMoney>& priceInfo);
+
+protected:
+ void contentsMousePressEvent( QMouseEvent* e );
+ void contentsMouseReleaseEvent( QMouseEvent* e );
+ void contentsMouseDoubleClickEvent( QMouseEvent* e );
+ bool eventFilter(QObject *o, QEvent *e);
+ void endEdit(int row, int col, bool accept, bool replace );
+
+ void resizeEvent(QResizeEvent*);
+ QWidget* createEditWidgets(void);
+ void destroyEditWidgets(void);
+
+ /**
+ * This method handles the focus of the keyboard. When in edit mode
+ * (m_editCategory widget is visible) the keyboard focus is handled
+ * according to the widgets that are referenced in m_tabOrderWidgets.
+ * If not in edit mode, the base class functionality is provided.
+ *
+ * @param next true if forward-tab, false if backward-tab was
+ * pressed by the user
+ */
+ virtual bool focusNextPrevChild(bool next);
+ void addToTabOrder(QWidget* w);
+
+ /**
+ * convenience function for setCurrentCell(int row, int col)
+ */
+ void setCurrentCell(int row) { setCurrentCell(row, 0); }
+
+ void updateTransactionTableSize(void);
+
+ /**
+ * This method returns the current state of the inline editing mode
+ *
+ * @return true if inline edit mode is on, false otherwise
+ */
+ bool isEditMode(void) const;
+
+ /**
+ * This method retuns the background color for a given @p row.
+ *
+ * @param row the row in question
+ * @return the color as QColor object
+ */
+ const QColor rowBackgroundColor(const int row) const;
+
+ void endEdit(bool keyboardDriven);
+
+public slots:
+ /** No descriptions */
+ virtual void setCurrentCell(int row, int col);
+
+ virtual void setNumRows(int r);
+
+ QWidget* slotStartEdit(void);
+ void slotEndEdit(void);
+ void slotEndEditKeyboard(void);
+ void slotDeleteSplit(void);
+ void slotCancelEdit(void);
+ void slotDuplicateSplit(void);
+
+protected slots:
+ virtual void columnWidthChanged(int col);
+
+ /// move the focus to the selected @p row.
+ void slotSetFocus(int row, int col = 0, int button = Qt::LeftButton, const QPoint & mousePos = QPoint(0, 0));
+
+ /**
+ * Calling this slot refills the widget with the data
+ * passed in the argument @p t.
+ *
+ * @param t reference to transaction data
+ */
+ void slotUpdateData(const MyMoneyTransaction& t);
+
+ void slotLoadEditWidgets(void);
+
+signals:
+ /**
+ * This signal is emitted whenever the return key is pressed
+ * and the widget is not in edit mode.
+ */
+ void escapePressed(void);
+
+ /**
+ * This signal is emitted whenever the return key is pressed
+ * and the widget is not in edit mode.
+ */
+ void returnPressed(void);
+
+ /**
+ * This signal is emitted whenever the transaction data has been changed
+ *
+ * @param t modified transaction data
+ */
+ void transactionChanged(const MyMoneyTransaction& t);
+
+ /**
+ * This signal is sent out, when a new category needs to be created
+ * @sa KMyMoneyCombo::createItem()
+ *
+ * @param txt The name of the category to be created
+ * @param id A connected slot should store the id of the created object in this variable
+ */
+ void createCategory(const QString& txt, QString& id);
+
+ /**
+ * Signal is emitted, if any of the widgets enters (@a state equals @a true)
+ * or leaves (@a state equals @a false) object creation mode.
+ *
+ * @param state Enter (@a true) or leave (@a false) object creation
+ */
+ void objectCreation(bool state);
+
+private:
+ /// the currently selected row (will be printed as selected)
+ int m_currentRow;
+
+ /// the number of rows filled with data
+ int m_maxRows;
+
+ /// indication if inline editing mode is on or not
+ bool m_editMode;
+
+ MyMoneyTransaction m_transaction;
+ MyMoneyAccount m_account;
+ MyMoneySplit m_split;
+ MyMoneySplit m_hiddenSplit;
+
+ unsigned m_amountWidth;
+
+ /**
+ * This member keeps a pointer to the context menu
+ */
+ KPopupMenu* m_contextMenu;
+
+ /// keeps the id of the delete entry in the context menu
+ int m_contextMenuDelete;
+
+ /// keeps the id of the duplicate entry in the context menu
+ int m_contextMenuDuplicate;
+
+ /**
+ * This member contains a pointer to the input widget for the category.
+ * The widget will be created and destroyed dynamically in createInputWidgets()
+ * and destroyInputWidgets().
+ */
+ QGuardedPtr<KMyMoneyCategory> m_editCategory;
+
+ /**
+ * This member contains a pointer to the input widget for the memo.
+ * The widget will be created and destroyed dynamically in createInputWidgets()
+ * and destroyInputWidgets().
+ */
+ QGuardedPtr<kMyMoneyLineEdit> m_editMemo;
+
+ /**
+ * This member contains a pointer to the input widget for the amount.
+ * The widget will be created and destroyed dynamically in createInputWidgets()
+ * and destroyInputWidgets().
+ */
+ QGuardedPtr<kMyMoneyEdit> m_editAmount;
+
+ /**
+ * This member keeps the tab order for the above widgets
+ */
+ QWidgetList m_tabOrderWidgets;
+
+ QGuardedPtr<QFrame> m_registerButtonFrame;
+ QGuardedPtr<KPushButton> m_registerEnterButton;
+ QGuardedPtr<KPushButton> m_registerCancelButton;
+
+ QMap<QString, MyMoneyMoney> m_priceInfo;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/knewaccountdlg.cpp b/kmymoney2/dialogs/knewaccountdlg.cpp
new file mode 100644
index 0000000..f941f2e
--- /dev/null
+++ b/kmymoney2/dialogs/knewaccountdlg.cpp
@@ -0,0 +1,1209 @@
+/***************************************************************************
+ knewaccountdlg.cpp
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ 2004 by Thomas Baumgart
+ email : mte@users.sourceforge.net
+ ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qpixmap.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qheader.h>
+#include <qtooltip.h>
+#include <qcheckbox.h>
+#include <qtimer.h>
+#include <qtabwidget.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qtextedit.h>
+#include <qlayout.h>
+#include <qtabwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#include <klocale.h>
+#include <kglobal.h>
+#include <kmessagebox.h>
+#include <kcombobox.h>
+#include <klistview.h>
+#include <kstandarddirs.h>
+#include <kiconloader.h>
+#include <kpushbutton.h>
+#include <kled.h>
+#include <kdebug.h>
+#include <kglobalsettings.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "knewaccountdlg.h"
+
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/mymoneyexception.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneyaccounttree.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+#include <kmymoney/mymoneyreport.h>
+#include <kmymoney/kguiutils.h>
+#include <kmymoney/kmymoneycombo.h>
+
+#include "../widgets/kmymoneycurrencyselector.h"
+#include "../widgets/kmymoneyaccountselector.h"
+
+#include "../mymoney/mymoneyexception.h"
+#include "../mymoney/mymoneykeyvaluecontainer.h"
+#include "../dialogs/knewbankdlg.h"
+#include "../views/kmymoneyfile.h"
+#include "../kmymoneyutils.h"
+
+#include "../reports/kreportchartview.h"
+#include "../reports/pivottable.h"
+
+// in KOffice version < 1.5 KDCHART_PROPSET_NORMAL_DATA was a static const
+// but in 1.5 this has been changed into a #define'd value. So we have to
+// make sure, we use the right one.
+#ifndef KDCHART_PROPSET_NORMAL_DATA
+#define KMM_KDCHART_PROPSET_NORMAL_DATA KDChartParams::KDCHART_PROPSET_NORMAL_DATA
+#else
+#define KMM_KDCHART_PROPSET_NORMAL_DATA KDCHART_PROPSET_NORMAL_DATA
+#endif
+
+KNewAccountDlg::KNewAccountDlg(const MyMoneyAccount& account, bool isEditing, bool categoryEditor, QWidget *parent, const char *name, const QString& title)
+ : KNewAccountDlgDecl(parent,name,true),
+ m_account(account),
+ m_bSelectedParentAccount(false),
+ m_categoryEditor(categoryEditor),
+ m_isEditing(isEditing)
+{
+ QString columnName = ( (categoryEditor) ? i18n("Categories") : i18n("Accounts") );
+
+ m_qlistviewParentAccounts->setRootIsDecorated(true);
+ m_qlistviewParentAccounts->setAllColumnsShowFocus(true);
+ m_qlistviewParentAccounts->setSectionHeader(columnName);
+ m_qlistviewParentAccounts->setMultiSelection(false);
+ m_qlistviewParentAccounts->header()->setResizeEnabled(true);
+ m_qlistviewParentAccounts->setColumnWidthMode(0, QListView::Maximum);
+ m_qlistviewParentAccounts->setEnabled(false);
+ // never show the horizontal scroll bar
+ m_qlistviewParentAccounts->setHScrollBarMode(QScrollView::AlwaysOff);
+
+ m_subAccountLabel->setText(i18n("Is a sub account"));
+
+ m_qlistviewParentAccounts->header()->setFont(KMyMoneyGlobalSettings::listHeaderFont());
+
+ accountNameEdit->setText(account.name());
+ descriptionEdit->setText(account.description());
+
+ typeCombo->setEnabled(true);
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ // load the price mode combo
+ m_priceMode->insertItem(i18n("default price mode", "<default>"), 0);
+ m_priceMode->insertItem(i18n("Price per share"), 1);
+ m_priceMode->insertItem(i18n("Total for all shares"), 2);
+
+ int priceMode = 0;
+ if(m_account.accountType() == MyMoneyAccount::Investment) {
+ m_priceMode->setEnabled(true);
+ if(!m_account.value("priceMode").isEmpty())
+ priceMode = m_account.value("priceMode").toInt();
+ }
+ m_priceMode->setCurrentItem(priceMode);
+
+ bool haveMinBalance = false;
+ bool haveMaxCredit = false;
+ if (categoryEditor)
+ {
+ // get rid of the tabs that are not used for categories
+ QWidget* tab = m_tab->page(m_tab->indexOf(m_institutionTab));
+ if(tab)
+ m_tab->removePage(tab);
+ tab = m_tab->page(m_tab->indexOf(m_limitsTab));
+ if(tab)
+ m_tab->removePage(tab);
+
+ //m_qlistviewParentAccounts->setEnabled(true);
+ startDateEdit->setEnabled(false);
+ accountNoEdit->setEnabled(false);
+
+ m_institutionBox->hide();
+ m_qcheckboxNoVat->hide();
+
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Income));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Expense));
+
+ // Hardcoded but acceptable
+ switch (account.accountType())
+ {
+ case MyMoneyAccount::Income:
+ typeCombo->setCurrentItem(0);
+ break;
+
+ case MyMoneyAccount::Expense:
+ default:
+ typeCombo->setCurrentItem(1);
+ break;
+ }
+ m_currency->setEnabled(true);
+ if (m_isEditing)
+ {
+ typeCombo->setEnabled(false);
+ m_currency->setDisabled(MyMoneyFile::instance()->isReferenced(m_account));
+ }
+ m_qcheckboxPreferred->hide();
+
+ m_qcheckboxTax->setChecked(account.value("Tax") == "Yes");
+ loadVatAccounts();
+ }
+ else
+ {
+ // get rid of the tabs that are not used for accounts
+ QWidget* taxtab = m_tab->page(m_tab->indexOf(m_taxTab));
+ if (taxtab) {
+ if(m_account.isAssetLiability()) {
+ m_vatCategory->setText(i18n( "VAT account"));
+ m_vatAssignmentFrame->hide();
+ m_qcheckboxTax->setChecked(account.value("Tax") == "Yes");
+ } else {
+ m_tab->removePage(taxtab);
+ }
+ }
+
+ switch(m_account.accountType()) {
+ case MyMoneyAccount::Savings:
+ case MyMoneyAccount::Cash:
+ haveMinBalance = true;
+ break;
+
+ case MyMoneyAccount::Checkings:
+ haveMinBalance = true;
+ haveMaxCredit = true;
+ break;
+
+ case MyMoneyAccount::CreditCard:
+ haveMaxCredit = true;
+ break;
+
+ default:
+ // no limit available, so we might get rid of the tab
+ QWidget* tab = m_tab->page(m_tab->indexOf(m_limitsTab));
+ if(tab)
+ m_tab->removePage(tab);
+ // don't try to hide the widgets we just wiped
+ // in the next step
+ haveMaxCredit = haveMinBalance = true;
+ break;
+ }
+
+ if(!haveMaxCredit) {
+ m_maxCreditLabel->setEnabled(false);
+ m_maxCreditLabel->hide();
+ m_maxCreditEarlyEdit->hide();
+ m_maxCreditAbsoluteEdit->hide();
+ }
+ if(!haveMinBalance) {
+ m_minBalanceLabel->setEnabled(false);
+ m_minBalanceLabel->hide();
+ m_minBalanceEarlyEdit->hide();
+ m_minBalanceAbsoluteEdit->hide();
+ }
+
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Checkings));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Savings));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Cash));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::CreditCard));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Loan));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Investment));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Asset));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Liability));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Stock));
+/*
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::CertificateDep));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::MoneyMarket));
+ typeCombo->insertItem(KMyMoneyUtils::accountTypeToString(MyMoneyAccount::Currency));
+*/
+
+ // Hardcoded but acceptable
+ switch (account.accountType())
+ {
+ default:
+ case MyMoneyAccount::Checkings:
+ typeCombo->setCurrentItem(0);
+ break;
+ case MyMoneyAccount::Savings:
+ typeCombo->setCurrentItem(1);
+ break;
+ case MyMoneyAccount::Cash:
+ typeCombo->setCurrentItem(2);
+ break;
+ case MyMoneyAccount::CreditCard:
+ typeCombo->setCurrentItem(3);
+ break;
+ case MyMoneyAccount::Loan:
+ typeCombo->setCurrentItem(4);
+ break;
+ case MyMoneyAccount::Investment:
+ typeCombo->setCurrentItem(5);
+ break;
+ case MyMoneyAccount::Asset:
+ typeCombo->setCurrentItem(6);
+ break;
+ case MyMoneyAccount::Liability:
+ typeCombo->setCurrentItem(7);
+ break;
+ case MyMoneyAccount::Stock:
+ m_institutionBox->hide();
+ typeCombo->setCurrentItem(8);
+ break;
+/*
+ case MyMoneyAccount::CertificateDep:
+ typeCombo->setCurrentItem(5);
+ break;
+ case MyMoneyAccount::MoneyMarket:
+ typeCombo->setCurrentItem(7);
+ break;
+ case MyMoneyAccount::Currency:
+ typeCombo->setCurrentItem(8);
+ break;
+*/
+ }
+
+ if(!m_account.openingDate().isValid())
+ m_account.setOpeningDate(QDate::currentDate());
+
+ startDateEdit->setDate(m_account.openingDate());
+ accountNoEdit->setText(account.number());
+ m_qcheckboxPreferred->setChecked(account.value("PreferredAccount") == "Yes");
+ m_qcheckboxNoVat->setChecked(account.value("NoVat") == "Yes");
+ loadKVP("iban", ibanEdit);
+ loadKVP("minBalanceAbsolute", m_minBalanceAbsoluteEdit);
+ loadKVP("minBalanceEarly", m_minBalanceEarlyEdit);
+ loadKVP("maxCreditAbsolute", m_maxCreditAbsoluteEdit);
+ loadKVP("maxCreditEarly", m_maxCreditEarlyEdit);
+ // reverse the sign for display purposes
+ if(!m_maxCreditAbsoluteEdit->lineedit()->text().isEmpty())
+ m_maxCreditAbsoluteEdit->setValue(m_maxCreditAbsoluteEdit->value()*MyMoneyMoney(-1,1));
+ if(!m_maxCreditEarlyEdit->lineedit()->text().isEmpty())
+ m_maxCreditEarlyEdit->setValue(m_maxCreditEarlyEdit->value()*MyMoneyMoney(-1,1));
+ loadKVP("lastNumberUsed", m_lastCheckNumberUsed);
+
+
+ // we do not allow to change the account type once an account
+ // was created. Same applies to currency if it is referenced.
+ if (m_isEditing)
+ {
+ typeCombo->setEnabled(false);
+ m_currency->setDisabled(MyMoneyFile::instance()->isReferenced(m_account));
+ }
+ if(m_account.isInvest()) {
+ typeCombo->setEnabled(false);
+ m_qcheckboxPreferred->hide();
+ m_currencyText->hide();
+ m_currency->hide();
+ } else {
+ // use the old field and override a possible new value
+ if(!MyMoneyMoney(account.value("minimumBalance")).isZero()) {
+ m_minBalanceAbsoluteEdit->setValue(MyMoneyMoney(account.value("minimumBalance")));
+ }
+ }
+
+// m_qcheckboxTax->hide(); TODO should only be visible for VAT category/account
+ }
+
+ m_currency->setSecurity(file->currency(account.currencyId()));
+
+ // Load the institutions
+ // then the accounts
+ QString institutionName;
+
+ try
+ {
+ if (m_isEditing && !account.institutionId().isEmpty())
+ institutionName = file->institution(account.institutionId()).name();
+ else
+ institutionName = QString();
+ }
+ catch (MyMoneyException *e)
+ {
+ qDebug("exception in init for account dialog: %s", e->what().latin1());
+ delete e;
+ }
+
+ initParentWidget(account.parentAccountId(), account.id());
+ if(m_account.isInvest())
+ m_qlistviewParentAccounts->setEnabled(false);
+
+ if (!categoryEditor)
+ slotLoadInstitutions(institutionName);
+
+ accountNameEdit->setFocus();
+
+ if (title)
+ setCaption(title);
+
+ // load button icons
+ KIconLoader* il = KGlobal::iconLoader();
+ cancelButton->setGuiItem(KStdGuiItem::cancel());
+ createButton->setGuiItem(KStdGuiItem::ok());
+
+ connect(cancelButton, SIGNAL(clicked()), SLOT(reject()));
+ connect(createButton, SIGNAL(clicked()), this, SLOT(okClicked()));
+ connect(m_qlistviewParentAccounts, SIGNAL(selectionChanged(QListViewItem*)),
+ this, SLOT(slotSelectionChanged(QListViewItem*)));
+ connect(m_qbuttonNew, SIGNAL(clicked()), this, SLOT(slotNewClicked()));
+ connect(typeCombo, SIGNAL(activated(const QString&)),
+ this, SLOT(slotAccountTypeChanged(const QString&)));
+
+ connect(accountNameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckFinished()));
+
+ connect(m_vatCategory, SIGNAL(toggled(bool)), this, SLOT(slotVatChanged(bool)));
+ connect(m_vatAssignment, SIGNAL(toggled(bool)), this, SLOT(slotVatAssignmentChanged(bool)));
+ connect(m_vatCategory, SIGNAL(toggled(bool)), this, SLOT(slotCheckFinished()));
+ connect(m_vatAssignment, SIGNAL(toggled(bool)), this, SLOT(slotCheckFinished()));
+ connect(m_vatRate, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckFinished()));
+ connect(m_vatAccount, SIGNAL(stateChanged()), this, SLOT(slotCheckFinished()));
+
+ connect(m_minBalanceEarlyEdit, SIGNAL(valueChanged(const QString&)), this, SLOT(slotAdjustMinBalanceAbsoluteEdit(const QString&)));
+ connect(m_minBalanceAbsoluteEdit, SIGNAL(valueChanged(const QString&)), this, SLOT(slotAdjustMinBalanceEarlyEdit(const QString&)));
+ connect(m_maxCreditEarlyEdit, SIGNAL(valueChanged(const QString&)), this, SLOT(slotAdjustMaxCreditAbsoluteEdit(const QString&)));
+ connect(m_maxCreditAbsoluteEdit, SIGNAL(valueChanged(const QString&)), this, SLOT(slotAdjustMaxCreditEarlyEdit(const QString&)));
+
+ connect(m_qcomboboxInstitutions, SIGNAL(activated(const QString&)), this, SLOT(slotLoadInstitutions(const QString&)));
+
+ m_vatCategory->setChecked(false);
+ m_vatAssignment->setChecked(false);
+
+ // make sure our account does not have an id and no parent assigned
+ // and certainly no children in case we create a new account
+ if(!m_isEditing) {
+ m_account.clearId();
+ m_account.setParentAccountId(QString());
+ QStringList::ConstIterator it;
+ while((it = m_account.accountList().begin()) != m_account.accountList().end())
+ m_account.removeAccountId(*it);
+
+ if(m_parentItem == 0) {
+ // force loading of initial parent
+ m_account.setAccountType(MyMoneyAccount::UnknownAccountType);
+ MyMoneyAccount::_accountTypeE type = account.accountType();
+ if(type == MyMoneyAccount::UnknownAccountType)
+ type = MyMoneyAccount::Checkings;
+ slotAccountTypeChanged(KMyMoneyUtils::accountTypeToString(type));
+ }
+ } else {
+ if(!m_account.value("VatRate").isEmpty()) {
+ m_vatCategory->setChecked(true);
+ m_vatRate->setValue(MyMoneyMoney(m_account.value("VatRate"))*MyMoneyMoney(100,1));
+ } else {
+ if(!m_account.value("VatAccount").isEmpty()) {
+ QString accId = m_account.value("VatAccount").latin1();
+ try {
+ // make sure account exists
+ MyMoneyFile::instance()->account(accId);
+ m_vatAssignment->setChecked(true);
+ m_vatAccount->setSelected(accId);
+ m_grossAmount->setChecked(true);
+ if(m_account.value("VatAmount") == "Net")
+ m_netAmount->setChecked(true);
+ } catch(MyMoneyException *e) {
+ delete e;
+ }
+ }
+ }
+ }
+ slotVatChanged(m_vatCategory->isChecked());
+ slotVatAssignmentChanged(m_vatAssignment->isChecked());
+ slotCheckFinished();
+
+ kMandatoryFieldGroup* requiredFields = new kMandatoryFieldGroup (this);
+ requiredFields->setOkButton(createButton); // button to be enabled when all fields present
+ requiredFields->add(accountNameEdit);
+
+ // using a timeout is the only way, I got the 'ensureItemVisible'
+ // working when creating the dialog. I assume, this
+ // has something to do with the delayed update of the display somehow.
+ QTimer::singleShot(50, this, SLOT(timerDone()));
+}
+
+void KNewAccountDlg::timerDone(void)
+{
+ if(m_accountItem) m_qlistviewParentAccounts->ensureItemVisible(m_accountItem);
+ if(m_parentItem) m_qlistviewParentAccounts->ensureItemVisible(m_parentItem);
+ // KNewAccountDlgDecl::resizeEvent(0);
+ m_qlistviewParentAccounts->setColumnWidth(m_qlistviewParentAccounts->nameColumn(), m_qlistviewParentAccounts->visibleWidth());
+ m_qlistviewParentAccounts->repaintContents(false);
+}
+
+void KNewAccountDlg::setOpeningBalance(const MyMoneyMoney& balance)
+{
+ m_openingBalanceEdit->setValue(balance);
+}
+
+void KNewAccountDlg::setOpeningBalanceShown(bool shown)
+{
+ m_openingBalanceEdit->setShown(shown);
+}
+
+void KNewAccountDlg::okClicked()
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ QString accountNameText = accountNameEdit->text();
+ if (accountNameText.isEmpty())
+ {
+ KMessageBox::error(this, i18n("You have not specified a name.\nPlease fill in this field."));
+ accountNameEdit->setFocus();
+ return;
+ }
+
+ MyMoneyAccount parent = parentAccount();
+ if (parent.name().length() == 0)
+ {
+ KMessageBox::error(this, i18n("Please select a parent account."));
+ return;
+ }
+
+ if (!m_categoryEditor)
+ {
+ QString institutionNameText = m_qcomboboxInstitutions->currentText();
+ if (institutionNameText != i18n("<No Institution>"))
+ {
+ try
+ {
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ QValueList<MyMoneyInstitution> list = file->institutionList();
+ QValueList<MyMoneyInstitution>::ConstIterator institutionIterator;
+ for (institutionIterator = list.begin(); institutionIterator != list.end(); ++institutionIterator)
+ {
+ if ((*institutionIterator).name() == institutionNameText)
+ m_account.setInstitutionId((*institutionIterator).id());
+ }
+ }
+ catch (MyMoneyException *e)
+ {
+ qDebug("Exception in account institution set: %s", e->what().latin1());
+ delete e;
+ }
+ }
+ else
+ {
+ m_account.setInstitutionId(QString());
+ }
+ }
+
+ m_account.setName(accountNameText);
+ m_account.setNumber(accountNoEdit->text());
+ storeKVP("iban", ibanEdit);
+ storeKVP("minBalanceAbsolute", m_minBalanceAbsoluteEdit);
+ storeKVP("minBalanceEarly", m_minBalanceEarlyEdit);
+
+ // the figures for credit line with reversed sign
+ if(!m_maxCreditAbsoluteEdit->lineedit()->text().isEmpty())
+ m_maxCreditAbsoluteEdit->setValue(m_maxCreditAbsoluteEdit->value()*MyMoneyMoney(-1,1));
+ if(!m_maxCreditEarlyEdit->lineedit()->text().isEmpty())
+ m_maxCreditEarlyEdit->setValue(m_maxCreditEarlyEdit->value()*MyMoneyMoney(-1,1));
+ storeKVP("maxCreditAbsolute", m_maxCreditAbsoluteEdit);
+ storeKVP("maxCreditEarly", m_maxCreditEarlyEdit);
+ if(!m_maxCreditAbsoluteEdit->lineedit()->text().isEmpty())
+ m_maxCreditAbsoluteEdit->setValue(m_maxCreditAbsoluteEdit->value()*MyMoneyMoney(-1,1));
+ if(!m_maxCreditEarlyEdit->lineedit()->text().isEmpty())
+ m_maxCreditEarlyEdit->setValue(m_maxCreditEarlyEdit->value()*MyMoneyMoney(-1,1));
+
+ storeKVP("lastNumberUsed", m_lastCheckNumberUsed);
+ // delete a previous version of the minimumbalance information
+ storeKVP("minimumBalance", QString(), QString());
+
+ MyMoneyAccount::accountTypeE acctype;
+ if (!m_categoryEditor)
+ {
+ acctype = KMyMoneyUtils::stringToAccountType(typeCombo->currentText());
+ // If it's a loan, check if the parent is asset or liability. In
+ // case of asset, we change the account type to be AssetLoan
+ if(acctype == MyMoneyAccount::Loan
+ && parent.accountGroup() == MyMoneyAccount::Asset)
+ acctype = MyMoneyAccount::AssetLoan;
+
+#if 0
+ // we do allow the same name for different accounts, so
+ // we don't need this check anymore.
+ if(!file->nameToAccount(accountNameText).isEmpty()
+ && (file->nameToAccount(accountNameText) != m_account.id())) {
+ KMessageBox::error(this, QString("<qt>")+i18n("An account named <b>%1</b> already exists. You cannot create a second account with the same name.").arg(accountNameText)+QString("</qt>"));
+ return;
+ }
+#endif
+ }
+ else
+ {
+ acctype = parent.accountGroup();
+ QString newName;
+ if(!MyMoneyFile::instance()->isStandardAccount(parent.id())) {
+ newName = MyMoneyFile::instance()->accountToCategory(parent.id()) + MyMoneyFile::AccountSeperator;
+ }
+ newName += accountNameText;
+ if(!file->categoryToAccount(newName, acctype).isEmpty()
+ && (file->categoryToAccount(newName, acctype) != m_account.id())) {
+ KMessageBox::error(this, QString("<qt>")+i18n("A category named <b>%1</b> already exists. You cannot create a second category with the same name.").arg(newName)+QString("</qt>"));
+ return;
+ }
+ }
+ m_account.setAccountType(acctype);
+
+ m_account.setDescription(descriptionEdit->text());
+
+ if (!m_categoryEditor)
+ {
+ m_account.setOpeningDate(startDateEdit->date());
+ m_account.setCurrencyId(m_currency->security().id());
+
+ if(m_qcheckboxPreferred->isChecked())
+ m_account.setValue("PreferredAccount", "Yes");
+ else
+ m_account.deletePair("PreferredAccount");
+ if(m_qcheckboxNoVat->isChecked())
+ m_account.setValue("NoVat", "Yes");
+ else
+ m_account.deletePair("NoVat");
+
+ if(m_minBalanceAbsoluteEdit->isVisible()) {
+ m_account.setValue("minimumBalance", m_minBalanceAbsoluteEdit->value().toString());
+ }
+ }
+ else
+ {
+ if(KMyMoneyGlobalSettings::hideUnusedCategory() && !m_isEditing) {
+ KMessageBox::information(this, i18n("You have selected to suppress the display of unused categories in the KMyMoney configuration dialog. The category you just created will therefore only be shown if it is used. Otherwise, it will be hidden in the accounts/categories view."), i18n("Hidden categories"), "NewHiddenCategory");
+ }
+ }
+
+ if ( m_qcheckboxTax->isChecked())
+ m_account.setValue("Tax", "Yes");
+ else
+ m_account.deletePair("Tax");
+
+ m_account.deletePair("VatAccount");
+ m_account.deletePair("VatAmount");
+ m_account.deletePair("VatRate");
+
+ if(m_vatCategory->isChecked()) {
+ m_account.setValue("VatRate", (m_vatRate->value().abs() / MyMoneyMoney(100,1)).toString());
+ } else {
+ if(m_vatAssignment->isChecked()) {
+ m_account.setValue("VatAccount", m_vatAccount->selectedItems().first());
+ if(m_netAmount->isChecked())
+ m_account.setValue("VatAmount", "Net");
+ }
+ }
+
+ accept();
+}
+
+void KNewAccountDlg::loadKVP(const QString& key, kMyMoneyEdit* widget)
+{
+ if(!widget)
+ return;
+
+ if(m_account.value(key).isEmpty()) {
+ widget->clearText();
+ } else {
+ widget->setValue(MyMoneyMoney(m_account.value(key)));
+ }
+}
+
+void KNewAccountDlg::loadKVP(const QString& key, KLineEdit* widget)
+{
+ if(!widget)
+ return;
+
+ widget->setText(m_account.value(key));
+}
+
+void KNewAccountDlg::storeKVP(const QString& key, const QString& text, const QString& value)
+{
+ if(text.isEmpty())
+ m_account.deletePair(key);
+ else
+ m_account.setValue(key, value);
+}
+
+void KNewAccountDlg::storeKVP(const QString& key, kMyMoneyEdit* widget)
+{
+ storeKVP(key, widget->lineedit()->text(), widget->text());
+}
+
+void KNewAccountDlg::storeKVP(const QString& key, KLineEdit* widget)
+{
+ storeKVP(key, widget->text(), widget->text());
+}
+
+const MyMoneyAccount& KNewAccountDlg::account(void)
+{
+ // assign the right currency to the account
+ m_account.setCurrencyId(m_currency->security().id());
+
+ // and the price mode
+ switch(m_priceMode->currentItem()) {
+ case 0:
+ m_account.deletePair("priceMode");
+ break;
+ case 1:
+ case 2:
+ m_account.setValue("priceMode", QString("%1").arg(m_priceMode->currentItem()));
+ break;
+ }
+
+ return m_account;
+}
+
+const MyMoneyAccount& KNewAccountDlg::parentAccount(void)
+{
+ if (!m_bSelectedParentAccount)
+ {
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ switch (m_account.accountGroup())
+ {
+ case MyMoneyAccount::Asset:
+ m_parentAccount = file->asset();
+ break;
+ case MyMoneyAccount::Liability:
+ m_parentAccount = file->liability();
+ break;
+ case MyMoneyAccount::Income:
+ m_parentAccount = file->income();
+ break;
+ case MyMoneyAccount::Expense:
+ m_parentAccount = file->expense();
+ break;
+ case MyMoneyAccount::Equity:
+ m_parentAccount = file->equity();
+ break;
+ default:
+ qDebug("Seems we have an account that hasn't been mapped to the top five");
+ if(m_categoryEditor)
+ m_parentAccount = file->income();
+ else
+ m_parentAccount = file->asset();
+ }
+ }
+ return m_parentAccount;
+}
+
+void KNewAccountDlg::initParentWidget(QString parentId, const QString& accountId)
+{
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ MyMoneyAccount liabilityAccount = file->liability();
+ MyMoneyAccount assetAccount = file->asset();
+ MyMoneyAccount expenseAccount = file->expense();
+ MyMoneyAccount incomeAccount = file->income();
+ MyMoneyAccount equityAccount = file->equity();
+
+ m_parentItem = 0;
+ m_accountItem = 0;
+
+ // Determine the parent account
+ try
+ {
+ m_parentAccount = file->account(parentId);
+ }
+ catch (MyMoneyException *e)
+ {
+ m_bSelectedParentAccount = false;
+ m_parentAccount = MyMoneyAccount();
+ if(m_account.accountType() != MyMoneyAccount::UnknownAccountType) {
+ parentAccount();
+ parentId = m_parentAccount.id();
+ }
+ delete e;
+ }
+ m_bSelectedParentAccount = true;
+
+ // extract the account type from the combo box
+ MyMoneyAccount::accountTypeE type;
+ MyMoneyAccount::accountTypeE groupType;
+ type = KMyMoneyUtils::stringToAccountType(typeCombo->currentText());
+ groupType = MyMoneyAccount::accountGroup(type);
+
+ m_qlistviewParentAccounts->clear();
+
+ // Now scan all 4 account roots to load the list and mark the parent
+ try
+ {
+ if (!m_categoryEditor)
+ {
+ if(groupType == MyMoneyAccount::Asset || type == MyMoneyAccount::Loan) {
+ // Asset
+ KMyMoneyAccountTreeBaseItem *assetTopLevelAccount = new KMyMoneyAccountTreeItem(m_qlistviewParentAccounts, assetAccount);
+
+ if(m_parentAccount.id().isEmpty()) {
+ m_parentAccount = assetAccount;
+ parentId = m_parentAccount.id();
+ }
+
+ if (parentId == assetAccount.id())
+ m_parentItem = assetTopLevelAccount;
+
+ assetTopLevelAccount->setOpen(true);
+
+ for ( QStringList::ConstIterator it = assetAccount.accountList().begin();
+ it != assetAccount.accountList().end();
+ ++it )
+ {
+ MyMoneyAccount acc = file->account(*it);
+ if(acc.isClosed())
+ continue;
+
+ KMyMoneyAccountTreeBaseItem *accountItem = new KMyMoneyAccountTreeItem(assetTopLevelAccount, acc);
+
+ if(parentId == acc.id()) {
+ m_parentItem = accountItem;
+ } else if(accountId == acc.id()) {
+ if(m_isEditing)
+ accountItem->setSelectable(false);
+ m_accountItem = accountItem;
+ }
+
+ QStringList subAccounts = acc.accountList();
+ if (subAccounts.count() >= 1)
+ {
+ showSubAccounts(subAccounts, accountItem, parentId, acc.id());
+ }
+ }
+ }
+
+ if(groupType == MyMoneyAccount::Liability) {
+ // Liability
+ KMyMoneyAccountTreeBaseItem *liabilityTopLevelAccount = new KMyMoneyAccountTreeItem(m_qlistviewParentAccounts, liabilityAccount);
+
+ if(m_parentAccount.id().isEmpty()) {
+ m_parentAccount = liabilityAccount;
+ parentId = m_parentAccount.id();
+ }
+
+ if (parentId == liabilityAccount.id())
+ m_parentItem = liabilityTopLevelAccount;
+
+ liabilityTopLevelAccount->setOpen(true);
+
+ for ( QStringList::ConstIterator it = liabilityAccount.accountList().begin();
+ it != liabilityAccount.accountList().end();
+ ++it )
+ {
+ MyMoneyAccount acc = file->account(*it);
+ if(acc.isClosed())
+ continue;
+
+ KMyMoneyAccountTreeBaseItem *accountItem = new KMyMoneyAccountTreeItem(liabilityTopLevelAccount, acc);
+
+ if(parentId == acc.id()) {
+ m_parentItem = accountItem;
+ } else if(accountId == acc.id()) {
+ if(m_isEditing)
+ accountItem->setSelectable(false);
+ m_accountItem = accountItem;
+ }
+
+ QStringList subAccounts = acc.accountList();
+ if (subAccounts.count() >= 1)
+ {
+ showSubAccounts(subAccounts, accountItem, parentId, acc.id());
+ }
+ }
+ }
+ }
+ else
+ {
+ if(groupType == MyMoneyAccount::Income) {
+ // Income
+ KMyMoneyAccountTreeBaseItem *incomeTopLevelAccount = new KMyMoneyAccountTreeItem(m_qlistviewParentAccounts,
+ incomeAccount);
+
+ if(m_parentAccount.id().isEmpty()) {
+ m_parentAccount = incomeAccount;
+ parentId = m_parentAccount.id();
+ }
+
+ if (parentId == incomeAccount.id())
+ m_parentItem = incomeTopLevelAccount;
+
+ incomeTopLevelAccount->setOpen(true);
+
+ for ( QStringList::ConstIterator it = incomeAccount.accountList().begin();
+ it != incomeAccount.accountList().end();
+ ++it )
+ {
+ KMyMoneyAccountTreeBaseItem *accountItem = new KMyMoneyAccountTreeItem(incomeTopLevelAccount,
+ file->account(*it));
+
+ QString id = file->account(*it).id();
+ if(parentId == id) {
+ m_parentItem = accountItem;
+ } else if(accountId == id) {
+ if(m_isEditing)
+ accountItem->setSelectable(false);
+ m_accountItem = accountItem;
+ }
+
+ QStringList subAccounts = file->account(*it).accountList();
+ if (subAccounts.count() >= 1)
+ {
+ showSubAccounts(subAccounts, accountItem, parentId, accountId);
+ }
+ }
+ }
+
+ if(groupType == MyMoneyAccount::Expense) {
+ // Expense
+ KMyMoneyAccountTreeBaseItem *expenseTopLevelAccount = new KMyMoneyAccountTreeItem(m_qlistviewParentAccounts,
+ expenseAccount);
+
+ if(m_parentAccount.id().isEmpty()) {
+ m_parentAccount = expenseAccount;
+ parentId = m_parentAccount.id();
+ }
+
+ if (parentId == expenseAccount.id())
+ m_parentItem = expenseTopLevelAccount;
+
+ expenseTopLevelAccount->setOpen(true);
+
+ for ( QStringList::ConstIterator it = expenseAccount.accountList().begin();
+ it != expenseAccount.accountList().end();
+ ++it )
+ {
+ KMyMoneyAccountTreeBaseItem *accountItem = new KMyMoneyAccountTreeItem(expenseTopLevelAccount,
+ file->account(*it));
+
+ QString id = file->account(*it).id();
+ if(parentId == id) {
+ m_parentItem = accountItem;
+ } else if(accountId == id) {
+ if(m_isEditing)
+ accountItem->setSelectable(false);
+ m_accountItem = accountItem;
+ }
+
+ QStringList subAccounts = file->account(*it).accountList();
+ if (subAccounts.count() >= 1)
+ {
+ showSubAccounts(subAccounts, accountItem, parentId, accountId);
+ }
+ }
+ }
+ }
+ }
+ catch (MyMoneyException *e)
+ {
+ qDebug("Exception in assets account refresh: %s", e->what().latin1());
+ delete e;
+ }
+
+ m_qlistviewParentAccounts->setColumnWidth(0, m_qlistviewParentAccounts->width());
+
+ if (m_parentItem)
+ {
+ m_subAccountLabel->setText(i18n("Is a sub account of %1").arg(m_parentAccount.name()));
+ m_parentItem->setOpen(true);
+ m_qlistviewParentAccounts->setSelected(m_parentItem, true);
+ }
+
+ m_qlistviewParentAccounts->setEnabled(true);
+}
+
+void KNewAccountDlg::showSubAccounts(QStringList accounts, KMyMoneyAccountTreeBaseItem *parentItem,
+ const QString& parentId, const QString& accountId)
+{
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ for ( QStringList::ConstIterator it = accounts.begin(); it != accounts.end(); ++it )
+ {
+ KMyMoneyAccountTreeBaseItem *accountItem = new KMyMoneyAccountTreeItem(parentItem,
+ file->account(*it));
+
+ QString id = file->account(*it).id();
+ if(parentId == id) {
+ m_parentItem = accountItem;
+ } else if(accountId == id) {
+ if(m_isEditing)
+ accountItem->setSelectable(false);
+ m_accountItem = accountItem;
+ }
+
+ QStringList subAccounts = file->account(*it).accountList();
+ if (subAccounts.count() >= 1)
+ {
+ showSubAccounts(subAccounts, accountItem, parentId, accountId);
+ }
+ }
+}
+
+void KNewAccountDlg::resizeEvent(QResizeEvent* e)
+{
+ m_qlistviewParentAccounts->setColumnWidth(0, m_qlistviewParentAccounts->width());
+
+ // call base class resizeEvent()
+ KNewAccountDlgDecl::resizeEvent(e);
+}
+
+void KNewAccountDlg::slotSelectionChanged(QListViewItem *item)
+{
+ KMyMoneyAccountTreeBaseItem *accountItem = dynamic_cast<KMyMoneyAccountTreeBaseItem*>(item);
+ try
+ {
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ //qDebug("Selected account id: %s", accountItem->accountID().data());
+ m_parentAccount = file->account(accountItem->id());
+ m_subAccountLabel->setText(i18n("Is a sub account of %1").arg(m_parentAccount.name()));
+ if(m_qlistviewParentAccounts->isEnabled()) {
+ m_bSelectedParentAccount = true;
+ }
+ }
+ catch (MyMoneyException *e)
+ {
+ qDebug("This shouldn't happen! : %s", e->what().latin1());
+ delete e;
+ }
+}
+
+void KNewAccountDlg::loadVatAccounts(void)
+{
+ QValueList<MyMoneyAccount> list;
+ MyMoneyFile::instance()->accountList(list);
+ QValueList<MyMoneyAccount>::Iterator it;
+ QStringList loadListExpense;
+ QStringList loadListIncome;
+ QStringList loadListAsset;
+ QStringList loadListLiability;
+ for(it = list.begin(); it != list.end(); ++it) {
+ if(!(*it).value("VatRate").isEmpty()) {
+ if((*it).accountType() == MyMoneyAccount::Expense)
+ loadListExpense += (*it).id();
+ else if((*it).accountType() == MyMoneyAccount::Income)
+ loadListIncome += (*it).id();
+ else if((*it).accountType() == MyMoneyAccount::Asset)
+ loadListAsset += (*it).id();
+ else if((*it).accountType() == MyMoneyAccount::Liability)
+ loadListLiability += (*it).id();
+ }
+ }
+ AccountSet vatSet;
+ if(!loadListAsset.isEmpty())
+ vatSet.load(m_vatAccount, i18n("Asset"), loadListAsset, true);
+ if(!loadListLiability.isEmpty())
+ vatSet.load(m_vatAccount, i18n("Liability"), loadListLiability, false);
+ if(!loadListIncome.isEmpty())
+ vatSet.load(m_vatAccount, i18n("Income"), loadListIncome, false);
+ if(!loadListExpense.isEmpty())
+ vatSet.load(m_vatAccount, i18n("Expense"), loadListExpense, false);
+}
+
+void KNewAccountDlg::slotLoadInstitutions(const QString& name)
+{
+ int id=-1, counter=0;
+ m_qcomboboxInstitutions->clear();
+ QString bic;
+ // Are we forcing the user to use institutions?
+ m_qcomboboxInstitutions->insertItem(i18n("<No Institution>"));
+ m_bicValue->setText(" ");
+ ibanEdit->setEnabled(false);
+ accountNoEdit->setEnabled(false);
+ try
+ {
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ QValueList<MyMoneyInstitution> list = file->institutionList();
+ QValueList<MyMoneyInstitution>::ConstIterator institutionIterator;
+ for (institutionIterator = list.begin(), counter=1; institutionIterator != list.end(); ++institutionIterator, counter++)
+ {
+ if ((*institutionIterator).name() == name) {
+ id = counter;
+ ibanEdit->setEnabled(true);
+ accountNoEdit->setEnabled(true);
+ m_bicValue->setText((*institutionIterator).value("bic"));
+ }
+ m_qcomboboxInstitutions->insertItem((*institutionIterator).name());
+ }
+
+ if (id != -1)
+ {
+ m_qcomboboxInstitutions->setCurrentItem(id);
+ }
+ }
+ catch (MyMoneyException *e)
+ {
+ qDebug("Exception in institution load: %s", e->what().latin1());
+ delete e;
+ }
+}
+
+void KNewAccountDlg::slotNewClicked()
+{
+ MyMoneyInstitution institution;
+
+ KNewBankDlg dlg(institution, this);
+ if (dlg.exec())
+ {
+ MyMoneyFileTransaction ft;
+ try
+ {
+ MyMoneyFile *file = MyMoneyFile::instance();
+
+ institution = dlg.institution();
+ file->addInstitution(institution);
+ ft.commit();
+ slotLoadInstitutions(institution.name());
+ }
+ catch (MyMoneyException *e)
+ {
+ delete e;
+ KMessageBox::information(this, i18n("Cannot add institution"));
+ }
+ }
+}
+
+void KNewAccountDlg::slotAccountTypeChanged(const QString& typeStr)
+{
+ MyMoneyAccount::accountTypeE type;
+ MyMoneyAccount::accountTypeE oldType;
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ type = KMyMoneyUtils::stringToAccountType(typeStr);
+ try {
+ oldType = m_account.accountType();
+ if(oldType != type) {
+ QString parentId;
+ switch(MyMoneyAccount::accountGroup(type)) {
+ case MyMoneyAccount::Asset:
+ parentId = file->asset().id();
+ break;
+ case MyMoneyAccount::Liability:
+ parentId = file->liability().id();
+ break;
+ case MyMoneyAccount::Expense:
+ parentId = file->expense().id();
+ break;
+ case MyMoneyAccount::Income:
+ parentId = file->income().id();
+ break;
+ default:
+ qWarning("Unknown account group in KNewAccountDlg::slotAccountTypeChanged()");
+ break;
+ }
+ initParentWidget(parentId, QString());
+ m_account.setAccountType(type);
+ }
+ } catch(MyMoneyException *e) {
+ delete e;
+ qWarning("Unexpected exception in KNewAccountDlg::slotAccountTypeChanged()");
+ }
+}
+
+void KNewAccountDlg::slotCheckFinished(void)
+{
+ bool showButton = true;
+
+ if(accountNameEdit->text().length() == 0) {
+ showButton = false;
+ }
+
+ if(m_vatCategory->isChecked() && m_vatRate->value() <= MyMoneyMoney(0)) {
+ showButton = false;
+ } else {
+ if(m_vatAssignment->isChecked() && m_vatAccount->selectedItems().isEmpty())
+ showButton = false;
+ }
+ createButton->setEnabled(showButton);
+}
+
+void KNewAccountDlg::slotVatChanged(bool state)
+{
+ if(state) {
+ m_vatCategoryFrame->show();
+ m_vatAssignmentFrame->hide();
+ } else {
+ m_vatCategoryFrame->hide();
+ if(!m_account.isAssetLiability()) {
+ m_vatAssignmentFrame->show();
+ }
+ }
+}
+
+void KNewAccountDlg::slotVatAssignmentChanged(bool state)
+{
+ m_vatAccount->setEnabled(state);
+ m_amountGroup->setEnabled(state);
+}
+
+void KNewAccountDlg::adjustEditWidgets(kMyMoneyEdit* dst, kMyMoneyEdit* src, char mode, int corr)
+{
+ MyMoneyMoney factor(corr, 1);
+ if(m_account.accountGroup() == MyMoneyAccount::Asset)
+ factor = -factor;
+
+ switch(mode) {
+ case '<':
+ if(src->value()*factor < dst->value()*factor)
+ dst->setValue(src->value());
+ break;
+
+ case '>':
+ if(src->value()*factor > dst->value()*factor)
+ dst->setValue(src->value());
+ break;
+ }
+}
+
+void KNewAccountDlg::slotAdjustMinBalanceAbsoluteEdit(const QString&)
+{
+ adjustEditWidgets(m_minBalanceAbsoluteEdit, m_minBalanceEarlyEdit, '<', -1);
+}
+
+void KNewAccountDlg::slotAdjustMinBalanceEarlyEdit(const QString&)
+{
+ adjustEditWidgets(m_minBalanceEarlyEdit, m_minBalanceAbsoluteEdit, '>', -1);
+}
+
+void KNewAccountDlg::slotAdjustMaxCreditAbsoluteEdit(const QString&)
+{
+ adjustEditWidgets(m_maxCreditAbsoluteEdit, m_maxCreditEarlyEdit, '>', 1);
+}
+
+void KNewAccountDlg::slotAdjustMaxCreditEarlyEdit(const QString&)
+{
+ adjustEditWidgets(m_maxCreditEarlyEdit, m_maxCreditAbsoluteEdit, '<', 1);
+}
+
+void KNewAccountDlg::addTab(QWidget* w, const QString& name)
+{
+ if(w) {
+ w->reparent(m_tab, QPoint(0,0));
+ m_tab->addTab(w, name);
+ }
+}
+
+
+#include "knewaccountdlg.moc"
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/knewaccountdlg.h b/kmymoney2/dialogs/knewaccountdlg.h
new file mode 100644
index 0000000..ee09158
--- /dev/null
+++ b/kmymoney2/dialogs/knewaccountdlg.h
@@ -0,0 +1,143 @@
+/***************************************************************************
+ knewaccountdlg.h
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWACCOUNTDLG_H
+#define KNEWACCOUNTDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#ifdef HAVE_KDCHART
+#include <KDChartWidget.h>
+#include <KDChartTable.h>
+#include <KDChartParams.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/mymoneymoney.h>
+#include <kmymoney/kmymoneyedit.h>
+
+#include "../dialogs/knewaccountdlgdecl.h"
+class KMyMoneyAccountTreeBaseItem;
+namespace reports {
+ class KReportChartView;
+};
+
+/**
+ * This dialog lets you create/edit an account.
+ */
+class KNewAccountDlg : public KNewAccountDlgDecl
+{
+ Q_OBJECT
+
+private:
+ MyMoneyAccount m_account;
+ MyMoneyAccount m_parentAccount;
+ bool m_bSelectedParentAccount;
+
+ KMyMoneyAccountTreeBaseItem *m_parentItem;
+ KMyMoneyAccountTreeBaseItem *m_accountItem;
+ bool m_categoryEditor;
+ bool m_isEditing;
+
+ int m_idPropFutureValue;
+ int m_idPropLastValue;
+ int m_idPropMaxCredit;
+ int m_idPropMinBalance;
+
+ void initParentWidget(QString parentId, const QString& accountId);
+ void showSubAccounts(QStringList accounts, KMyMoneyAccountTreeBaseItem *parentItem, const QString& parentId, const QString& accountId);
+ void loadVatAccounts(void);
+ void storeKVP(const QString& key, kMyMoneyEdit* widget);
+ void storeKVP(const QString& key, KLineEdit* widget);
+ void storeKVP(const QString& key, const QString& text, const QString& value);
+ void loadKVP(const QString& key, kMyMoneyEdit* widget);
+ void loadKVP(const QString& key, KLineEdit* widget);
+
+public:
+ /**
+ * This is the constructor of the dialog. The parameters define the environment
+ * in which the dialog will be used. Depending on the environment, certain rules
+ * apply and will be handled by the dialog.
+ *
+ * @param account The original data to be used to create the account. In case
+ * of @p isEditing is false, the account id, the parent account id
+ * and the list of all child accounts will be cleared.
+ * @param isEditing If @p false, rules for new account creation apply.
+ * If @p true, rules for account editing apply
+ * @param categoryEditor If @p false, rules for asset/liability accounts apply.
+ * If @p true, rules for income/expense account apply.
+ * @param parent Pointer to parent object (passed to QDialog). Default is 0.
+ * @param name Name of the object (passed to QDialog). Default is 0.
+ * @param title Caption of the object (passed to QDialog). Default is empty string.
+ */
+ KNewAccountDlg(const MyMoneyAccount& account, bool isEditing, bool categoryEditor, QWidget *parent=0, const char *name=0, const QString& title=QString::null);
+
+ /**
+ * This method returns the edited account object.
+ */
+ const MyMoneyAccount& account(void);
+
+ /**
+ * This method returns the parent account of the edited account object.
+ */
+ const MyMoneyAccount& parentAccount(void);
+
+ void setOpeningBalance(const MyMoneyMoney& balance);
+
+ const MyMoneyMoney openingBalance(void) const { return m_openingBalanceEdit->value(); };
+
+ void setOpeningBalanceShown(bool shown);
+
+ /**
+ * This method adds an additional tab pointed to with @a w to the tab widget.
+ * This tab is usually defined by a plugin (eg. online banking). If @a w is
+ * zero, this is a NOP. @a name is used as the text to be placed on the tab.
+ */
+ void addTab(QWidget* w, const QString& name);
+
+protected:
+ void resizeEvent(QResizeEvent* e);
+ void displayOnlineBankingStatus(void);
+ void adjustEditWidgets(kMyMoneyEdit* dst, kMyMoneyEdit* src, char mode, int corr);
+
+protected slots:
+ void okClicked();
+ void slotSelectionChanged(QListViewItem *item);
+ void slotAccountTypeChanged(const QString& type);
+ void slotVatChanged(bool);
+ void slotVatAssignmentChanged(bool);
+ void slotNewClicked(void);
+ void slotCheckFinished(void);
+ void slotLoadInstitutions(const QString&);
+ void slotAdjustMinBalanceAbsoluteEdit(const QString&);
+ void slotAdjustMinBalanceEarlyEdit(const QString&);
+ void slotAdjustMaxCreditAbsoluteEdit(const QString&);
+ void slotAdjustMaxCreditEarlyEdit(const QString&);
+
+private slots:
+ void timerDone(void);
+
+};
+
+#endif
+
diff --git a/kmymoney2/dialogs/knewaccountdlgdecl.ui b/kmymoney2/dialogs/knewaccountdlgdecl.ui
new file mode 100644
index 0000000..6f6357e
--- /dev/null
+++ b/kmymoney2/dialogs/knewaccountdlgdecl.ui
@@ -0,0 +1,1044 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KNewAccountDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kNewAccountDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>670</width>
+ <height>518</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New Account Dialog</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>m_tab</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_generalTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>accountNameEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Opening information</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>6</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KMyMoneySecuritySelector" row="1" column="1">
+ <property name="name">
+ <cstring>m_currency</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>m_currencyText</cstring>
+ </property>
+ <property name="text">
+ <string>Currency:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>typeCombo</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>MShape</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>MShadow</enum>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="0" column="3">
+ <property name="name">
+ <cstring>startDateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Balance:</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="1" column="3">
+ <property name="name">
+ <cstring>m_openingBalanceEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox6</cstring>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout19</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>m_lastCheckNumberUsed</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>140</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Last check number:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Notes:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QTextEdit" row="1" column="1">
+ <property name="name">
+ <cstring>descriptionEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>m_qcheckboxNoVat</cstring>
+ </property>
+ <property name="text">
+ <string>No auto-VAT-assignment</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_5</cstring>
+ </property>
+ <property name="text">
+ <string>Price entry</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo">
+ <property name="name">
+ <cstring>m_priceMode</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>m_qcheckboxPreferred</cstring>
+ </property>
+ <property name="text">
+ <string>Preferred Account</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_institutionTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Institution</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_institutionBox</cstring>
+ </property>
+ <property name="title">
+ <string>Institution</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>m_qcomboboxInstitutions</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>m_qbuttonNew</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>New...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>accountNoEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Number:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>BIC</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>ibanEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>IBAN</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_bicValue</cstring>
+ </property>
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_hiearchyTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Hierarchy</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_subAccountLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Subaccount</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyAccountTreeBase">
+ <header location="global">../widgets/kmymoneyaccounttreebase.h</header>
+ <property name="name">
+ <cstring>m_qlistviewParentAccounts</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_limitsTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Limits</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>This page allows to setup certain limits. KMyMoney will warn you when the account balance reaches a limit.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="2" column="2">
+ <property name="name">
+ <cstring>m_minBalanceAbsoluteEdit</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Absolute limit</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>m_maxCreditLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Maximum credit limit</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="3" column="1">
+ <property name="name">
+ <cstring>m_maxCreditEarlyEdit</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="3" column="2">
+ <property name="name">
+ <cstring>m_maxCreditAbsoluteEdit</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_minBalanceEarlyEdit</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>m_minBalanceLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Minimum balance</string>
+ </property>
+ </widget>
+ <widget class="Line" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Early warning</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_taxTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tax</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>VAT details</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout34</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_vatCategory</cstring>
+ </property>
+ <property name="text">
+ <string>VAT category</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_vatCategoryFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>VAT percentage</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout33</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_vatRate</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_vatAssignmentFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_vatAssignment</cstring>
+ </property>
+ <property name="text">
+ <string>Enable auto VAT assignment</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_vatAccount</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>m_amountGroup</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Amount entered</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_grossAmount</cstring>
+ </property>
+ <property name="text">
+ <string>Gross amount</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_netAmount</cstring>
+ </property>
+ <property name="text">
+ <string>Net amount</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_qcheckboxTax</cstring>
+ </property>
+ <property name="text">
+ <string>Include on Tax Reports</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout29</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>422</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>createButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyAccountSelector</class>
+ <header location="global">../widgets/kmymoneyaccountselector.h</header>
+ <sizehint>
+ <width>80</width>
+ <height>80</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>kMyMoneyAccountTreeBase</class>
+ <header location="global">../widgets/kmymoneyaccounttreebase.h</header>
+ <sizehint>
+ <width>80</width>
+ <height>80</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1110">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041d49444154388d8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d09a6c508138cb8c13d647141163de49043bca9f1628eb9294810f24f88c15b728b07617358888785d980427290b4a8d00b19a8821da8228cf42316ac87eed9247ac95c9aeaeef9eaabdffb5ebf85f178ccfcf7f5b79fec07a7280a08a008f25ceb7c29e5da573716e65a0be3f198ef6f5ededff9b9e1b34faf90882092a1ea21428b9220ffbf46054055b19386ba6970ae6665b5e0d2c5eb0b066067bbe1f21757c88f5504eff0c192189081303a5582b16854fccce2fe041f00cdd0a8103b874556405476b62d972ec2c2b90ff3fd8df5cb946549d80b34aea15ccaa94625450e2d0e558b460b7371a734b5e027251a155545678ab62d7eea90b4c504078908c107acb354cb251b1f8f08b1c18631aabbb4d18211404804f22545863561d2f060fb34aa8a18d0086204e72c46a32292e1a796f278c1da7a859d8da9a737506db04d0a24103d8949480b214d3bbee952a05c1d536f9d2684160c744f048311543d459eb1b65ee1754cedae13a64abd5d6127053c9d0281f22d4f75c6a2118a5c09272d7ab740638bf4ef2dd2174032d0d8d04c6fe19c32bedd8bc65e342aa3f785e2784bfd6bc1bd9db24b05505616a4edd67d5a8c1801a03a9962754c504bf34b8986acfb9be91cac7d54315a15541b36b134f74bd2dc53940115a5381e087bc25c6f71be831a8baa234cc1ee3eeb74ed83116beb2b8849d108a3730e8ce27e2bfb82419a7b407ac7c222fd0e6280a8078ce64e47ef54ac9d5be9aaae0162e0de568a44a18d3df90845d919c4f01463406340a44f40efb43a99b371618488e2670d1a2d7ee6f1d3be39342104e937ed85fb86599c33e9ee0be9a004946259d8b858909880d59aa00daa0d3280b5f39e34074c4b3a5434029a76a9e9f5cc0163b5c80024158a1cfc4cb1d3061d5834066cb0a403c008599a70f6bc27b8d03106ea3ae91987278c5b143b015547224ab5e24185cd9b81665273e7b6e7cecd82ddbf8098002de94049737bc09828cf3036f31c3735c8b0e98eb704672f348c7f7c93cd1fb2ae905119ff54e0dff3542b0e9dd983dcea2cc5eea6cf303e74ec687af5c41b6fa38f5e203c7ec8e1238ef85831a214afef21060ea781ec68247b65c6916353cc8b73d1ae79354606af2a930709aa118da1636c274dd7e3774b884a79aa6b5711a538d33cf9c01c1c9b83bc6a1f55c91ccb23b05b1deb43a7decdaffefd2862f61366aa8449c69e33642f012f2bb208fa98eeda1f3346f076c8eeef19475e9be115423364f78f84105a8643d34d90cfbfdcd8cf872589a45dc7f54cf3134a36f4e495c23f9da8db15bccb708d4014f2ca512cb5d4f7c13e84300d5cff6eb39b202bab053bdb9674f0648609427d0f8402ddeac30f4fcd3ced3efc3b422d406c09b340bedc1571e1bfc3d44dc281634c5fe5e758e7395cfbe6d6c130fd17d92372d277c159b70000000049454e44ae426082</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>m_tab</tabstop>
+ <tabstop>accountNameEdit</tabstop>
+ <tabstop>typeCombo</tabstop>
+ <tabstop>startDateEdit</tabstop>
+ <tabstop>m_currency</tabstop>
+ <tabstop>m_openingBalanceEdit</tabstop>
+ <tabstop>m_lastCheckNumberUsed</tabstop>
+ <tabstop>descriptionEdit</tabstop>
+ <tabstop>m_qcheckboxPreferred</tabstop>
+ <tabstop>m_qcheckboxNoVat</tabstop>
+ <tabstop>m_qcomboboxInstitutions</tabstop>
+ <tabstop>m_qbuttonNew</tabstop>
+ <tabstop>ibanEdit</tabstop>
+ <tabstop>accountNoEdit</tabstop>
+ <tabstop>m_qlistviewParentAccounts</tabstop>
+ <tabstop>kActiveLabel1</tabstop>
+ <tabstop>m_minBalanceEarlyEdit</tabstop>
+ <tabstop>m_minBalanceAbsoluteEdit</tabstop>
+ <tabstop>m_maxCreditEarlyEdit</tabstop>
+ <tabstop>m_maxCreditAbsoluteEdit</tabstop>
+ <tabstop>m_vatCategory</tabstop>
+ <tabstop>m_vatRate</tabstop>
+ <tabstop>m_vatAssignment</tabstop>
+ <tabstop>m_grossAmount</tabstop>
+ <tabstop>m_qcheckboxTax</tabstop>
+ <tabstop>createButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/knewbankdlg.cpp b/kmymoney2/dialogs/knewbankdlg.cpp
new file mode 100644
index 0000000..f1c4e3f
--- /dev/null
+++ b/kmymoney2/dialogs/knewbankdlg.cpp
@@ -0,0 +1,105 @@
+/***************************************************************************
+ knewbankdlg.cpp
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qpixmap.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <kguiitem.h>
+#include <klineedit.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyinstitution.h>
+#include <kmymoney/kguiutils.h>
+
+#include "knewbankdlg.h"
+
+KNewBankDlg::KNewBankDlg(MyMoneyInstitution& institution, QWidget *parent, const char *name)
+ : KNewBankDlgDecl(parent,name,true), m_institution(institution)
+{
+ okBtn->setGuiItem(KStdGuiItem::ok());
+ cancelBtn->setGuiItem(KStdGuiItem::cancel());
+
+ nameEdit->setFocus();
+ nameEdit->setText(institution.name());
+ cityEdit->setText(institution.city());
+ streetEdit->setText(institution.street());
+ postcodeEdit->setText(institution.postcode());
+ telephoneEdit->setText(institution.telephone());
+ bicEdit->setText(institution.value("bic"));
+ sortCodeEdit->setText(institution.sortcode());
+
+ connect(okBtn, SIGNAL(clicked()), SLOT(okClicked()));
+ connect(cancelBtn, SIGNAL(clicked()), SLOT(reject()));
+ connect(nameEdit, SIGNAL(textChanged ( const QString & )), SLOT(institutionNameChanged( const QString &)));
+ institutionNameChanged( nameEdit->text());
+
+ kMandatoryFieldGroup* requiredFields = new kMandatoryFieldGroup (this);
+ requiredFields->setOkButton(okBtn); // button to be enabled when all fields present
+ requiredFields->add(nameEdit);
+}
+
+void KNewBankDlg::institutionNameChanged( const QString &_text)
+{
+ okBtn->setEnabled( !_text.isEmpty() );
+}
+
+KNewBankDlg::~KNewBankDlg()
+{
+}
+
+void KNewBankDlg::okClicked()
+{
+ if (nameEdit->text().isEmpty()) {
+ KMessageBox::information(this, i18n("The institution name field is empty. Please enter the name."), i18n("Adding New Institution"));
+ nameEdit->setFocus();
+ return;
+ }
+
+ m_institution.setName(nameEdit->text());
+ m_institution.setTown(cityEdit->text());
+ m_institution.setStreet(streetEdit->text());
+ m_institution.setPostcode(postcodeEdit->text());
+ m_institution.setTelephone(telephoneEdit->text());
+ m_institution.setValue("bic", bicEdit->text());
+ m_institution.setSortcode(sortCodeEdit->text());
+
+ accept();
+}
+
+const MyMoneyInstitution& KNewBankDlg::institution(void)
+{
+ return m_institution;
+}
+
+
+#include "knewbankdlg.moc"
diff --git a/kmymoney2/dialogs/knewbankdlg.h b/kmymoney2/dialogs/knewbankdlg.h
new file mode 100644
index 0000000..f829a4c
--- /dev/null
+++ b/kmymoney2/dialogs/knewbankdlg.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ knewbankdlg.h
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWBANKDLG_H
+#define KNEWBANKDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qdialog.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../mymoney/mymoneyinstitution.h"
+#include "../mymoney/mymoneykeyvaluecontainer.h"
+
+#include "../dialogs/knewbankdlgdecl.h"
+
+/// This dialog lets the user create or edit an institution
+class KNewBankDlg : public KNewBankDlgDecl
+{
+ Q_OBJECT
+
+public:
+ KNewBankDlg(MyMoneyInstitution& institution, QWidget *parent = 0, const char *name = 0);
+ ~KNewBankDlg();
+ const MyMoneyInstitution& institution(void);
+
+protected slots:
+ void okClicked();
+ void institutionNameChanged( const QString &);
+
+private:
+ MyMoneyInstitution m_institution;
+
+};
+
+#endif
diff --git a/kmymoney2/dialogs/knewbankdlgdecl.ui b/kmymoney2/dialogs/knewbankdlgdecl.ui
new file mode 100644
index 0000000..e6d4f52
--- /dev/null
+++ b/kmymoney2/dialogs/knewbankdlgdecl.ui
@@ -0,0 +1,268 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KNewBankDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kNewBankDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>631</width>
+ <height>344</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New Institution Dialog</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Institution Details</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>nameEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>City:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>cityEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Street:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>streetEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Postal Code:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>postcodeEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Telephone/Fax:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>telephoneEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Routing Number:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>sortCodeEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>BIC</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="6" column="1">
+ <property name="name">
+ <cstring>bicEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer30</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line1_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout51</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>449</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>okBtn</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>cancelBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<tabstops>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/knewbudgetdlg.cpp b/kmymoney2/dialogs/knewbudgetdlg.cpp
new file mode 100644
index 0000000..5971e54
--- /dev/null
+++ b/kmymoney2/dialogs/knewbudgetdlg.cpp
@@ -0,0 +1,83 @@
+/***************************************************************************
+ knewbudgetdlg.cpp
+ -------------------
+ begin : Wed Jan 18 2006
+ copyright : (C) 2000-2004 by Darren Gould
+ email : darren_gould@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "knewbudgetdlg.h"
+
+const int KNewBudgetDlg::m_icFutureYears = 5;
+const int KNewBudgetDlg::m_icPastYears = 2;
+
+KNewBudgetDlg::KNewBudgetDlg(QWidget* parent, const char *name) :
+ KNewBudgetDlgDecl(parent, name)
+{
+ QStringList slYear;
+ QDate dToday = QDate::currentDate();
+ int iYear = dToday.year();
+
+ for (int i=0; i<=m_icFutureYears; i++)
+ m_cbYear->insertItem( QString::number(iYear++) );
+
+ iYear = dToday.year();
+ for (int i=0; i<=m_icFutureYears; i++)
+ m_cbYear->insertItem( QString::number(--iYear) );
+}
+
+KNewBudgetDlg::~KNewBudgetDlg()
+{
+}
+
+void KNewBudgetDlg::m_pbCancel_clicked()
+{
+ reject();
+}
+
+void KNewBudgetDlg::m_pbOk_clicked()
+{
+ // force focus change to update all data
+ m_pbOk->setFocus();
+
+ if (m_leBudgetName->displayText().isEmpty())
+ {
+ KMessageBox::information(this, i18n("Please specify a budget name"));
+ m_leBudgetName->setFocus();
+ return;
+ }
+
+ m_year = m_cbYear->currentText();
+ m_name = m_leBudgetName->displayText();
+
+ accept();
+}
+
+
+#include "knewbudgetdlg.moc"
diff --git a/kmymoney2/dialogs/knewbudgetdlg.h b/kmymoney2/dialogs/knewbudgetdlg.h
new file mode 100644
index 0000000..db63e11
--- /dev/null
+++ b/kmymoney2/dialogs/knewbudgetdlg.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ knewbudgetdlg.h
+ -------------------
+ begin : Wed Jan 18 2006
+ copyright : (C) 2000-2004 by Darren Gould
+ email : darren_gould@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWBUDGETDLG_H
+#define KNEWBUDGETDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QListViewItem;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <qdatetime.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/knewbudgetdlgdecl.h"
+
+class KNewBudgetDlg : public KNewBudgetDlgDecl
+{
+ Q_OBJECT
+public:
+ KNewBudgetDlg(QWidget* parent, const char *name);
+ ~KNewBudgetDlg();
+
+ QString& getYear() {return m_year;};
+ QString& getName() {return m_name;};
+
+public slots:
+ virtual void m_pbCancel_clicked();
+ virtual void m_pbOk_clicked();
+
+private:
+ // the combobox should look m_icNextYears into the future
+ static const int m_icFutureYears;
+ static const int m_icPastYears;
+
+ QString m_year;
+ QString m_name;
+};
+
+#endif // KNEWBUDGETDLG_H
diff --git a/kmymoney2/dialogs/knewbudgetdlgdecl.ui b/kmymoney2/dialogs/knewbudgetdlgdecl.ui
new file mode 100644
index 0000000..7066a56
--- /dev/null
+++ b/kmymoney2/dialogs/knewbudgetdlgdecl.ui
@@ -0,0 +1,175 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>KNewBudgetDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KNewBudgetDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>283</width>
+ <height>116</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New Budget</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Year</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>m_leBudgetName</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>m_cbYear</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentItem">
+ <number>0</number>
+ </property>
+ <property name="sizeLimit">
+ <number>15</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pbOk</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_pbCancel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>m_pbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KNewBudgetDlgDecl</receiver>
+ <slot>m_pbOk_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>m_pbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KNewBudgetDlgDecl</receiver>
+ <slot>m_pbCancel_clicked()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">knewbudgetdlgdecl.ui.h</include>
+</includes>
+<slots>
+ <slot>m_pbOk_clicked()</slot>
+ <slot>m_pbCancel_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+
+
+
+
+</UI>
diff --git a/kmymoney2/dialogs/knewequityentrydecl.ui b/kmymoney2/dialogs/knewequityentrydecl.ui
new file mode 100644
index 0000000..affd116
--- /dev/null
+++ b/kmymoney2/dialogs/knewequityentrydecl.ui
@@ -0,0 +1,236 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>kNewEquityEntryDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kNewEquityEntryDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>417</width>
+ <height>208</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New Equity</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lblEquityName</cstring>
+ </property>
+ <property name="text">
+ <string>Equity Name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblType</cstring>
+ </property>
+ <property name="text">
+ <string>Investment Type:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>edtMarketSymbol</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Trading Symbol of the stock or mutual fund, not required.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Trading Symbol of the stock or mutual fund, not required.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="1">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>1 /</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>edtFraction</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>lblSymbol</cstring>
+ </property>
+ <property name="text">
+ <string>Market Symbol:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Smallest fraction:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>Stock</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mutual Fund</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Bond</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>cmbInvestmentType</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>edtEquityName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Name of the company, or mutual fund.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Name of the company, or mutual fund.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnOK</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyEdit</class>
+ <header location="local">../widgets/kmymoneyedit.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>1</hordata>
+ <verdata>1</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="256">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154789cad55db1184200c4c180bb005eab1cd6b8112b40d4bf1bee2486ef3006fbf1c93ece605f07eece4e1a4ed42ff2b35f6e2961132e46309941952ed8f628a761a21f56217cb20b04a45fe276d97f8ffb422431ad96e62a4ee057a83131bcc38431a6d057f8eb5cb36438afcb5cded719614011e9088308374c61aa9adb0e0651b5552b4b29efaacb099312ad5da5b2d50a93124463b2adf516fbb8cbd1354a9b1b667c8a787674144f9f982bcb93635ba8cb3fd1b2616f251013403fee763fabce8bff0aa6c989d7e67440000000049454e44ae426082</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>edtEquityName</tabstop>
+ <tabstop>edtMarketSymbol</tabstop>
+ <tabstop>cmbInvestmentType</tabstop>
+ <tabstop>btnOK</tabstop>
+ <tabstop>btnCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/knewequityentrydlg.cpp b/kmymoney2/dialogs/knewequityentrydlg.cpp
new file mode 100644
index 0000000..86a1ab8
--- /dev/null
+++ b/kmymoney2/dialogs/knewequityentrydlg.cpp
@@ -0,0 +1,99 @@
+/***************************************************************************
+ knewequityentrydlg.cpp - description
+ -------------------
+ begin : Tue Jan 29 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "knewequityentrydlg.h"
+#include "../widgets/kmymoneyedit.h"
+#include "../mymoney/mymoneymoney.h"
+
+KNewEquityEntryDlg::KNewEquityEntryDlg(QWidget *parent, const char *name)
+ : kNewEquityEntryDecl(parent, name, TRUE)
+{
+ edtFraction->setCalculatorButtonVisible(false);
+ edtFraction->setPrecision(0);
+ edtFraction->loadText("100");
+
+ connect(btnOK, SIGNAL(clicked()), this, SLOT(onOKClicked()));
+ connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
+
+ connect(edtFraction, SIGNAL(textChanged(const QString&)), this, SLOT(slotDataChanged()));
+ connect(edtMarketSymbol, SIGNAL(textChanged(const QString&)), this, SLOT(slotDataChanged()));
+ connect(edtEquityName, SIGNAL(textChanged(const QString&)), this, SLOT(slotDataChanged()));
+
+ // add icons to buttons
+ btnOK->setGuiItem(KStdGuiItem::ok());
+ btnCancel->setGuiItem(KStdGuiItem::cancel());
+
+ slotDataChanged();
+
+ edtEquityName->setFocus();
+}
+
+KNewEquityEntryDlg::~KNewEquityEntryDlg()
+{
+}
+
+/** No descriptions */
+void KNewEquityEntryDlg::onOKClicked()
+{
+ m_strSymbolName = edtMarketSymbol->text();
+ m_strName = edtEquityName->text();
+ m_fraction = edtFraction->value().abs();
+ accept();
+}
+
+void KNewEquityEntryDlg::setSymbolName(const QString& str)
+{
+ m_strSymbolName = str;
+ edtMarketSymbol->setText(m_strSymbolName);
+}
+
+void KNewEquityEntryDlg::setName(const QString& str)
+{
+ m_strName = str;
+ edtEquityName->setText(m_strName);
+}
+
+void KNewEquityEntryDlg::slotDataChanged(void)
+{
+ bool okEnabled = true;
+
+ if(!edtFraction->value().isPositive()
+ || edtMarketSymbol->text().isEmpty()
+ || edtEquityName->text().isEmpty())
+ okEnabled = false;
+
+ btnOK->setEnabled(okEnabled);
+}
+
+#include "knewequityentrydlg.moc"
diff --git a/kmymoney2/dialogs/knewequityentrydlg.h b/kmymoney2/dialogs/knewequityentrydlg.h
new file mode 100644
index 0000000..25605c6
--- /dev/null
+++ b/kmymoney2/dialogs/knewequityentrydlg.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ knewequityentrydlg.h - description
+ -------------------
+ begin : Tue Jan 29 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWEQUITYENTRY_H
+#define KNEWEQUITYENTRY_H
+
+#include <qdialog.h>
+#include <klocale.h>
+
+#include "../dialogs/knewequityentrydecl.h"
+
+/**
+ *
+ * Dialog to allow user to enter all data for a stock or mutual fund investment type.
+ *
+ * @author Kevin Tambascio
+ *
+ */
+
+class KNewEquityEntryDlg : public kNewEquityEntryDecl
+{
+ Q_OBJECT
+public:
+ KNewEquityEntryDlg(QWidget *parent = NULL, const char *name = NULL);
+ virtual ~KNewEquityEntryDlg();
+
+ void setSymbolName(const QString& str);
+ QString symbolName(void) const { return m_strSymbolName; }
+
+ void setName(const QString& str);
+ QString name(void) const { return m_strName; }
+
+ int fraction(void) const { return m_fraction; }
+
+protected slots:
+ void onOKClicked(void);
+ void slotDataChanged(void);
+
+private:
+ QString m_strSymbolName;
+ QString m_strName;
+ int m_fraction;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/knewfiledlg.cpp b/kmymoney2/dialogs/knewfiledlg.cpp
new file mode 100644
index 0000000..2ea043f
--- /dev/null
+++ b/kmymoney2/dialogs/knewfiledlg.cpp
@@ -0,0 +1,138 @@
+/***************************************************************************
+ knewfiledlg.cpp
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "kdecompat.h"
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qpixmap.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Headers
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kstdguiitem.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+
+#if KDE_IS_VERSION(3,1,90)
+#include <kabc/addressee.h>
+#include <kabc/stdaddressbook.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "knewfiledlg.h"
+
+KNewFileDlg::KNewFileDlg(QWidget *parent, const char *name, const QString& title)
+ : KNewFileDlgDecl(parent,name,true)
+{
+ init(title);
+}
+
+KNewFileDlg::KNewFileDlg(QString userName, QString userStreet,
+ QString userTown, QString userCounty, QString userPostcode, QString userTelephone,
+ QString userEmail, QWidget *parent, const char *name, const QString& title)
+ : KNewFileDlgDecl(parent,name,true)
+{
+ userNameEdit->setText(userName);
+ streetEdit->setText(userStreet);
+ townEdit->setText(userTown);
+ countyEdit->setText(userCounty);
+ postcodeEdit->setText(userPostcode);
+ telephoneEdit->setText(userTelephone);
+ emailEdit->setText(userEmail);
+
+ init(title);
+}
+
+void KNewFileDlg::init(const QString& title)
+{
+ bool showLoadButton = false;
+ okBtn->setGuiItem(KStdGuiItem::ok());
+ cancelBtn->setGuiItem(KStdGuiItem::cancel());
+
+ if (!title.isEmpty())
+ setCaption(title);
+
+#if KDE_IS_VERSION( 3, 1, 90 )
+ KABC::StdAddressBook *ab = static_cast<KABC::StdAddressBook*>
+ ( KABC::StdAddressBook::self() );
+ if ( ab && !ab->whoAmI().isEmpty() )
+ showLoadButton = true;
+#endif
+
+ if(!showLoadButton)
+ kabcBtn->hide();
+
+ userNameEdit->setFocus();
+
+ connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(okBtn, SIGNAL(clicked()), this, SLOT(okClicked()));
+ connect(kabcBtn, SIGNAL(clicked()), this, SLOT(loadFromKABC()));
+}
+
+KNewFileDlg::~KNewFileDlg(){
+}
+
+void KNewFileDlg::okClicked()
+{
+ userNameText = userNameEdit->text();
+ userStreetText = streetEdit->text();
+ userTownText = townEdit->text();
+ userCountyText = countyEdit->text();
+ userPostcodeText = postcodeEdit->text();
+ userTelephoneText = telephoneEdit->text();
+ userEmailText = emailEdit->text();
+
+ accept();
+}
+
+void KNewFileDlg::loadFromKABC(void)
+{
+#if KDE_IS_VERSION( 3, 1, 90 )
+ KABC::StdAddressBook *ab = static_cast<KABC::StdAddressBook*>
+ ( KABC::StdAddressBook::self() );
+ if ( !ab )
+ return;
+
+ KABC::Addressee addr = ab->whoAmI();
+ if ( addr.isEmpty() ) {
+ KMessageBox::sorry(this, i18n("Unable to load data, because no contact has been associated with the owner of the standard addressbook."), i18n("Addressbook import"));
+ return;
+ }
+
+ userNameEdit->setText( addr.formattedName() );
+ emailEdit->setText( addr.preferredEmail() );
+
+ KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Home );
+ telephoneEdit->setText( phone.number() );
+
+ KABC::Address a = addr.address( KABC::Address::Home );
+ countyEdit->setText( a.country() + " / " + a.region() );
+ postcodeEdit->setText( a.postalCode() );
+ townEdit->setText( a.locality() );
+ streetEdit->setText( a.street() );
+#endif
+}
+
+#include "knewfiledlg.moc"
diff --git a/kmymoney2/dialogs/knewfiledlg.h b/kmymoney2/dialogs/knewfiledlg.h
new file mode 100644
index 0000000..706a139
--- /dev/null
+++ b/kmymoney2/dialogs/knewfiledlg.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ knewfiledlg.h
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWFILEDLG_H
+#define KNEWFILEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qdialog.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "../dialogs/knewfiledlgdecl.h"
+
+// This dialog lets the user create/edit a file.
+// Use the second constructor to edit a file.
+class KNewFileDlg : public KNewFileDlgDecl {
+ Q_OBJECT
+public:
+ KNewFileDlg(QWidget *parent=0, const char *name=0, const QString& title=QString());
+ KNewFileDlg(QString userName, QString userStreet,
+ QString userTown, QString userCounty, QString userPostcode, QString userTelephone,
+ QString userEmail, QWidget *parent=0, const char *name=0, const QString& title=QString());
+ ~KNewFileDlg();
+
+ KPushButton* cancelButton(void) { return cancelBtn; };
+
+public:
+ QString userNameText;
+ QString userStreetText;
+ QString userTownText;
+ QString userCountyText;
+ QString userPostcodeText;
+ QString userTelephoneText;
+ QString userEmailText;
+
+protected:
+ /// helper method for constructors
+ void init(const QString& title);
+
+protected slots:
+ void okClicked();
+ void loadFromKABC(void);
+};
+
+#endif
diff --git a/kmymoney2/dialogs/knewfiledlgdecl.ui b/kmymoney2/dialogs/knewfiledlgdecl.ui
new file mode 100644
index 0000000..9097a74
--- /dev/null
+++ b/kmymoney2/dialogs/knewfiledlgdecl.ui
@@ -0,0 +1,328 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KNewFileDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kNewFileDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>546</width>
+ <height>448</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New File Dialog</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Use this dialog to enter personal information about yourself.
+
+All information is optional and is provided to personalize
+your KMyMoney file.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>County/State:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>userNameEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>countyEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>townEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Street:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>streetEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Email:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Your name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Telephone:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Town:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="6" column="1">
+ <property name="name">
+ <cstring>emailEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Postal Code:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>telephoneEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>postcodeEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kabcBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Load from Addressbook</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>305</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>360</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>okBtn</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>cancelBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>userNameEdit</tabstop>
+ <tabstop>streetEdit</tabstop>
+ <tabstop>townEdit</tabstop>
+ <tabstop>countyEdit</tabstop>
+ <tabstop>postcodeEdit</tabstop>
+ <tabstop>telephoneEdit</tabstop>
+ <tabstop>emailEdit</tabstop>
+ <tabstop>kabcBtn</tabstop>
+ <tabstop>okBtn</tabstop>
+ <tabstop>cancelBtn</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/knewinvestmentwizard.cpp b/kmymoney2/dialogs/knewinvestmentwizard.cpp
new file mode 100644
index 0000000..d0c9046
--- /dev/null
+++ b/kmymoney2/dialogs/knewinvestmentwizard.cpp
@@ -0,0 +1,314 @@
+/***************************************************************************
+ knewinvestmentwizard - description
+ -------------------
+ begin : Sat Dec 4 2004
+ copyright : (C) 2004 by Thomas Baumgart
+ email : kmymoney2-developer@lists.sourceforge.net
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <kcombobox.h>
+#include <kurlrequester.h>
+#include <klocale.h>
+#include <kapplication.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "knewinvestmentwizard.h"
+
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/mymoneysecurity.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneycombo.h>
+#include "../widgets/kmymoneycurrencyselector.h"
+#include "../converter/webpricequote.h"
+#include "../kmymoneyutils.h"
+
+KNewInvestmentWizard::KNewInvestmentWizard( QWidget *parent, const char *name ) :
+ KNewInvestmentWizardDecl( parent, name )
+{
+ init1();
+ slotCheckPage(QString());
+
+ m_investmentSymbol->setFocus();
+ connect(m_investmentSymbol, SIGNAL(lineChanged(const QString&)), this, SLOT(slotCheckForExistingSymbol(const QString&)));
+}
+
+KNewInvestmentWizard::KNewInvestmentWizard( const MyMoneyAccount& acc, QWidget *parent, const char *name ) :
+ KNewInvestmentWizardDecl( parent, name ),
+ m_account(acc)
+{
+ setCaption(i18n("Investment detail wizard"));
+ init1();
+
+ // load the widgets with the data
+ setName(m_account.name());
+ m_security = MyMoneyFile::instance()->security(m_account.currencyId());
+
+ init2();
+
+ int priceMode = 0;
+ if(!m_account.value("priceMode").isEmpty())
+ priceMode = m_account.value("priceMode").toInt();
+ m_priceMode->setCurrentItem(priceMode);
+
+}
+
+KNewInvestmentWizard::KNewInvestmentWizard( const MyMoneySecurity& security, QWidget *parent, const char *name ) :
+ KNewInvestmentWizardDecl( parent, name ),
+ m_security(security)
+{
+ setCaption(i18n("Security detail wizard"));
+ init1();
+ m_createAccount = false;
+
+ // load the widgets with the data
+ setName(security.name());
+
+ init2();
+
+ // no chance to change the price mode here
+ m_priceMode->setCurrentItem(0);
+ m_priceMode->setEnabled(false);
+}
+
+void KNewInvestmentWizard::init1(void)
+{
+ m_onlineSourceCombo->insertStringList( WebPriceQuote::quoteSources() );
+
+ m_onlineFactor->setValue(MyMoneyMoney(1,1));
+ m_onlineFactor->setPrecision(4);
+
+ m_fraction->setPrecision(0);
+ m_fraction->setValue(MyMoneyMoney(100, 1));
+ kMyMoneyMoneyValidator* fractionValidator = new kMyMoneyMoneyValidator(1, 100000, 0, this);
+ m_fraction->setValidator(fractionValidator);
+
+ // load the price mode combo
+ m_priceMode->insertItem(i18n("default price mode", "<default>"), 0);
+ m_priceMode->insertItem(i18n("Price per share"), 1);
+ m_priceMode->insertItem(i18n("Total for all shares"), 2);
+
+ // load the widget with the available currencies
+ m_tradingCurrencyEdit->update(QString());
+
+ connect(helpButton(),SIGNAL(clicked()), this, SLOT(slotHelp(void)));
+ connect(m_investmentName, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPage(void)));
+ connect(m_investmentSymbol, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPage(void)));
+ connect(m_fraction, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPage(void)));
+ connect(m_investmentIdentification, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPage(void)));
+ connect(m_onlineFactor, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPage(void)));
+ connect(m_onlineSourceCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCheckPage(const QString&)));
+ connect(m_useFinanceQuote, SIGNAL(toggled(bool)), this, SLOT(slotSourceChanged(bool)));
+
+ m_createAccount = true;
+
+ // Update label in case of edit
+ if(!m_account.id().isEmpty()) {
+ m_introLabel->setText(i18n("This wizard allows you to modify the selected investment."));
+ }
+ if(!m_security.id().isEmpty()) {
+ m_introLabel->setText(i18n("This wizard allows you to modify the selected security."));
+ }
+
+
+}
+
+void KNewInvestmentWizard::init2(void)
+{
+ MyMoneySecurity tradingCurrency = MyMoneyFile::instance()->currency(m_security.tradingCurrency());
+ m_investmentSymbol->setText(m_security.tradingSymbol());
+ m_tradingMarket->setCurrentText(m_security.tradingMarket());
+ m_fraction->setValue(MyMoneyMoney(m_security.smallestAccountFraction(), 1));
+ m_tradingCurrencyEdit->setSecurity(tradingCurrency);
+ if (m_security.value("kmm-online-quote-system") == "Finance::Quote") {
+ FinanceQuoteProcess p;
+ m_useFinanceQuote->setChecked(true);
+ m_onlineSourceCombo->setCurrentText(p.niceName(m_security.value("kmm-online-source")));
+ } else {
+ m_onlineSourceCombo->setCurrentText(m_security.value("kmm-online-source"));
+ }
+ if(!m_security.value("kmm-online-factor").isEmpty())
+ m_onlineFactor->setValue(MyMoneyMoney(m_security.value("kmm-online-factor")));
+ m_investmentIdentification->setText(m_security.value("kmm-security-id"));
+ m_securityType->setCurrentText(KMyMoneyUtils::securityTypeToString(m_security.securityType()));
+
+ slotCheckPage(m_security.value("kmm-online-source"));
+}
+
+KNewInvestmentWizard::~KNewInvestmentWizard()
+{
+}
+
+void KNewInvestmentWizard::setName(const QString& name)
+{
+ m_investmentName->setText(name);
+}
+
+void KNewInvestmentWizard::next(void)
+{
+ KNewInvestmentWizardDecl::next();
+ slotCheckPage();
+}
+
+void KNewInvestmentWizard::slotCheckForExistingSymbol(const QString& symbol)
+{
+ if(m_investmentName->text().isEmpty()) {
+ QValueList<MyMoneySecurity> list = MyMoneyFile::instance()->securityList();
+ QValueList<MyMoneySecurity>::const_iterator it_s;
+ MyMoneySecurity::eSECURITYTYPE type = KMyMoneyUtils::stringToSecurity(m_securityType->currentText());
+
+ for(it_s = list.begin(); it_s != list.end(); ++it_s) {
+ if((*it_s).securityType() == type
+ && (*it_s).tradingSymbol() == m_investmentSymbol->text()) {
+ m_security = MyMoneySecurity();
+ if(KMessageBox::questionYesNo(this, i18n("The selected symbol is already on file. Do you want to reuse the existing security?"), i18n("Security found")) == KMessageBox::Yes) {
+ m_security = *it_s;
+ init2();
+ m_investmentName->loadText(m_security.name());
+ }
+ break;
+ }
+ }
+ }
+}
+
+void KNewInvestmentWizard::slotSourceChanged(bool useFQ)
+{
+ m_onlineSourceCombo->clear();
+ m_onlineSourceCombo->insertItem(QString(), 0);
+ if (useFQ) {
+ m_onlineSourceCombo->insertStringList( WebPriceQuote::quoteSources( WebPriceQuote::FinanceQuote ) );
+ } else {
+ m_onlineSourceCombo->insertStringList( WebPriceQuote::quoteSources() );
+ }
+}
+
+void KNewInvestmentWizard::slotCheckPage(const QString& txt)
+{
+ m_onlineFactor->setEnabled(!txt.isEmpty());
+}
+
+void KNewInvestmentWizard::slotCheckPage(void)
+{
+ if(currentPage() == m_investmentDetailsPage) {
+ setNextEnabled(m_investmentDetailsPage, false);
+ if(m_investmentName->text().length() > 0
+ && m_investmentSymbol->text().length() > 0
+ && !m_fraction->value().isZero()
+ ) {
+ setNextEnabled(m_investmentDetailsPage, true);
+ }
+ } else if(currentPage() == m_onlineUpdatePage) {
+ setFinishEnabled(m_onlineUpdatePage, true);
+ if(m_onlineFactor->isEnabled() && m_onlineFactor->value().isZero())
+ setFinishEnabled(m_onlineUpdatePage, false);
+ }
+}
+
+void KNewInvestmentWizard::slotHelp(void)
+{
+ kapp->invokeHelp("details.investments.newinvestmentwizard");
+}
+
+void KNewInvestmentWizard::createObjects(const QString& parentId)
+{
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ QValueList<MyMoneySecurity> list = MyMoneyFile::instance()->securityList();
+ QValueList<MyMoneySecurity>::ConstIterator it;
+
+ MyMoneySecurity::eSECURITYTYPE type = KMyMoneyUtils::stringToSecurity(m_securityType->currentText());
+ MyMoneyFileTransaction ft;
+ try {
+ // update all relevant attributes only, if we create a stock
+ // account and the security is unknown or we modifiy the security
+ MyMoneySecurity newSecurity(m_security);
+ newSecurity.setName(m_investmentName->text());
+ newSecurity.setTradingSymbol(m_investmentSymbol->text());
+ newSecurity.setTradingMarket(m_tradingMarket->currentText());
+ newSecurity.setSmallestAccountFraction(m_fraction->value());
+ newSecurity.setTradingCurrency(m_tradingCurrencyEdit->security().id());
+ newSecurity.setSecurityType(type);
+ newSecurity.deletePair("kmm-online-source");
+ newSecurity.deletePair("kmm-online-quote-system");
+ newSecurity.deletePair("kmm-online-factor");
+ newSecurity.deletePair("kmm-security-id");
+
+ if(!m_onlineSourceCombo->currentText().isEmpty()) {
+ if (m_useFinanceQuote->isChecked()) {
+ FinanceQuoteProcess p;
+ newSecurity.setValue("kmm-online-quote-system", "Finance::Quote");
+ newSecurity.setValue("kmm-online-source", p.crypticName(m_onlineSourceCombo->currentText()));
+ }else{
+ newSecurity.setValue("kmm-online-source", m_onlineSourceCombo->currentText());
+ }
+ }
+ if(m_onlineFactor->isEnabled() && (m_onlineFactor->value() != MyMoneyMoney(1,1)))
+ newSecurity.setValue("kmm-online-factor", m_onlineFactor->value().toString());
+ if(!m_investmentIdentification->text().isEmpty())
+ newSecurity.setValue("kmm-security-id", m_investmentIdentification->text());
+
+ if(m_security.id().isEmpty() || newSecurity != m_security) {
+ m_security = newSecurity;
+
+ // add or update it
+ if(m_security.id().isEmpty()) {
+ file->addSecurity(m_security);
+ } else {
+ file->modifySecurity(m_security);
+ }
+ }
+
+ if(m_createAccount) {
+ // now that the security exists, we can add the account to store it
+ m_account.setName(m_investmentName->text());
+ if(m_account.accountType() == MyMoneyAccount::UnknownAccountType)
+ m_account.setAccountType(MyMoneyAccount::Stock);
+
+ m_account.setCurrencyId(m_security.id());
+ switch(m_priceMode->currentItem()) {
+ case 0:
+ m_account.deletePair("priceMode");
+ break;
+ case 1:
+ case 2:
+ m_account.setValue("priceMode", QString("%1").arg(m_priceMode->currentItem()));
+ break;
+ }
+
+ if(m_account.id().isEmpty()) {
+ MyMoneyAccount parent = file->account(parentId);
+ file->addAccount(m_account, parent);
+ } else
+ file->modifyAccount(m_account);
+ }
+ ft.commit();
+ } catch(MyMoneyException* e) {
+ KMessageBox::detailedSorry(0, i18n("Unable to create all objects for the investment"), QString("%1 caugt in %2:%3").arg(e->what()).arg(e->file()).arg(e->line()));
+ delete e;
+ }
+}
+
+#include "knewinvestmentwizard.moc"
diff --git a/kmymoney2/dialogs/knewinvestmentwizard.h b/kmymoney2/dialogs/knewinvestmentwizard.h
new file mode 100644
index 0000000..7540521
--- /dev/null
+++ b/kmymoney2/dialogs/knewinvestmentwizard.h
@@ -0,0 +1,94 @@
+/***************************************************************************
+ knewinvestmentwizard - description
+ -------------------
+ begin : Sat Dec 4 2004
+ copyright : (C) 2004 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWINVESTMENTWIZARD_H
+#define KNEWINVESTMENTWIZARD_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/knewinvestmentwizarddecl.h"
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/mymoneysecurity.h>
+
+/**
+ * This class contains the implementation of the new investment wizard.
+ *
+ * @author Thomas Baumgart
+ */
+class KNewInvestmentWizard : public KNewInvestmentWizardDecl
+{
+ Q_OBJECT
+public:
+ /**
+ * Use this constructor for the creation of a new investment
+ */
+ KNewInvestmentWizard( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * Use this constructor for the modification of an existing investment
+ */
+ KNewInvestmentWizard( const MyMoneyAccount& acc, QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * Use this constructor for the modification of an existing security
+ */
+ KNewInvestmentWizard( const MyMoneySecurity& sec, QWidget *parent = 0, const char *name = 0 );
+
+ ~KNewInvestmentWizard();
+
+ /**
+ * This method sets the name in the name widget.
+ */
+ void setName(const QString& name);
+
+ /**
+ * Depending on the constructor used, this method either
+ * creates all necessary objects for the investment or updates
+ * them.
+ *
+ * @param parentId id of parent account for the investment
+ */
+ void createObjects(const QString& parentId);
+
+ const MyMoneyAccount& account(void) const { return m_account; }
+
+protected slots:
+ void next(void);
+ void slotCheckPage(void);
+ void slotCheckPage(const QString&);
+ void slotCheckForExistingSymbol(const QString&);
+ void slotSourceChanged(bool);
+ void slotHelp(void);
+
+private:
+ void init1(void);
+ void init2(void);
+
+private:
+ MyMoneyAccount m_account;
+ MyMoneySecurity m_security;
+ bool m_createAccount;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/knewinvestmentwizarddecl.ui b/kmymoney2/dialogs/knewinvestmentwizarddecl.ui
new file mode 100644
index 0000000..a6e9241
--- /dev/null
+++ b/kmymoney2/dialogs/knewinvestmentwizarddecl.ui
@@ -0,0 +1,591 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KNewInvestmentWizardDecl</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>KNewInvestmentWizardDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>584</width>
+ <height>385</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New Investment wizard</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_investmentTypePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Investment Type</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_introLabel</cstring>
+ </property>
+ <property name="text">
+ <string>This wizard allows you to create a new investment.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>The first step in this process requires to select the type of investment. The following steps collect more details about the investment from you.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Type of investment</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <item>
+ <property name="text">
+ <string>Stock</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mutual Fund</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Bond</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_securityType</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_investmentDetailsPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Investment details</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Enter the details below and click &lt;b&gt;Next&lt;/b&gt; to continue entering the online update details.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_investmentName</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>1 /</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_fraction</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel2_5</cstring>
+ </property>
+ <property name="text">
+ <string>Price entry</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Fraction</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Trading Currency</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Full name</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo" row="6" column="1">
+ <property name="name">
+ <cstring>m_priceMode</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>AMEX</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>EUREX</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>FUND</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NASDAQ</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>NYSE</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>XETRA</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_tradingMarket</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Trading symbol</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Identification</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneySecuritySelector" row="5" column="1">
+ <property name="name">
+ <cstring>m_tradingCurrencyEdit</cstring>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_investmentSymbol</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter the ticker symbol (e.g. RHAT).</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>m_investmentIdentification</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter the CUSIP/ISIN/WKN identification number here</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Trading market</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_onlineUpdatePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Online Update</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Select an online source and click &lt;b&gt;Finish&lt;/b&gt; to store the investment data. If you don't want to use online updates, just leave the data as is.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout21</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>Use Finance::Quote</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_useFinanceQuote</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout23</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Online Source</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <item>
+ <property name="text">
+ <string></string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_onlineSourceCombo</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>180</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_6</cstring>
+ </property>
+ <property name="text">
+ <string>Factor</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_onlineFactor</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer29</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>371</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer30</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>181</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyLineEdit</class>
+ <header location="local">../widgets/kmymoneylineedit.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1110">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041d49444154388d8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d09a6c508138cb8c13d647141163de49043bca9f1628eb9294810f24f88c15b728b07617358888785d980427290b4a8d00b19a8821da8228cf42316ac87eed9247ac95c9aeaeef9eaabdffb5ebf85f178ccfcf7f5b79fec07a7280a08a008f25ceb7c29e5da573716e65a0be3f198ef6f5ededff9b9e1b34faf90882092a1ea21428b9220ffbf46054055b19386ba6970ae6665b5e0d2c5eb0b066067bbe1f21757c88f5504eff0c192189081303a5582b16854fccce2fe041f00cdd0a8103b874556405476b62d972ec2c2b90ff3fd8df5cb946549d80b34aea15ccaa94625450e2d0e558b460b7371a734b5e027251a155545678ab62d7eea90b4c504078908c107acb354cb251b1f8f08b1c18631aabbb4d18211404804f22545863561d2f060fb34aa8a18d0086204e72c46a32292e1a796f278c1da7a859d8da9a737506db04d0a24103d8949480b214d3bbee952a05c1d536f9d2684160c744f048311543d459eb1b65ee1754cedae13a64abd5d6127053c9d0281f22d4f75c6a2118a5c09272d7ab740638bf4ef2dd2174032d0d8d04c6fe19c32bedd8bc65e342aa3f785e2784bfd6bc1bd9db24b05505616a4edd67d5a8c1801a03a9962754c504bf34b8986acfb9be91cac7d54315a15541b36b134f74bd2dc53940115a5381e087bc25c6f71be831a8baa234cc1ee3eeb74ed83116beb2b8849d108a3730e8ce27e2bfb82419a7b407ac7c222fd0e6280a8078ce64e47ef54ac9d5be9aaae0162e0de568a44a18d3df90845d919c4f01463406340a44f40efb43a99b371618488e2670d1a2d7ee6f1d3be39342104e937ed85fb86599c33e9ee0be9a004946259d8b858909880d59aa00daa0d3280b5f39e34074c4b3a5434029a76a9e9f5cc0163b5c80024158a1cfc4cb1d3061d5834066cb0a403c008599a70f6bc27b8d03106ea3ae91987278c5b143b015547224ab5e24185cd9b81665273e7b6e7cecd82ddbf8098002de94049737bc09828cf3036f31c3735c8b0e98eb704672f348c7f7c93cd1fb2ae905119ff54e0dff3542b0e9dd983dcea2cc5eea6cf303e74ec687af5c41b6fa38f5e203c7ec8e1238ef85831a214afef21060ea781ec68247b65c6916353cc8b73d1ae79354606af2a930709aa118da1636c274dd7e3774b884a79aa6b5711a538d33cf9c01c1c9b83bc6a1f55c91ccb23b05b1deb43a7decdaffefd2862f61366aa8449c69e33642f012f2bb208fa98eeda1f3346f076c8eeef19475e9be115423364f78f84105a8643d34d90cfbfdcd8cf872589a45dc7f54cf3134a36f4e495c23f9da8db15bccb708d4014f2ca512cb5d4f7c13e84300d5cff6eb39b202bab053bdb9674f0648609427d0f8402ddeac30f4fcd3ced3efc3b422d406c09b340bedc1571e1bfc3d44dc281634c5fe5e758e7395cfbe6d6c130fd17d92372d277c159b70000000049454e44ae426082</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>m_securityType</tabstop>
+ <tabstop>m_investmentSymbol</tabstop>
+ <tabstop>m_investmentName</tabstop>
+ <tabstop>m_fraction</tabstop>
+ <tabstop>m_tradingMarket</tabstop>
+ <tabstop>m_investmentIdentification</tabstop>
+ <tabstop>m_tradingCurrencyEdit</tabstop>
+ <tabstop>m_priceMode</tabstop>
+ <tabstop>m_useFinanceQuote</tabstop>
+ <tabstop>m_onlineSourceCombo</tabstop>
+ <tabstop>m_onlineFactor</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/knewloanwizard.cpp b/kmymoney2/dialogs/knewloanwizard.cpp
new file mode 100644
index 0000000..28c48ef
--- /dev/null
+++ b/kmymoney2/dialogs/knewloanwizard.cpp
@@ -0,0 +1,1088 @@
+/***************************************************************************
+ knewloanwizard.cpp - description
+ -------------------
+ begin : Wed Oct 8 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <math.h>
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <knuminput.h>
+#include <kmessagebox.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "knewloanwizard.h"
+
+#include "../kmymoneyutils.h"
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include "../widgets/kmymoneycombo.h"
+
+#include "../dialogs/knewaccountdlg.h"
+#include "../dialogs/ksplittransactiondlg.h"
+
+#include "../mymoney/mymoneyfinancialcalculator.h"
+#include "../mymoney/mymoneyfile.h"
+
+#include "../kmymoney2.h"
+
+KNewLoanWizard::KNewLoanWizard(QWidget *parent, const char *name ) :
+ KNewLoanWizardDecl(parent, name, true)
+{
+ connect(m_borrowButton, SIGNAL(clicked()), this, SLOT(slotLiabilityLoan()));
+ connect(m_lendButton, SIGNAL(clicked()), this, SLOT(slotAssetLoan()));
+
+ connect(m_nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished()));
+ // connect(m_payeeEdit, SIGNAL(newPayee(const QString&)), this, SLOT(slotNewPayee(const QString&)));
+ connect(m_payeeEdit, SIGNAL(createItem(const QString&, QString&)), this, SIGNAL(createPayee(const QString&, QString&)));
+
+ connect(m_previousPaymentButton, SIGNAL(clicked()), this, SLOT(slotPaymentsMade()));
+ connect(m_noPreviousPaymentButton, SIGNAL(clicked()), this, SLOT(slotNoPaymentsMade()));
+
+ connect(m_allPaymentsButton, SIGNAL(clicked()), this, SLOT(slotRecordAllPayments()));
+ connect(m_thisYearPaymentButton, SIGNAL(clicked()), this, SLOT(slotRecordThisYearsPayments()));
+
+ connect(m_firstDueDateEdit, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotCheckPageFinished()));
+
+ connect(m_interestOnPaymentButton, SIGNAL(clicked()), this, SLOT(slotInterestOnPayment()));
+ connect(m_interestOnReceptionButton, SIGNAL(clicked()), this, SLOT(slotInterestOnReception()));
+
+ connect(m_loanAmountEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckPageFinished()));
+
+ connect(m_interestAccountEdit, SIGNAL(stateChanged()), this, SLOT(slotCheckPageFinished()));
+
+ connect(m_nextDueDateEdit, SIGNAL(dateChanged(const QDate&)), this, SLOT(slotCheckPageFinished()));
+ connect(m_paymentAccountEdit, SIGNAL(stateChanged()), this, SLOT(slotCheckPageFinished()));
+
+ connect(m_assetAccountEdit, SIGNAL(stateChanged()), this, SLOT(slotCheckPageFinished()));
+ connect(m_dontCreatePayoutCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckPageFinished()));
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotReloadEditWidgets()));
+
+ loadComboBoxes();
+
+ resetCalculator();
+
+ slotReloadEditWidgets();
+
+ // As default we assume a liability loan, with fixed interest rate,
+ // with a first payment due on the 30th of this month. All payments
+ // should be recorded and none have been made so far.
+ m_dontCreatePayoutCheckBox->setChecked(false);
+ m_borrowButton->animateClick();
+ m_fixedInterestButton->animateClick();
+ m_noPreviousPaymentButton->animateClick();
+ m_allPaymentsButton->animateClick();
+ m_interestOnReceptionButton->animateClick();
+
+ m_interestFrequencyAmountEdit->setValue(1);
+ m_interestFrequencyUnitEdit->setCurrentItem(static_cast<int>(MyMoneyAccountLoan::changeYearly));
+ m_paymentFrequencyUnitEdit->setCurrentItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_MONTHLY)));
+ m_firstDueDateEdit->loadDate(QDate(QDate::currentDate().year(),QDate::currentDate().month(),30));
+
+ m_paymentAccountEdit->removeButtons();
+ m_assetAccountEdit->removeButtons();
+ m_interestAccountEdit->removeButtons();
+
+ // load button icons
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem createCategoryButtenItem( i18n( "&Create..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new category"),
+ i18n("Use this to open the new account editor"));
+ m_createCategoryButton->setGuiItem(createCategoryButtenItem);
+ connect(m_createCategoryButton, SIGNAL(clicked()), this, SLOT(slotCreateCategory()));
+
+ KGuiItem additionalFeeButtenItem( i18n( "&Additional fees..." ),
+ 0, //QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Enter additional fees"),
+ i18n("Use this to add any additional fees other than principal and interest contained in your periodical payments."));
+ m_additionalFeeButton->setGuiItem(additionalFeeButtenItem);
+ connect(m_additionalFeeButton, SIGNAL(clicked()), this, SLOT(slotAdditionalFees()));
+
+ KGuiItem createAssetButtenItem( i18n( "&Create..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new asset account"),
+ i18n("Use this to create a new account to which the initial payment should be made"));
+ m_createNewAssetButton->setGuiItem(createAssetButtenItem);
+ connect(m_createNewAssetButton, SIGNAL(clicked()), kmymoney2, SLOT(slotAccountNew()));
+
+ // enable the finish button on the last page
+ setFinishEnabled(m_summaryPage, true);
+
+ // FIXME: we currently only support interest calculation on reception
+ setAppropriate(m_interestCalculationPage, false);
+
+ // turn off all pages that are contained here for derived classes
+ setAppropriate(m_editIntroPage, false);
+ setAppropriate(m_editSelectionPage, false);
+ setAppropriate(m_effectiveDatePage, false);
+ setAppropriate(m_paymentEditPage, false);
+ setAppropriate(m_interestEditPage, false);
+ setAppropriate(m_summaryEditPage, false);
+
+ // for now, we don't have online help :-(
+ helpButton()->hide();
+
+ // setup a phony transaction for additional fee processing
+ m_account = MyMoneyAccount("Phony-ID", MyMoneyAccount());
+ m_split.setAccountId(m_account.id());
+ m_split.setValue(0);
+ m_transaction.addSplit(m_split);
+}
+
+KNewLoanWizard::~KNewLoanWizard()
+{
+}
+
+void KNewLoanWizard::resetCalculator(void)
+{
+ m_loanAmount1->setText(QString());
+ m_interestRate1->setText(QString());
+ m_duration1->setText(QString());
+ m_payment1->setText(QString());
+ m_balloon1->setText(QString());
+
+ m_loanAmount2->setText(QString());
+ m_interestRate2->setText(QString());
+ m_duration2->setText(QString());
+ m_payment2->setText(QString());
+ m_balloon2->setText(QString());
+
+ m_loanAmount3->setText(QString());
+ m_interestRate3->setText(QString());
+ m_duration3->setText(QString());
+ m_payment3->setText(QString());
+ m_balloon3->setText(QString());
+
+ m_loanAmount4->setText(QString());
+ m_interestRate4->setText(QString());
+ m_duration4->setText(QString());
+ m_payment4->setText(QString());
+ m_balloon4->setText(QString());
+
+ m_loanAmount5->setText(QString());
+ m_interestRate5->setText(QString());
+ m_duration5->setText(QString());
+ m_payment5->setText(QString());
+ m_balloon5->setText(QString());
+
+ m_additionalCost->setText(MyMoneyMoney(0).formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()))));
+}
+
+void KNewLoanWizard::slotLiabilityLoan(void)
+{
+ m_generalReceiverText->setText(i18n("To whom do you make payments?"));
+ m_receiverLabel->setText(i18n("Payments to"));
+}
+
+void KNewLoanWizard::slotAssetLoan(void)
+{
+ m_generalReceiverText->setText(i18n("From whom do you expect payments?"));
+ m_receiverLabel->setText(i18n("Payments from"));
+}
+
+void KNewLoanWizard::slotPaymentsMade(void)
+{
+ setAppropriate(m_recordPaymentPage, true);
+}
+
+void KNewLoanWizard::slotNoPaymentsMade(void)
+{
+ m_allPaymentsButton->animateClick();
+ setAppropriate(m_recordPaymentPage, false);
+}
+
+void KNewLoanWizard::slotRecordAllPayments(void)
+{
+ m_firstPaymentLabel->setText(
+ QString("\n") +
+ i18n("Please enter the date, the first payment for this loan was/is due."));
+ m_firstPaymentNote->setText(
+ i18n("Note: Consult the loan contract for details of the first due date. "
+ "Keep in mind, that the first due date usually differs from the date "
+ "the contract was signed"));
+ m_balanceLabel->setText(
+ QString("\n") +
+ i18n("Please enter the original loan amount in the field below or leave it "
+ "empty to be calculated."));
+}
+
+void KNewLoanWizard::slotRecordThisYearsPayments(void)
+{
+ m_firstPaymentLabel->setText(
+ QString("\n") +
+ i18n("Please enter the date, the first payment for this loan was/is due this year."));
+ m_firstPaymentNote->setText(
+ i18n("Note: You can easily figure out the date of the first payment "
+ "if you consult the last statement of last year."));
+ m_balanceLabel->setText(
+ QString("\n") +
+ i18n("Please enter the remaining loan amount of last years final "
+ "statement in the field below. You should not leave this field empty."));
+}
+
+void KNewLoanWizard::slotCheckPageFinished(void)
+{
+ nextButton()->setEnabled(false);
+
+ if(currentPage() == m_namePage) {
+ if(!m_nameEdit->text().isEmpty()) {
+ nextButton()->setEnabled(true);
+ }
+
+ } else if(currentPage() == m_loanAmountPage) {
+ nextButton()->setEnabled(true);
+ if(m_thisYearPaymentButton->isChecked()
+ && !m_loanAmountEdit->isValid()) {
+ nextButton()->setEnabled(false);
+ }
+
+ } else if(currentPage() == m_interestCategoryPage) {
+ if(m_interestAccountEdit->selectedItems().count() > 0) {
+ nextButton()->setEnabled(true);
+ }
+
+ } else if(currentPage() == m_firstPaymentPage) {
+ if(m_firstDueDateEdit->date().isValid())
+ nextButton()->setEnabled(true);
+
+ } else if(currentPage() == m_schedulePage) {
+ if(m_nextDueDateEdit->date().isValid()
+ && m_nextDueDateEdit->date() >= m_firstDueDateEdit->date()
+ && m_paymentAccountEdit->selectedItems().count() > 0)
+ nextButton()->setEnabled(true);
+
+ } else if(currentPage() == m_assetAccountPage) {
+ if(m_dontCreatePayoutCheckBox->isChecked()) {
+ m_assetAccountEdit->setEnabled(false);
+ m_paymentDate->setEnabled(false);
+ m_createNewAssetButton->setEnabled(false);
+ nextButton()->setEnabled(true);
+ } else {
+ m_assetAccountEdit->setEnabled(true);
+ m_paymentDate->setEnabled(true);
+ m_createNewAssetButton->setEnabled(true);
+ if(!m_assetAccountEdit->selectedItems().isEmpty()
+ && m_paymentDate->date().isValid())
+ nextButton()->setEnabled(true);
+ }
+ } else
+ nextButton()->setEnabled(true);
+}
+
+void KNewLoanWizard::updateLoanAmount(void)
+{
+ QString txt;
+ if(m_loanAmountEdit->lineedit()->text().isEmpty()) {
+ txt = QString("<") + i18n("calculate") + QString(">");
+ } else {
+ txt = m_loanAmountEdit->value().formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId())));
+ }
+ m_loanAmount1->setText(txt);
+ m_loanAmount2->setText(txt);
+ m_loanAmount3->setText(txt);
+ m_loanAmount4->setText(txt);
+ m_loanAmount5->setText(txt);
+}
+
+void KNewLoanWizard::updateInterestRate(void)
+{
+ QString txt;
+ if(m_interestRateEdit->lineedit()->text().isEmpty()) {
+ txt = QString("<") + i18n("calculate") + QString(">");
+ } else {
+ txt = m_interestRateEdit->value().formatMoney("", 3) + QString("%");
+ }
+ m_interestRate1->setText(txt);
+ m_interestRate2->setText(txt);
+ m_interestRate3->setText(txt);
+ m_interestRate4->setText(txt);
+ m_interestRate5->setText(txt);
+}
+
+void KNewLoanWizard::updateDuration(void)
+{
+ QString txt;
+ if(m_durationValueEdit->value() == 0) {
+ txt = QString("<") + i18n("calculate") + QString(">");
+ } else {
+ txt = QString().sprintf("%d ", m_durationValueEdit->value())
+ + m_durationUnitEdit->currentText();
+ }
+ m_duration1->setText(txt);
+ m_duration2->setText(txt);
+ m_duration3->setText(txt);
+ m_duration4->setText(txt);
+ m_duration5->setText(txt);
+}
+
+void KNewLoanWizard::updatePayment(void)
+{
+ QString txt;
+ if(m_paymentEdit->lineedit()->text().isEmpty()) {
+ txt = QString("<") + i18n("calculate") + QString(">");
+ } else {
+ txt = m_paymentEdit->value().formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId())));
+ }
+ m_payment1->setText(txt);
+ m_payment2->setText(txt);
+ m_payment3->setText(txt);
+ m_payment4->setText(txt);
+ m_payment5->setText(txt);
+ m_basePayment->setText(txt);
+}
+
+void KNewLoanWizard::updateFinalPayment(void)
+{
+ QString txt;
+ if(m_finalPaymentEdit->lineedit()->text().isEmpty()) {
+ txt = QString("<") + i18n("calculate") + QString(">");
+ } else {
+ txt = m_finalPaymentEdit->value().formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId())));
+ }
+ m_balloon1->setText(txt);
+ m_balloon2->setText(txt);
+ m_balloon3->setText(txt);
+ m_balloon4->setText(txt);
+ m_balloon5->setText(txt);
+}
+
+void KNewLoanWizard::updateLoanInfo(void)
+{
+ updateLoanAmount();
+ updateInterestRate();
+ updateDuration();
+ updatePayment();
+ updateFinalPayment();
+ updatePeriodicPayment();
+
+ QString txt;
+
+ int fraction = m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()));
+ m_loanAmount6->setText(m_loanAmountEdit->value().formatMoney(fraction));
+ m_interestRate6->setText(m_interestRateEdit->value().formatMoney("", 3) + QString("%"));
+ txt = QString().sprintf("%d ", m_durationValueEdit->value())
+ + m_durationUnitEdit->currentText();
+ m_duration6->setText(txt);
+ m_payment6->setText(m_paymentEdit->value().formatMoney(fraction));
+ m_balloon6->setText(m_finalPaymentEdit->value().formatMoney(fraction));
+}
+
+void KNewLoanWizard::updatePeriodicPayment(void)
+{
+ MyMoneyMoney base(m_basePayment->text());
+ MyMoneyMoney add(m_additionalCost->text());
+
+ m_periodicPayment->setText((base + add).formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()))));
+}
+
+void KNewLoanWizard::updateSummary(void)
+{
+ // General
+ if(m_borrowButton->isChecked())
+ m_summaryLoanType->setText(i18n("borrowed"));
+ else
+ m_summaryLoanType->setText(i18n("lend"));
+
+ m_summaryFirstPayment->setText(KGlobal::locale()->formatDate(m_firstDueDateEdit->date(), true));
+ if(m_payeeEdit->selectedItem().isEmpty()) {
+ m_summaryPayee->setText(i18n("not assigned"));
+ } else {
+ m_summaryPayee->setText(m_payeeEdit->currentText());
+ }
+
+ // Calculation
+ if(m_interestOnReceptionButton->isChecked())
+ m_summaryInterestDue->setText(i18n("on reception"));
+ else
+ m_summaryInterestDue->setText(i18n("on due date"));
+ m_summaryPaymentFrequency->setText(m_paymentFrequencyUnitEdit->currentText());
+ m_summaryAmount->setText(m_loanAmount6->text());
+ m_summaryInterestRate->setText(m_interestRate6->text());
+ m_summaryTerm->setText(m_duration6->text());
+ m_summaryPeriodicPayment->setText(m_payment6->text());
+ m_summaryBalloonPayment->setText(m_balloon6->text());
+
+ // Payment
+ try {
+ QStringList sel = m_interestAccountEdit->selectedItems();
+ if(sel.count() != 1)
+ throw new MYMONEYEXCEPTION("Need a single selected interest category");
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(sel.first());
+ m_summaryInterestCategory->setText(acc.name());
+ } catch(MyMoneyException *e) {
+ qWarning("Unable to determine interest category for loan account creation");
+ delete e;
+ }
+ m_summaryAdditionalFees->setText(m_additionalCost->text());
+ m_summaryTotalPeriodicPayment->setText(m_periodicPayment->text());
+ m_summaryNextPayment->setText(KGlobal::locale()->formatDate(m_nextDueDateEdit->date(), true));
+
+ try {
+ QStringList sel = m_paymentAccountEdit->selectedItems();
+ if(sel.count() != 1)
+ throw new MYMONEYEXCEPTION("Need a single selected payment account");
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(sel.first());
+ m_summaryPaymentAccount->setText(acc.name());
+ } catch(MyMoneyException *e) {
+ qWarning("Unable to determine payment account for loan account creation");
+ delete e;
+ }
+}
+
+void KNewLoanWizard::next()
+{
+ bool dontLeavePage = false;
+ QString errMsg = i18n(
+ "The loan wizard is unable to calculate two different values for your loan "
+ "at the same time. "
+ "Please enter a value for the %1 on this page or backup to the page where the "
+ " current value to be calculated is defined and fill in a value.");
+
+ if(currentPage() == m_lendBorrowPage) {
+ // load the appropriate categories into the list
+ loadAccountList();
+ m_nameEdit->setFocus();
+
+ } else if(currentPage() == m_interestTypePage) {
+ if(m_fixedInterestButton->isChecked()) {
+ setAppropriate(m_previousPaymentsPage, true);
+ if(m_previousPaymentButton->isChecked())
+ setAppropriate(m_recordPaymentPage, true);
+ else
+ setAppropriate(m_recordPaymentPage, false);
+ setAppropriate(m_variableInterestDatePage, false);
+
+ } else {
+ setAppropriate(m_previousPaymentsPage, false);
+ setAppropriate(m_recordPaymentPage, false);
+ setAppropriate(m_variableInterestDatePage, true);
+ }
+
+ } else if(currentPage() == m_loanAmountPage) {
+ m_interestRateEdit->setFocus();
+ if(m_thisYearPaymentButton->isChecked()
+ && m_loanAmountEdit->lineedit()->text().isEmpty()) {
+ errMsg = i18n("You selected, that payments have already been made towards this loan. "
+ "This requires you to enter the loan amount exactly as found on your "
+ "last statement.");
+ dontLeavePage = true;
+ KMessageBox::error(0, errMsg, i18n("Calculation error"));
+ } else
+ updateLoanAmount();
+
+ } else if(currentPage() == m_interestPage) {
+
+ if(m_loanAmountEdit->lineedit()->text().isEmpty()
+ && m_interestRateEdit->lineedit()->text().isEmpty()) {
+ dontLeavePage = true;
+ KMessageBox::error(0, errMsg.arg(i18n("interest rate")), i18n("Calculation error"));
+ } else
+ updateInterestRate();
+
+ } else if(currentPage() == m_durationPage) {
+ if((m_loanAmountEdit->lineedit()->text().isEmpty()
+ || m_interestRateEdit->lineedit()->text().isEmpty())
+ && m_durationValueEdit->value() == 0) {
+ dontLeavePage = true;
+ KMessageBox::error(0, errMsg.arg(i18n("term")), i18n("Calculation error"));
+ } else
+ updateDuration();
+
+ } else if(currentPage() == m_paymentPage) {
+ if((m_loanAmountEdit->lineedit()->text().isEmpty()
+ || m_interestRateEdit->lineedit()->text().isEmpty()
+ || m_durationValueEdit->value() == 0)
+ && m_paymentEdit->lineedit()->text().isEmpty()) {
+ dontLeavePage = true;
+ KMessageBox::error(0, errMsg.arg(i18n("principal and interest")), i18n("Calculation error"));
+ } else
+ updatePayment();
+
+ } else if(currentPage() == m_finalPaymentPage) {
+ if((m_loanAmountEdit->lineedit()->text().isEmpty()
+ || m_interestRateEdit->lineedit()->text().isEmpty()
+ || m_durationValueEdit->value() == 0
+ || m_paymentEdit->lineedit()->text().isEmpty())
+ && m_finalPaymentEdit->lineedit()->text().isEmpty()) {
+ // if two fields are empty and one of them is the final payment
+ // we assume the final payment to be 0 instead of presenting a
+ m_finalPaymentEdit->setValue(MyMoneyMoney(0, 1));
+ }
+ updateFinalPayment();
+ if(!calculateLoan()) {
+ dontLeavePage = true;
+ } else
+ updateLoanInfo();
+
+ } else if(currentPage() == m_additionalFeesPage) {
+ m_nextDueDateEdit->setEnabled(true);
+ if(m_allPaymentsButton->isChecked() || m_noPreviousPaymentButton->isChecked()) {
+ m_nextDueDateEdit->setDate(m_firstDueDateEdit->date());
+ m_nextDueDateEdit->setEnabled(false);
+ if(m_assetAccountPage)
+ setAppropriate(m_assetAccountPage, true);
+ } else {
+ QDate nextPayment(QDate::currentDate().year(), 1, m_firstDueDateEdit->date().day());
+ m_nextDueDateEdit->setDate(nextPayment);
+ if(m_assetAccountPage)
+ setAppropriate(m_assetAccountPage, false);
+ m_assetAccountEdit->slotDeselectAllAccounts();
+ }
+ if(m_nextDueDateEdit->date() < m_firstDueDateEdit->date()) {
+ m_nextDueDateEdit->setDate(m_firstDueDateEdit->date());
+ }
+
+ } else if(currentPage() == m_schedulePage) {
+ updateSummary();
+ }
+
+/*
+ switch(m_accountType) {
+ case MyMoneyAccount::Cash:
+ case MyMoneyAccount::Asset:
+ if(indexOf(accountPaymentPage) != -1) {
+ removePage(accountPaymentPage);
+ }
+ setAppropriate(accountNumberPage, false);
+ setFinishEnabled(accountDetailsPage, true);
+ break;
+
+ case MyMoneyAccount::CreditCard:
+ if(indexOf(accountPaymentPage) == -1) {
+ loadPaymentMethods();
+ addPage(accountPaymentPage, m_accountPaymentPageTitle);
+ }
+ setAppropriate(accountPaymentPage, true);
+ setFinishEnabled(accountPaymentPage, true);
+ setFinishEnabled(accountDetailsPage, false);
+ break;
+
+ default:
+ setAppropriate(accountNumberPage, institutionComboBox->currentText() != "");
+ if(indexOf(accountPaymentPage) != -1) {
+ removePage(accountPaymentPage);
+ }
+ setFinishEnabled(accountDetailsPage, true);
+ break;
+ }
+*/
+ if(!dontLeavePage)
+ KNewLoanWizardDecl::next();
+
+ // setup the availability of widgets on the selected page
+ slotCheckPageFinished();
+}
+
+void KNewLoanWizard::loadComboBoxes(void)
+{
+ m_interestFrequencyUnitEdit->insertItem(i18n("Days"), static_cast<int>(MyMoneyAccountLoan::changeDaily));
+ m_interestFrequencyUnitEdit->insertItem(i18n("Weeks"), static_cast<int>(MyMoneyAccountLoan::changeWeekly));
+ m_interestFrequencyUnitEdit->insertItem(i18n("Months"), static_cast<int>(MyMoneyAccountLoan::changeMonthly));
+ m_interestFrequencyUnitEdit->insertItem(i18n("Years"), static_cast<int>(MyMoneyAccountLoan::changeYearly));
+
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_DAILY)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_WEEKLY)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_FORTNIGHTLY)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYOTHERWEEK)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYHALFMONTH)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYTHREEWEEKS)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYFOURWEEKS)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYTHIRTYDAYS)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_MONTHLY)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYEIGHTWEEKS)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYOTHERMONTH)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_QUARTERLY)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_EVERYFOURMONTHS)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_TWICEYEARLY)));
+ m_paymentFrequencyUnitEdit->insertItem(i18n(MyMoneySchedule::occurenceToString(MyMoneySchedule::OCCUR_YEARLY)));
+
+ m_durationUnitEdit->insertItem(i18n("Months"), static_cast<int>(MyMoneySchedule::OCCUR_MONTHLY));
+ m_durationUnitEdit->insertItem(i18n("Years"), static_cast<int>(MyMoneySchedule::OCCUR_YEARLY));
+ m_durationUnitEdit->insertItem(i18n("Payments"), static_cast<int>(MyMoneySchedule::OCCUR_ONCE));
+
+}
+
+void KNewLoanWizard::slotInterestOnPayment(void)
+{
+ m_interestOnPaymentButton->setChecked(true);
+ m_interestOnReceptionButton->setChecked(false);
+}
+
+void KNewLoanWizard::slotInterestOnReception(void)
+{
+ m_interestOnPaymentButton->setChecked(false);
+ m_interestOnReceptionButton->setChecked(true);
+}
+
+int KNewLoanWizard::calculateLoan(void)
+{
+ MyMoneyFinancialCalculator calc;
+ long double val;
+ int PF;
+ QString result;
+
+ // FIXME: for now, we only support interest calculation at the end of the period
+ calc.setBep();
+ // FIXME: for now, we only support periodic compounding
+ calc.setDisc();
+
+ PF = MyMoneySchedule::eventsPerYear(MyMoneySchedule::stringToOccurence(
+ m_paymentFrequencyUnitEdit->currentText()));
+ if(PF == 0)
+ return 0;
+ calc.setPF(PF);
+
+ // FIXME: for now we only support compounding frequency == payment frequency
+ calc.setCF(PF);
+
+
+ if(!m_loanAmountEdit->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_loanAmountEdit->value().abs().toDouble());
+ if(m_borrowButton->isChecked())
+ val = -val;
+ calc.setPv(val);
+ }
+
+ if(!m_interestRateEdit->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_interestRateEdit->value().abs().toDouble());
+ calc.setIr(val);
+ }
+
+ if(!m_paymentEdit->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_paymentEdit->value().abs().toDouble());
+ if(m_lendButton->isChecked())
+ val = -val;
+ calc.setPmt(val);
+ }
+
+ if(!m_finalPaymentEdit->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_finalPaymentEdit->value().abs().toDouble());
+ if(m_lendButton->isChecked())
+ val = -val;
+ calc.setFv(val);
+ }
+
+ if(m_durationValueEdit->value() != 0) {
+ calc.setNpp(static_cast<long double>(term()));
+ }
+
+ int fraction = m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()));
+ // setup of parameters is done, now do the calculation
+ try {
+ if(m_loanAmountEdit->lineedit()->text().isEmpty()) {
+ // calculate the amount of the loan out of the other information
+ val = calc.presentValue();
+ m_loanAmountEdit->loadText(MyMoneyMoney(static_cast<double>(val)).abs().formatMoney(fraction));
+ result = i18n("KMyMoney has calculated the amount of the loan as %1.")
+ .arg(m_loanAmountEdit->lineedit()->text());
+
+ } else if(m_interestRateEdit->lineedit()->text().isEmpty()) {
+ // calculate the interest rate out of the other information
+ val = calc.interestRate();
+ m_interestRateEdit->loadText(MyMoneyMoney(static_cast<double>(val)).abs().formatMoney("", 3));
+ result = i18n("KMyMoney has calculated the interest rate to %1%.")
+ .arg(m_interestRateEdit->lineedit()->text());
+
+ } else if(m_paymentEdit->lineedit()->text().isEmpty()) {
+ // calculate the periodical amount of the payment out of the other information
+ val = calc.payment();
+ m_paymentEdit->setValue(MyMoneyMoney(static_cast<double>(val)).abs());
+ // reset payment as it might have changed due to rounding
+ val = static_cast<long double> (m_paymentEdit->value().abs().toDouble());
+ if(m_lendButton->isChecked())
+ val = -val;
+ calc.setPmt(val);
+
+ result = i18n("KMyMoney has calculated a periodic payment of %1 to cover principal and interest.")
+ .arg(m_paymentEdit->lineedit()->text());
+
+ val = calc.futureValue();
+ if((m_borrowButton->isChecked() && val < 0 && fabsl(val) >= fabsl(calc.payment()))
+ || (m_lendButton->isChecked() && val > 0 && fabs(val) >= fabs(calc.payment()))) {
+ calc.setNpp(calc.npp()-1);
+ updateTermWidgets(calc.npp());
+ val = calc.futureValue();
+ MyMoneyMoney refVal(static_cast<double>(val));
+ m_finalPaymentEdit->loadText(refVal.abs().formatMoney(fraction));
+ result += QString(" ");
+ result += i18n("The number of payments has been decremented and the final payment has been modified to %1.")
+ .arg(m_finalPaymentEdit->lineedit()->text());
+ } else if((m_borrowButton->isChecked() && val < 0 && fabsl(val) < fabsl(calc.payment()))
+ || (m_lendButton->isChecked() && val > 0 && fabs(val) < fabs(calc.payment()))) {
+ m_finalPaymentEdit->loadText(MyMoneyMoney(0,1).formatMoney(fraction));
+ } else {
+ MyMoneyMoney refVal(static_cast<double>(val));
+ m_finalPaymentEdit->loadText(refVal.abs().formatMoney(fraction));
+ result += i18n("The final payment has been modified to %1.")
+ .arg(m_finalPaymentEdit->lineedit()->text());
+ }
+
+ } else if(m_durationValueEdit->value() == 0) {
+ // calculate the number of payments out of the other information
+ val = calc.numPayments();
+ if(val == 0)
+ throw new MYMONEYEXCEPTION("incorrect fincancial calculation");
+
+ // if the number of payments has a fractional part, then we
+ // round it to the smallest integer and calculate the balloon payment
+ result = i18n("KMyMoney has calculated the term of your loan as %1. ")
+ .arg(updateTermWidgets(floorl(val)));
+
+ if(val != floorl(val)) {
+ calc.setNpp(floorl(val));
+ val = calc.futureValue();
+ MyMoneyMoney refVal(static_cast<double>(val));
+ m_finalPaymentEdit->loadText(refVal.abs().formatMoney(fraction));
+ result += i18n("The final payment has been modified to %1.")
+ .arg(m_finalPaymentEdit->lineedit()->text());
+ }
+
+ } else {
+ // calculate the future value of the loan out of the other information
+ val = calc.futureValue();
+
+ // we differentiate between the following cases:
+ // a) the future value is greater than a payment
+ // b) the future value is less than a payment or the loan is overpaid
+ // c) all other cases
+ //
+ // a) means, we have paid more than we owed. This can't be
+ // b) means, we paid more than we owed but the last payment is
+ // less in value than regular payments. That means, that the
+ // future value is to be treated as (fully payed back)
+ // c) the loan is not payed back yet
+ if((m_borrowButton->isChecked() && val < 0 && fabsl(val) > fabsl(calc.payment()))
+ || (m_lendButton->isChecked() && val > 0 && fabs(val) > fabs(calc.payment()))) {
+ // case a)
+ qDebug("Future Value is %Lf", val);
+ throw new MYMONEYEXCEPTION("incorrect fincancial calculation");
+
+ } else if((m_borrowButton->isChecked() && val < 0 && fabsl(val) <= fabsl(calc.payment()))
+ || (m_lendButton->isChecked() && val > 0 && fabs(val) <= fabs(calc.payment()))) {
+ // case b)
+ val = 0;
+ }
+
+ MyMoneyMoney refVal(static_cast<double>(val));
+ result = i18n("KMyMoney has calculated a final payment of %1 for this loan.")
+ .arg(refVal.abs().formatMoney(fraction));
+
+ if(!m_finalPaymentEdit->lineedit()->text().isEmpty()) {
+ if((m_finalPaymentEdit->value().abs() - refVal.abs()).abs().toDouble() > 1) {
+ throw new MYMONEYEXCEPTION("incorrect fincancial calculation");
+ }
+ result = i18n("KMyMoney has successfully verified your loan information.");
+ }
+ m_finalPaymentEdit->loadText(refVal.abs().formatMoney(fraction));
+ }
+
+ } catch (MyMoneyException *e) {
+ delete e;
+ KMessageBox::error(0,
+ i18n("You have entered mis-matching information. Please backup to the "
+ "appropriate page and update your figures or leave one value empty "
+ "to let KMyMoney calculate it for you"),
+ i18n("Calculation error"));
+ return 0;
+ }
+
+ result += i18n("\n\nAccept this or modify the loan information and recalculate.");
+
+ KMessageBox::information(0, result, i18n("Calculation successful"));
+ return 1;
+}
+
+QString KNewLoanWizard::updateTermWidgets(const long double val)
+{
+ long long vl = static_cast<long long>(floorl(val));
+
+ QString valString;
+ MyMoneySchedule::occurenceE unit;
+ unit = MyMoneySchedule::stringToOccurence(m_paymentFrequencyUnitEdit->currentText());
+
+ if((unit == MyMoneySchedule::OCCUR_MONTHLY)
+ && ((vl % 12) == 0)) {
+ vl /= 12;
+ unit = MyMoneySchedule::OCCUR_YEARLY;
+ }
+
+ switch(unit) {
+ case MyMoneySchedule::OCCUR_MONTHLY:
+ valString = i18n("one month", "%n months", vl);
+ m_durationUnitEdit->setCurrentItem(static_cast<int>(MyMoneySchedule::OCCUR_MONTHLY));
+ break;
+ case MyMoneySchedule::OCCUR_YEARLY:
+ valString = i18n("one year", "%n years", vl);
+ m_durationUnitEdit->setCurrentItem(static_cast<int>(MyMoneySchedule::OCCUR_YEARLY));
+ break;
+ default:
+ valString = i18n("one payment", "%n payments", vl);
+ m_durationUnitEdit->setCurrentItem(static_cast<int>(MyMoneySchedule::OCCUR_ONCE));
+ break;
+ }
+ m_durationValueEdit->setValue(vl);
+ return valString;
+}
+
+void KNewLoanWizard::slotCreateCategory(void)
+{
+ MyMoneyAccount acc, base;
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ if(m_borrowButton->isChecked()) {
+ base = file->expense();
+ acc.setAccountType(MyMoneyAccount::Expense);
+ } else {
+ base = file->income();
+ acc.setAccountType(MyMoneyAccount::Income);
+ }
+ acc.setParentAccountId(base.id());
+
+ KNewAccountDlg* dlg = new KNewAccountDlg(acc, true, true);
+ if(dlg->exec() == QDialog::Accepted) {
+ acc = dlg->account();
+
+ MyMoneyFileTransaction ft;
+ try {
+ QString id;
+ id = file->createCategory(base, acc.name());
+ if(id.isEmpty())
+ throw new MYMONEYEXCEPTION("failure while creating the account hierarchy");
+
+ ft.commit();
+
+ m_interestAccountEdit->setSelected(id);
+
+ } catch (MyMoneyException *e) {
+ KMessageBox::information(this, i18n("Unable to add account: %1").arg(e->what()));
+ delete e;
+ }
+ }
+ delete dlg;
+}
+
+void KNewLoanWizard::loadAccountList(void)
+{
+ AccountSet interestSet, assetSet;
+
+ if(m_borrowButton->isChecked()) {
+ interestSet.addAccountType(MyMoneyAccount::Expense);
+ } else {
+ interestSet.addAccountType(MyMoneyAccount::Income);
+ }
+ interestSet.load(m_interestAccountEdit);
+
+ assetSet.addAccountType(MyMoneyAccount::Checkings);
+ assetSet.addAccountType(MyMoneyAccount::Savings);
+ assetSet.addAccountType(MyMoneyAccount::Cash);
+ assetSet.addAccountType(MyMoneyAccount::Asset);
+ assetSet.addAccountType(MyMoneyAccount::Currency);
+ assetSet.load(m_assetAccountEdit);
+
+ assetSet.addAccountType(MyMoneyAccount::CreditCard);
+ assetSet.addAccountType(MyMoneyAccount::Liability);
+ assetSet.load(m_paymentAccountEdit);
+}
+
+void KNewLoanWizard::slotAdditionalFees(void)
+{
+ // KMessageBox::information(0, QString("Not yet implemented ... if you want to help, contact kmymoney2-developer@lists.sourceforge.net"), QString("Development notice"));
+ MyMoneyAccount account("Phony-ID", MyMoneyAccount());
+
+ QMap<QString, MyMoneyMoney> priceInfo;
+ KSplitTransactionDlg* dlg = new KSplitTransactionDlg(m_transaction, m_split, account, false, !m_borrowButton->isChecked(), MyMoneyMoney(0), priceInfo);
+ connect(dlg, SIGNAL(newCategory(MyMoneyAccount&)), this, SIGNAL(newCategory(MyMoneyAccount&)));
+
+ if(dlg->exec() == QDialog::Accepted) {
+ m_transaction = dlg->transaction();
+ // sum up the additional fees
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ MyMoneyMoney fees;
+ for(it = m_transaction.splits().begin(); it != m_transaction.splits().end(); ++it) {
+ if((*it).accountId() != account.id()) {
+ fees += (*it).value();
+ }
+ }
+ m_additionalCost->setText(fees.formatMoney(m_account.fraction(MyMoneyFile::instance()->security(m_account.currencyId()))));
+ }
+
+ delete dlg;
+ updatePeriodicPayment();
+}
+
+MyMoneyTransaction KNewLoanWizard::transaction() const
+{
+ MyMoneyTransaction t;
+
+ MyMoneySplit sPayment, sInterest, sAmortization;
+ // setup accounts. at this point, we cannot fill in the id of the
+ // account that the amortization will be performed on, because we
+ // create the account. So the id is yet unknown.
+ sPayment.setAccountId(m_paymentAccountEdit->selectedItems().first());
+ sInterest.setAccountId(m_interestAccountEdit->selectedItems().first());
+
+ // values
+ if(m_borrowButton->isChecked()) {
+ sPayment.setValue(-m_paymentEdit->value());
+ } else {
+ sPayment.setValue(m_paymentEdit->value());
+ }
+ sInterest.setValue(MyMoneyMoney::autoCalc);
+ sAmortization.setValue(MyMoneyMoney::autoCalc);
+ // don't forget the shares
+ sPayment.setShares(sPayment.value());
+ sInterest.setShares(sInterest.value());
+ sAmortization.setShares(sAmortization.value());
+
+ // setup the commodity
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(sPayment.accountId());
+ t.setCommodity(acc.currencyId());
+
+ // actions
+ sPayment.setAction(MyMoneySplit::ActionAmortization);
+ sAmortization.setAction(MyMoneySplit::ActionAmortization);
+ sInterest.setAction(MyMoneySplit::ActionInterest);
+
+ // payee
+ QString payeeId = m_payeeEdit->selectedItem();
+ sPayment.setPayeeId(payeeId);
+ sAmortization.setPayeeId(payeeId);
+
+ MyMoneyAccount account("Phony-ID", MyMoneyAccount());
+ sAmortization.setAccountId(account.id());
+
+ // IMPORTANT: Payment split must be the first one, because
+ // the schedule view expects it this way during display
+ t.addSplit(sPayment);
+ t.addSplit(sAmortization);
+ t.addSplit(sInterest);
+
+ // copy the splits from the other costs and update the payment split
+ QValueList<MyMoneySplit>::ConstIterator it;
+ for(it = m_transaction.splits().begin(); it != m_transaction.splits().end(); ++it) {
+ if((*it).accountId() != account.id()) {
+ MyMoneySplit sp = (*it);
+ sp.clearId();
+ t.addSplit(sp);
+ sPayment.setValue(sPayment.value()-sp.value());
+ sPayment.setShares(sPayment.value());
+ t.modifySplit(sPayment);
+ }
+ }
+ return t;
+}
+
+MyMoneySchedule KNewLoanWizard::schedule(void) const
+{
+ MyMoneySchedule sched(m_nameEdit->text(),
+ MyMoneySchedule::TYPE_LOANPAYMENT,
+ MyMoneySchedule::stringToOccurence(m_paymentFrequencyUnitEdit->currentText()), 1,
+ MyMoneySchedule::STYPE_OTHER,
+ QDate(),
+ QDate(),
+ false,
+ false);
+
+ MyMoneyTransaction t = transaction();
+ t.setPostDate(m_nextDueDateEdit->date());
+ sched.setTransaction(t);
+
+ return sched;
+}
+
+void KNewLoanWizard::slotReloadEditWidgets(void)
+{
+ // load the various account widgets
+ loadAccountList();
+
+ // reload payee widget
+ QString payeeId = m_payeeEdit->selectedItem();
+
+ m_payeeEdit->loadPayees(MyMoneyFile::instance()->payeeList());
+
+ if(!payeeId.isEmpty()) {
+ m_payeeEdit->setSelectedItem(payeeId);
+ }
+}
+
+int KNewLoanWizard::term(void) const
+{
+ int factor = 0;
+
+ if(m_durationValueEdit->value() != 0) {
+ factor = 1;
+ switch(m_durationUnitEdit->currentItem()) {
+ case MyMoneySchedule::OCCUR_YEARLY: // years
+ factor = 12;
+ // tricky fall through here
+
+ case MyMoneySchedule::OCCUR_MONTHLY: // months
+ factor *= 30;
+ factor *= m_durationValueEdit->value();
+ // factor now is the duration in days. we divide this by the
+ // payment frequency and get the number of payments
+ factor /= MyMoneySchedule::daysBetweenEvents(MyMoneySchedule::stringToOccurence(
+ m_paymentFrequencyUnitEdit->currentText()));
+ break;
+
+ case MyMoneySchedule::OCCUR_ONCE: // payments
+ factor = m_durationValueEdit->value();
+ break;
+ }
+ }
+ return factor;
+}
+
+QString KNewLoanWizard::initialPaymentAccount(void) const
+{
+ if(m_dontCreatePayoutCheckBox->isChecked()) {
+ return QString();
+ }
+ return m_assetAccountEdit->selectedItems().first();
+}
+
+QDate KNewLoanWizard::initialPaymentDate(void) const
+{
+ if(m_dontCreatePayoutCheckBox->isChecked()) {
+ return QDate();
+ }
+ return m_paymentDate->date();
+}
+
+#include "knewloanwizard.moc"
diff --git a/kmymoney2/dialogs/knewloanwizard.h b/kmymoney2/dialogs/knewloanwizard.h
new file mode 100644
index 0000000..5e291b7
--- /dev/null
+++ b/kmymoney2/dialogs/knewloanwizard.h
@@ -0,0 +1,167 @@
+/***************************************************************************
+ knewloanwizard.h - description
+ -------------------
+ begin : Wed Oct 8 2003
+ copyright : (C) 2000-2003 by Thomas Baumgart
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNEWLOANWIZARD_H
+#define KNEWLOANWIZARD_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <../dialogs/knewloanwizarddecl.h>
+#include <kmymoney/mymoneyscheduled.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kmymoneydateinput.h>
+
+/**
+ * @author Thomas Baumgart
+ */
+
+/**
+ * This class implementes a wizard for the creation of loan accounts.
+ * The user is asked a set of questions and according to the answers
+ * the respective MyMoneyAccount object can be requested from the
+ * wizard when accept() has been called. A MyMoneySchedule is also
+ * available to create a schedule entry for the payments to the newly
+ * created loan.
+ */
+class KNewLoanWizard : public KNewLoanWizardDecl
+{
+ Q_OBJECT
+public:
+ KNewLoanWizard(QWidget *parent=0, const char *name=0);
+ ~KNewLoanWizard();
+
+ /**
+ * This method returns the schedule for the payments. The account
+ * where the amortization should be transferred to is the one
+ * we currently try to create with this wizard. The appropriate split
+ * will be returned as the first split of the transaction inside
+ *
+ * as parameter @p accountId as this is the account that was created
+ * after this wizard was left via the accept() method.
+ *
+ * @return MyMoneySchedule object for payments
+ */
+ MyMoneySchedule schedule(void) const;
+
+ /**
+ * This method returns the id of the account to/from which
+ * the payout should be created. If the checkbox that allows
+ * to skip the creation of this transaction is checked, this
+ * method returns QString()
+ *
+ * @return id of account or empty QString
+ */
+ QString initialPaymentAccount(void) const;
+
+ /**
+ * This method returns the date of the payout transaction.
+ * If the checkbox that allows to skip the creation of
+ * this transaction is checked, this method returns QDate()
+ *
+ * @return selected date or invalid QDate if checkbox is selected.
+ */
+ QDate initialPaymentDate(void) const;
+
+protected:
+ /**
+ * This method returns the transaction that is stored within
+ * the schedule. See schedule().
+ *
+ * @return MyMoneyTransaction object to be used within the schedule
+ */
+ MyMoneyTransaction transaction(void) const;
+
+public slots:
+ void next();
+
+protected slots:
+ void slotLiabilityLoan(void);
+ void slotAssetLoan(void);
+ virtual void slotCheckPageFinished(void);
+ void slotPaymentsMade(void);
+ void slotNoPaymentsMade(void);
+ void slotRecordAllPayments(void);
+ void slotRecordThisYearsPayments(void);
+ void slotInterestOnPayment(void);
+ void slotInterestOnReception(void);
+ void slotCreateCategory(void);
+ virtual void slotAdditionalFees(void);
+ // void slotNewPayee(const QString&);
+ void slotReloadEditWidgets(void);
+
+protected:
+ void loadComboBoxes(void);
+ void loadAccountList(void);
+ void resetCalculator(void);
+ void updateLoanAmount(void);
+ void updateInterestRate(void);
+ void updateDuration(void);
+ void updatePayment(void);
+ void updateFinalPayment(void);
+ void updateLoanInfo(void);
+ QString updateTermWidgets(const long double v);
+ void updatePeriodicPayment(void);
+ void updateSummary(void);
+ int calculateLoan(void);
+ int term(void) const;
+
+signals:
+ /**
+ * This signal is emitted, when a new category name has been
+ * entered by the user and this name is not known as account
+ * by the MyMoneyFile object.
+ * Before the signal is emitted, a MyMoneyAccount is constructed
+ * by this object and filled with the desired name. All other members
+ * of MyMoneyAccount will remain in their default state. Upon return,
+ * the connected slot should have created the object in the MyMoneyFile
+ * engine and filled the member @p id.
+ *
+ * @param acc reference to MyMoneyAccount object that caries the name
+ * and will return information about the created category.
+ */
+ void newCategory(MyMoneyAccount& acc);
+
+ /**
+ * This signal is sent out, when a new payee needs to be created
+ * @sa KMyMoneyCombo::createItem()
+ *
+ * @param txt The name of the payee to be created
+ * @param id A connected slot should store the id of the created object in this variable
+ */
+ void createPayee(const QString& txt, QString& id);
+
+protected:
+ MyMoneyAccountLoan m_account;
+ MyMoneyTransaction m_transaction;
+ MyMoneySplit m_split;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/knewloanwizarddecl.ui b/kmymoney2/dialogs/knewloanwizarddecl.ui
new file mode 100644
index 0000000..d45eb4b
--- /dev/null
+++ b/kmymoney2/dialogs/knewloanwizarddecl.ui
@@ -0,0 +1,5497 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KNewLoanWizardDecl</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>KNewLoanWizardDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>589</width>
+ <height>458</height>
+ </rect>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>800</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>New Loan Wizard</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="titleFont">
+ <font>
+ </font>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_newIntroPage</cstring>
+ </property>
+ <attribute name="title">
+ <string></string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>98</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Helvetica</family>
+ <pointsize>16</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>New Loan Account Wizard</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignHCenter</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>119</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Welcome to the New Loan Account Wizard which will guide you through the creation of a new loan e.g. for your home, your car or any other loan that you pay or gain interest for.
+
+Please make sure that you have the relevant information handy. You usually get the information out of your contract and the last statement.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_editIntroPage</cstring>
+ </property>
+ <attribute name="title">
+ <string></string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>98</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_1_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Helvetica</family>
+ <pointsize>16</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Edit Loan Account Wizard</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignHCenter</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>119</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Welcome to the Edit Loan Account Wizard. Please use this wizard to modify information about your loan account.
+
+Please make sure that you have the relevant information handy. You usually get the information out of your contract and the last statement.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer79</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_newGeneralInfoPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>General Information</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+In the first step, KMyMoney will ask you some general information about the loan account to be created.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>138</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>1. General Information</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>
+2. Calculate Loan
+
+3. Payments</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>137</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer44</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_editSelectionPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Edit selection</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2_1</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please select, which data of the loan you want to modify.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer64</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>48</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout33</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer67_4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>93</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>m_selectionButtonGroup</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_editInterestRateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Modify the interest rate</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_editOtherCostButton</cstring>
+ </property>
+ <property name="text">
+ <string>Modify additional fees</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_editOtherInfoButton</cstring>
+ </property>
+ <property name="text">
+ <string>Modify other loan information</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer66</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>108</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer65</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>47</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_effectiveDatePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Effective date</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_effectiveDateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_effectiveDateNoteLabel</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer68_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout34</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_7</cstring>
+ </property>
+ <property name="text">
+ <string>When should the changes become active?</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_effectiveChangeDateEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer69_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>87</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_lendBorrowPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Lending or borrowing money</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Do you borrow or lend money?</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>61</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout38</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_borrowButton</cstring>
+ </property>
+ <property name="text">
+ <string>I am borrowing money</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_lendButton</cstring>
+ </property>
+ <property name="text">
+ <string>I am lending money</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>299</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_namePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Name of the loan</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+How do you want to call this loan? Examples for names are 'car loan', 'school loan', 'home owner loan'.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer15_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>56</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyLineEdit">
+ <property name="name">
+ <cstring>m_nameEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>56</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_generalReceiverText</cstring>
+ </property>
+ <property name="text">
+ <string>TextLabel6</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout55</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_receiverLabel</cstring>
+ </property>
+ <property name="text">
+ <string>TextLabel7</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyPayeeCombo">
+ <property name="name">
+ <cstring>m_payeeEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer21</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>56</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_interestTypePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Type of interest</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel5_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Is the interest of this loan fixed over a period of time or is it adapted from time to time? If the interest rate changes during the amortization phase of the loan you should choose the option 'variable interest rate'.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer23</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>53</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout39</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_fixedInterestButton</cstring>
+ </property>
+ <property name="text">
+ <string>Fixed interest rate</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_variableInterestButton</cstring>
+ </property>
+ <property name="text">
+ <string>Variable interest rate</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer14_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>286</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>53</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_previousPaymentsPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Payments?</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel6_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Were there any payments for this loan whether they are entered into KMyMoney or not?</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer28</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout40</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_noPreviousPaymentButton</cstring>
+ </property>
+ <property name="text">
+ <string>No, no payments were made yet.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_previousPaymentButton</cstring>
+ </property>
+ <property name="text">
+ <string>Yes, payments were made.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer14_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>202</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer29</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3_3</cstring>
+ </property>
+ <property name="text">
+ <string>Note: Payments made to obtain the loan (e.g. Dissagio) are not considered as payments in this context.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer41</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_recordPaymentPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Recording payments?</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel7_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Do you want to record all payments of this loan with KMyMoney?</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer33</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>69</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout41</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup4</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_allPaymentsButton</cstring>
+ </property>
+ <property name="text">
+ <string>Yes, record all payments.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_thisYearPaymentButton</cstring>
+ </property>
+ <property name="text">
+ <string>No, only record payments since the beginning of this year.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer14_2_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>137</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer34</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>69</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_variableInterestDatePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Date of next interest change</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel8_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Select the date when the interest rate for this loan will be modified and the frequency of the future changes.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer39</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>99</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout44</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Next interest change on</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout42</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>m_interestFrequencyAmountEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo">
+ <property name="name">
+ <cstring>m_interestFrequencyUnitEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="0" column="1">
+ <property name="name">
+ <cstring>m_interestChangeDateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Time until next change</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer40</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_paymentEditPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Payment</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel8_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please enter the amount you pay for principal and interest or leave the field empty to calculate it.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer70_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout39</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer76</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout35</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="kMyMoneyEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_newPaymentEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2_4</cstring>
+ </property>
+ <property name="text">
+ <string>Current amount</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_paymentLabel</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_5</cstring>
+ </property>
+ <property name="text">
+ <string>Principal and interest</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer75</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer71</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>19</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4_5</cstring>
+ </property>
+ <property name="text">
+ <string>KMyMoney either calculates the new interest rate or the amount for principal and interest. If you know the amount for principal and interest then enter it here.
+
+If KMyMoney should calculate this value for you, then leave the field blank.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_interestEditPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interest Rate</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel5_4</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please enter the interest rate or leave the field empty to calculate it.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer72</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout40</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer77</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>101</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout36</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="kMyMoneyEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_newInterestRateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel7_3</cstring>
+ </property>
+ <property name="text">
+ <string>Current rate</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_5</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer78</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>101</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer73</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel9_4</cstring>
+ </property>
+ <property name="text">
+ <string>KMyMoney either calculates the new interest rate or the amount for principal and interest. If you know the interest rate then enter it here.
+
+If KMyMoney should calculate this value for you, then leave the field blank.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_firstPaymentPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Date of first payment</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_firstPaymentLabel</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer42</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>78</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout22_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>First payment due on</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_firstDueDateEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer43</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>28</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_firstPaymentNote</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignBottom</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_newCalculateLoanPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Calculate Loan</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+You have successfully entered the general information about your loan. Next, KMyMoney needs some information about the calculation of the loan.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>19</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout31</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>136</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout30</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3_4</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>1. General Information</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+2. Calculate Loan</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4_3</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>
+3. Payments</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>135</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer51</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>23</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_paymentFrequencyPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Payment frequency</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel11_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+How often will there be payments made to this loan?</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer54</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>49</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout33</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer57</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>39</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>m_paymentFrequencyUnitEdit</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer56</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>56</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer55</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>49</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_interestCalculationPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interest calculation</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel12_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+When does the actual interest rate get calculated?</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer61</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>69</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout42</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup5</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_interestOnReceptionButton</cstring>
+ </property>
+ <property name="text">
+ <string>When the payment is received.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_interestOnPaymentButton</cstring>
+ </property>
+ <property name="text">
+ <string>When the payment is due.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer14_2_2_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>296</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer62</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>69</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_loanAmountPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Loan amount</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_balanceLabel</cstring>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer68</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout38</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel16</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_loanAmountEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_loanAmount1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRate1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_duration1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payment1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_balloon1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_interestPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interest</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel14_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please enter the interest rate or leave the field empty to calculate it.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer67</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout36</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_interestRateEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_3</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8_3</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9_2</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_loanAmount2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRate2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_duration2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payment2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_balloon2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_durationPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Duration</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel15_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please enter the term of this loan or leave the field empty to calculate it. The term is the time that is required to fully repay the loan. This time might be different from the time your loan contract is signed for.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer67_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>54</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout43</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Term</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>m_durationValueEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo">
+ <property name="name">
+ <cstring>m_durationUnitEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_loanAmount3</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRate3</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_duration3</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payment3</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_balloon3</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_paymentPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Payment</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel16_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please enter the amount you pay for principal and interest or leave the field empty to calculate it.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer74</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout36_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal and interest</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_paymentEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3_2_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_3_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8_3_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_loanAmount4</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRate4</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_duration4</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payment4</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_balloon4</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_finalPaymentPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Final amortization payment</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel17_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please enter the amount of a final amortization payment or leave the field empty to calculate it.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer74_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout44</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_4_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit">
+ <property name="name">
+ <cstring>m_finalPaymentEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3_2_2_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_3_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8_3_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_loanAmount5</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRate5</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_duration5</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payment5</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_balloon5</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_calculationOverviewPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Calculation Overview</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel18_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+KMyMoney has calculated the loan as shown in the overview below. You can accept these values by selecting "Next" or change them by choosing "Back" to return to the input field for the information you want to change.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer79</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>22</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3_2_2_2_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_3_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8_3_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Final amortization payment</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_loanAmount6</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_interestRate6</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_duration6</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_payment6</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_balloon6</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_newPaymentsPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Payments</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel19_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+In the following steps, KMyMoney supports you in setting up categories and schedules for your loan payments.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>14</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout31_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>136</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout30_2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel19_3</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>1. General Information</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel19_4</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>
+2. Calculate Loan</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel19_5</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>
+3. Payments</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>135</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer51_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_interestCategoryPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interest category</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel20_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+Please select the category you want to assign the interest payments to or create a new category.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer90</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>38</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_interestAccountEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout29</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer54_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>264</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_createCategoryButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer91</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>22</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_additionalFeesPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Additional Fees</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel21_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+If your regular payment contains any additional fees, click on the button "Additional fees" to enter them.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer58</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame9</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>TextLabel21_1_3</cstring>
+ </property>
+ <property name="text">
+ <string>= periodical payment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>m_periodicPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>m_additionalCost</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>Layout63</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel21_1_2</cstring>
+ </property>
+ <property name="text">
+ <string>+</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_additionalFeeButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>m_basePayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel21_1</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer173_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="3">
+ <property name="name">
+ <cstring>spacer173</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer59</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel21_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>If no additional fees are included in your periodical payment or you have entered all such fees, then click on "Next".</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer60</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_schedulePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Schedule</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel22_2</cstring>
+ </property>
+ <property name="text">
+ <string>KMyMoney will create a schedule for this payment and reminds you whenever a payment must be made.&lt;p&gt;
+If you selected to record all payments this date has already been supplied. If you selected to record only this years payments, then the &lt;b&gt;First payment due date&lt;/b&gt; is the date of the first payment made in this year.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer67_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>23</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout49</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="kMyMoneyAccountSelector" row="1" column="1">
+ <property name="name">
+ <cstring>m_paymentAccountEdit</cstring>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="0" column="1">
+ <property name="name">
+ <cstring>m_nextDueDateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>m_dueLabel</cstring>
+ </property>
+ <property name="text">
+ <string>First payment due on:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2_5</cstring>
+ </property>
+ <property name="text">
+ <string>Make payment from/to:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer68_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>24</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_summaryEditPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Summary</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel10_4</cstring>
+ </property>
+ <property name="text">
+ <string>
+KMyMoney has calculated the loan as shown below. If you want to accept these values use the "Finish" button to update your account, otherwise use the "Back" button to modify your settings.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer74_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>23</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3_2_2_2_2_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_3_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel8_3_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Additional fees:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel9_2_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Total payment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel10_2_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Valid from:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>TextLabel11_3_2_2_2_2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Affected payments:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_payment7</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_additionalFees7</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_totalPayment7</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_interestRate7</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_startDateChanges</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="1">
+ <property name="name">
+ <cstring>m_affectedPayments</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_assetAccountPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Asset Account</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel10_4_2</cstring>
+ </property>
+ <property name="text">
+ <string>If this loan is for an asset, such as a car or a house, you can create the asset account now. An asset account represents the total value of an asset. The money from this loan will be transfered into the asset account you create or select.
+If this loan is a 'consumer loan' (money to use however you want), you can use a checking account instead.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer80</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_dontCreatePayoutCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Don't create payout transaction</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout124</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyAccountSelector">
+ <property name="name">
+ <cstring>m_assetAccountEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout123</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer244</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>466</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_createNewAssetButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Press this to create a new asset account</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout170</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Date of payment</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_paymentDate</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer328</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_summaryPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Summary</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel22_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>
+This page summarizes the data you entered. If you need to modify anything, please use the "Back" button to go to respective page. Otherwise use the "Finish" button to create the account.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer69</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout61</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout60</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>General</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout52</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel5_3</cstring>
+ </property>
+ <property name="text">
+ <string>Payee:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_summaryLoanType</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_summaryPayee</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel4_4</cstring>
+ </property>
+ <property name="text">
+ <string>First payment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_summaryFirstPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3_5</cstring>
+ </property>
+ <property name="text">
+ <string>Amount is:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Loan calculation</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout57</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_summaryTotalPeriodicPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="1">
+ <property name="name">
+ <cstring>m_summaryPaymentAccount</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_summaryAdditionalFees</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel15</cstring>
+ </property>
+ <property name="text">
+ <string>Periodic Payment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>TextLabel14</cstring>
+ </property>
+ <property name="text">
+ <string>Additional Fees:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel13</cstring>
+ </property>
+ <property name="text">
+ <string>Interest category:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>TextLabel17</cstring>
+ </property>
+ <property name="text">
+ <string>Payment from:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>m_summaryInterestCategory</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_summaryNextPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel16_3</cstring>
+ </property>
+ <property name="text">
+ <string>Next due date:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Payment</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout59</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>m_summaryInterestRate</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel10_3</cstring>
+ </property>
+ <property name="text">
+ <string>Term:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="1">
+ <property name="name">
+ <cstring>m_summaryPeriodicPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel9_3</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>m_summaryPaymentFrequency</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>TextLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Final Payment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>m_summaryTerm</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel6_4</cstring>
+ </property>
+ <property name="text">
+ <string>Interest is due:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>m_summaryAmount</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>TextLabel11_4</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="1">
+ <property name="name">
+ <cstring>m_summaryBalloonPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel8_4</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Payment frequency:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>m_summaryInterestDue</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="textFormat">
+ <enum>PlainText</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer70</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneyLineEdit</class>
+ <header location="local">../widgets/kmymoneylineedit.h</header>
+ <sizehint>
+ <width>90</width>
+ <height>25</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>kMyMoneyAccountSelector</class>
+ <header location="global">../widgets/kmymoneyaccountselector.h</header>
+ <sizehint>
+ <width>80</width>
+ <height>80</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1110">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041d49444154388d8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d09a6c508138cb8c13d647141163de49043bca9f1628eb9294810f24f88c15b728b07617358888785d980427290b4a8d00b19a8821da8228cf42316ac87eed9247ac95c9aeaeef9eaabdffb5ebf85f178ccfcf7f5b79fec07a7280a08a008f25ceb7c29e5da573716e65a0be3f198ef6f5ededff9b9e1b34faf90882092a1ea21428b9220ffbf46054055b19386ba6970ae6665b5e0d2c5eb0b066067bbe1f21757c88f5504eff0c192189081303a5582b16854fccce2fe041f00cdd0a8103b874556405476b62d972ec2c2b90ff3fd8df5cb946549d80b34aea15ccaa94625450e2d0e558b460b7371a734b5e027251a155545678ab62d7eea90b4c504078908c107acb354cb251b1f8f08b1c18631aabbb4d18211404804f22545863561d2f060fb34aa8a18d0086204e72c46a32292e1a796f278c1da7a859d8da9a737506db04d0a24103d8949480b214d3bbee952a05c1d536f9d2684160c744f048311543d459eb1b65ee1754cedae13a64abd5d6127053c9d0281f22d4f75c6a2118a5c09272d7ab740638bf4ef2dd2174032d0d8d04c6fe19c32bedd8bc65e342aa3f785e2784bfd6bc1bd9db24b05505616a4edd67d5a8c1801a03a9962754c504bf34b8986acfb9be91cac7d54315a15541b36b134f74bd2dc53940115a5381e087bc25c6f71be831a8baa234cc1ee3eeb74ed83116beb2b8849d108a3730e8ce27e2bfb82419a7b407ac7c222fd0e6280a8078ce64e47ef54ac9d5be9aaae0162e0de568a44a18d3df90845d919c4f01463406340a44f40efb43a99b371618488e2670d1a2d7ee6f1d3be39342104e937ed85fb86599c33e9ee0be9a004946259d8b858909880d59aa00daa0d3280b5f39e34074c4b3a5434029a76a9e9f5cc0163b5c80024158a1cfc4cb1d3061d5834066cb0a403c008599a70f6bc27b8d03106ea3ae91987278c5b143b015547224ab5e24185cd9b81665273e7b6e7cecd82ddbf8098002de94049737bc09828cf3036f31c3735c8b0e98eb704672f348c7f7c93cd1fb2ae905119ff54e0dff3542b0e9dd983dcea2cc5eea6cf303e74ec687af5c41b6fa38f5e203c7ec8e1238ef85831a214afef21060ea781ec68247b65c6916353cc8b73d1ae79354606af2a930709aa118da1636c274dd7e3774b884a79aa6b5711a538d33cf9c01c1c9b83bc6a1f55c91ccb23b05b1deb43a7decdaffefd2862f61366aa8449c69e33642f012f2bb208fa98eeda1f3346f076c8eeef19475e9be115423364f78f84105a8643d34d90cfbfdcd8cf872589a45dc7f54cf3134a36f4e495c23f9da8db15bccb708d4014f2ca512cb5d4f7c13e84300d5cff6eb39b202bab053bdb9674f0648609427d0f8402ddeac30f4fcd3ced3efc3b422d406c09b340bedc1571e1bfc3d44dc281634c5fe5e758e7395cfbe6d6c130fd17d92372d277c159b70000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/konlinequoteconfigurationdecl.ui b/kmymoney2/dialogs/konlinequoteconfigurationdecl.ui
new file mode 100644
index 0000000..0ca2d14
--- /dev/null
+++ b/kmymoney2/dialogs/konlinequoteconfigurationdecl.ui
@@ -0,0 +1,199 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>kOnlineQuoteConfigurationDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kOnlineQuoteConfigurationDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>511</width>
+ <height>282</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Online Quote Configuration</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>240</y>
+ <width>476</width>
+ <height>33</height>
+ </rect>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>90</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Perl Location:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>90</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Script:</string>
+ </property>
+ </widget>
+ <widget class="KHistoryCombo">
+ <property name="name">
+ <cstring>cmbScriptName</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>110</x>
+ <y>40</y>
+ <width>310</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>edtPerlLocation</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>110</x>
+ <y>10</y>
+ <width>380</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnBrowse</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>430</x>
+ <y>40</y>
+ <width>61</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Browse...</string>
+ </property>
+ </widget>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>kOnlineQuoteConfigurationDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>kOnlineQuoteConfigurationDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/konlinequoteconfigurationdlg.cpp b/kmymoney2/dialogs/konlinequoteconfigurationdlg.cpp
new file mode 100644
index 0000000..8503d5a
--- /dev/null
+++ b/kmymoney2/dialogs/konlinequoteconfigurationdlg.cpp
@@ -0,0 +1,51 @@
+/***************************************************************************
+ konlinequoteconfigurationdlg.cpp - description
+ -------------------
+ begin : Tuesday July 1st, 2004
+ copyright : (C) 2004 by Kevin Tambascio
+ email : ktambascio@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <klistbox.h>
+#include <klistview.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "konlinequoteconfigurationdecl.h"
+#include "konlinequoteconfigurationdlg.h"
+
+
+KOnlineQuoteConfigurationDlg::KOnlineQuoteConfigurationDlg(QWidget *parent) : kOnlineQuoteConfigurationDecl(parent)
+{
+
+}
+
+KOnlineQuoteConfigurationDlg::~KOnlineQuoteConfigurationDlg()
+{
+
+}
+
+#include "konlinequoteconfigurationdlg.moc"
diff --git a/kmymoney2/dialogs/konlinequoteconfigurationdlg.h b/kmymoney2/dialogs/konlinequoteconfigurationdlg.h
new file mode 100644
index 0000000..f6ea139
--- /dev/null
+++ b/kmymoney2/dialogs/konlinequoteconfigurationdlg.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ konlinequoteconfigurationdlg.h - description
+ -------------------
+ begin : Tuesday July 1st, 2004
+ copyright : (C) 2004 by Kevin Tambascio
+ email : ktambascio@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KONLINEQUOTECONFIGURATIONDIALOG_H
+#define KONLINEQUOTECONFIGURATIONDIALOG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "konlinequoteconfigurationdecl.h"
+//#include "../mymoney/mymoneyonlinepriceupdate.h"
+
+
+/**
+ * @author Kevin Tambascio
+ */
+
+class KOnlineQuoteConfigurationDlg : public kOnlineQuoteConfigurationDecl
+{
+ Q_OBJECT
+public:
+ KOnlineQuoteConfigurationDlg(QWidget *parent);
+ ~KOnlineQuoteConfigurationDlg();
+
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kpayeereassigndlg.cpp b/kmymoney2/dialogs/kpayeereassigndlg.cpp
new file mode 100644
index 0000000..0ed8a5a
--- /dev/null
+++ b/kmymoney2/dialogs/kpayeereassigndlg.cpp
@@ -0,0 +1,81 @@
+/***************************************************************************
+ kpayeereassigndlg.cpp
+ -------------------
+ copyright : (C) 2005 by Andreas Nicolai
+ (C) 2007 by Thomas Baumgart
+ author : Andreas Nicolai, Thomas Baumgart
+ email : ghorwin@users.sourceforge.net
+ ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kpayeereassigndlg.h"
+#include <kmymoney/kmymoneycombo.h>
+#include <kmymoney/kguiutils.h>
+
+KPayeeReassignDlg::KPayeeReassignDlg( QWidget* parent, const char* name) :
+ KPayeeReassignDlgDecl( parent, name)
+{
+ buttonOk->setGuiItem(KStdGuiItem::ok());
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+ kMandatoryFieldGroup* mandatory = new kMandatoryFieldGroup(this);
+ mandatory->add(payeeCombo);
+ mandatory->setOkButton(buttonOk);
+}
+
+KPayeeReassignDlg::~KPayeeReassignDlg()
+{
+}
+
+QString KPayeeReassignDlg::show(const QValueList<MyMoneyPayee>& payeeslist)
+{
+ if (payeeslist.isEmpty())
+ return QString(); // no payee available? nothing can be selected...
+
+ payeeCombo->loadPayees(payeeslist);
+
+ // execute dialog and if aborted, return empty string
+ if (this->exec() == QDialog::Rejected)
+ return QString();
+
+ // otherwise return index of selected payee
+ return payeeCombo->selectedItem();
+}
+
+
+void KPayeeReassignDlg::accept(void)
+{
+ // force update of payeeCombo
+ buttonOk->setFocus();
+
+ if(payeeCombo->selectedItem().isEmpty()) {
+ KMessageBox::information(this, i18n("This dialog does not allow to create new payees. Please pick a payee from the list."), i18n("Payee creation"));
+ } else {
+ KPayeeReassignDlgDecl::accept();
+ }
+}
+
+#include "kpayeereassigndlg.moc"
diff --git a/kmymoney2/dialogs/kpayeereassigndlg.h b/kmymoney2/dialogs/kpayeereassigndlg.h
new file mode 100644
index 0000000..3edab86
--- /dev/null
+++ b/kmymoney2/dialogs/kpayeereassigndlg.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ kpayeereassigndlg.cpp
+ -------------------
+ copyright : (C) 2005 by Andreas Nicolai
+ (C) 2007 by Thomas Baumgart
+ author : Andreas Nicolai, Thomas Baumgart
+ email : ghorwin@users.sourceforge.net
+ ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KPAYEEREASSIGNDLG_H
+#define KPAYEEREASSIGNDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qvaluelist.h>
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneypayee.h>
+#include "kmymoney2/dialogs/kpayeereassigndlgdecl.h"
+
+/**
+ * Implementation of the dialog that lets the user select a payee in order
+ * to re-assign transactions (for instance, if payees are deleted).
+ */
+class KPayeeReassignDlg : public KPayeeReassignDlgDecl
+{
+ Q_OBJECT
+public:
+ /** Default constructor */
+ KPayeeReassignDlg( QWidget* parent = 0, const char* name = 0);
+
+ /** Destructor */
+ ~KPayeeReassignDlg();
+
+ /**
+ * This function sets up the dialog, lets the user select a payee and returns
+ * the id of the selected payee in the payeeslist.
+ *
+ * @param payeeslist reference to QValueList of MyMoneyPayee objects to be contained in the list
+ *
+ * @return Returns the id of the selected payee in the list or QString() if
+ * the dialog was aborted. QString() is also returned if the payeeslist is empty.
+ */
+ QString show(const QValueList<MyMoneyPayee>& payeeslist);
+
+ /**
+ * Returns true, if the names of the payees to be deleted should be copied
+ * to the selected payee's match list.
+ */
+ bool addToMatchList(void) const { return m_copyToMatchList->isChecked(); }
+
+protected:
+ void accept(void);
+
+};
+
+#endif // KPAYEEREASSIGNDLG_H
diff --git a/kmymoney2/dialogs/kpayeereassigndlgdecl.ui b/kmymoney2/dialogs/kpayeereassigndlgdecl.ui
new file mode 100644
index 0000000..a968709
--- /dev/null
+++ b/kmymoney2/dialogs/kpayeereassigndlgdecl.ui
@@ -0,0 +1,186 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KPayeeReassignDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KPayeeReassignDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>558</width>
+ <height>312</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Reassign payees</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>The transactions associated with the selected payees need to be re-assigned to a different payee before the selected payees can be deleted. Please select a payee from the list below.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignJustify|AlignTop</set>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Available payees:</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyPayeeCombo">
+ <property name="name">
+ <cstring>payeeCombo</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_copyToMatchList</cstring>
+ </property>
+ <property name="text">
+ <string>Assign deleted names to the above selected payee's matching list</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>305</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KPayeeReassignDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KPayeeReassignDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kplugindlg.ui b/kmymoney2/dialogs/kplugindlg.ui
new file mode 100644
index 0000000..33a6f88
--- /dev/null
+++ b/kmymoney2/dialogs/kplugindlg.ui
@@ -0,0 +1,154 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KPluginDlg</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KPluginDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>503</width>
+ <height>285</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>PluginDlg</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView" row="0" column="0" rowspan="1" colspan="4">
+ <column>
+ <property name="text">
+ <string>PlugIn</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Status</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Feature</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_listView</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ <property name="shadeSortColumn">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>180</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="3">
+ <property name="name">
+ <cstring>closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>13</number>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KPluginDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KPluginDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KPluginDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/krecentfileitem.cpp b/kmymoney2/dialogs/krecentfileitem.cpp
new file mode 100644
index 0000000..679078d
--- /dev/null
+++ b/kmymoney2/dialogs/krecentfileitem.cpp
@@ -0,0 +1,62 @@
+/***************************************************************************
+ krecentfileitem.cpp - description
+ -------------------
+ begin : Wed Jul 30 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qtooltip.h>
+#include <qwidget.h>
+#include <qrect.h>
+#include <qpoint.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+
+#include "krecentfileitem.h"
+
+KRecentFileItem::KRecentFileItem(const QString& url, QIconView* parent, const QString& text, const QPixmap& icon)
+ : QIconViewItem(parent, text, icon),
+ m_url(url),
+ m_parent(parent)
+{
+ QToolTip::add(parent, rect(), url);
+ // avoid moving this item around
+ setDragEnabled(false);
+}
+
+KRecentFileItem::~KRecentFileItem()
+{
+}
+
+bool KRecentFileItem::move( int x, int y )
+{
+ QRect r = rect();
+ QToolTip::remove(m_parent, rect());
+ r.moveTopLeft(QPoint(x,y));
+ QToolTip::add(m_parent, r, m_url);
+ return QIconViewItem::move(x,y);
+}
+
diff --git a/kmymoney2/dialogs/krecentfileitem.h b/kmymoney2/dialogs/krecentfileitem.h
new file mode 100644
index 0000000..bb88cba
--- /dev/null
+++ b/kmymoney2/dialogs/krecentfileitem.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ krecentfileitem.h - description
+ -------------------
+ begin : Wed Jul 30 2003
+ copyright : (C) 2000-2003 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef KRECENTFILEITEM_H
+#define KRECENTFILEITEM_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qwidget.h>
+#include <qiconview.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <kurl.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+
+
+/**
+ * @author Michael Edwardes
+ */
+
+class KRecentFileItem : public QIconViewItem {
+public:
+ KRecentFileItem(const QString& url, QIconView* parent, const QString& text, const QPixmap& icon);
+ ~KRecentFileItem();
+ QString fileURL(void) const { return m_url; }
+
+ bool move( int x, int y );
+
+private:
+ QString m_url;
+ QWidget* m_parent;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kreconciledlg.cpp b/kmymoney2/dialogs/kreconciledlg.cpp
new file mode 100644
index 0000000..75e7b48
--- /dev/null
+++ b/kmymoney2/dialogs/kreconciledlg.cpp
@@ -0,0 +1,463 @@
+/***************************************************************************
+ kreconciledlg.cpp
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kmessagebox.h>
+#include <kglobal.h>
+#include <klocale.h>
+#if QT_VERSION > 300
+#include <kstandarddirs.h>
+#else
+#include <kstddirs.h>
+#endif
+
+
+#include "kreconciledlg.h"
+
+KReconcileDlg::KReconcileDlg(const MyMoneyMoney /* previousBal */, const MyMoneyMoney /* endingBal */,
+ const QDate /* endingDate */, MyMoneyAccount* /*accountIndex */,
+ const MyMoneyFile* /* file */, QWidget *parent, const char *name)
+ : KReconcileDlgDecl(parent,name,true)
+{
+/*
+ m_balanced = false;
+ m_debitsQList.setAutoDelete(false);
+ m_creditsQList.setAutoDelete(false);
+ m_reconciledTransactions.setAutoDelete(false);
+
+ m_file = file;
+ m_accountIndex = accountIndex;
+ m_endingBalance = endingBal;
+ m_previousBalance = previousBal;
+ m_clearedBalance.setAmount(0.0);
+ m_debitBalance.setAmount(0.0);
+ m_creditBalance.setAmount(0.0);
+ m_endingDate = endingDate;
+
+
+ totalCreditsLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ totalDebitsLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ previousLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ endingLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ differenceLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+
+
+ debitListView->setRootIsDecorated(false);
+ debitListView->addColumn(i18n("Date"));
+ debitListView->addColumn(i18n("Number"));
+ debitListView->addColumn(i18n("Payee"));
+ debitListView->addColumn(i18n("Amount"));
+ debitListView->addColumn(i18n("C"));
+ debitListView->setMultiSelection(true);
+ debitListView->setAllColumnsShowFocus(true);
+ // never show a horizontal scroll bar
+ debitListView->setHScrollBarMode(QScrollView::AlwaysOff);
+
+ creditListView->setRootIsDecorated(false);
+ creditListView->addColumn(i18n("Date"));
+ creditListView->addColumn(i18n("Number"));
+ creditListView->addColumn(i18n("Payee"));
+ creditListView->addColumn(i18n("Amount"));
+ creditListView->addColumn(i18n("C"));
+ creditListView->setMultiSelection(true);
+ creditListView->setAllColumnsShowFocus(true);
+ // never show a horizontal scroll bar
+ creditListView->setHScrollBarMode(QScrollView::AlwaysOff);
+
+ endingLabel->setText(KGlobal::locale()->formatMoney(m_clearedBalance.amount(),""));
+
+ previousLabel->setText(KGlobal::locale()->formatMoney(m_endingBalance.amount(),""));
+
+ broughtForwardLabel->setText(KGlobal::locale()->formatMoney(m_previousBalance.amount(),""));
+
+ totalCreditsLabel->setText(i18n("Deposits: ") + KGlobal::locale()->formatMoney(m_creditBalance.amount(),""));
+
+ totalDebitsLabel->setText(i18n("Withdrawals: ") + KGlobal::locale()->formatMoney(m_debitBalance.amount(),""));
+
+
+ loadLists();
+ insertTransactions();
+
+ connect(debitListView, SIGNAL(clicked(QListViewItem*, const QPoint&, int)), this, SLOT(slotDebitSelected(QListViewItem*, const QPoint&, int)));
+ connect(creditListView, SIGNAL(clicked(QListViewItem*, const QPoint&, int)), this, SLOT(slotCreditSelected(QListViewItem*, const QPoint&, int)));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(finishClicked()));
+ connect(buttonEdit, SIGNAL(clicked()), this, SLOT(editClicked()));
+
+ doDifference();
+*/
+}
+
+KReconcileDlg::~KReconcileDlg()
+{
+}
+
+void KReconcileDlg::clearReconcile()
+{
+/*
+ MyMoneyTransaction *temp_transaction;
+ for(temp_transaction = m_creditsQList.first();temp_transaction;temp_transaction = m_creditsQList.next())
+ {
+ if(temp_transaction->state() == MyMoneyTransaction::Reconciled)
+ {
+ temp_transaction->setState(MyMoneyTransaction::Unreconciled);
+ }
+ }
+ for(temp_transaction = m_debitsQList.first();temp_transaction;temp_transaction = m_debitsQList.next())
+ {
+ if(temp_transaction->state() == MyMoneyTransaction::Reconciled)
+ {
+ temp_transaction->setState(MyMoneyTransaction::Unreconciled);
+ }
+ }
+*/
+}
+
+void KReconcileDlg::loadLists(void)
+{
+/*
+ // Load the internal transaaction lists
+ m_creditsQList.clear();
+ m_debitsQList.clear();
+
+ unsigned int i=0;
+ MyMoneyTransaction *transaction;
+ for (i=0, transaction=m_accountIndex->transactionFirst(); transaction; transaction=m_accountIndex->transactionNext(), i++) {
+ if (transaction->date()>m_endingDate)
+ break;
+
+ if (transaction->state()!=MyMoneyTransaction::Reconciled) {
+ if (transaction->type() == MyMoneyTransaction::Debit) {
+ transaction->setIndex(i);
+ m_debitsQList.append(transaction);
+ }
+ else {
+ transaction->setIndex(i);
+ m_creditsQList.append(transaction);
+ }
+ }
+ }
+ resizeEvent(NULL);
+*/
+}
+
+void KReconcileDlg::insertTransactions(void)
+{
+/*
+ creditListView->clear();
+ debitListView->clear();
+
+ QListIterator<MyMoneyTransaction> it(m_debitsQList);
+ for ( ; it.current(); ++it) {
+ (void) new KReconcileListItem(debitListView, it.current());
+ }
+
+ QListIterator<MyMoneyTransaction> it2(m_creditsQList);
+ for ( ; it2.current(); ++it2) {
+ (void) new KReconcileListItem(creditListView, it2.current());
+ }
+
+ resizeEvent(0);
+*/
+}
+
+void KReconcileDlg::slotDebitSelected(QListViewItem* /* item */, const QPoint&/*p*/, int/* col*/)
+{
+/*
+ KReconcileListItem *reconcileItem = (KReconcileListItem*)item;
+ if (!reconcileItem)
+ return;
+
+ // Changed double types to MyMoneyMoney because in the future
+ // we will support mulitple currencies and have our own incompatable
+ // internal format. (one that rounds properly and supports large numbers
+ // e.g unsigned long.int with sign being a boolean).
+// MyMoneyMoney dblDebit = m_debitBalance;
+// MyMoneyMoney dblCleared = m_clearedBalance;
+ MyMoneyMoney dblItem = reconcileItem->transaction()->amount();
+
+ if(reconcileItem->isSelected())
+ {
+ m_debitBalance += dblItem;
+ m_clearedBalance -= dblItem;
+ reconcileItem->setReconciled(true);
+ m_reconciledTransactions.append(reconcileItem->transaction());
+ }
+ else
+ {
+ m_debitBalance -= dblItem;
+ m_clearedBalance += dblItem;
+ reconcileItem->setReconciled(false);
+ m_reconciledTransactions.remove(reconcileItem->transaction());
+ }
+ totalDebitsLabel->setText(i18n("Withdrawals: ") + KGlobal::locale()->formatMoney(m_debitBalance.amount(),""));
+
+ endingLabel->setText(KGlobal::locale()->formatMoney(m_clearedBalance.amount(),""));
+
+ doDifference();
+*/
+}
+
+void KReconcileDlg::slotCreditSelected(QListViewItem* /* item */, const QPoint&, int)
+{
+/*
+ KReconcileListItem *reconcileItem = (KReconcileListItem*)item;
+ if (!reconcileItem)
+ return;
+
+ // See above func
+// double dblCredit = m_creditBalance.amount();
+// double dblCleared = m_clearedBalance.amount();
+ MyMoneyMoney dblItem = reconcileItem->transaction()->amount();
+ if(reconcileItem->isSelected())
+ {
+ m_creditBalance += dblItem;
+ m_clearedBalance += dblItem;
+ reconcileItem->setReconciled(true);
+ m_reconciledTransactions.append(reconcileItem->transaction());
+ }
+ else
+ {
+ m_creditBalance -= dblItem;
+ m_clearedBalance -= dblItem;
+ reconcileItem->setReconciled(false);
+ m_reconciledTransactions.remove(reconcileItem->transaction());
+ }
+
+ totalCreditsLabel->setText(i18n("Deposits: ") + KGlobal::locale()->formatMoney(m_creditBalance.amount(),""));
+
+ endingLabel->setText(KGlobal::locale()->formatMoney(m_clearedBalance.amount(),""));
+
+ doDifference();
+*/
+}
+
+void KReconcileDlg::doDifference(void)
+{
+/*
+ MyMoneyMoney difference((m_previousBalance + m_clearedBalance)- m_endingBalance);
+
+ differenceLabel->setText(KGlobal::locale()->formatMoney(difference.amount(),""));
+ if (difference.isZero())
+ m_balanced = true;
+ else
+ m_balanced = false;
+*/
+}
+
+void KReconcileDlg::finishClicked(void)
+{
+/*
+ if (!m_balanced) {
+ if ((KMessageBox::questionYesNo(this, i18n("Account did not balance, are you sure ?")))==KMessageBox::No) {
+ clearReconcile();
+ return;
+ }
+ }
+// else
+// {
+// }
+ emit reconcileFinished(true);
+*/
+}
+
+/*
+void KReconcileDlg::updateData(void)
+{
+ // Simply reload the list clearing the status.
+ qDebug("In updateData");
+ m_reconciledTransactions.clear();
+ m_debitsQList.clear();
+ m_creditsQList.clear();
+
+ loadLists();
+ insertTransactions();
+ doDifference();
+}
+*/
+void KReconcileDlg::cancelClicked()
+{
+/*
+ clearReconcile();
+ // Stop the transaction view from being refreshed on
+ // cancel by passing false.
+ emit reconcileFinished(false);
+*/
+}
+
+void KReconcileDlg::resetData(const MyMoneyMoney /* previousBal */, const MyMoneyMoney /* endingBal */, const QDate /* endingDate */, MyMoneyAccount* /* accountIndex */, const MyMoneyFile* /* file */)
+{
+/*
+ m_reconciledTransactions.clear();
+ m_debitsQList.clear();
+ m_creditsQList.clear();
+
+ m_balanced = false;
+
+ m_file = file;
+ m_bankIndex = bankIndex;
+ m_accountIndex = accountIndex;
+ m_endingBalance = endingBal;
+ m_previousBalance = previousBal;
+ m_clearedBalance.setAmount(0.0);
+ m_debitBalance.setAmount(0.0);
+ m_creditBalance.setAmount(0.0);
+ m_endingDate = endingDate;
+
+
+ //totalCreditsLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ //totalDebitsLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ //previousLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ //endingLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+ //differenceLabel->setAlignment(AlignRight | AlignVCenter | ExpandTabs | SingleLine);
+
+
+ endingLabel->setText(KGlobal::locale()->formatMoney(m_clearedBalance.amount(),""));
+
+ previousLabel->setText(KGlobal::locale()->formatMoney(m_endingBalance.amount(),""));
+
+ broughtForwardLabel->setText(KGlobal::locale()->formatMoney(m_previousBalance.amount(),""));
+
+ totalCreditsLabel->setText(i18n("Deposits: ") + KGlobal::locale()->formatMoney(m_creditBalance.amount(),""));
+
+ totalDebitsLabel->setText(i18n("Withdrawals: ") + KGlobal::locale()->formatMoney(m_debitBalance.amount(),""));
+
+ loadLists();
+ insertTransactions();
+*/
+}
+
+void KReconcileDlg::slotTransactionChanged()
+{
+/*
+ reloadLists();
+ insertTransactions();
+ show();
+*/
+}
+
+/** No descriptions */
+void KReconcileDlg::reloadLists()
+{
+/*
+ unsigned int i=0;
+ MyMoneyTransaction *transaction;
+ for (i=0, transaction=m_accountIndex->transactionFirst(); transaction; transaction=m_accountIndex->transactionNext(), i++) {
+ if (transaction->state()!=MyMoneyTransaction::Reconciled) {
+ if (transaction->type() == MyMoneyTransaction::Debit) {
+ transaction->setIndex(i);
+ if(m_debitsQList.find(transaction) < 0)
+ {
+ m_debitsQList.append(transaction);
+ }
+ }
+ else {
+ transaction->setIndex(i);
+ if(m_creditsQList.find(transaction) < 0)
+ {
+ m_creditsQList.append(transaction);
+ }
+ }
+ }
+ }
+
+
+ QListIterator<MyMoneyTransaction> it(m_debitsQList);
+ for ( ; it.current(); ++it) {
+ bool transactionFound = inTransactions(it.current());
+ if(transactionFound == false)
+ m_debitsQList.remove(it.current());
+ }
+
+ QListIterator<MyMoneyTransaction> it2(m_creditsQList);
+ for ( ; it2.current(); ++it2) {
+ bool transactionFound = inTransactions(it2.current());
+ if(transactionFound == false)
+ m_creditsQList.remove(it2.current());
+ }
+*/
+}
+
+
+/** No descriptions */
+bool KReconcileDlg::inTransactions(MyMoneyTransaction * /*credittrans */)
+{
+/*
+ MyMoneyTransaction *transaction;
+ int i = 0;
+ for ( i=0, transaction=m_accountIndex->transactionFirst(); transaction; transaction=m_accountIndex->transactionNext(), i++) {
+ if( credittrans == transaction)
+ return true;
+ }
+*/
+ return false;
+}
+
+/* Not used (yet?)
+bool KReconcileDlg::inCredits(MyMoneyTransaction *transaction)
+{
+ QListIterator<MyMoneyTransaction> it(m_creditsQList);
+ for ( ; it.current(); ++it) {
+ if(transaction == it.current())
+ return true;
+ }
+
+ return false;
+
+}
+*/
+
+/* Not used (yet?)
+bool KReconcileDlg::inDebits(MyMoneyTransaction *transaction)
+{
+ QListIterator<MyMoneyTransaction> it(m_debitsQList);
+ for ( ; it.current(); ++it) {
+ if(transaction == it.current())
+ return true;
+ }
+
+ return false;
+
+}
+*/
+
+void KReconcileDlg::editClicked()
+{
+/*
+ hide();
+*/
+}
+
+void KReconcileDlg::resizeEvent(QResizeEvent* /* e */)
+{
+/*
+ debitListView->setColumnWidth( 2, debitListView->visibleWidth()
+ - debitListView->columnWidth(0)
+ - debitListView->columnWidth(1)
+ - debitListView->columnWidth(3)
+ - debitListView->columnWidth(4));
+
+ creditListView->setColumnWidth( 2, creditListView->visibleWidth()
+ - creditListView->columnWidth(0)
+ - creditListView->columnWidth(1)
+ - creditListView->columnWidth(3)
+ - creditListView->columnWidth(4));
+
+ // call base class resizeEvent()
+ KReconcileDlgDecl::resizeEvent(e);
+*/
+}
+
+#include "kreconciledlg.moc"
diff --git a/kmymoney2/dialogs/kreconciledlg.h b/kmymoney2/dialogs/kreconciledlg.h
new file mode 100644
index 0000000..9ddb079
--- /dev/null
+++ b/kmymoney2/dialogs/kreconciledlg.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+ kreconciledlg.h
+ -------------------
+ copyright : (C) 2000 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KRECONCILEDLG_H
+#define KRECONCILEDLG_H
+
+#include <qlabel.h>
+#include <klistview.h>
+#include <qpushbutton.h>
+
+#include "../mymoney/mymoneyfile.h"
+#include "../mymoney/mymoneymoney.h"
+
+#include "kreconciledlgdecl.h"
+
+// This dialog is used for reconciliation.
+class KReconcileDlg : public KReconcileDlgDecl {
+ Q_OBJECT
+public:
+ KReconcileDlg(const MyMoneyMoney previousBal, const MyMoneyMoney endingBal, const QDate endingDate, MyMoneyAccount *accountIndex, const MyMoneyFile* file, QWidget *parent=0, const char *name=0);
+ ~KReconcileDlg();
+// void updateData(void);
+ void resetData(const MyMoneyMoney previousBal, const MyMoneyMoney endingBal, const QDate endingDate, MyMoneyAccount *accountIndex, const MyMoneyFile* file);
+ /** No descriptions */
+
+protected:
+ void resizeEvent(QResizeEvent*);
+
+protected slots:
+ void slotDebitSelected(QListViewItem*, const QPoint&, int);
+ void slotCreditSelected(QListViewItem*, const QPoint&, int);
+ void finishClicked();
+ void cancelClicked();
+ /** No descriptions */
+ void editClicked();
+
+signals:
+ void reconcileFinished(bool);
+
+private:
+ MyMoneyMoney m_endingBalance;
+ MyMoneyMoney m_previousBalance;
+ MyMoneyMoney m_clearedBalance;
+ MyMoneyMoney m_debitBalance;
+ MyMoneyMoney m_creditBalance;
+
+ MyMoneyFile* m_file;
+ //MyMoneyBank m_bankIndex;
+ MyMoneyAccount *m_accountIndex;
+
+ QList<MyMoneyTransaction> m_debitsQList;
+ QList<MyMoneyTransaction> m_creditsQList;
+ QList<MyMoneyTransaction> m_reconciledTransactions;
+
+ bool m_balanced; // true when the account is balanced (determined by doDifference)
+
+ QDate m_endingDate;
+
+ void loadLists(void);
+ void insertTransactions(void);
+ void doDifference(void);
+ /** No descriptions */
+ bool inTransactions(MyMoneyTransaction *debittrans);
+ /** No descriptions */
+ bool inDebits(MyMoneyTransaction *transaction);
+ /** No descriptions */
+ bool inCredits(MyMoneyTransaction *transaction);
+
+ void reloadLists();
+ void clearReconcile();
+
+public slots: // Public slots
+ /** No descriptions */
+ void slotTransactionChanged();
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kreconciledlgdecl.ui b/kmymoney2/dialogs/kreconciledlgdecl.ui
new file mode 100644
index 0000000..c75ceed
--- /dev/null
+++ b/kmymoney2/dialogs/kreconciledlgdecl.ui
@@ -0,0 +1,709 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KReconcileDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>reconcileDlg</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Reconciliation Dialog</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>descriptionLabel</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="text">
+ <string>This dialog will assist in helping you to balance your account.
+
+Click on an appropriate transaction within one of the two list views to mark it as reconciled. To create a transaction or edit
+a transaction you can return to the register by clicking on the Edit Transactions button.
+
+Your account is balanced when the Difference is Zero. Click on the Finish button to save the reconciled transactions.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignLeft</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout27</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout25</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>0</height>
+ </size>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Withdrawals</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>debitListView</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>100</height>
+ </size>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout26</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_3_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Deposits</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>creditListView</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>100</height>
+ </size>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>totalDebitsLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>$</string>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>totalCreditsLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>$</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>infoGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Balance</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Previous Balance:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>broughtForwardLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Ending Balance:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>previousLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Cleared Balance:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>endingLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Difference:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>differenceLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonEdit</cstring>
+ </property>
+ <property name="text">
+ <string>Edit Transactions...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>Finish</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>reconcileDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>reconcileDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kreportconfigurationfilterdlg.cpp b/kmymoney2/dialogs/kreportconfigurationfilterdlg.cpp
new file mode 100644
index 0000000..949601d
--- /dev/null
+++ b/kmymoney2/dialogs/kreportconfigurationfilterdlg.cpp
@@ -0,0 +1,687 @@
+/***************************************************************************
+ kreportconfigurationdlg.cpp - description
+ -------------------
+ begin : Mon Jun 21 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ Ace Jones <ace.j@hotpop.com>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qvariant.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qframe.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qtabwidget.h>
+#include <qtextedit.h>
+#include <qlayout.h>
+#include <qapplication.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kapplication.h>
+#include <kpushbutton.h>
+#include <klineedit.h>
+#include <klistview.h>
+#include <kcombobox.h>
+#include <kguiitem.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+#include <kstdguiitem.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kreportconfigurationfilterdlg.h"
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/mymoneyreport.h>
+#include <kmymoney/kmymoneycombo.h>
+#include "../widgets/kmymoneyreportconfigtab1decl.h"
+#include "../widgets/kmymoneyreportconfigtab2decl.h"
+#include "../widgets/kmymoneyreportconfigtab3decl.h"
+#include "../widgets/kmymoneyreportconfigtabchartdecl.h"
+
+KReportConfigurationFilterDlg::KReportConfigurationFilterDlg(
+ MyMoneyReport report, QWidget *parent, const char *name)
+ : KFindTransactionDlg(parent, name),
+ m_tab2(0),
+ m_tab3(0),
+ m_tabChart(0),
+ m_initialState(report),
+ m_currentState(report)
+{
+ //
+ // Rework labelling
+ //
+
+ setCaption( i18n( "Report Configuration" ) );
+ delete TextLabel1;
+
+ //
+ // Rework the buttons
+ //
+
+ // the Ok button is always enabled
+ disconnect(SIGNAL(selectionEmpty(bool)));
+ m_searchButton->setGuiItem( KStdGuiItem::ok() );
+ m_searchButton->setEnabled(true);
+
+ // reconnect the close button
+ m_closeButton->disconnect();
+ connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+
+ //
+ // Add new tabs
+ //
+
+ m_tab1 = new kMyMoneyReportConfigTab1Decl( m_criteriaTab, "kMyMoneyReportConfigTab1" );
+ m_criteriaTab->insertTab( m_tab1, i18n("Report"), 0 );
+
+ if ( m_initialState.reportType() == MyMoneyReport::ePivotTable )
+ {
+ m_tab2 = new kMyMoneyReportConfigTab2Decl( m_criteriaTab, "kMyMoneyReportConfigTab2" );
+ m_criteriaTab->insertTab( m_tab2, i18n( "Rows/Columns"), 1 );
+ connect(m_tab2->m_comboRows, SIGNAL(highlighted(int)), this, SLOT(slotRowTypeChanged(int)));
+ connect(m_tab2->m_comboColumns, SIGNAL(activated(int)), this, SLOT(slotColumnTypeChanged(int)));
+ //control the state of the includeTransfer check
+ connect(m_categoriesView, SIGNAL(stateChanged()), this, SLOT(slotUpdateCheckTransfers()));
+
+#ifdef HAVE_KDCHART
+ m_tabChart = new kMyMoneyReportConfigTabChartDecl( m_criteriaTab, "kMyMoneyReportConfigTabChart" );
+ m_criteriaTab->insertTab( m_tabChart, i18n( "Chart"), 2 );
+#endif
+ }
+ else if ( m_initialState.reportType() == MyMoneyReport::eQueryTable )
+ {
+ // eInvestmentHoldings is a special-case report, and you cannot configure the
+ // rows & columns of that report.
+ if ( m_initialState.rowType() < MyMoneyReport::eAccountByTopAccount )
+ {
+ m_tab3 = new kMyMoneyReportConfigTab3Decl( m_criteriaTab, "kMyMoneyReportConfigTab3" );
+ m_criteriaTab->insertTab( m_tab3, i18n("Rows/Columns"), 1 );
+ }
+ }
+
+ m_criteriaTab->showPage( m_tab1 );
+ m_criteriaTab->setMinimumSize( 500,200 );
+
+ QValueList<MyMoneyBudget> list = MyMoneyFile::instance()->budgetList();
+ QValueList<MyMoneyBudget>::const_iterator it_b;
+ for(it_b = list.begin(); it_b != list.end(); ++it_b) {
+ m_budgets.push_back(*it_b);
+ }
+
+ //
+ // Now set up the widgets with proper values
+ //
+ slotReset();
+}
+
+KReportConfigurationFilterDlg::~KReportConfigurationFilterDlg()
+{
+}
+
+void KReportConfigurationFilterDlg::slotSearch(void)
+{
+ // setup the filter from the dialog widgets
+ setupFilter();
+
+ // Copy the m_filter over to the filter part of m_currentConfig.
+ m_currentState.assignFilter(m_filter);
+
+ // Then extract the report properties
+ m_currentState.setName( m_tab1->m_editName->text() );
+ m_currentState.setComment( m_tab1->m_editComment->text() );
+ m_currentState.setConvertCurrency( m_tab1->m_checkCurrency->isChecked() );
+ m_currentState.setFavorite( m_tab1->m_checkFavorite->isChecked() );
+
+ if ( m_tab2 )
+ {
+ MyMoneyReport::EDetailLevel dl[4] = { MyMoneyReport::eDetailAll, MyMoneyReport::eDetailTop, MyMoneyReport::eDetailGroup, MyMoneyReport::eDetailTotal };
+
+ m_currentState.setDetailLevel( dl[m_tab2->m_comboDetail->currentItem()] );
+
+ // modify the rowtype only if the widget is enabled
+ if(m_tab2->m_comboRows->isEnabled()) {
+ MyMoneyReport::ERowType rt[2] = { MyMoneyReport::eExpenseIncome, MyMoneyReport::eAssetLiability };
+ m_currentState.setRowType( rt[m_tab2->m_comboRows->currentItem()] );
+ }
+
+ m_currentState.setShowingRowTotals(false);
+ if(m_tab2->m_comboRows->currentItem() == 0)
+ m_currentState.setShowingRowTotals(m_tab2->m_checkTotalColumn->isChecked());
+
+ MyMoneyReport::EColumnType ct[6] = { MyMoneyReport::eDays, MyMoneyReport::eWeeks, MyMoneyReport::eMonths, MyMoneyReport::eBiMonths, MyMoneyReport::eQuarters, MyMoneyReport::eYears };
+ bool dy[6] = { true, true, false, false, false, false };
+ m_currentState.setColumnType( ct[m_tab2->m_comboColumns->currentItem()] );
+
+ //TODO (Ace) This should be implicit in the call above. MMReport needs fixin'
+ m_currentState.setColumnsAreDays( dy[m_tab2->m_comboColumns->currentItem()] );
+
+ m_currentState.setIncludingSchedules( m_tab2->m_checkScheduled->isChecked() );
+
+ m_currentState.setIncludingTransfers( m_tab2->m_checkTransfers->isChecked() );
+
+ m_currentState.setIncludingUnusedAccounts( m_tab2->m_checkUnused->isChecked() );
+
+ if(m_tab2->m_comboBudget->isEnabled()) {
+ m_currentState.setBudget(m_budgets[m_tab2->m_comboBudget->currentItem()].id(), m_initialState.rowType() == MyMoneyReport::eBudgetActual);
+ } else {
+ m_currentState.setBudget(QString(), false);
+ }
+
+ //set moving average days
+ if(m_tab2->m_movingAverageDays->isEnabled()) {
+ m_currentState.setMovingAverageDays( m_tab2->m_movingAverageDays->value() );
+ }
+ }
+ else if ( m_tab3 )
+ {
+ MyMoneyReport::ERowType rtq[7] = { MyMoneyReport::eCategory, MyMoneyReport::eTopCategory, MyMoneyReport::ePayee, MyMoneyReport::eAccount, MyMoneyReport::eTopAccount, MyMoneyReport::eMonth, MyMoneyReport::eWeek };
+ m_currentState.setRowType( rtq[m_tab3->m_comboOrganizeBy->currentItem()] );
+
+ unsigned qc = MyMoneyReport::eQCnone;
+
+ if (m_currentState.queryColumns() & MyMoneyReport::eQCloan)
+ // once a loan report, always a loan report
+ qc = MyMoneyReport::eQCloan;
+
+ if ( m_tab3->m_checkNumber->isChecked() )
+ qc |= MyMoneyReport::eQCnumber;
+ if ( m_tab3->m_checkPayee->isChecked() )
+ qc |= MyMoneyReport::eQCpayee;
+ if ( m_tab3->m_checkCategory->isChecked() )
+ qc |= MyMoneyReport::eQCcategory;
+ if ( m_tab3->m_checkMemo->isChecked() )
+ qc |= MyMoneyReport::eQCmemo;
+ if ( m_tab3->m_checkAccount->isChecked() )
+ qc |= MyMoneyReport::eQCaccount;
+ if ( m_tab3->m_checkReconciled->isChecked() )
+ qc |= MyMoneyReport::eQCreconciled;
+ if ( m_tab3->m_checkAction->isChecked() )
+ qc |= MyMoneyReport::eQCaction;
+ if ( m_tab3->m_checkShares->isChecked() )
+ qc |= MyMoneyReport::eQCshares;
+ if ( m_tab3->m_checkPrice->isChecked() )
+ qc |= MyMoneyReport::eQCprice;
+ if( m_tab3->m_checkBalance->isChecked() )
+ qc |= MyMoneyReport::eQCbalance;
+
+ m_currentState.setQueryColumns(static_cast<MyMoneyReport::EQueryColumns>(qc));
+
+ m_currentState.setTax( m_tab3->m_checkTax->isChecked() );
+ m_currentState.setInvestmentsOnly( m_tab3->m_checkInvestments->isChecked() );
+ m_currentState.setLoansOnly( m_tab3->m_checkLoans->isChecked() );
+
+ m_currentState.setDetailLevel(m_tab3->m_checkHideSplitDetails->isChecked() ?
+ MyMoneyReport::eDetailNone : MyMoneyReport::eDetailAll);
+ }
+
+ if ( m_tabChart )
+ {
+ MyMoneyReport::EChartType ct[5] = { MyMoneyReport::eChartLine, MyMoneyReport::eChartBar, MyMoneyReport::eChartStackedBar, MyMoneyReport::eChartPie, MyMoneyReport::eChartRing };
+ m_currentState.setChartType( ct[m_tabChart->m_comboType->currentItem()] );
+
+ m_currentState.setChartGridLines( m_tabChart->m_checkGridLines->isChecked() );
+ m_currentState.setChartDataLabels( m_tabChart->m_checkValues->isChecked() );
+ m_currentState.setChartByDefault( m_tabChart->m_checkShowChart->isChecked() );
+ m_currentState.setChartLineWidth( m_tabChart->m_lineWidth->value() );
+ }
+
+ // setup the date lock
+ MyMoneyTransactionFilter::dateOptionE range = m_dateRange->currentItem();
+ m_currentState.setDateFilter(range);
+
+ done(true);
+}
+
+void KReportConfigurationFilterDlg::slotRowTypeChanged(int row)
+{
+ m_tab2->m_checkTotalColumn->setEnabled(row == 0);
+}
+
+void KReportConfigurationFilterDlg::slotColumnTypeChanged(int row)
+{
+ if(m_tab2->m_comboBudget->isEnabled() && row < 2) {
+ m_tab2->m_comboColumns->setCurrentItem(2);
+ }
+}
+
+void KReportConfigurationFilterDlg::slotReset(void)
+{
+ //
+ // Set up the widget from the initial filter
+ //
+ m_currentState = m_initialState;
+
+ //
+ // Report Properties
+ //
+
+ m_tab1->m_editName->setText( m_initialState.name() );
+ m_tab1->m_editComment->setText( m_initialState.comment() );
+ m_tab1->m_checkCurrency->setChecked( m_initialState.isConvertCurrency() );
+ m_tab1->m_checkFavorite->setChecked( m_initialState.isFavorite() );
+
+ if ( m_tab2 )
+ {
+ switch ( m_initialState.detailLevel() )
+ {
+ case MyMoneyReport::eDetailNone:
+ case MyMoneyReport::eDetailEnd:
+ case MyMoneyReport::eDetailAll:
+ m_tab2->m_comboDetail->setCurrentItem(0);
+ break;
+ case MyMoneyReport::eDetailTop:
+ m_tab2->m_comboDetail->setCurrentItem(1);
+ break;
+ case MyMoneyReport::eDetailGroup:
+ m_tab2->m_comboDetail->setCurrentItem(2);
+ break;
+ case MyMoneyReport::eDetailTotal:
+ m_tab2->m_comboDetail->setCurrentItem(3);
+ break;
+ }
+
+ switch(m_initialState.rowType()) {
+ case MyMoneyReport::eExpenseIncome:
+ case MyMoneyReport::eBudget:
+ case MyMoneyReport::eBudgetActual:
+ m_tab2->m_comboRows->setCurrentItem(0); // income / expense
+ break;
+ default:
+ m_tab2->m_comboRows->setCurrentItem(1); // asset / liability
+ break;
+ }
+ m_tab2->m_checkTotalColumn->setChecked(m_initialState.isShowingRowTotals());
+
+ slotRowTypeChanged(m_tab2->m_comboRows->currentItem());
+
+ if ( m_initialState.isColumnsAreDays() )
+ {
+ switch ( m_initialState.columnType() )
+ {
+ case MyMoneyReport::eNoColumns:
+ case MyMoneyReport::eDays:
+ m_tab2->m_comboColumns->setCurrentItem(0);
+ break;
+ case MyMoneyReport::eWeeks:
+ m_tab2->m_comboColumns->setCurrentItem(1);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch ( m_initialState.columnType() )
+ {
+ case MyMoneyReport::eNoColumns:
+ case MyMoneyReport::eMonths:
+ m_tab2->m_comboColumns->setCurrentItem(2);
+ break;
+ case MyMoneyReport::eBiMonths:
+ m_tab2->m_comboColumns->setCurrentItem(3);
+ break;
+ case MyMoneyReport::eQuarters:
+ m_tab2->m_comboColumns->setCurrentItem(4);
+ break;
+ case MyMoneyReport::eYears:
+ m_tab2->m_comboColumns->setCurrentItem(5);
+ break;
+ default:
+ break;
+ }
+ }
+
+ //load budgets combo
+ if(m_initialState.rowType() == MyMoneyReport::eBudget
+ || m_initialState.rowType() == MyMoneyReport::eBudgetActual) {
+ m_tab2->m_comboRows->setEnabled(false);
+ m_tab2->m_budgetFrame->setEnabled(!m_budgets.empty());
+ QValueVector<MyMoneyBudget>::const_iterator it_b;
+ int i = 0;
+ for(it_b = m_budgets.begin(); it_b != m_budgets.end(); ++it_b) {
+ m_tab2->m_comboBudget->insertItem((*it_b).name(), i);
+ //set the current selected item
+ if( (m_initialState.budget() == "Any" && (*it_b).budgetStart().year() == QDate::currentDate().year())
+ || m_initialState.budget() == (*it_b).id())
+ m_tab2->m_comboBudget->setCurrentItem(i);
+ i++;
+ }
+ }
+
+ //set moving average days spinbox
+ m_tab2->m_movingAverageDays->setEnabled( m_initialState.isIncludingMovingAverage() );
+ if(m_initialState.isIncludingMovingAverage() ) {
+ m_tab2->m_movingAverageDays->setValue( m_initialState.movingAverageDays() );
+ }
+
+ m_tab2->m_checkScheduled->setChecked( m_initialState.isIncludingSchedules() );
+ m_tab2->m_checkTransfers->setChecked( m_initialState.isIncludingTransfers() );
+ m_tab2->m_checkUnused->setChecked( m_initialState.isIncludingUnusedAccounts() );
+ }
+ else if ( m_tab3 )
+ {
+ switch ( m_initialState.rowType() )
+ {
+ case MyMoneyReport::eNoColumns:
+ case MyMoneyReport::eCategory:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(0);
+ break;
+ case MyMoneyReport::eTopCategory:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(1);
+ break;
+ case MyMoneyReport::ePayee:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(2);
+ break;
+ case MyMoneyReport::eAccount:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(3);
+ break;
+ case MyMoneyReport::eTopAccount:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(4);
+ break;
+ case MyMoneyReport::eMonth:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(5);
+ break;
+ case MyMoneyReport::eWeek:
+ m_tab3->m_comboOrganizeBy->setCurrentItem(6);
+ break;
+ default:
+ throw new MYMONEYEXCEPTION("KReportConfigurationFilterDlg::slotReset(): QueryTable report has invalid rowtype");
+ }
+
+ unsigned qc = m_initialState.queryColumns();
+ m_tab3->m_checkNumber->setChecked(qc & MyMoneyReport::eQCnumber);
+ m_tab3->m_checkPayee->setChecked(qc & MyMoneyReport::eQCpayee);
+ m_tab3->m_checkCategory->setChecked(qc & MyMoneyReport::eQCcategory);
+ m_tab3->m_checkMemo->setChecked(qc & MyMoneyReport::eQCmemo);
+ m_tab3->m_checkAccount->setChecked(qc & MyMoneyReport::eQCaccount);
+ m_tab3->m_checkReconciled->setChecked(qc & MyMoneyReport::eQCreconciled);
+ m_tab3->m_checkAction->setChecked(qc & MyMoneyReport::eQCaction);
+ m_tab3->m_checkShares->setChecked(qc & MyMoneyReport::eQCshares);
+ m_tab3->m_checkPrice->setChecked(qc & MyMoneyReport::eQCprice);
+ m_tab3->m_checkBalance->setChecked(qc & MyMoneyReport::eQCbalance);
+
+ m_tab3->m_checkTax->setChecked( m_initialState.isTax() );
+ m_tab3->m_checkInvestments->setChecked( m_initialState.isInvestmentsOnly() );
+ m_tab3->m_checkLoans->setChecked( m_initialState.isLoansOnly() );
+
+ m_tab3->m_checkHideSplitDetails->setChecked
+ (m_initialState.detailLevel() == MyMoneyReport::eDetailNone);
+ }
+
+ if ( m_tabChart )
+ {
+ switch( m_initialState.chartType() )
+ {
+ case MyMoneyReport::eChartNone:
+ case MyMoneyReport::eChartLine:
+ m_tabChart->m_comboType->setCurrentItem(0);
+ break;
+ case MyMoneyReport::eChartBar:
+ m_tabChart->m_comboType->setCurrentItem(1);
+ break;
+ case MyMoneyReport::eChartStackedBar:
+ m_tabChart->m_comboType->setCurrentItem(2);
+ break;
+ case MyMoneyReport::eChartPie:
+ m_tabChart->m_comboType->setCurrentItem(3);
+ break;
+ case MyMoneyReport::eChartRing:
+ m_tabChart->m_comboType->setCurrentItem(4);
+ break;
+ case MyMoneyReport::eChartEnd:
+ throw new MYMONEYEXCEPTION("KReportConfigurationFilterDlg::slotReset(): Report has invalid charttype");
+ }
+ m_tabChart->m_checkGridLines->setChecked(m_initialState.isChartGridLines());
+ m_tabChart->m_checkValues->setChecked(m_initialState.isChartDataLabels());
+ m_tabChart->m_checkShowChart->setChecked(m_initialState.isChartByDefault());
+ m_tabChart->m_lineWidth->setValue(m_initialState.chartLineWidth());
+ }
+
+ //
+ // Text Filter
+ //
+
+ QRegExp textfilter;
+ if ( m_initialState.textFilter(textfilter))
+ {
+ m_textEdit->setText(textfilter.pattern());
+ m_caseSensitive->setChecked(textfilter.caseSensitive());
+ m_regExp->setChecked(!textfilter.wildcard());
+ m_textNegate->setCurrentItem(m_initialState.isInvertingText());
+ }
+
+ //
+ // Type & State Filters
+ //
+
+ int type;
+ if ( m_initialState.firstType(type) )
+ m_typeBox->setCurrentItem(type);
+
+ int state;
+ if ( m_initialState.firstState(state) )
+ m_stateBox->setCurrentItem(state);
+
+ //
+ // Number Filter
+ //
+
+ QString nrFrom, nrTo;
+ if ( m_initialState.numberFilter(nrFrom, nrTo) )
+ {
+ if ( nrFrom == nrTo )
+ {
+ m_nrEdit->setEnabled(true);
+ m_nrFromEdit->setEnabled(false);
+ m_nrToEdit->setEnabled(false);
+ m_nrEdit->setText(nrFrom);
+ m_nrFromEdit->setText(QString());
+ m_nrToEdit->setText(QString());
+ m_nrButton->setChecked(true);
+ m_nrRangeButton->setChecked(false);
+ }
+ else
+ {
+ m_nrEdit->setEnabled(false);
+ m_nrFromEdit->setEnabled(true);
+ m_nrToEdit->setEnabled(false);
+ m_nrEdit->setText(QString());
+ m_nrFromEdit->setText(nrFrom);
+ m_nrToEdit->setText(nrTo);
+ m_nrButton->setChecked(false);
+ m_nrRangeButton->setChecked(true);
+ }
+ }
+ else
+ {
+ m_nrEdit->setEnabled(true);
+ m_nrFromEdit->setEnabled(false);
+ m_nrToEdit->setEnabled(false);
+ m_nrEdit->setText(QString());
+ m_nrFromEdit->setText(QString());
+ m_nrToEdit->setText(QString());
+ m_nrButton->setChecked(true);
+ m_nrRangeButton->setChecked(false);
+ }
+
+ //
+ // Amount Filter
+ //
+
+ MyMoneyMoney from, to;
+ if ( m_initialState.amountFilter(from,to) ) // bool getAmountFilter(MyMoneyMoney&,MyMoneyMoney&);
+ {
+ if ( from == to )
+ {
+ m_amountEdit->setEnabled(true);
+ m_amountFromEdit->setEnabled(false);
+ m_amountToEdit->setEnabled(false);
+ m_amountEdit->loadText(QString::number(from.toDouble()));
+ m_amountFromEdit->loadText(QString());
+ m_amountToEdit->loadText(QString());
+ m_amountButton->setChecked(true);
+ m_amountRangeButton->setChecked(false);
+ }
+ else
+ {
+ m_amountEdit->setEnabled(false);
+ m_amountFromEdit->setEnabled(true);
+ m_amountToEdit->setEnabled(true);
+ m_amountEdit->loadText(QString());
+ m_amountFromEdit->loadText(QString::number(from.toDouble()));
+ m_amountToEdit->loadText(QString::number(to.toDouble()));
+ m_amountButton->setChecked(false);
+ m_amountRangeButton->setChecked(true);
+ }
+ }
+ else
+ {
+ m_amountEdit->setEnabled(true);
+ m_amountFromEdit->setEnabled(false);
+ m_amountToEdit->setEnabled(false);
+ m_amountEdit->loadText(QString());
+ m_amountFromEdit->loadText(QString());
+ m_amountToEdit->loadText(QString());
+ m_amountButton->setChecked(true);
+ m_amountRangeButton->setChecked(false);
+ }
+
+ //
+ // Payees Filter
+ //
+
+ QStringList payees;
+ if ( m_initialState.payees(payees) )
+ {
+ if ( payees.empty() )
+ {
+ m_emptyPayeesButton->setChecked(true);
+ }
+ else
+ {
+ selectAllItems(m_payeesView, false);
+ selectItems(m_payeesView,payees,true);
+ }
+ }
+ else
+ {
+ selectAllItems(m_payeesView, true);
+ }
+
+ //
+ // Accounts Filter
+ //
+
+ QStringList accounts;
+ if ( m_initialState.accounts(accounts) )
+ {
+ m_accountsView->selectAllItems(false);
+ m_accountsView->selectItems(accounts,true);
+ }
+ else
+ m_accountsView->selectAllItems(true);
+
+ //
+ // Categories Filter
+ //
+
+ if ( m_initialState.categories(accounts) )
+ {
+ m_categoriesView->selectAllItems(false);
+ m_categoriesView->selectItems(accounts,true);
+ }
+ else
+ m_categoriesView->selectAllItems(true);
+
+ //
+ // Date Filter
+ //
+
+ // the following call implies a call to slotUpdateSelections,
+ // that's why we call it last
+
+ m_initialState.updateDateFilter();
+ QDate dateFrom, dateTo;
+ if ( m_initialState.dateFilter( dateFrom, dateTo ) )
+ {
+ if(m_initialState.isUserDefined()) {
+ m_dateRange->setCurrentItem(MyMoneyTransactionFilter::userDefined);
+ m_fromDate->setDate(dateFrom);
+ m_toDate->setDate(dateTo);
+ } else {
+ m_fromDate->setDate(dateFrom);
+ m_toDate->setDate(dateTo);
+ KFindTransactionDlg::slotDateChanged();
+ }
+ }
+ else
+ {
+ m_dateRange->setCurrentItem(MyMoneyTransactionFilter::allDates);
+ slotDateRangeChanged(MyMoneyTransactionFilter::allDates);
+ }
+
+ slotRightSize();
+}
+
+void KReportConfigurationFilterDlg::slotDateChanged(void)
+{
+ if(m_dateRange->currentItem() != MyMoneyTransactionFilter::userDefined) {
+ KFindTransactionDlg::slotDateChanged();
+ }
+ slotUpdateSelections();
+}
+
+void KReportConfigurationFilterDlg::slotShowHelp(void)
+{
+ kapp->invokeHelp("details.reports.config");
+}
+
+//TODO Fix the reports and engine to include transfers even if categories are filtered - bug #1523508
+void KReportConfigurationFilterDlg::slotUpdateCheckTransfers(void)
+{
+ if(!m_categoriesView->allItemsSelected()) {
+ m_tab2->m_checkTransfers->setChecked(false);
+ m_tab2->m_checkTransfers->setDisabled(true);
+ } else {
+ m_tab2->m_checkTransfers->setEnabled(true);
+ }
+}
+
+#include "kreportconfigurationfilterdlg.moc"
diff --git a/kmymoney2/dialogs/kreportconfigurationfilterdlg.h b/kmymoney2/dialogs/kreportconfigurationfilterdlg.h
new file mode 100644
index 0000000..56e398d
--- /dev/null
+++ b/kmymoney2/dialogs/kreportconfigurationfilterdlg.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+ kreportconfigurationdlg.h - description
+ -------------------
+ begin : Mon Jun 21 2004
+ copyright : (C) 2000-2004 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ Ace Jones <ace.j@hotpop.com>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KREPORTCONFIGURATIONFILTERDLG_H
+#define KREPORTCONFIGURATIONFILTERDLG_H
+
+#include <qvaluevector.h>
+
+#include "../dialogs/kfindtransactiondlg.h"
+#include "../mymoney/mymoneyreport.h"
+#include "../mymoney/mymoneybudget.h"
+
+class kMyMoneyReportConfigTab1Decl;
+class kMyMoneyReportConfigTab2Decl;
+class kMyMoneyReportConfigTab3Decl;
+class kMyMoneyReportConfigTabChartDecl;
+class MyMoneyBudget;
+
+/**
+ * @author Ace Jones
+ */
+class KReportConfigurationFilterDlg : public KFindTransactionDlg
+{
+Q_OBJECT
+public:
+ KReportConfigurationFilterDlg(MyMoneyReport report, QWidget *parent = 0, const char *name = 0);
+ ~KReportConfigurationFilterDlg();
+
+ const MyMoneyReport& getConfig(void) const { return m_currentState; }
+
+protected:
+ kMyMoneyReportConfigTab1Decl* m_tab1;
+ kMyMoneyReportConfigTab2Decl* m_tab2;
+ kMyMoneyReportConfigTab3Decl* m_tab3;
+ kMyMoneyReportConfigTabChartDecl* m_tabChart;
+
+ MyMoneyReport m_initialState;
+ MyMoneyReport m_currentState;
+
+protected slots:
+ void slotRowTypeChanged(int);
+ void slotColumnTypeChanged(int);
+ void slotReset(void);
+ void slotSearch(void);
+ void slotShowHelp(void);
+ /**
+ * This is to enable/disable the check to Include Transfers based on whether Categories are filtered or not.
+ * This is because if Categories are filtered, transfers will not be included anyway
+ */
+ void slotUpdateCheckTransfers(void);
+
+ virtual void slotDateChanged(void);
+
+private:
+ QValueVector<MyMoneyBudget> m_budgets;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/ksecuritylisteditor.cpp b/kmymoney2/dialogs/ksecuritylisteditor.cpp
new file mode 100644
index 0000000..ee4c486
--- /dev/null
+++ b/kmymoney2/dialogs/ksecuritylisteditor.cpp
@@ -0,0 +1,220 @@
+/***************************************************************************
+ ksecuritylisteditor.cpp - description
+ -------------------
+ begin : Wed Dec 16 2004
+ copyright : (C) 2004 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <kguiitem.h>
+#include <kiconloader.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksecuritylisteditor.h"
+
+#include "../mymoney/mymoneysecurity.h"
+#include "../mymoney/mymoneyfile.h"
+#include "../dialogs/knewinvestmentwizard.h"
+
+#include "../kmymoneyutils.h"
+
+#define ID_COL 0
+#define TYPE_COL 1
+#define NAME_COL 2
+#define SYMBOL_COL 3
+#define MARKET_COL 4
+#define CURR_COL 5
+#define ACCFRACT_COL 6
+#define CASHFRACT_COL 7
+
+#define CURRENCY_MARKET QString("ISO 4217")
+
+KSecurityListEditor::KSecurityListEditor(QWidget *parent, const char *name) :
+ KSecurityListEditorDecl(parent, name)
+{
+ m_listView->setColumnWidth(ID_COL, 0);
+ m_listView->setColumnWidthMode(NAME_COL, QListView::Maximum);
+ m_listView->setColumnWidthMode(ID_COL, QListView::Manual);
+ m_listView->setColumnAlignment(CURR_COL, Qt::AlignHCenter);
+ m_listView->setMultiSelection(false);
+ m_listView->setAllColumnsShowFocus(true);
+
+ KIconLoader *il = KGlobal::iconLoader();
+ KGuiItem removeButtenItem( i18n( "&Delete" ),
+ QIconSet(il->loadIcon("delete", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Delete this entry"),
+ i18n("Remove this security item from the file"));
+ m_deleteButton->setGuiItem(removeButtenItem);
+
+ KGuiItem addButtenItem( i18n( "&Add" ),
+ QIconSet(il->loadIcon("file_new", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Add a new entry"),
+ i18n("Create a new security entry."));
+ m_addButton->setGuiItem(addButtenItem);
+
+ KGuiItem editButtenItem( i18n( "&Edit" ),
+ QIconSet(il->loadIcon("edit", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Modify the selected entry"),
+ i18n("Change the security information of the selected entry."));
+ m_editButton->setGuiItem(editButtenItem);
+
+ KGuiItem okButtenItem( i18n("&Close" ),
+ QIconSet(il->loadIcon("button_ok", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Close the dialog"),
+ i18n("Use this to close the dialog and return to the application."));
+ m_closeButton->setGuiItem(okButtenItem);
+
+ connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_showCurrencyButton, SIGNAL(toggled(bool)), this, SLOT(slotLoadList()));
+ connect(m_listView, SIGNAL(selectionChanged()), this, SLOT(slotUpdateButtons()));
+
+ connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditSecurity()));
+ connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteSecurity()));
+
+ // FIXME for now, the only way to add a new security is to add a new investment
+ m_addButton->hide();
+
+ slotLoadList();
+}
+
+KSecurityListEditor::~KSecurityListEditor()
+{
+}
+
+void KSecurityListEditor::slotLoadList(void)
+{
+ m_listView->clear();
+
+ QValueList<MyMoneySecurity> list = MyMoneyFile::instance()->securityList();
+ QValueList<MyMoneySecurity>::ConstIterator it;
+ if(m_showCurrencyButton->isChecked()) {
+ list += MyMoneyFile::instance()->currencyList();
+ }
+ for(it = list.begin(); it != list.end(); ++it) {
+ KListViewItem* newItem = new KListViewItem(m_listView, QString((*it).id()));
+ fillItem(newItem, *it);
+
+ }
+ slotUpdateButtons();
+}
+
+void KSecurityListEditor::fillItem(QListViewItem* item, const MyMoneySecurity& security)
+{
+ QString market = security.tradingMarket();
+ MyMoneySecurity tradingCurrency;
+ if(security.isCurrency())
+ market = CURRENCY_MARKET;
+ else
+ tradingCurrency = MyMoneyFile::instance()->security(security.tradingCurrency());
+
+ item->setText(TYPE_COL, KMyMoneyUtils::securityTypeToString(security.securityType()));
+ item->setText(NAME_COL, security.name());
+ item->setText(SYMBOL_COL, security.tradingSymbol());
+ item->setText(MARKET_COL, market);
+ item->setText(CURR_COL, tradingCurrency.tradingSymbol());
+ item->setText(ACCFRACT_COL, QString::number(security.smallestAccountFraction()));
+
+ // smallestCashFraction is only applicable for currencies
+ if(security.isCurrency())
+ item->setText(CASHFRACT_COL, QString::number(security.smallestCashFraction()));
+}
+
+void KSecurityListEditor::slotUpdateButtons(void)
+{
+ QListViewItem* item = m_listView->selectedItem();
+
+ if(item) {
+ MyMoneySecurity security = MyMoneyFile::instance()->security(item->text(ID_COL).latin1());
+ m_editButton->setEnabled(item->text(MARKET_COL) != CURRENCY_MARKET);
+ m_deleteButton->setEnabled(!MyMoneyFile::instance()->isReferenced(security));
+
+ } else {
+ m_editButton->setEnabled(false);
+ m_deleteButton->setEnabled(false);
+ }
+}
+
+void KSecurityListEditor::slotEditSecurity(void)
+{
+ QListViewItem* item = m_listView->selectedItem();
+ if(item) {
+ MyMoneySecurity security = MyMoneyFile::instance()->security(item->text(ID_COL).latin1());
+
+ KNewInvestmentWizard dlg(security, this, "KNewInvestmentWizard");
+ if(dlg.exec() == QDialog::Accepted) {
+ dlg.createObjects(QString());
+ security = MyMoneyFile::instance()->security(item->text(ID_COL).latin1());
+ fillItem(item, security);
+ }
+ }
+}
+
+void KSecurityListEditor::slotDeleteSecurity(void)
+{
+ QListViewItem* item = m_listView->selectedItem();
+ if(item) {
+ MyMoneySecurity security = MyMoneyFile::instance()->security(item->text(ID_COL).latin1());
+ QString msg;
+ QString dontAsk;
+ if(security.isCurrency()) {
+ msg = QString("<p>") + i18n("Do you really want to remove the currency <b>%1</b> from the file?</p><i>Note: It is currently not supported to add currencies.</i>").arg(security.name());
+ dontAsk = "DeleteCurrency";
+ } else {
+ msg = QString("<p>") + i18n("Do you really want to remove the %1 <b>%2</b> from the file?").arg(KMyMoneyUtils::securityTypeToString(security.securityType())).arg(security.name());
+ dontAsk = "DeleteSecurity";
+ }
+ if(KMessageBox::questionYesNo(this, msg, i18n("Delete security"), KStdGuiItem::yes(), KStdGuiItem::no(), dontAsk) == KMessageBox::Yes) {
+ MyMoneyFileTransaction ft;
+ try {
+ if(security.isCurrency())
+ MyMoneyFile::instance()->removeCurrency(security);
+ else
+ MyMoneyFile::instance()->removeSecurity(security);
+ ft.commit();
+ slotLoadList();
+ } catch(MyMoneyException *e) {
+ delete e;
+ }
+ }
+ }
+}
+
+// Make sure, that these definitions are only used within this file
+// this does not seem to be necessary, but when building RPMs the
+// build option 'final' is used and all CPP files are concatenated.
+// So it could well be, that in another CPP file these definitions
+// are also used.
+#undef ID_COL
+#undef TYPE_COL
+#undef NAME_COL
+#undef SYMBOL_COL
+#undef MARKET_COL
+#undef CURR_COL
+#undef ACCFRACT_COL
+#undef CASHFRACT_COL
+
+#include "ksecuritylisteditor.moc"
diff --git a/kmymoney2/dialogs/ksecuritylisteditor.h b/kmymoney2/dialogs/ksecuritylisteditor.h
new file mode 100644
index 0000000..050edbe
--- /dev/null
+++ b/kmymoney2/dialogs/ksecuritylisteditor.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ ksecuritylisteditor.h - description
+ -------------------
+ begin : Wed Dec 16 2004
+ copyright : (C) 2004 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSECURITYLISTEDITOR_H
+#define KSECURITYLISTEDITOR_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QListViewItem;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksecuritylisteditordecl.h"
+
+#include "../mymoney/mymoneysecurity.h"
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KSecurityListEditor : public KSecurityListEditorDecl
+{
+ Q_OBJECT
+public:
+ KSecurityListEditor(QWidget *parent, const char* name = 0);
+ ~KSecurityListEditor();
+
+protected slots:
+ void slotLoadList(void);
+ void slotUpdateButtons(void);
+ void slotEditSecurity(void);
+ void slotDeleteSecurity(void);
+
+protected:
+ void fillItem(QListViewItem* item, const MyMoneySecurity& security);
+
+};
+
+#endif
diff --git a/kmymoney2/dialogs/ksecuritylisteditordecl.ui b/kmymoney2/dialogs/ksecuritylisteditordecl.ui
new file mode 100644
index 0000000..cbb9999
--- /dev/null
+++ b/kmymoney2/dialogs/ksecuritylisteditordecl.ui
@@ -0,0 +1,262 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>KSecurityListEditorDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KSecurityListEditorDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>722</width>
+ <height>453</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Security List Editor</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>ID</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Symbol</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Market</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Currency</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Fraction</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Cash Fraction</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_listView</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_addButton</cstring>
+ </property>
+ <property name="text">
+ <string>Add...</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_editButton</cstring>
+ </property>
+ <property name="text">
+ <string>Edit...</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_deleteButton</cstring>
+ </property>
+ <property name="text">
+ <string>Delete...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>110</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_showCurrencyButton</cstring>
+ </property>
+ <property name="text">
+ <string>Show national currencies</string>
+ </property>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_closeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kselectdatabasedlg.cpp b/kmymoney2/dialogs/kselectdatabasedlg.cpp
new file mode 100644
index 0000000..941712c
--- /dev/null
+++ b/kmymoney2/dialogs/kselectdatabasedlg.cpp
@@ -0,0 +1,232 @@
+/***************************************************************************
+ kselectdatabasedlg.cpp
+ -------------------
+ copyright : (C) 2005 by Tony Bloomfield
+ author : Tony Bloomfield
+ email : tonybloom@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qapplication.h>
+#include <qsqldatabase.h>
+#include <qfiledialog.h>
+#include <qstatusbar.h>
+#include <qcheckbox.h>
+#include <qcolor.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kapplication.h>
+#include <kurlrequester.h>
+#include <ktextbrowser.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kselectdatabasedlg.h"
+
+KSelectDatabaseDlg::KSelectDatabaseDlg(QWidget *parent, const char *name)
+ : KSelectDatabaseDlgDecl(parent, name) {
+ listDrivers->clear();
+ // list drivers supported by KMM
+ QMap<QString, QString> map = m_map.driverMap();
+ // list drivers installed on system
+ QStringList list = QSqlDatabase::drivers();
+ if (list.count() == 0) {
+ KMessageBox::error (0, i18n("There are no Qt SQL drivers installed in your system.\n"
+ "Please consult documentation for your distro, or visit the Qt web site (www.trolltech.com)"
+ " and search for SQL drivers."),
+ "");
+ setError();
+ } else {
+ QStringList::Iterator it = list.begin();
+ while(it != list.end()) {
+ QString dname = *it;
+ if (map.keys().contains(dname)) { // only display if driver is supported
+ dname = dname + " - " + map[dname];
+ listDrivers->insertItem (dname);
+ }
+ it++;
+ }
+ textDbName->setText ("KMyMoney");
+ textHostName->setText ("localhost");
+ textUserName->setText("");
+ struct passwd * pwd = getpwuid(geteuid());
+ if (pwd != 0)
+ textUserName->setText (QString(pwd->pw_name));
+ textPassword->setText ("");
+ m_requiredFields = new kMandatoryFieldGroup(this);
+ m_requiredFields->setOkButton(buttonOK);
+ m_requiredFields->add(listDrivers);
+ m_requiredFields->add(textDbName);
+ connect (listDrivers, SIGNAL(clicked(QListBoxItem *)),
+ this, SLOT(slotDriverSelected(QListBoxItem *)));
+ connect (buttonSQL, SIGNAL(clicked()), this, SLOT(slotGenerateSQL()));
+ connect (buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
+ checkPreLoad->setChecked(false);
+ buttonSQL->setEnabled(true);
+ }
+ connect (buttonHelp, SIGNAL(clicked()), this, SLOT(slotHelp()));
+ // ensure a driver gets selected; pre-select if only one
+ listDrivers->clearSelection();
+ if (listDrivers->count() == 1) {
+ listDrivers->setSelected(0, true);
+ slotDriverSelected(listDrivers->item(0));
+ }
+}
+
+KSelectDatabaseDlg::KSelectDatabaseDlg(KURL openURL, QWidget *parent, const char *name)
+ : KSelectDatabaseDlgDecl(parent, name) {
+ // here we are re-opening a database from a URL
+ // probably taken from the last-used or recent file list
+ listDrivers->clear();
+ // check that the SQL driver is still available
+ QString driverName = openURL.queryItem("driver");
+ // list drivers installed on system
+ QStringList list = QSqlDatabase::drivers();
+ // list drivers supported by KMM
+ QMap<QString, QString> map = m_map.driverMap();
+ if (!list.contains(driverName)) {
+ KMessageBox::error (0, i18n("Qt SQL driver %1 is no longer installed on your system").arg(driverName),
+ "");
+ setError();
+ } else if (!map.contains(driverName)) {
+ KMessageBox::error (0, i18n("Qt SQL driver %1 is not suported").arg(driverName),
+ "");
+ setError();
+ } else {
+ // fill in the fixed data from the URL
+ listDrivers->insertItem (QString(driverName + " - " + map[driverName]));
+ listDrivers->setSelected(0,true);
+ QString dbName = openURL.path().right(openURL.path().length() - 1); // remove separator slash
+ textDbName->setText (dbName);
+ textHostName->setText (openURL.host());
+ textUserName->setText(openURL.user());
+ // disable all but the password field, coz that's why we're here
+ textDbName->setEnabled(false);
+ listDrivers->setEnabled(false);
+ textHostName->setEnabled(false);
+ textUserName->setEnabled(false);
+ textPassword->setEnabled(true);
+ textPassword->setFocus();
+ buttonSQL->setEnabled(false);
+ // set password as required
+ m_requiredFields = new kMandatoryFieldGroup(this);
+ m_requiredFields->add(textPassword);
+ m_requiredFields->setOkButton(buttonOK);
+
+ connect (buttonOK, SIGNAL(clicked()), this, SLOT(accept()));
+ checkPreLoad->setChecked(false);
+ }
+ connect (buttonHelp, SIGNAL(clicked()), this, SLOT(slotHelp()));
+
+}
+
+KSelectDatabaseDlg::~KSelectDatabaseDlg() {
+ if (m_requiredFields != 0) delete m_requiredFields;
+}
+
+void KSelectDatabaseDlg::setMode (int openMode) {
+ m_mode = openMode;
+ checkPreLoad->setEnabled (openMode == IO_ReadWrite);
+}
+
+const KURL KSelectDatabaseDlg::selectedURL() {
+ KURL url;
+ url.setProtocol("sql");
+ url.setUser(textUserName->text());
+ url.setPass(textPassword->text());
+ url.setHost(textHostName->text());
+ url.setPath("/" + textDbName->text());
+ QString qs = QString("driver=%1")
+ .arg(listDrivers->currentText().section (' ', 0, 0));
+ if (checkPreLoad->isChecked()) qs.append("&options=loadAll");
+ if (!textPassword->text().isEmpty()) qs.append("&secure=yes");
+ url.setQuery(qs);
+ return (url);
+}
+
+void KSelectDatabaseDlg::slotDriverSelected (QListBoxItem *driver) {
+ databaseTypeE dbType = m_map.driverToType(driver->text().section(' ', 0, 0));
+ if (!m_map.isTested(dbType)) {
+ int rc = KMessageBox::warningContinueCancel (0,
+ i18n("Qt SQL driver %1 has not been fully tested in a KMyMoney environment. Please make sure you have adequate backups of your data. Please report any problems to the developer mailing list at kmymoney2-developer@lists.sourceforge.net")
+ .arg(driver->text()),
+ "");
+ if (rc == KMessageBox::Cancel) {
+ listDrivers->clearSelection();
+ return;
+ }
+ }
+
+ if (dbType == Sqlite3){
+ QString dbName = QFileDialog::getOpenFileName(
+ "",
+ i18n("SQLite files (*.sql);; All files (*.*)"),
+ this,
+ "",
+ i18n("Select SQLite file"));
+ if (dbName.isNull()) {
+ listDrivers->setSelected(driver, false);
+ return;
+ } else {
+ textDbName->setText(dbName);
+ }
+ // sql databases do not react to host/user/password; file system permissions must be used
+ textHostName->setEnabled (false);
+ textUserName->setEnabled (false);
+ textPassword->setEnabled(false);
+ } else {
+ textUserName->setEnabled (true); // but not host
+ textHostName->setEnabled (true);
+ textPassword->setEnabled(true);
+ }
+}
+
+void KSelectDatabaseDlg::slotGenerateSQL () {
+ QString fileName = QFileDialog::getSaveFileName(
+ "",
+ i18n("All files (*.*)"),
+ this,
+ "",
+ i18n("Select output file"));
+ if (fileName == "") return;
+ QFile out(fileName);
+ if (!out.open(IO_WriteOnly)) return;
+ QTextStream s(&out);
+ MyMoneyDbDef db;
+ s << db.generateSQL(listDrivers->currentText().section (' ', 0, 0));
+ out.close();
+}
+
+void KSelectDatabaseDlg::slotHelp(void) {
+ kapp->invokeHelp("details.database.selectdatabase");
+}
+
+void KSelectDatabaseDlg::setError() {
+ buttonOK->setEnabled(false);
+ buttonSQL->setEnabled(false);
+ m_requiredFields = 0;
+}
+
+#include "kselectdatabasedlg.moc"
diff --git a/kmymoney2/dialogs/kselectdatabasedlg.h b/kmymoney2/dialogs/kselectdatabasedlg.h
new file mode 100644
index 0000000..bc5a782
--- /dev/null
+++ b/kmymoney2/dialogs/kselectdatabasedlg.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ kselectdatabase.h
+ -------------------
+ copyright : (C) 2005 by Tony Bloomfield
+ author : Tony Bloomfield
+ email : tonybloom@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSELECTDATABASEDLG_H
+#define KSELECTDATABASEDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+#include <qlistbox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <kurl.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+#include "kselectdatabasedlgdecl.h"
+#include "../mymoney/storage/mymoneystoragesql.h"
+#include "kmymoney/kguiutils.h"
+
+class KSelectDatabaseDlg : public KSelectDatabaseDlgDecl
+{
+Q_OBJECT
+public:
+ KSelectDatabaseDlg(QWidget *parent = 0, const char *name = 0);
+ KSelectDatabaseDlg(KURL openURL, QWidget *parent = 0, const char *name = 0);
+ ~KSelectDatabaseDlg();
+ /** Set the mode of this dialog
+ * @param - openMode (IO_ReadWrite = open database; IO_WriteOnly = saveas database)
+ **/
+ void setMode(int openMode);
+ /** Return URL of database
+ * @return - pseudo-URL of database selected by user
+ **/
+ const KURL selectedURL();
+
+public slots:
+ void slotDriverSelected(QListBoxItem *driver);
+ void slotHelp();
+ void slotGenerateSQL();
+private:
+ void setError();
+ int m_mode;
+ MyMoneyDbDrivers m_map;
+ kMandatoryFieldGroup* m_requiredFields;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kselectdatabasedlgdecl.ui b/kmymoney2/dialogs/kselectdatabasedlgdecl.ui
new file mode 100644
index 0000000..4736fb7
--- /dev/null
+++ b/kmymoney2/dialogs/kselectdatabasedlgdecl.ui
@@ -0,0 +1,250 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSelectDatabaseDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KSelectDatabaseDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>449</width>
+ <height>640</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KMyMoney - Select Database</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox6</cstring>
+ </property>
+ <property name="title">
+ <string>CAUTION!</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>&lt;font color="#ff2727"&gt;This software is still in an experimental stage, and there are still some known response time problems. Please be patient; we are working on them.
+As always, please make sure you have adequate backups of your data.&lt;/font&gt;</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Database Type</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>listDrivers</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Database Name</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>textDbName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Host Name</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>textHostName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>User Name</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>textUserName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBoxPassword</cstring>
+ </property>
+ <property name="title">
+ <string>Password</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>textPassword</cstring>
+ </property>
+ <property name="echoMode">
+ <enum>Password</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkPreLoad</cstring>
+ </property>
+ <property name="text">
+ <string>Preload &amp;all data</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonSQL</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Generate SQL</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOK</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Ca&amp;ncel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOK</sender>
+ <signal>released()</signal>
+ <receiver>KSelectDatabaseDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>released()</signal>
+ <receiver>KSelectDatabaseDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kselecttransactionsdlg.cpp b/kmymoney2/dialogs/kselecttransactionsdlg.cpp
new file mode 100644
index 0000000..7a87dc8
--- /dev/null
+++ b/kmymoney2/dialogs/kselecttransactionsdlg.cpp
@@ -0,0 +1,178 @@
+/***************************************************************************
+ kselecttransactionsdlg.cpp
+ -------------------
+ begin : Wed May 16 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+#include <kapplication.h>
+#include <kactivelabel.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/mymoneytransaction.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+
+#include "kmergetransactionsdlg.h"
+
+KSelectTransactionsDlg::KSelectTransactionsDlg(const MyMoneyAccount& _account, QWidget* parent, const char* name) :
+ KSelectTransactionsDlgDecl(parent, name),
+ m_account(_account)
+{
+ // setup descriptive texts
+ setCaption(i18n("Select Transaction"));
+ m_description->setText(i18n("Select a transaction and press the OK button or use Cancel to select none."));
+
+ // clear current register contents
+ m_register->clear();
+
+ // no selection possible
+ m_register->setSelectionMode(QTable::Single);
+
+ // setup header font
+ QFont font = KMyMoneyGlobalSettings::listHeaderFont();
+ QFontMetrics fm( font );
+ int height = fm.lineSpacing()+6;
+ m_register->horizontalHeader()->setMinimumHeight(height);
+ m_register->horizontalHeader()->setMaximumHeight(height);
+ m_register->horizontalHeader()->setFont(font);
+
+ // setup cell font
+ font = KMyMoneyGlobalSettings::listCellFont();
+ m_register->setFont(font);
+
+ // ... setup the register columns ...
+ m_register->setupRegister(m_account);
+
+ // setup buttons
+ m_helpButton->setGuiItem(KStdGuiItem::help());
+ buttonOk->setGuiItem(KStdGuiItem::ok());
+ buttonCancel->setGuiItem(KStdGuiItem::cancel());
+
+ // default is to need at least one transaction selected
+ buttonOk->setDisabled(true);
+
+ // catch some events from the register
+ m_register->installEventFilter(this);
+
+ connect(m_register, SIGNAL(selectionChanged(const KMyMoneyRegister::SelectedTransactions&)), this, SLOT(slotEnableOk(const KMyMoneyRegister::SelectedTransactions&)));
+ connect(m_register, SIGNAL(editTransaction()), this, SLOT(accept()));
+
+ connect(m_helpButton, SIGNAL(clicked()), this, SLOT(slotHelp()));
+}
+
+void KSelectTransactionsDlg::slotEnableOk(const KMyMoneyRegister::SelectedTransactions& list)
+{
+ buttonOk->setEnabled(list.count() != 0);
+}
+
+void KSelectTransactionsDlg::addTransaction(const MyMoneyTransaction& t)
+{
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = t.splits().begin(); it_s != t.splits().end(); ++it_s) {
+ if((*it_s).accountId() == m_account.id()) {
+ KMyMoneyRegister::Transaction* tr = KMyMoneyRegister::Register::transactionFactory(m_register, t, (*it_s), 0);
+ // force full detail display
+ tr->setNumRowsRegister(tr->numRowsRegister(true));
+ break;
+ }
+ }
+}
+
+int KSelectTransactionsDlg::exec(void)
+{
+ m_register->updateRegister(true);
+ m_register->updateContents();
+
+ m_register->setFocus();
+
+ return KSelectTransactionsDlgDecl::exec();
+}
+
+void KSelectTransactionsDlg::slotHelp(void)
+{
+ // kapp->invokeHelp("details.ledgers.match");
+}
+
+void KSelectTransactionsDlg::show(void)
+{
+ KSelectTransactionsDlgDecl::show();
+ m_register->resize(KMyMoneyRegister::DetailColumn);
+}
+
+void KSelectTransactionsDlg::resizeEvent(QResizeEvent* ev)
+{
+ // don't forget the resizer
+ KSelectTransactionsDlgDecl::resizeEvent(ev);
+
+ // resize the register
+ m_register->resize(KMyMoneyRegister::DetailColumn);
+}
+
+MyMoneyTransaction KSelectTransactionsDlg::transaction(void) const
+{
+ MyMoneyTransaction t;
+
+ QValueList<KMyMoneyRegister::RegisterItem*> list;
+ list = m_register->selectedItems();
+ if(list.count()) {
+ KMyMoneyRegister::Transaction* _t = dynamic_cast<KMyMoneyRegister::Transaction*>(list[0]);
+ if(_t)
+ t = _t->transaction();
+ }
+ return t;
+}
+
+bool KSelectTransactionsDlg::eventFilter(QObject* o, QEvent* e)
+{
+ bool rc = false;
+ QKeyEvent* k;
+
+ if(o == m_register) {
+ switch(e->type()) {
+ case QEvent::KeyPress:
+ k = dynamic_cast<QKeyEvent*>(e);
+ if((k->state() & Qt::KeyButtonMask) == 0) {
+ switch(k->key()) {
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ if(buttonOk->isEnabled()) {
+ accept();
+ rc = true;
+ }
+ // tricky fall through here
+ default:
+ break;
+ }
+ }
+ // tricky fall through here
+ default:
+ break;
+ }
+ }
+ return rc;
+}
+
+#include "kselecttransactionsdlg.moc"
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kselecttransactionsdlg.h b/kmymoney2/dialogs/kselecttransactionsdlg.h
new file mode 100644
index 0000000..7bab9eb
--- /dev/null
+++ b/kmymoney2/dialogs/kselecttransactionsdlg.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ kselecttransactionsdlg.h
+ -------------------
+ begin : Wed May 16 2007
+ copyright : (C) 2007 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSELECTTRANSACTIONSDLG_H
+#define KSELECTTRANSACTIONSDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QResizeEvent;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdebug.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/register.h>
+#include <kmymoney/mymoneyaccount.h>
+
+#include "../dialogs/kselecttransactionsdlgdecl.h"
+
+class KSelectTransactionsDlg: public KSelectTransactionsDlgDecl
+{
+ Q_OBJECT
+public:
+ KSelectTransactionsDlg(const MyMoneyAccount& account, QWidget* parent = 0, const char* name = 0);
+
+ /**
+ * Adds the transaction @a t to the dialog
+ */
+ void addTransaction(const MyMoneyTransaction& t);
+ int exec(void);
+ void show(void);
+
+ MyMoneyTransaction transaction(void) const;
+
+ bool eventFilter(QObject* o, QEvent* e);
+
+public slots:
+ virtual void slotHelp();
+
+protected slots:
+ void slotEnableOk(const KMyMoneyRegister::SelectedTransactions& list);
+
+protected:
+ void resizeEvent(QResizeEvent* ev);
+
+private:
+ /**
+ * The account in which the transactions are displayed
+ */
+ MyMoneyAccount m_account;
+};
+
+#endif // KMERGETRANSACTIONSDLG_H
+// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/kmymoney2/dialogs/kselecttransactionsdlgdecl.ui b/kmymoney2/dialogs/kselecttransactionsdlgdecl.ui
new file mode 100644
index 0000000..76d825b
--- /dev/null
+++ b/kmymoney2/dialogs/kselecttransactionsdlgdecl.ui
@@ -0,0 +1,174 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSelectTransactionsDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KSelectTransactionsDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>794</width>
+ <height>456</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>xxx</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>m_description</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyRegister::Register">
+ <column>
+ <property name="text">
+ <string>Security</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Details</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>C</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Payment</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Deposit</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Quantity</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Balance</string>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_register</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>3</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="numRows">
+ <number>0</number>
+ </property>
+ <property name="numCols">
+ <number>12</number>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_helpButton</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>430</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KSelectTransactionsDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KSelectTransactionsDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/ksortoptiondlg.ui b/kmymoney2/dialogs/ksortoptiondlg.ui
new file mode 100644
index 0000000..e5606ae
--- /dev/null
+++ b/kmymoney2/dialogs/ksortoptiondlg.ui
@@ -0,0 +1,129 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSortOptionDlg</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KSortOptionDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>511</width>
+ <height>348</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Sort options</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_useDefault</cstring>
+ </property>
+ <property name="text">
+ <string>Use default</string>
+ </property>
+ </widget>
+ <widget class="TransactionSortOption">
+ <property name="name">
+ <cstring>m_sortOption</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_helpButton</cstring>
+ </property>
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>237</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_okButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>m_okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KSortOptionDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>m_cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KSortOptionDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>m_useDefault</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_sortOption</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">ksortoptiondlg.ui.h</include>
+</includes>
+<slots>
+ <slot>setSortOption( const QString &amp; option, const QString &amp; def )</slot>
+</slots>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+ <function returnType="QString">sortOption( void ) const</function>
+ <function>hideDefaultButton( void )</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/ksortoptiondlg.ui.h b/kmymoney2/dialogs/ksortoptiondlg.ui.h
new file mode 100644
index 0000000..62c26b7
--- /dev/null
+++ b/kmymoney2/dialogs/ksortoptiondlg.ui.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kstdguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+
+void KSortOptionDlg::init()
+{
+ m_okButton->setGuiItem(KStdGuiItem::ok());
+ m_cancelButton->setGuiItem(KStdGuiItem::cancel());
+ m_helpButton->setGuiItem(KStdGuiItem::help());
+}
+
+void KSortOptionDlg::setSortOption(const QString& option, const QString& def)
+{
+ if(option.isEmpty()) {
+ m_sortOption->setSettings(def);
+ m_useDefault->setChecked(true);
+ } else {
+ m_sortOption->setSettings(option);
+ m_useDefault->setChecked(false);
+ }
+}
+
+QString KSortOptionDlg::sortOption(void) const
+{
+ QString rc;
+ if(!m_useDefault->isChecked()) {
+ rc = m_sortOption->settings();
+ }
+ return rc;
+}
+
+void KSortOptionDlg::hideDefaultButton(void)
+{
+ m_useDefault->hide();
+}
+
diff --git a/kmymoney2/dialogs/ksplitcorrectiondlg.ui b/kmymoney2/dialogs/ksplitcorrectiondlg.ui
new file mode 100644
index 0000000..f5d9757
--- /dev/null
+++ b/kmymoney2/dialogs/ksplitcorrectiondlg.ui
@@ -0,0 +1,245 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSplitCorrectionDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KSplitCorrectionDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>462</width>
+ <height>292</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Correct splits</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>explanation</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>question</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>How do you want to proceed?</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>continueBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Continue to edit splits</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>changeBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Change total amount of transaction to %1.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>distributeBtn</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Distribute difference of %1 among all splits.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>leaveBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Leave %1 unassigned.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>okBtn</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>cancelBtn</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>okBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>KSplitCorrectionDlgDecl</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>KSplitCorrectionDlgDecl</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/ksplittransactiondlg.cpp b/kmymoney2/dialogs/ksplittransactiondlg.cpp
new file mode 100644
index 0000000..a197b4c
--- /dev/null
+++ b/kmymoney2/dialogs/ksplittransactiondlg.cpp
@@ -0,0 +1,449 @@
+/***************************************************************************
+ ksplittransactiondlg.cpp - description
+ -------------------
+ begin : Thu Jan 10 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qtable.h>
+#include <qtimer.h>
+#include <qptrlist.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qcursor.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kglobal.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <kactivelabel.h>
+#include <kstdguiitem.h>
+#include <kapplication.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksplittransactiondlg.h"
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/mymoneyfile.h>
+
+#include "kmymoneysplittable.h"
+#include "../dialogs/ksplitcorrectiondlg.h"
+
+KSplitTransactionDlg::KSplitTransactionDlg(const MyMoneyTransaction& t,
+ const MyMoneySplit& s,
+ const MyMoneyAccount& acc,
+ const bool amountValid,
+ const bool deposit,
+ const MyMoneyMoney& calculatedValue,
+ const QMap<QString, MyMoneyMoney>& priceInfo,
+ QWidget* parent, const char* name) :
+ KSplitTransactionDlgDecl(parent, name, true),
+ m_account(acc),
+ m_split(s),
+ m_precision(2),
+ m_amountValid(amountValid),
+ m_isDeposit(deposit),
+ m_calculatedValue(calculatedValue)
+{
+ // add icons to buttons
+ KIconLoader *il = KGlobal::iconLoader();
+
+ KGuiItem clearButtenItem( i18n( "Clear &All" ),
+ QIconSet(il->loadIcon("edittrash", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Clear all splits"),
+ i18n("Use this to clear all splits of this transaction"));
+ clearAllBtn->setGuiItem(clearButtenItem);
+
+
+ KGuiItem mergeButtenItem( i18n( "&Merge" ),
+ QIconSet(il->loadIcon("math_sum", KIcon::Small, KIcon::SizeSmall)),
+ "", "");
+ mergeBtn->setGuiItem(mergeButtenItem);
+
+ // make finish the default
+ finishBtn->setDefault(true);
+
+ // setup the focus
+ cancelBtn->setFocusPolicy(QWidget::NoFocus);
+ finishBtn->setFocusPolicy(QWidget::NoFocus);
+ clearAllBtn->setFocusPolicy(QWidget::NoFocus);
+
+ // connect signals with slots
+ connect(transactionsTable, SIGNAL(transactionChanged(const MyMoneyTransaction&)),
+ this, SLOT(slotSetTransaction(const MyMoneyTransaction&)));
+ connect(transactionsTable, SIGNAL(createCategory(const QString&, QString&)), this, SLOT(slotCreateCategory(const QString&, QString&)));
+ connect(transactionsTable, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+
+ connect(transactionsTable, SIGNAL(returnPressed()), this, SLOT(accept()));
+ connect(transactionsTable, SIGNAL(escapePressed()), this, SLOT(reject()));
+
+ connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(finishBtn, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(clearAllBtn, SIGNAL(clicked()), this, SLOT(slotClearAllSplits()));
+ connect(mergeBtn, SIGNAL(clicked()), this, SLOT(slotMergeSplits()));
+ connect(clearZeroBtn, SIGNAL(clicked()), this, SLOT(slotClearUnusedSplits()));
+
+ // setup the precision
+ try {
+ MyMoneySecurity currency = MyMoneyFile::instance()->currency(t.commodity());
+ m_precision = MyMoneyMoney::denomToPrec(m_account.fraction(currency));
+ } catch(MyMoneyException *e) {
+ delete e;
+ }
+
+ slotSetTransaction(t);
+
+ // pass on those vars
+ transactionsTable->setup(priceInfo);
+
+ QSize size(width(), height());
+ kapp->config()->setGroup("SplitTransactionEditor");
+ size = kapp->config()->readSizeEntry("Geometry", &size);
+ size.setHeight(size.height()-1);
+ QDialog::resize( size.expandedTo(minimumSizeHint()) );
+
+ // Trick: it seems, that the initial sizing of the dialog does
+ // not work correctly. At least, the columns do not get displayed
+ // correct. Reason: the return value of transactionsTable->visibleWidth()
+ // is incorrect. If the widget is visible, resizing works correctly.
+ // So, we let the dialog show up and resize it then. It's not really
+ // clean, but the only way I got the damned thing working.
+ QTimer::singleShot( 10, this, SLOT(initSize()) );
+}
+
+KSplitTransactionDlg::~KSplitTransactionDlg()
+{
+ kapp->config()->setGroup("SplitTransactionEditor");
+ kapp->config()->writeEntry("Geometry", size());
+}
+
+int KSplitTransactionDlg::exec(void)
+{
+ // for deposits, we invert the sign of all splits.
+ // don't forget to revert when we're done ;-)
+ if(m_isDeposit) {
+ for(unsigned i = 0; i < m_transaction.splits().count(); ++i) {
+ MyMoneySplit split = m_transaction.splits()[i];
+ split.setValue(-split.value());
+ split.setShares(-split.shares());
+ m_transaction.modifySplit(split);
+ }
+ }
+
+ int rc;
+ do {
+ transactionsTable->setFocus();
+
+ // initialize the display
+ transactionsTable->setTransaction(m_transaction, m_split, m_account);
+ updateSums();
+
+ rc = KSplitTransactionDlgDecl::exec();
+
+ if(rc == QDialog::Accepted) {
+ if(!diffAmount().isZero()) {
+ KSplitCorrectionDlgDecl* corrDlg = new KSplitCorrectionDlgDecl(this, 0, true);
+
+ // add icons to buttons
+ corrDlg->okBtn->setGuiItem(KStdGuiItem::ok());
+ corrDlg->cancelBtn->setGuiItem(KStdGuiItem::cancel());
+
+ MyMoneySplit split = m_transaction.splits()[0];
+ QString total = (-split.value()).formatMoney("", m_precision);
+ QString sums = splitsValue().formatMoney("", m_precision);
+ QString diff = diffAmount().formatMoney("", m_precision);
+
+ // now modify the text items of the dialog to contain the correct values
+ QString q = i18n("The total amount of this transaction is %1 while "
+ "the sum of the splits is %2. The remaining %3 are "
+ "unassigned.")
+ .arg(total)
+ .arg(sums)
+ .arg(diff);
+ corrDlg->explanation->setText(q);
+
+ q = i18n("Change &total amount of transaction to %1.").arg(sums);
+ corrDlg->changeBtn->setText(q);
+
+ q = i18n("&Distribute difference of %1 among all splits.").arg(diff);
+ corrDlg->distributeBtn->setText(q);
+ // FIXME remove the following line once distribution among
+ // all splits is implemented
+ corrDlg->distributeBtn->hide();
+
+
+ // if we have only two splits left, we don't allow leaving sth. unassigned.
+ if(m_transaction.splitCount() < 3) {
+ q = i18n("&Leave total amount of transaction at %1.").arg(total);
+ } else {
+ q = i18n("&Leave %1 unassigned.").arg(diff);
+ }
+ corrDlg->leaveBtn->setText(q);
+
+ if((rc = corrDlg->exec()) == QDialog::Accepted) {
+ QButton* button = corrDlg->buttonGroup->selected();
+ if(button != 0) {
+ switch(corrDlg->buttonGroup->id(button)) {
+ case 0: // continue to edit
+ rc = QDialog::Rejected;
+ break;
+
+ case 1: // modify total
+ split.setValue(-splitsValue());
+ split.setShares(-splitsValue());
+ m_transaction.modifySplit(split);
+ break;
+
+ case 2: // distribute difference
+ qDebug("distribution of difference not yet supported in KSplitTransactionDlg::slotFinishClicked()");
+ break;
+
+ case 3: // leave unassigned
+ break;
+ }
+ }
+ }
+ delete corrDlg;
+ }
+ } else
+ break;
+
+ } while(rc != QDialog::Accepted);
+
+ // for deposits, we inverted the sign of all splits.
+ // now we revert it back, so that things are left correct
+ if(m_isDeposit) {
+ for(unsigned i = 0; i < m_transaction.splits().count(); ++i) {
+ MyMoneySplit split = m_transaction.splits()[i];
+ split.setValue(-split.value());
+ split.setShares(-split.shares());
+ m_transaction.modifySplit(split);
+ }
+ }
+
+ return rc;
+}
+
+void KSplitTransactionDlg::initSize(void)
+{
+ QDialog::resize(width(), height()+1);
+}
+
+void KSplitTransactionDlg::accept()
+{
+ transactionsTable->slotCancelEdit();
+ KSplitTransactionDlgDecl::accept();
+}
+
+void KSplitTransactionDlg::reject()
+{
+ // cancel any edit activity in the split register
+ transactionsTable->slotCancelEdit();
+ KSplitTransactionDlgDecl::reject();
+}
+
+void KSplitTransactionDlg::slotClearAllSplits(void)
+{
+ transactionsTable->slotEndEdit();
+ int answer;
+ answer = KMessageBox::warningContinueCancel (this,
+ i18n("You are about to delete all splits of this transaction. "
+ "Do you really want to continue?"),
+ i18n("KMyMoney"),
+ i18n("Continue")
+ );
+
+ if(answer == KMessageBox::Continue) {
+ transactionsTable->slotCancelEdit();
+ QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction);
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ // clear all but the one referencing the account
+ for(it = list.begin(); it != list.end(); ++it) {
+ m_transaction.removeSplit(*it);
+ }
+
+ transactionsTable->setTransaction(m_transaction, m_split, m_account);
+ slotSetTransaction(m_transaction);
+ }
+}
+
+void KSplitTransactionDlg::slotClearUnusedSplits(void)
+{
+ transactionsTable->slotEndEdit();
+
+ QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction);
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ try {
+ // remove all splits that don't have a value assigned
+ for(it = list.begin(); it != list.end(); ++it) {
+ if((*it).shares().isZero()) {
+ m_transaction.removeSplit(*it);
+ }
+ }
+
+ transactionsTable->setTransaction(m_transaction, m_split, m_account);
+ slotSetTransaction(m_transaction);
+ } catch(MyMoneyException* e) {
+ delete e;
+ }
+}
+
+void KSplitTransactionDlg::slotMergeSplits(void)
+{
+ transactionsTable->slotEndEdit();
+
+ QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction);
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ try {
+ // collect all splits, merge them if needed and remove from transaction
+ QValueList<MyMoneySplit> splits;
+ for(it = list.begin(); it != list.end(); ++it) {
+ QValueList<MyMoneySplit>::iterator it_s;
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ if((*it_s).accountId() == (*it).accountId()
+ && (*it_s).memo().isEmpty() && (*it).memo().isEmpty())
+ break;
+ }
+ if(it_s != splits.end()) {
+ (*it_s).setShares((*it).shares() + (*it_s).shares());
+ (*it_s).setValue((*it).value() + (*it_s).value());
+ } else {
+ splits << *it;
+ }
+ m_transaction.removeSplit(*it);
+ }
+
+ // now add them back to the transaction
+ QValueList<MyMoneySplit>::iterator it_s;
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ (*it_s).clearId();
+ m_transaction.addSplit(*it_s);
+ }
+
+ transactionsTable->setTransaction(m_transaction, m_split, m_account);
+ slotSetTransaction(m_transaction);
+ } catch(MyMoneyException* e) {
+ delete e;
+ }
+}
+
+void KSplitTransactionDlg::slotSetTransaction(const MyMoneyTransaction& t)
+{
+ transactionsTable->slotCancelEdit();
+
+ m_transaction = t;
+ QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction);
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ // check if we can merge splits or not, have zero splits or not
+ QMap<QString, int> splits;
+ bool haveZeroSplit = false;
+ for(it = list.begin(); it != list.end(); ++it) {
+ splits[(*it).accountId()]++;
+ if(((*it).id() != m_split.id()) && ((*it).shares().isZero()))
+ haveZeroSplit = true;
+ }
+ QMap<QString, int>::const_iterator it_s;
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ if((*it_s) > 1)
+ break;
+ }
+ mergeBtn->setDisabled(it_s == splits.end());
+ clearZeroBtn->setEnabled(haveZeroSplit);
+
+ updateSums();
+}
+
+void KSplitTransactionDlg::updateSums(void)
+{
+ MyMoneyMoney splits(splitsValue());
+
+ if(m_amountValid == false) {
+ m_split.setValue(-splits);
+ m_transaction.modifySplit(m_split);
+ }
+
+ splitSum->setText("<b>" + splits.formatMoney("", m_precision) + " ");
+ splitUnassigned->setText("<b>" + diffAmount().formatMoney("", m_precision) + " ");
+ transactionAmount->setText("<b>" + (-m_split.value()).formatMoney("", m_precision) + " ");
+}
+
+MyMoneyMoney KSplitTransactionDlg::splitsValue(void)
+{
+ MyMoneyMoney splitsValue(m_calculatedValue);
+ QValueList<MyMoneySplit> list = transactionsTable->getSplits(m_transaction);
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ // calculate the current sum of all split parts
+ for(it = list.begin(); it != list.end(); ++it) {
+ if((*it).value() != MyMoneyMoney::autoCalc)
+ splitsValue += (*it).value();
+ }
+
+ return splitsValue;
+}
+
+MyMoneyMoney KSplitTransactionDlg::diffAmount(void)
+{
+ MyMoneyMoney diff(0);
+
+ // if there is an amount specified in the transaction, we need to calculate the
+ // difference, otherwise we display the difference as 0 and display the same sum.
+ if(m_amountValid) {
+ MyMoneySplit split = m_transaction.splits()[0];
+
+ diff = -(splitsValue() + split.value());
+ }
+ return diff;
+}
+
+void KSplitTransactionDlg::slotCreateCategory(const QString& name, QString& id)
+{
+ MyMoneyAccount acc, parent;
+ acc.setName(name);
+
+ if(m_isDeposit)
+ parent = MyMoneyFile::instance()->income();
+ else
+ parent = MyMoneyFile::instance()->expense();
+
+ // TODO extract possible first part of a hierarchy and check if it is one
+ // of our top categories. If so, remove it and select the parent
+ // according to this information.
+
+ emit createCategory(acc, parent);
+
+ // return id
+ id = acc.id();
+}
+
+#include "ksplittransactiondlg.moc"
diff --git a/kmymoney2/dialogs/ksplittransactiondlg.h b/kmymoney2/dialogs/ksplittransactiondlg.h
new file mode 100644
index 0000000..67a5b92
--- /dev/null
+++ b/kmymoney2/dialogs/ksplittransactiondlg.h
@@ -0,0 +1,174 @@
+/***************************************************************************
+ ksplittransactiondlg.h - description
+ -------------------
+ begin : Thu Jan 10 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSPLITTRANSACTIONDLG_H
+#define KSPLITTRANSACTIONDLG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpopupmenu.h>
+#include <kiconloader.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneymoney.h>
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/mymoneytransaction.h>
+
+class kMyMoneyEdit;
+class kMyMoneyLineEdit;
+
+#include "../dialogs/ksplittransactiondlgdecl.h"
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class KSplitTransactionDlg : public KSplitTransactionDlgDecl
+{
+ Q_OBJECT
+
+public:
+ KSplitTransactionDlg(const MyMoneyTransaction& t,
+ const MyMoneySplit& s,
+ const MyMoneyAccount& acc,
+ const bool amountValid,
+ const bool deposit,
+ const MyMoneyMoney& calculatedValue,
+ const QMap<QString, MyMoneyMoney>& priceInfo,
+ QWidget* parent = 0, const char* name = 0);
+
+ virtual ~KSplitTransactionDlg();
+
+ /**
+ * Using this method, an external object can retrieve the result
+ * of the dialog.
+ *
+ * @return MyMoneyTransaction based on the transaction passes during
+ * the construction of this object and modified using the
+ * dialog.
+ */
+ const MyMoneyTransaction& transaction(void) const { return m_transaction; };
+
+ /**
+ * This method calculates the difference between the split that references
+ * the account passed as argument to the constructor of this object and
+ * all the other splits shown in the register of this dialog.
+ *
+ * @return difference as MyMoneyMoney object
+ */
+ MyMoneyMoney diffAmount(void);
+
+ /**
+ * This method calculates the sum of the splits shown in the register
+ * of this dialog.
+ *
+ * @return sum of splits as MyMoneyMoney object
+ */
+ MyMoneyMoney splitsValue(void);
+
+private:
+ /**
+ * This method updates the display of the sums below the register
+ */
+ void updateSums(void);
+
+public slots:
+ int exec(void);
+
+protected slots:
+ void accept();
+ void reject();
+ void slotClearAllSplits(void);
+ void slotClearUnusedSplits(void);
+ void slotSetTransaction(const MyMoneyTransaction& t);
+ void slotCreateCategory(const QString& txt, QString& id);
+ void slotMergeSplits(void);
+
+ /// used internally to setup the initial size of all widgets
+ void initSize(void);
+
+signals:
+ /**
+ * This signal is sent out, when a new category needs to be created
+ * Depending on the setting of either a payment or deposit, the parent
+ * account will be preset to Expense or Income.
+ *
+ * @param account reference to account info. Will be filled by called slot
+ * @param parent reference to parent account
+ */
+ void createCategory(MyMoneyAccount& account, const MyMoneyAccount& parent);
+
+ /**
+ * Signal is emitted, if any of the widgets enters (@a state equals @a true)
+ * or leaves (@a state equals @a false) object creation mode.
+ *
+ * @param state Enter (@a true) or leave (@a false) object creation
+ */
+ void objectCreation(bool state);
+
+private:
+ /**
+ * This member keeps a copy of the current selected transaction
+ */
+ MyMoneyTransaction m_transaction;
+
+ /**
+ * This member keeps a copy of the currently selected account
+ */
+ MyMoneyAccount m_account;
+
+ /**
+ * This member keeps a copy of the currently selected split
+ */
+ MyMoneySplit m_split;
+
+ /**
+ * This member keeps the precision for the values
+ */
+ int m_precision;
+
+ /**
+ * flag that shows that the amount specified in the constructor
+ * should be used as fix value (true) or if it can be changed (false)
+ */
+ bool m_amountValid;
+
+ /**
+ * This member keeps track if the current transaction is of type
+ * deposit (true) or withdrawal (false).
+ */
+ bool m_isDeposit;
+
+ /**
+ * This member keeps the amount that will be assigned to all the
+ * splits that are marked 'will be calculated'.
+ */
+ MyMoneyMoney m_calculatedValue;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/ksplittransactiondlgdecl.ui b/kmymoney2/dialogs/ksplittransactiondlgdecl.ui
new file mode 100644
index 0000000..72a19e3
--- /dev/null
+++ b/kmymoney2/dialogs/ksplittransactiondlgdecl.ui
@@ -0,0 +1,424 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSplitTransactionDlgDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KSplitTransactionDlgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>656</width>
+ <height>408</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Split transaction</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout61</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="kMyMoneySplitTable">
+ <property name="name">
+ <cstring>transactionsTable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>5</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="cursor">
+ <cursor>0</cursor>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_sumFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout49</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>80</height>
+ </size>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>splitUnassigned</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;11,00&lt;b&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>transactionAmount</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;111,00&lt;b&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Unassigned</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Sum of splits</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>splitSum</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>100,00</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Transaction amount</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="Line" row="2" column="1">
+ <property name="name">
+ <cstring>Line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>Frame3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>15</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>80</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>mergeBtn</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Merge</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Merges splits with the same category to one split</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>In case you have multiple split entries to the same category and you like to keep them as a single split, press this button. The amount for identical categories will be added and stored in a single split for that category.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>clearZeroBtn</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Clear &amp;Zero</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Removes all splits that have a value of zero.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>clearAllBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Clear &amp;All</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer30</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>120</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>cancelBtn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>finishBtn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>1</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>kMyMoneySplitTable</class>
+ <header location="local">../dialogs/kmymoneysplittable.h</header>
+ <sizehint>
+ <width>330</width>
+ <height>390</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>3</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="256">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154388dad55db1184200c4c180bb81a28c73aad811228c356f42b3792db3cc0db2fc724bb7901dc7b270f27ed17fa5fa9b117b7cd90211f4ba0ac906a7f1453b4d30ca917bb590681552af23f69bfc4ffa71519d2c8f62546ea5ea03738b1c18c33a4d156f0d13f43b61952e4af6d6e8fb3a408f080448419a433d6486d85052fdba892a295f5d45785cd8c51a9d6de6a814a8d2131da51f98e7a3b64ec9da04a8db53d43be3c3c0b22cacf17e4cdb5a931649ceddf34b190cf0aa019f03f1fd3e7457f03b5a66c9ed26e86130000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/kstartdlg.cpp b/kmymoney2/dialogs/kstartdlg.cpp
new file mode 100644
index 0000000..d0af8eb
--- /dev/null
+++ b/kmymoney2/dialogs/kstartdlg.cpp
@@ -0,0 +1,243 @@
+/***************************************************************************
+ KStartDlg.cpp - description
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qvbox.h>
+#include <qlayout.h>
+#include <qbuttongroup.h>
+#include <qabstractlayout.h>
+#include <qpixmap.h>
+#include <qtextview.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include "kdecompat.h"
+
+#if QT_VERSION > 300
+#include <kstandarddirs.h>
+#else
+#include <kstddirs.h>
+#endif
+
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kglobalsettings.h>
+#include <kfiledialog.h>
+#include <kurl.h>
+#include <kurlrequester.h>
+#include <kfile.h>
+#include <kio/netaccess.h>
+#include <kmessagebox.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kstartdlg.h"
+#include "krecentfileitem.h"
+#include "../kmymoney2.h"
+
+#include <qtooltip.h>
+
+KStartDlg::KStartDlg(QWidget *parent, const char *name, bool modal) : KDialogBase(IconList,i18n("Start Dialog"),Help|Ok|Cancel,Ok, parent, name, modal, true)
+{
+ setPage_Template();
+ setPage_Documents();
+
+ isnewfile = false;
+ isopenfile = false;
+
+ readConfig();
+}
+
+KStartDlg::~KStartDlg()
+{
+}
+
+/** Set the font Page of the preferences dialog */
+void KStartDlg::setPage_Template()
+{
+ KIconLoader *ic = KGlobal::iconLoader();
+ templateMainFrame = addVBoxPage( i18n("Templates"), i18n("Select templates"), DesktopIcon("wizard"));
+ view_wizard = new KIconView( templateMainFrame, "view_options" );
+ (void)new QIconViewItem( view_wizard, i18n("New KMyMoney document"), ic->loadIcon("mime_empty.png", KIcon::Desktop, KIcon::SizeLarge)/*QPixmap( locate("icon","hicolor/48x48/mimetypes/mime_empty.png") )*/ );
+ connect(view_wizard, SIGNAL(executed(QIconViewItem *) ), this, SLOT(slotTemplateClicked(QIconViewItem *) ) );
+ connect(view_wizard, SIGNAL(selectionChanged(QIconViewItem*)),
+ this, SLOT(slotTemplateSelectionChanged(QIconViewItem*)));
+ connect(this, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT(slotAboutToShowPage(QWidget*)));
+}
+
+/** Set the Misc options Page of the preferences dialog */
+void KStartDlg::setPage_Documents()
+{
+ recentMainFrame = addPage( i18n("Open"), i18n("Open a KMyMoney document"), DesktopIcon("fileopen"));
+ QVBoxLayout *mainLayout = new QVBoxLayout( recentMainFrame );
+
+ kurlrequest = new KURLRequester( recentMainFrame, "kurlrequest" );
+
+ //allow user to select either a .kmy file, or any generic file.
+ kurlrequest->fileDialog()->setFilter( i18n("%1|KMyMoney files (*.kmy)\n" "%2|All files (*.*)").arg("*.kmy").arg("*.*") );
+ kurlrequest->fileDialog()->setMode(KFile::File || KFile::ExistingOnly);
+ kurlrequest->fileDialog()->setURL(KURL(kmymoney2->readLastUsedDir()));//kurlrequest->fileDialog()->setURL(KURL(KGlobalSettings::documentPath()));
+ mainLayout->addWidget( kurlrequest );
+
+ QLabel *label1 = new QLabel( recentMainFrame, "label1" );
+ label1->setText( i18n("Recent Files") );
+ mainLayout->addWidget( label1 );
+ view_recent = new KIconView( recentMainFrame, "view_recent" );
+ connect( view_recent, SIGNAL( executed(QIconViewItem *) ), this, SLOT( slotRecentClicked(QIconViewItem *) ) );
+ mainLayout->addWidget( view_recent );
+ view_recent->setArrangement(KIconView::LeftToRight/*TopToBottom*/);
+ view_recent->setItemTextPos(KIconView::Bottom);
+
+ connect(view_recent, SIGNAL(selectionChanged(QIconViewItem*)),
+ this, SLOT(slotRecentSelectionChanged(QIconViewItem*)));
+}
+
+void KStartDlg::slotTemplateClicked(QIconViewItem *item)
+{
+ if(!item) return;
+
+ // If the item is the blank document turn isnewfile variable true, else is template or wizard
+ if( item->text() == i18n("New KMyMoney document") )
+ isnewfile = true;
+ else
+ templatename = item->text();
+
+ isopenfile = false;
+ // Close the window if the user pressed an icon
+ slotOk();
+}
+
+/** Read config window */
+void KStartDlg::readConfig()
+{
+ QString value;
+ unsigned int i = 1;
+
+ KConfig *config = KGlobal::config();
+ KIconLoader *il = KGlobal::iconLoader();
+
+ // read file list
+ do {
+ // for some reason, I had to setup the group to get reasonable results
+ // after program startup. If the wizard was opened the second time,
+ // it does not make a difference, if you call setGroup() outside of
+ // this loop. The first time it does make a difference!
+ config->setGroup("Recent Files");
+ value = config->readEntry( QString( "File%1" ).arg( i ), QString::null );
+ if( !value.isNull() && fileExists(value) )
+ {
+ QString file_name = value.mid(value.findRev('/')+1);
+ (void)new KRecentFileItem( value, view_recent, file_name, il->loadIcon("kmy", KIcon::Desktop, KIcon::SizeLarge));
+ }
+ i++;
+ } while( !value.isNull() );
+
+ config->setGroup("Start Dialog");
+ QSize *defaultSize = new QSize(400,300);
+ this->resize( config->readSizeEntry("Geometry", defaultSize ) );
+
+ // Restore the last page viewed
+ // default to the recent files page if no entry exists but files have been found
+ // otherwise, default to template page
+ if(view_recent->count() > 0)
+ showPage(config->readNumEntry("LastPage", this->pageIndex(recentMainFrame)));
+ else {
+ showPage(config->readNumEntry("LastPage", this->pageIndex(templateMainFrame)));
+ slotAboutToShowPage(templateMainFrame);
+ }
+}
+
+/** Write config window */
+void KStartDlg::writeConfig()
+{
+ KConfig *config = KGlobal::config();
+
+ config->setGroup("Start Dialog");
+ config->writeEntry("Geometry", this->size() );
+ config->writeEntry("LastPage", this->activePageIndex());
+ config->sync();
+}
+
+/** slot to recent view */
+void KStartDlg::slotRecentClicked(QIconViewItem *item)
+{
+ KRecentFileItem *kitem = (KRecentFileItem*)item;
+ if(!kitem) return;
+
+ isopenfile = true;
+ kurlrequest->setURL( kitem->fileURL() );
+ // Close the window if the user press an icon
+ slotOk();
+}
+
+/** No descriptions */
+void KStartDlg::slotOk()
+{
+ writeConfig();
+ this->accept();
+}
+
+bool KStartDlg::fileExists(KURL url)
+{
+#if KDE_IS_VERSION(3,2,0)
+ return KIO::NetAccess::exists(url, true, this);
+#else
+ return KIO::NetAccess::exists(url);
+#endif
+}
+
+void KStartDlg::slotTemplateSelectionChanged(QIconViewItem* item)
+{
+ if(!item) return;
+
+ // Clear the other selection
+ view_recent->clearSelection();
+
+ // If the item is the blank document turn isnewfile
+ // variable true, else is template or wizard
+ if( item->text() == i18n("Blank Document") )
+ isnewfile = true;
+ else
+ templatename = item->text();
+
+ isopenfile = false;
+}
+
+void KStartDlg::slotRecentSelectionChanged(QIconViewItem* item)
+{
+ KRecentFileItem *kitem = (KRecentFileItem*)item;
+ if(!kitem) return;
+
+ // Clear the other selection
+ view_wizard->clearSelection();
+
+ isnewfile = false;
+ isopenfile = true;
+ kurlrequest->setURL( kitem->fileURL() );
+}
+
+void KStartDlg::slotAboutToShowPage(QWidget* page)
+{
+ enableButtonOK(page == recentMainFrame);
+}
+
+#include "kstartdlg.moc"
diff --git a/kmymoney2/dialogs/kstartdlg.h b/kmymoney2/dialogs/kstartdlg.h
new file mode 100644
index 0000000..a09f72d
--- /dev/null
+++ b/kmymoney2/dialogs/kstartdlg.h
@@ -0,0 +1,84 @@
+
+/***************************************************************************
+ kstartdlg.h - description
+ -------------------
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSTARTDLG_H
+#define KSTARTDLG_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <kdialogbase.h>
+
+#include <klocale.h>
+#include <kfontdialog.h>
+#include <kurlrequester.h>
+#include <kiconview.h>
+
+#include <qstring.h>
+#include <qradiobutton.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+
+/**KMyMoney 2 start dialog
+ */
+
+class KStartDlg : public KDialogBase {
+ Q_OBJECT
+public:
+ KStartDlg( QWidget *parent=0, const char *name=0, bool modal=true );
+ virtual ~KStartDlg();
+ bool isNewFile(void) const { return isnewfile; }
+ bool isOpenFile(void) const { return !kurlrequest->url().isEmpty(); }
+ const QString getURL(void) const { return kurlrequest->url(); }
+ QString getTemplateName(void) const { return templatename; }
+
+private: // Private methods
+ QString m_filename;
+ bool fileExists(KURL url);
+
+ void setPage_Template();
+ void setPage_Documents();
+ /** misc widgets */
+ /** Write config window */
+ void writeConfig();
+ /** Read config window */
+ void readConfig();
+ KIconView *view_wizard;
+ KIconView *view_recent;
+ KURLRequester *kurlrequest;
+ /** misc variables */
+ bool isnewfile;
+ bool isopenfile;
+ QString templatename;
+ QVBox *templateMainFrame;
+ QFrame *recentMainFrame;
+
+protected slots:
+ /** No descriptions */
+ void slotOk();
+private slots:
+ void slotTemplateClicked(QIconViewItem *item);
+ /** slot to recent view */
+ void slotRecentClicked(QIconViewItem *item);
+
+ /** Handle selections */
+ void slotTemplateSelectionChanged(QIconViewItem* item);
+ void slotRecentSelectionChanged(QIconViewItem* item);
+ void slotAboutToShowPage(QWidget* page);
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kupdatestockpricedlg.cpp b/kmymoney2/dialogs/kupdatestockpricedlg.cpp
new file mode 100644
index 0000000..05eee8a
--- /dev/null
+++ b/kmymoney2/dialogs/kupdatestockpricedlg.cpp
@@ -0,0 +1,119 @@
+/***************************************************************************
+ kupdatestockpricedlg.cpp - description
+ -------------------
+ begin : Thu Feb 7 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kupdatestockpricedlg.h"
+#include "../widgets/kmymoneycurrencyselector.h"
+
+KUpdateStockPriceDlg::KUpdateStockPriceDlg(QWidget* parent, const char* name) :
+ kUpdateStockPriceDecl(parent, name, true)
+{
+ m_date->setDate(QDate::currentDate());
+ init();
+}
+
+KUpdateStockPriceDlg::~KUpdateStockPriceDlg()
+{
+}
+
+void KUpdateStockPriceDlg::init()
+{
+ m_okButton->setGuiItem(KStdGuiItem::ok());
+ m_cancelButton->setGuiItem(KStdGuiItem::cancel());
+
+ connect(m_okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+
+ connect(m_security, SIGNAL(activated(int)), this, SLOT(slotCheckData()));
+ connect(m_currency, SIGNAL(activated(int)), this, SLOT(slotCheckData()));
+
+ // load initial values into the selection widgets
+ m_currency->update(QString());
+ m_security->update(QString());
+
+ slotCheckData();
+}
+
+int KUpdateStockPriceDlg::exec(void)
+{
+ slotCheckData();
+ return kUpdateStockPriceDecl::exec();
+}
+
+void KUpdateStockPriceDlg::slotCheckData(void)
+{
+ QString from = m_security->security().id();
+ QString to = m_currency->security().id();
+
+ m_okButton->setEnabled(!from.isEmpty() && !to.isEmpty() && from != to);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#include "kupdatestockpricedlg.moc"
diff --git a/kmymoney2/dialogs/kupdatestockpricedlg.h b/kmymoney2/dialogs/kupdatestockpricedlg.h
new file mode 100644
index 0000000..c7dd407
--- /dev/null
+++ b/kmymoney2/dialogs/kupdatestockpricedlg.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ kupdatestockpricedlg.h - description
+ -------------------
+ begin : Thu Feb 7 2002
+ copyright : (C) 2000-2002 by Michael Edwardes
+ email : mte@users.sourceforge.net
+ Javier Campos Morales <javi_c@users.sourceforge.net>
+ Felix Rodriguez <frodriguez@users.sourceforge.net>
+ John C <thetacoturtle@users.sourceforge.net>
+ Thomas Baumgart <ipwizard@users.sourceforge.net>
+ Kevin Tambascio <ktambascio@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef KUPDATESTOCKPRICEDLG_H
+#define KUPDATESTOCKPRICEDLG_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qdatetime.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kdialogbase.h>
+#include <klocale.h>
+#include <kpushbutton.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "../dialogs/kupdatestockpricedlgdecl.h"
+
+#include <kmymoney/mymoneyprice.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneyedit.h>
+
+/**
+ * @author Kevin Tambascio
+ */
+class KUpdateStockPriceDlg : public kUpdateStockPriceDecl
+{
+ Q_OBJECT
+
+public:
+ KUpdateStockPriceDlg(QWidget* parent = NULL, const char* name = NULL);
+ ~KUpdateStockPriceDlg();
+
+ const QDate date() const { return m_date->date(); };
+ const MyMoneyMoney price(void) const;
+
+public slots:
+ int exec(void);
+
+protected slots:
+ void slotCheckData(void);
+
+private:
+ void init();
+
+};
+
+#endif
diff --git a/kmymoney2/dialogs/kupdatestockpricedlgdecl.ui b/kmymoney2/dialogs/kupdatestockpricedlgdecl.ui
new file mode 100644
index 0000000..d9770b2
--- /dev/null
+++ b/kmymoney2/dialogs/kupdatestockpricedlgdecl.ui
@@ -0,0 +1,257 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>kUpdateStockPriceDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>kUpdateStockPriceDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>457</width>
+ <height>194</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New price entry</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout38</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout37</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_date</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer25</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout36</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneySecuritySelector">
+ <property name="name">
+ <cstring>m_currency</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer26</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Currency</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>lblDate</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Security</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout35</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneySecuritySelector">
+ <property name="name">
+ <cstring>m_security</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line6</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>2</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/mymoneyqifprofileeditor.cpp b/kmymoney2/dialogs/mymoneyqifprofileeditor.cpp
new file mode 100644
index 0000000..cc43ced
--- /dev/null
+++ b/kmymoney2/dialogs/mymoneyqifprofileeditor.cpp
@@ -0,0 +1,483 @@
+/***************************************************************************
+ kqifprofileeditor.cpp - description
+ -------------------
+ begin : Tue Dec 24 2002
+ copyright : (C) 2002 by Thomas Baumgart
+ email : thb@net-bembel.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include <qlistview.h>
+#include <qcheckbox.h>
+#include <qtabwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include "kdecompat.h"
+#include <klocale.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+#include <kcombobox.h>
+#include <kurlrequester.h>
+#include <kiconloader.h>
+#include <kapplication.h>
+
+#if KDE_IS_VERSION(3,2,0)
+ #include <kinputdialog.h>
+#else
+ #include <klineeditdlg.h>
+#endif
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "mymoneyqifprofileeditor.h"
+
+MyMoneyQifProfileNameValidator::MyMoneyQifProfileNameValidator(QObject *o, const char *name)
+ : QValidator(o, name)
+{
+}
+
+MyMoneyQifProfileNameValidator::~MyMoneyQifProfileNameValidator()
+{
+}
+
+QValidator::State MyMoneyQifProfileNameValidator::validate(QString& name, int&) const
+{
+ KConfig* config = KGlobal::config();
+ config->setGroup("Profiles");
+ QStringList list = config->readListEntry("profiles");
+
+ // invalid character?
+ if(name.contains(",") != 0)
+ return QValidator::Invalid;
+
+ // would not work in this form (empty or existing name)
+ if(name.isEmpty() || list.contains(name))
+ return QValidator::Intermediate;
+
+ // is OK
+ return QValidator::Acceptable;
+}
+
+MyMoneyQifProfileEditor::MyMoneyQifProfileEditor(const bool edit, QWidget *parent, const char *name )
+ : MyMoneyQifProfileEditorDecl(parent,name),
+ m_inEdit(edit),
+ m_isDirty(false),
+ m_isAccepted(false),
+ m_selectedAmountType(0)
+{
+ // we don't need the date and amounts tab anymore, so we just hide them for now
+ profileTabs->removePage( tabMoney );
+ profileTabs->removePage( tabDate );
+
+ loadWidgets();
+ loadProfileListFromConfig();
+
+ // load button icons
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem newButtenItem( i18n( "&New" ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new profile"),
+ i18n("Use this to create a new QIF import/export profile"));
+ m_newButton->setGuiItem(newButtenItem);
+
+ connect(m_profileListBox, SIGNAL(highlighted(const QString&)), this, SLOT(slotLoadProfileFromConfig(const QString&)));
+ connect(m_resetButton, SIGNAL(clicked()), this, SLOT(slotReset()));
+ connect(m_okButton, SIGNAL(clicked()), this, SLOT(slotOk()));
+ connect(m_renameButton, SIGNAL(clicked()), this, SLOT(slotRename()));
+ connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(slotDelete()));
+ connect(m_newButton, SIGNAL(clicked()), this, SLOT(slotNew()));
+ connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_helpButton, SIGNAL(clicked()), this, SLOT(slotHelp()));
+
+ connect(m_editDescription, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setProfileDescription(const QString&)));
+ connect(m_editType, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setProfileType(const QString&)));
+ connect(m_editOpeningBalance, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setOpeningBalanceText(const QString&)));
+ connect(m_editAccountDelimiter, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setAccountDelimiter(const QString&)));
+ connect(m_editVoidMark, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setVoidMark(const QString&)));
+
+ //connect(m_editDateFormat, SIGNAL(highlighted(const QString&)), &m_profile, SLOT(setDateFormat(const QString&)));
+ connect(m_editApostrophe, SIGNAL(highlighted(const QString&)), &m_profile, SLOT(setApostropheFormat(const QString&)));
+
+ connect(m_editAmounts, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotAmountTypeSelected(QListViewItem*)));
+ connect(m_decimalBox, SIGNAL(activated(const QString&)), this, SLOT(slotDecimalChanged(const QString&)));
+ connect(m_thousandsBox, SIGNAL(activated(const QString&)), this, SLOT(slotThousandsChanged(const QString&)));
+
+ connect(m_editInputFilterLocation, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setFilterScriptImport(const QString&)));
+ connect(m_editInputFilterLocation, SIGNAL(urlSelected(const QString&)), m_editInputFilterLocation, SLOT(setURL(const QString&)));
+
+ connect(m_editInputFilterFileType, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setFilterFileType(const QString&)));
+
+ connect(m_editOutputFilterLocation, SIGNAL(textChanged(const QString&)), &m_profile, SLOT(setFilterScriptExport(const QString&)));
+ connect(m_editOutputFilterLocation, SIGNAL(urlSelected(const QString&)), m_editOutputFilterLocation, SLOT(setURL(const QString&)));
+
+ connect(m_attemptMatch, SIGNAL(toggled(bool)), &m_profile, SLOT(setAttemptMatchDuplicates(bool)));
+}
+
+MyMoneyQifProfileEditor::~MyMoneyQifProfileEditor()
+{
+ if(m_inEdit && m_isDirty && m_isAccepted) {
+ KConfig* config = KGlobal::config();
+ config->sync();
+ } else {
+ slotReset();
+ }
+ delete tabMoney;
+ delete tabDate;
+}
+
+void MyMoneyQifProfileEditor::loadWidgets(void)
+{
+ if(m_inEdit)
+ setCaption(i18n("QIF Profile Editor"));
+ else
+ setCaption(i18n("QIF Profile Selector"));
+
+ m_editDateFormat->clear();
+ m_editDateFormat->insertItem( "%d/%m/%yy" );
+ m_editDateFormat->insertItem( "%d/%mmm/%yy" );
+ m_editDateFormat->insertItem( "%d/%m/%yyyy" );
+ m_editDateFormat->insertItem( "%d/%mmm/%yyyy" );
+ m_editDateFormat->insertItem( "%d/%m%yy" );
+ m_editDateFormat->insertItem( "%d/%mmm%yy" );
+ m_editDateFormat->insertItem( "%d.%m.%yy" );
+ m_editDateFormat->insertItem( "%d.%m.%yyyy" );
+ m_editDateFormat->insertItem( "%m.%d.%yy" );
+ m_editDateFormat->insertItem( "%m.%d.%yyyy" );
+ m_editDateFormat->insertItem( "%m/%d/%yy" );
+ m_editDateFormat->insertItem( "%mmm/%d/%yy" );
+ m_editDateFormat->insertItem( "%m/%d/%yyyy" );
+ m_editDateFormat->insertItem( "%m-%d-%yyyy" );
+ m_editDateFormat->insertItem( "%mmm/%d/%yyyy" );
+ m_editDateFormat->insertItem( "%m%d%yy" );
+ m_editDateFormat->insertItem( "%mmm/%d%yy" );
+ m_editDateFormat->insertItem( "%yyyy-%mm-%dd" );
+ m_editDateFormat->insertItem( "%m/%d'%yyyy" );
+
+ m_editApostrophe->clear();
+ m_editApostrophe->insertItem( "1900-1949" );
+ m_editApostrophe->insertItem( "1900-1999" );
+ m_editApostrophe->insertItem( "2000-2099" );
+
+ m_editAmounts->setColumnAlignment(1, Qt::AlignCenter);
+ m_editAmounts->setColumnAlignment(2, Qt::AlignCenter);
+ m_editAmounts->setColumnAlignment(3, Qt::AlignCenter);
+
+ m_editAmounts->setColumnWidth(4, 0);
+ m_editAmounts->setColumnWidthMode(4, QListView::Manual);
+ m_editAmounts->setSorting(4);
+ m_editAmounts->sort();
+
+ m_decimalBox->insertItem( " " );
+ m_decimalBox->insertItem( "," );
+ m_decimalBox->insertItem( "." );
+
+ m_thousandsBox->insertItem( " " );
+ m_thousandsBox->insertItem( "," );
+ m_thousandsBox->insertItem( "." );
+
+ m_editDescription->setEnabled(m_inEdit);
+ m_editType->setEnabled(m_inEdit);
+ m_editDateFormat->setEnabled(m_inEdit);
+ m_editApostrophe->setEnabled(m_inEdit);
+ m_editAmounts->setEnabled(m_inEdit);
+ m_decimalBox->setEnabled(m_inEdit);
+ m_thousandsBox->setEnabled(m_inEdit);
+ m_editOpeningBalance->setEnabled(m_inEdit);
+ m_editAccountDelimiter->setEnabled(m_inEdit);
+ m_editVoidMark->setEnabled(m_inEdit);
+ m_editInputFilterLocation->setEnabled(m_inEdit);
+ m_editOutputFilterLocation->setEnabled(m_inEdit);
+ m_editInputFilterFileType->setEnabled(m_inEdit);
+
+ if(!m_inEdit) {
+ m_renameButton->hide();
+ m_deleteButton->hide();
+ m_resetButton->hide();
+ m_newButton->hide();
+ }
+}
+
+void MyMoneyQifProfileEditor::loadProfileListFromConfig(void)
+{
+ QFontMetrics fontMetrics(m_profileListBox->font());
+ int w = 100; // minimum is 100 pixels width for the list box
+
+ if(m_profile.isDirty()) {
+ m_profile.saveProfile();
+ m_isDirty = true;
+ }
+
+ m_profileListBox->clear();
+
+ QStringList list;
+ KConfig* config = KGlobal::config();
+ config->setGroup("Profiles");
+ list = config->readListEntry("profiles");
+
+ if(list.count() == 0) {
+ m_profile.clear();
+ m_profile.setProfileDescription(i18n("The default QIF profile"));
+ addProfile("Default");
+
+ config->setGroup("Profiles");
+ list = config->readListEntry("profiles");
+ }
+
+ list.sort();
+
+ m_profileListBox->insertStringList(list);
+ if(list.count() > 0) {
+ m_profileListBox->setSelected(0, true);
+ slotLoadProfileFromConfig(list[0]);
+ }
+ for(unsigned int i = 0; i < list.count(); ++i) {
+ int nw = fontMetrics.width(list[i]) + 10;
+ w = QMAX( w, nw );
+ }
+ w = QMIN(w, 200);
+ m_profileListBox->setMinimumWidth(w);
+}
+
+void MyMoneyQifProfileEditor::slotLoadProfileFromConfig(const QString& profile)
+{
+ QString profileName = profile;
+
+ if(m_profile.isDirty()) {
+ m_profile.saveProfile();
+ m_isDirty = true;
+ }
+
+ if(m_profileListBox->findItem(profileName, Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
+ profileName = m_profileListBox->text(0);
+ }
+
+ m_profile.loadProfile("Profile-" + profileName);
+
+ QListBoxItem *lbi = m_profileListBox->findItem(profileName, Qt::ExactMatch | Qt::CaseSensitive);
+ int idx = m_profileListBox->index(lbi);
+ showProfile();
+ if(idx >= 0) {
+ m_profileListBox->setSelected(idx, true);
+ }
+}
+
+void MyMoneyQifProfileEditor::showProfile(void)
+{
+ m_editDescription->setText(m_profile.profileDescription());
+ m_editType->setText(m_profile.profileType());
+ m_editOpeningBalance->setText(m_profile.openingBalanceText());
+ m_editAccountDelimiter->setText(m_profile.accountDelimiter());
+ m_editVoidMark->setText(m_profile.voidMark());
+ m_editInputFilterLocation->setURL(m_profile.filterScriptImport());
+ m_editOutputFilterLocation->setURL(m_profile.filterScriptExport());
+ m_editInputFilterFileType->setText(m_profile.filterFileType());
+
+ m_editDateFormat->setCurrentText(m_profile.outputDateFormat());
+ m_editApostrophe->setCurrentText(m_profile.apostropheFormat());
+
+ m_attemptMatch->setChecked(m_profile.attemptMatchDuplicates());
+
+ QListViewItem* item;
+ QListViewItemIterator it(m_editAmounts);
+
+ while((item = it.current()) != 0) {
+ QChar key = item->text(1)[0];
+ item->setText(2, m_profile.amountDecimal(key));
+ item->setText(3, m_profile.amountThousands(key));
+ if(m_selectedAmountType == 0 && key == 'T' && m_inEdit) {
+ m_editAmounts->setSelected(item, true);
+ slotAmountTypeSelected(item);
+ } else if(item == m_selectedAmountType) {
+ slotAmountTypeSelected(item);
+ }
+ ++it;
+ }
+}
+
+void MyMoneyQifProfileEditor::deleteProfile(const QString& name)
+{
+ KConfig* config = KGlobal::config();
+
+ config->deleteGroup("Profile-" + name);
+
+ config->setGroup("Profiles");
+ QStringList list = config->readListEntry("profiles");
+ list.remove(name);
+
+ config->writeEntry("profiles", list);
+ m_isDirty = true;
+}
+
+void MyMoneyQifProfileEditor::addProfile(const QString& name)
+{
+ KConfig* config = KGlobal::config();
+ config->setGroup("Profiles");
+ QStringList list = config->readListEntry("profiles");
+
+ list += name;
+ list.sort();
+ config->writeEntry("profiles", list);
+
+ m_profile.setProfileName("Profile-" + name);
+ m_profile.saveProfile();
+
+ m_isDirty = true;
+}
+
+void MyMoneyQifProfileEditor::slotOk(void)
+{
+ if(m_profile.isDirty())
+ m_isDirty = true;
+
+ m_profile.saveProfile();
+
+ KConfig* config = KGlobal::config();
+ config->sync();
+
+ m_isAccepted = true;
+ accept();
+}
+
+void MyMoneyQifProfileEditor::slotReset(void)
+{
+ // first flush any changes
+ m_profile.saveProfile();
+
+ KConfig* config = KGlobal::config();
+ config->rollback();
+ config->reparseConfiguration();
+
+ QString currentProfile = m_profile.profileName().mid(8);
+ loadProfileListFromConfig();
+ slotLoadProfileFromConfig(currentProfile);
+ m_isDirty = false;
+}
+
+void MyMoneyQifProfileEditor::slotRename(void)
+{
+ bool ok;
+ QString newName = enterName(ok);
+
+ if(ok == true) {
+ deleteProfile(m_profile.profileName().mid(8));
+ addProfile(newName);
+ loadProfileListFromConfig();
+ slotLoadProfileFromConfig(newName);
+ }
+}
+
+void MyMoneyQifProfileEditor::slotNew(void)
+{
+ bool ok;
+ QString newName = enterName(ok);
+
+ if(ok == true) {
+ m_profile.clear();
+ addProfile(newName);
+ loadProfileListFromConfig();
+ slotLoadProfileFromConfig(newName);
+ }
+}
+
+const QString MyMoneyQifProfileEditor::enterName(bool& ok)
+{
+ MyMoneyQifProfileNameValidator val(this, "Validator");
+#if KDE_IS_VERSION(3,2,0)
+ return KInputDialog::getText(i18n("QIF Profile Editor"),
+ i18n("Enter new profile name"),
+ QString::null,
+ &ok,
+ this,
+ 0,
+ &val,
+ 0);
+#else
+ QString rc;
+
+ // the blank in the next line as the value for the edit box is
+ // there on purpose, so that with the following call to validateAndSet
+ // the state is changed and the OK-Button is greyed
+ KLineEditDlg* dlg = new KLineEditDlg(i18n("Enter new profile name"), " ", this);
+ dlg->lineEdit()->setValidator(&val);
+ dlg->lineEdit()->validateAndSet("", 0, 0, 0);
+
+ ok = false;
+ if(dlg->exec()) {
+ ok = true;
+ }
+ rc = dlg->lineEdit()->text();
+ delete dlg;
+
+ return rc;
+#endif
+}
+
+void MyMoneyQifProfileEditor::slotDelete(void)
+{
+ QString profile = m_profile.profileName().mid(8);
+
+ if(KMessageBox::questionYesNo(this, i18n("Do you really want to delete profile '%1'?").arg(profile)) == KMessageBox::Yes) {
+ int idx = m_profileListBox->currentItem();
+ m_profile.saveProfile();
+ deleteProfile(profile);
+ loadProfileListFromConfig();
+ if(idx >= static_cast<int> (m_profileListBox->count()))
+ idx = m_profileListBox->count() - 1;
+
+ slotLoadProfileFromConfig(m_profileListBox->text(idx));
+ }
+}
+
+void MyMoneyQifProfileEditor::slotHelp(void)
+{
+ kapp->invokeHelp("details.impexp.qifimp.profile");
+}
+
+void MyMoneyQifProfileEditor::slotAmountTypeSelected(QListViewItem* item)
+{
+ m_decimalBox->setCurrentText(item->text(2));
+ m_thousandsBox->setCurrentText(item->text(3));
+ m_selectedAmountType = item;
+}
+
+void MyMoneyQifProfileEditor::slotDecimalChanged(const QString& val)
+{
+ if(m_selectedAmountType != 0) {
+ QChar key = m_selectedAmountType->text(1)[0];
+ m_profile.setAmountDecimal(key, val[0]);
+ m_selectedAmountType->setText(2, val);
+ }
+}
+
+void MyMoneyQifProfileEditor::slotThousandsChanged(const QString& val)
+{
+ if(m_selectedAmountType != 0) {
+ QChar key = m_selectedAmountType->text(1)[0];
+ m_profile.setAmountThousands(key, val[0]);
+ m_selectedAmountType->setText(3, val);
+ }
+}
+
+const QString MyMoneyQifProfileEditor::selectedProfile() const
+{
+ return m_profileListBox->currentText();
+}
+
+#include "mymoneyqifprofileeditor.moc"
diff --git a/kmymoney2/dialogs/mymoneyqifprofileeditor.h b/kmymoney2/dialogs/mymoneyqifprofileeditor.h
new file mode 100644
index 0000000..ce95c9a
--- /dev/null
+++ b/kmymoney2/dialogs/mymoneyqifprofileeditor.h
@@ -0,0 +1,96 @@
+/***************************************************************************
+ kqifprofileeditor.h - description
+ -------------------
+ begin : Tue Dec 24 2002
+ copyright : (C) 2002 by Thomas Baumgart
+ email : thb@net-bembel.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MYMONEYQIFPROFILEEDITOR_H
+#define MYMONEYQIFPROFILEEDITOR_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+#include <qvalidator.h>
+class QListViewItem;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "mymoneyqifprofileeditordecl.h"
+#include "../converter/mymoneyqifprofile.h"
+
+/**
+ * @author Thomas Baumgart
+ */
+
+class MyMoneyQifProfileNameValidator : public QValidator
+{
+ Q_OBJECT
+
+public:
+ MyMoneyQifProfileNameValidator(QObject *o, const char *name);
+ virtual ~MyMoneyQifProfileNameValidator();
+
+ QValidator::State validate(QString&, int&) const;
+};
+
+
+class MyMoneyQifProfileEditor : public MyMoneyQifProfileEditorDecl
+{
+ Q_OBJECT
+
+public:
+ MyMoneyQifProfileEditor(const bool edit = false, QWidget *parent=0, const char *name=0);
+ virtual ~MyMoneyQifProfileEditor();
+
+ /**
+ * This method returns the currently selected profile in the list box.
+ */
+ const QString selectedProfile() const;
+
+public slots:
+ void slotOk(void);
+
+protected slots:
+ void slotLoadProfileFromConfig(const QString& name);
+ void slotReset(void);
+ void slotRename(void);
+ void slotDelete(void);
+ void slotNew(void);
+ void slotAmountTypeSelected(QListViewItem*);
+ void slotDecimalChanged(const QString& val);
+ void slotThousandsChanged(const QString& val);
+ void slotHelp(void);
+
+private:
+ void loadProfileListFromConfig(void);
+ void loadWidgets(void);
+ void showProfile(void);
+ void addProfile(const QString& name);
+ void deleteProfile(const QString& name);
+ const QString enterName(bool& ok);
+
+private:
+ bool m_inEdit;
+ MyMoneyQifProfile m_profile;
+ bool m_isDirty;
+ bool m_isAccepted;
+ QListViewItem* m_selectedAmountType;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/mymoneyqifprofileeditordecl.ui b/kmymoney2/dialogs/mymoneyqifprofileeditordecl.ui
new file mode 100644
index 0000000..43e56fa
--- /dev/null
+++ b/kmymoney2/dialogs/mymoneyqifprofileeditordecl.ui
@@ -0,0 +1,905 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>MyMoneyQifProfileEditorDecl</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyMoneyQifProfileEditorDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>736</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>QIF Profile Editor</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListBox">
+ <item>
+ <property name="text">
+ <string></string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_profileListBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="variableWidth">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>profileTabs</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tabGeneral</cstring>
+ </property>
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2_3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Void mark</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Opening Balance text</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_editOpeningBalance</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Type field text</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>m_editAccountDelimiter</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>m_editVoidMark</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Account delimiter</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_editType</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_editDescription</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_attemptMatch</cstring>
+ </property>
+ <property name="text">
+ <string>Attempt to match similar transactions</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tabDate</cstring>
+ </property>
+ <attribute name="title">
+ <string>Date</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout43</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout36</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>m_editDateFormat</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The format of the dates in the QIF file.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Date Format</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The format of the dates in the QIF file.</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>m_editApostrophe</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a QIF file contains date entries with years represented with two digits then either an apostrophe or a slash may be used to delimit the year in the dates for certain centuries. This enables 1905 to be distinguished from 2005. Specify here which range of years will have year delimited by an apostrophe (eg. for Quicken this is usually 1900-1949).</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Apostrophe Handling</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a QIF file contains date entries with years represented with two digits then either an apostrophe or a slash may be used to delimit the year in the dates for certain centuries. This enables 1905 to be distinguished from 2005. Specify here which range of years will have year delimited by an apostrophe (eg. for Quicken this is usually 1900-1949).</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tabMoney</cstring>
+ </property>
+ <attribute name="title">
+ <string>Amounts</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Field</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>QIF-Record</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Decimal Symbol</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Thousand Delimiter</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>SortColumnInvisible</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <item>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="text">
+ <string>T</string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Split-Value</string>
+ </property>
+ <property name="text">
+ <string>$</string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Commission</string>
+ </property>
+ <property name="text">
+ <string>O</string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string>2</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ <property name="text">
+ <string>I</string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string>3</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Quantity</string>
+ </property>
+ <property name="text">
+ <string>Q</string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="text">
+ <string>4</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_editAmounts</cstring>
+ </property>
+ <property name="hScrollBarMode">
+ <enum>AlwaysOff</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="defaultRenameAction">
+ <enum>Accept</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout41</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout40</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>m_thousandsBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Decimal Symbol</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Thousands Separator</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>m_decimalBox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tabFilter</cstring>
+ </property>
+ <attribute name="title">
+ <string>Filter</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel1_4_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Output filter location</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>m_editInputFilterLocation</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>m_editOutputFilterLocation</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1_4_3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Input filter file type</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_editInputFilterFileType</cstring>
+ </property>
+ <property name="text">
+ <string>*.qif</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_4</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Input filter location</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>90</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_helpButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>11</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_newButton</cstring>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_deleteButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>22</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_renameButton</cstring>
+ </property>
+ <property name="text">
+ <string>Rename</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>104</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_resetButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Reset</string>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>21</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="stdItem" stdset="0">
+ <number>2</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<tabstops>
+ <tabstop>m_profileListBox</tabstop>
+ <tabstop>profileTabs</tabstop>
+ <tabstop>m_editDescription</tabstop>
+ <tabstop>m_editType</tabstop>
+ <tabstop>m_editOpeningBalance</tabstop>
+ <tabstop>m_editAccountDelimiter</tabstop>
+ <tabstop>m_editVoidMark</tabstop>
+ <tabstop>m_helpButton</tabstop>
+ <tabstop>m_newButton</tabstop>
+ <tabstop>m_deleteButton</tabstop>
+ <tabstop>m_renameButton</tabstop>
+ <tabstop>m_resetButton</tabstop>
+ <tabstop>m_okButton</tabstop>
+ <tabstop>m_cancelButton</tabstop>
+ <tabstop>m_editDateFormat</tabstop>
+ <tabstop>m_editApostrophe</tabstop>
+ <tabstop>m_decimalBox</tabstop>
+ <tabstop>m_thousandsBox</tabstop>
+ <tabstop>m_editAmounts</tabstop>
+ <tabstop>m_editInputFilterLocation</tabstop>
+ <tabstop>m_editOutputFilterLocation</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/Makefile.am b/kmymoney2/dialogs/settings/Makefile.am
new file mode 100644
index 0000000..f296c11
--- /dev/null
+++ b/kmymoney2/dialogs/settings/Makefile.am
@@ -0,0 +1,25 @@
+noinst_LIBRARIES = libsettings.a
+KDE_OPTIONS = noautodist
+
+INCLUDES = $(all_includes) -I$(top_srcdir) -I.
+
+libsettings_a_METASOURCES = AUTO
+
+libsettings_a_SOURCES = ksettingsgeneraldecl.ui ksettingsgeneral.cpp \
+ ksettingsregisterdecl.ui ksettingsregister.cpp \
+ ksettingsgpgdecl.ui ksettingsgpg.cpp \
+ ksettingscolorsdecl.ui ksettingscolors.cpp \
+ ksettingsfontsdecl.ui ksettingsfonts.cpp \
+ ksettingsschedulesdecl.ui ksettingsschedules.cpp \
+ ksettingsonlinequotesdecl.ui ksettingsonlinequotes.cpp \
+ ksettingshomedecl.ui ksettingshome.cpp \
+ ksettingsforecastdecl.ui ksettingsforecast.cpp \
+ ksettingsplugins.cpp
+
+EXTRA_DIST = ksettingsgeneraldecl.ui ksettingsregisterdecl.ui ksettingsgpgdecl.ui ksettingscolorsdecl.ui ksettingsfontsdecl.ui ksettingsschedulesdecl.ui ksettingsonlinequotesdecl.ui ksettingshomedecl.ui ksettingsforecastdecl.ui
+
+DISTCLEANFILES= ksettingsgeneraldecl.cpp ksettingsgeneraldecl.h ksettingsregisterdecl.cpp ksettingsregisterdecl.h ksettingsgpgdecl.cpp ksettingsgpgdecl.h ksettingscolorsdecl.cpp ksettingscolorsdecl.h ksettingsfontsdecl.cpp ksettingsfontsdecl.h ksettingsschedulesdecl.cpp ksettingsschedulesdecl.h ksettingsonlinequotesdecl.cpp ksettingsonlinequotesdecl.h ksettingshomedecl.cpp ksettingshomedecl.h ksettingsforecastdecl.cpp ksettingsforecastdecl.h
+
+noinst_HEADERS = ksettingsgeneral.h ksettingsregister.h ksettingsgpg.h ksettingscolors.h ksettingsfonts.h ksettingsschedules.h ksettingsonlinequotes.h ksettingshome.h ksettingsforecast.h ksettingsplugins.h
+
+messages: rc.cpp
diff --git a/kmymoney2/dialogs/settings/ksettingscolors.cpp b/kmymoney2/dialogs/settings/ksettingscolors.cpp
new file mode 100644
index 0000000..727241c
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingscolors.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ ksettingscolors.cpp
+ --------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingscolors.h"
+
+KSettingsColors::KSettingsColors(QWidget* parent, const char* name) :
+ KSettingsColorsDecl(parent, name)
+{
+}
+
+KSettingsColors::~KSettingsColors()
+{
+}
+
+#include "ksettingscolors.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingscolors.h b/kmymoney2/dialogs/settings/ksettingscolors.h
new file mode 100644
index 0000000..896ad85
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingscolors.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ ksettingscolors.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSCOLORS_H
+#define KSETTINGSCOLORS_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingscolorsdecl.h"
+
+class KSettingsColors : public KSettingsColorsDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsColors(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsColors();
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingscolorsdecl.ui b/kmymoney2/dialogs/settings/ksettingscolorsdecl.ui
new file mode 100644
index 0000000..2d4d15b
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingscolorsdecl.ui
@@ -0,0 +1,406 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsColorsDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsColorsDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>453</width>
+ <height>402</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Color settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Foreground</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Text colors</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Grid color</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Erronous transaction</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Value with missing conversion rate</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="2" column="1">
+ <property name="name">
+ <cstring>kcfg_listMissingConversionRate</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="3" column="1">
+ <property name="name">
+ <cstring>kcfg_listNegativeValueColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Negative value</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_listErronousTransactionColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_listGridColor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>154</red>
+ <green>154</green>
+ <blue>154</blue>
+ </color>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Background</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_useSystemColors</cstring>
+ </property>
+ <property name="text">
+ <string>Use system colors</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_individualColorFrame</cstring>
+ </property>
+ <property name="title">
+ <string>List background colors</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Normal</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Alternate</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_listColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>240</red>
+ <green>240</green>
+ <blue>240</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_listBGColor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>Special background colors</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_5</cstring>
+ </property>
+ <property name="text">
+ <string>Ledger group separator</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_groupMarkerColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Required field</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_requiredFieldColor</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>221</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Imported transaction</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="2" column="1">
+ <property name="name">
+ <cstring>kcfg_importedTransactionColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Matched transaction</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="3" column="1">
+ <property name="name">
+ <cstring>kcfg_matchedTransactionColor</cstring>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>221</blue>
+ </color>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="color">
+ <color>
+ <red>152</red>
+ <green>251</green>
+ <blue>152</blue>
+ </color>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>kcfg_useSystemColors</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_individualColorFrame</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsfonts.cpp b/kmymoney2/dialogs/settings/ksettingsfonts.cpp
new file mode 100644
index 0000000..a4aef71
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsfonts.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ ksettingsfonts.cpp
+ --------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingsfonts.h"
+
+KSettingsFonts::KSettingsFonts(QWidget* parent, const char* name) :
+ KSettingsFontsDecl(parent, name)
+{
+}
+
+KSettingsFonts::~KSettingsFonts()
+{
+}
+
+#include "ksettingsfonts.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsfonts.h b/kmymoney2/dialogs/settings/ksettingsfonts.h
new file mode 100644
index 0000000..40cb9de
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsfonts.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ ksettingsfonts.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSFONTS_H
+#define KSETTINGSFONTS_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsfontsdecl.h"
+
+class KSettingsFonts : public KSettingsFontsDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsFonts(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsFonts();
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingsfontsdecl.ui b/kmymoney2/dialogs/settings/ksettingsfontsdecl.ui
new file mode 100644
index 0000000..cbaefeb
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsfontsdecl.ui
@@ -0,0 +1,131 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsFontsDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsFontsDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>398</width>
+ <height>222</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Font settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_useSystemFont</cstring>
+ </property>
+ <property name="text">
+ <string>Use system fonts</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_individualFontsFrame</cstring>
+ </property>
+ <property name="title">
+ <string>Individual font settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KFontRequester" row="0" column="2">
+ <property name="name">
+ <cstring>kcfg_listCellFont</cstring>
+ </property>
+ </widget>
+ <widget class="KFontRequester" row="1" column="2">
+ <property name="name">
+ <cstring>kcfg_listHeaderFont</cstring>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>110</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Cell font</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Header font</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>kcfg_useSystemFont</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_individualFontsFrame</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsforecast.cpp b/kmymoney2/dialogs/settings/ksettingsforecast.cpp
new file mode 100644
index 0000000..0a74252
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsforecast.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ ksettingsforecast.cpp
+ --------------------
+ copyright : (C) 2007 by Alvaro Soliverez
+ email : asoliverez@gmail.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingsforecast.h"
+
+KSettingsForecast::KSettingsForecast(QWidget* parent, const char* name) :
+ KSettingsForecastDecl(parent, name)
+{
+}
+
+KSettingsForecast::~KSettingsForecast()
+{
+}
+
+#include "ksettingsforecast.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsforecast.h b/kmymoney2/dialogs/settings/ksettingsforecast.h
new file mode 100644
index 0000000..7195eee
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsforecast.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ ksettingsforecast.h
+ -------------------
+ copyright : (C) 2007 by Alvaro Soliverez
+ email : asoliverez@gmail.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSFORECAST_H
+#define KSETTINGSFORECAST_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsforecastdecl.h"
+
+class KSettingsForecast : public KSettingsForecastDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsForecast(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsForecast();
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingsforecastdecl.ui b/kmymoney2/dialogs/settings/ksettingsforecastdecl.ui
new file mode 100644
index 0000000..c412f81
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsforecastdecl.ui
@@ -0,0 +1,268 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsForecastDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsForecastDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>497</width>
+ <height>379</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Forecast Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_forecastAccountCycle</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Number of Days of Account Cycle:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_forecastDays</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Day of Month to start Forecast:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>kcfg_beginForecastDay</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Number of Days to Forecast:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>133</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>kcfg_forecastMethod</cstring>
+ </property>
+ <property name="title">
+ <string>Forecast Method</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton9</cstring>
+ </property>
+ <property name="text">
+ <string>Scheduled and Future Transactions</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton10</cstring>
+ </property>
+ <property name="text">
+ <string>History-based</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>History-based settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Number of Cycles to use in Forecast:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>kcfg_forecastCycles</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>130</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>kcfg_historyMethod</cstring>
+ </property>
+ <property name="title">
+ <string>History Forecast Method</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton11</cstring>
+ </property>
+ <property name="text">
+ <string>Simple Moving Average</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton12</cstring>
+ </property>
+ <property name="text">
+ <string>Weighted Moving Average</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton13</cstring>
+ </property>
+ <property name="text">
+ <string>Linear Regression</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsgeneral.cpp b/kmymoney2/dialogs/settings/ksettingsgeneral.cpp
new file mode 100644
index 0000000..5acdd08
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsgeneral.cpp
@@ -0,0 +1,63 @@
+/***************************************************************************
+ ksettingsgeneral.cpp
+ --------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klineedit.h>
+#include <klistview.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/kmymoneydateinput.h>
+#include "ksettingsgeneral.h"
+
+KSettingsGeneral::KSettingsGeneral(QWidget* parent, const char* name) :
+ KSettingsGeneralDecl(parent, name)
+{
+ // hide the internally used date field
+ kcfg_StartDate->hide();
+ kcfg_hiddenViews->hide();
+
+ // for now, we don't show the widgets for view selection
+ m_viewLabel->hide();
+ m_viewList->hide();
+
+ // setup connections, so that the sort optios get loaded once the edit fields are filled
+ connect(kcfg_StartDate, SIGNAL(valueChanged(const QDate&)), this, SLOT(slotLoadStartDate(const QDate&)));
+
+ // setup connections, so that changes by the user are forwarded to the (hidden) edit fields
+ connect(m_startDateEdit, SIGNAL(dateChanged(const QDate&)), kcfg_StartDate, SLOT(setDate(const QDate&)));
+}
+
+KSettingsGeneral::~KSettingsGeneral()
+{
+}
+
+void KSettingsGeneral::slotLoadStartDate(const QDate&)
+{
+ // only need this once
+ disconnect(kcfg_StartDate, SIGNAL(valueChanged(const QDate&)), this, SLOT(slotLoadStartDate(const QDate&)));
+ m_startDateEdit->setDate(kcfg_StartDate->date());
+}
+
+#include "ksettingsgeneral.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsgeneral.h b/kmymoney2/dialogs/settings/ksettingsgeneral.h
new file mode 100644
index 0000000..3bd0992
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsgeneral.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ ksettingsgeneral.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSGENERAL_H
+#define KSETTINGSGENERAL_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsgeneraldecl.h"
+
+class KSettingsGeneral : public KSettingsGeneralDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsGeneral(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsGeneral();
+
+protected slots:
+ void slotLoadStartDate(const QDate&);
+
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingsgeneraldecl.ui b/kmymoney2/dialogs/settings/ksettingsgeneraldecl.ui
new file mode 100644
index 0000000..9eeb181
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsgeneraldecl.ui
@@ -0,0 +1,646 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsGeneralDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsGeneralDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>614</width>
+ <height>438</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>General Settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Global</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>kcfg_StartLastViewSelected</cstring>
+ </property>
+ <property name="title">
+ <string>Startup page options</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton1</cstring>
+ </property>
+ <property name="text">
+ <string>Start with homepage</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2</cstring>
+ </property>
+ <property name="text">
+ <string>Start with last selected view</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Precision settings</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Price precision</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>kcfg_PricePrecision</cstring>
+ </property>
+ <property name="maxValue">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>digits</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Autosave options</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_AutoSaveFile</cstring>
+ </property>
+ <property name="text">
+ <string>Autosave periodically</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_periodFrame</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>kcfg_AutoSavePeriod</cstring>
+ </property>
+ <property name="maxValue">
+ <number>60</number>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>minutes</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>354</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox6</cstring>
+ </property>
+ <property name="title">
+ <string>Fiscal Year</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Your fiscal year starts on</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>kcfg_FiscalYearBeginDay</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <item>
+ <property name="text">
+ <string>January</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>February</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>March</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>April</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>May</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>June</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>July</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>August</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>September</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>October</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>November</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>December</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kcfg_FiscalYearBegin</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Views</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_syncLedgerInvestment</cstring>
+ </property>
+ <property name="text">
+ <string>Synchronize account selection of ledger and investment view</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>kcfg_hiddenViews</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_viewLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Check the views you want to enable, uncheck those you want to hide, because you don't need the functionality.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>m_viewList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>kcfg_iconSize</cstring>
+ </property>
+ <property name="title">
+ <string>Icon size of navigation bar</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>radioButton3</cstring>
+ </property>
+ <property name="text">
+ <string>Micro (16px)</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioButton4</cstring>
+ </property>
+ <property name="text">
+ <string>Small (32px)</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="1">
+ <property name="name">
+ <cstring>radioButton5</cstring>
+ </property>
+ <property name="text">
+ <string>Normal (48px)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="1">
+ <property name="name">
+ <cstring>radioButton6</cstring>
+ </property>
+ <property name="text">
+ <string>Large (64px)</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_showTitleBar</cstring>
+ </property>
+ <property name="text">
+ <string>Show title bar on each page</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Filter</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Accounts / Categories</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_HideUnusedCategory</cstring>
+ </property>
+ <property name="text">
+ <string>Don't show unused categories</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This option hides all categories in the categories view that are not used in at least a single transaction. They are still shown in the category selection lists.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_HideClosedAccounts</cstring>
+ </property>
+ <property name="text">
+ <string>Don't show closed accounts</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This option hides all accounts that have been closed by the user in views and selection lists.
+
+You can use &lt;b&gt;View/Show all accounts&lt;/b&gt; to temporarily show hidden accounts in the views.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_ExpertMode</cstring>
+ </property>
+ <property name="text">
+ <string>Show equity accounts</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Schedules</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_HideFinishedSchedules</cstring>
+ </property>
+ <property name="text">
+ <string>Don't show finished schedules</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This option hides all finished schedules in the schedules view.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox5</cstring>
+ </property>
+ <property name="title">
+ <string>Transactions</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Don't show transactions prior to</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_startDateEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QDateEdit">
+ <property name="name">
+ <cstring>kcfg_StartDate</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>63</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_HideReconciledTransactions</cstring>
+ </property>
+ <property name="text">
+ <string>Don't show reconciled transactions</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This option hides all reconciled transactions in the ledger view.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>kcfg_AutoSaveFile</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_periodFrame</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsgpg.cpp b/kmymoney2/dialogs/settings/ksettingsgpg.cpp
new file mode 100644
index 0000000..2dba83e
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsgpg.cpp
@@ -0,0 +1,200 @@
+/***************************************************************************
+ ksettingsgpg.cpp
+ --------------------
+ copyright : (C) 2005, 2008 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kled.h>
+#include <klineedit.h>
+#include <keditlistbox.h>
+#include <kcombobox.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingsgpg.h"
+#include <kmymoney/kgpgfile.h>
+
+#define RECOVER_KEY_ID "0xD2B08440"
+#define RECOVER_KEY_ID_FULL "59B0F826D2B08440"
+
+KSettingsGpg::KSettingsGpg(QWidget* parent, const char* name) :
+ KSettingsGpgDecl(parent, name),
+ m_checkCount(0),
+ m_needCheckList(true),
+ m_listOk(false)
+{
+ setEnabled(KGPGFile::GPGAvailable());
+
+ // don't show the widget in which the master key is actually kept
+ kcfg_GpgRecipient->hide();
+
+ connect(kcfg_WriteDataEncrypted, SIGNAL(toggled(bool)), this, SLOT(slotStatusChanged(bool)));
+ connect(m_masterKeyCombo, SIGNAL(activated(int)), this, SLOT(slotIdChanged()));
+ connect(kcfg_GpgRecipientList, SIGNAL(changed()), this, SLOT(slotIdChanged()));
+ connect(kcfg_GpgRecipientList, SIGNAL(added(const QString&)), this, SLOT(slotKeyListChanged()));
+ connect(kcfg_GpgRecipientList, SIGNAL(removed(const QString&)), this, SLOT(slotKeyListChanged()));
+
+ // Initial state setup
+ slotStatusChanged(kcfg_WriteDataEncrypted->isChecked());
+}
+
+KSettingsGpg::~KSettingsGpg()
+{
+}
+
+void KSettingsGpg::slotKeyListChanged(void)
+{
+ m_needCheckList = true;
+ slotIdChanged();
+}
+
+void KSettingsGpg::slotIdChanged(void)
+{
+ // this looks a bit awkward. Here's why: KGPGFile::keyAvailable() starts
+ // an external task and processes UI events while it waits for the external
+ // process to finish. Thus, the first time we get here, the external process
+ // is started and the user may press a second key which calls this routine
+ // again.
+ //
+ // The second invocation is counted, but the check is not started until the
+ // first one finishes. Once the external process finishes, we check if we
+ // were called in the meantime and restart the check.
+ if(++m_checkCount == 1) {
+ while(1) {
+ // first we check the current edit field if filled
+ bool keysOk = true;
+ if(!kcfg_GpgRecipientList->currentText().isEmpty()) {
+ keysOk = KGPGFile::keyAvailable(kcfg_GpgRecipientList->currentText());
+ }
+
+ // if it is available, then scan the current list if we need to
+ if(keysOk) {
+ if(m_needCheckList) {
+ QStringList keys = kcfg_GpgRecipientList->items();
+ QStringList::const_iterator it_s;
+ for(it_s = keys.begin(); keysOk && it_s != keys.end(); ++it_s) {
+ if(!KGPGFile::keyAvailable(*it_s))
+ keysOk = false;
+ }
+ m_listOk = keysOk;
+ m_needCheckList = false;
+
+ } else {
+ keysOk = m_listOk;
+ }
+ }
+
+ // did we receive some more requests to check?
+ if(m_checkCount > 1) {
+ m_checkCount = 1;
+ continue;
+ }
+
+ // if we have a master key, we store it in the hidden widget
+ if(m_masterKeyCombo->currentItem() != 0) {
+ QRegExp keyExp(".* \\((.*)\\)");
+ if(keyExp.search(m_masterKeyCombo->currentText()) != -1) {
+ kcfg_GpgRecipient->setText(keyExp.cap(1));
+ }
+ }
+
+ m_userKeysFound->setState(static_cast<KLed::State>(keysOk && (kcfg_GpgRecipientList->items().count() != 0) ? KLed::On : KLed::Off));
+ break;
+ }
+
+ --m_checkCount;
+ }
+}
+
+void KSettingsGpg::show(void)
+{
+ QString masterKey;
+
+ if(m_masterKeyCombo->currentItem() != 0) {
+ QRegExp keyExp(".* \\((.*)\\)");
+ if(keyExp.search(m_masterKeyCombo->currentText()) != -1) {
+ masterKey = keyExp.cap(1);
+ }
+ } else
+ masterKey = kcfg_GpgRecipient->text();
+
+ // fill the secret key combobox with a fresh list
+ m_masterKeyCombo->clear();
+ QStringList keyList;
+ KGPGFile::secretKeyList(keyList);
+
+ for(QStringList::iterator it = keyList.begin(); it != keyList.end(); ++it) {
+ QStringList fields = QStringList::split(":", *it);
+ if(fields[0] != RECOVER_KEY_ID_FULL) {
+ // replace parenthesis in name field with brackets
+ QString name = fields[1];
+ name.replace('(', "[");
+ name.replace(')', "]");
+ name = QString("%1 (0x%2)").arg(name).arg(fields[0]);
+ m_masterKeyCombo->insertItem(name);
+ if(name.contains(masterKey))
+ m_masterKeyCombo->setCurrentItem(name);
+ }
+ }
+
+ // if we don't have at least one secret key, we turn off encryption
+ if(keyList.isEmpty()) {
+ setEnabled(false);
+ kcfg_WriteDataEncrypted->setChecked(false);
+ }
+
+ slotStatusChanged(kcfg_WriteDataEncrypted->isChecked());
+ KSettingsGpgDecl::show();
+}
+
+void KSettingsGpg::slotStatusChanged(bool state)
+{
+ static bool oncePerSession = true;
+ if(state && !KGPGFile::GPGAvailable())
+ state = false;
+
+ if((state == true) && (oncePerSession == true) && isVisible()) {
+ KMessageBox::information(this, QString("<qt>%1</qt>").arg(i18n("You have turned on the GPG encryption support. This means, that new files will be stored encrypted. Existing files will not be encrypted automatically. To achieve encryption of existing files, please use the <b>File/Save as...</b> feature and store the file under a different name. Once confident with the result, feel free to delete the old file and rename the encrypted one to the old name.")), i18n("GPG encryption activated"), "GpgEncryptionActivated");
+ oncePerSession = false;
+ }
+
+ m_idGroup->setEnabled(state);
+ kcfg_EncryptRecover->setEnabled(state);
+ m_masterKeyCombo->setEnabled(state);
+ kcfg_GpgRecipientList->setEnabled(state);
+
+ if(state) {
+ m_recoverKeyFound->setState((KLed::State) (KGPGFile::keyAvailable(RECOVER_KEY_ID) ? KLed::On : KLed::Off));
+ kcfg_EncryptRecover->setEnabled(m_recoverKeyFound->state() == KLed::On);
+ slotIdChanged();
+
+ } else {
+ m_recoverKeyFound->setState(KLed::Off);
+ m_userKeysFound->setState(KLed::Off);
+ }
+}
+
+#include "ksettingsgpg.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsgpg.h b/kmymoney2/dialogs/settings/ksettingsgpg.h
new file mode 100644
index 0000000..ecea6ab
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsgpg.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ ksettingsgpg.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSGPG_H
+#define KSETTINGSGPG_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsgpgdecl.h"
+
+class KSettingsGpg : public KSettingsGpgDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsGpg(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsGpg();
+
+public slots:
+ void show(void);
+
+protected slots:
+ void slotStatusChanged(bool state);
+ void slotIdChanged(void);
+ void slotKeyListChanged(void);
+
+private:
+ int m_checkCount;
+ bool m_needCheckList;
+ bool m_listOk;
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingsgpgdecl.ui b/kmymoney2/dialogs/settings/ksettingsgpgdecl.ui
new file mode 100644
index 0000000..15d3bbe
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsgpgdecl.ui
@@ -0,0 +1,238 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsGpgDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsGpgDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>601</width>
+ <height>418</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>GPG encryption settings</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This page allows you to set the parameters for encrypted file storage of your &lt;b&gt;KMyMoney&lt;/b&gt; data based on &lt;b&gt;GPG&lt;/b&gt;.&lt;p&gt;
+Access to the settings is disabled if &lt;b&gt;GPG&lt;/b&gt; could not be detected on your system. In this case, please make sure that &lt;b&gt;GPG&lt;/b&gt; is working properly for the current user.&lt;p&gt;
+The &lt;i&gt;additional recovery encryption&lt;/i&gt; is only accessible, if the necessary key for &lt;b&gt;kmymoney-recover@users.sourceforge.net&lt;/b&gt; with id 0x8AFDDC8E is found in your keyring.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_WriteDataEncrypted</cstring>
+ </property>
+ <property name="text">
+ <string>Use GPG encryption</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_idGroup</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>GPG encryption</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Your key</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>m_masterKeyCombo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This combo box lists all the secret keys you have in your keyring. Select the one you want to use for encryption when saving to a file.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>kcfg_GpgRecipient</cstring>
+ </property>
+ </widget>
+ <widget class="KEditListBox">
+ <property name="name">
+ <cstring>kcfg_GpgRecipientList</cstring>
+ </property>
+ <property name="title">
+ <string>Additonal keys</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="buttons">
+ <set>Remove|Add</set>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the id of the key you want to use for data encryption. This can either be an e-mail address or the hexadecimal key id. In case of the key id don't forget the leading 0x.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>m_userKeysFound</cstring>
+ </property>
+ <property name="shape">
+ <enum>Circular</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This symbol denotes, if the key for the given user id has been found in your keyring. It is green when found, dark otherwise.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Keys for all of the above user ids found</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>m_recoverKeyFound</cstring>
+ </property>
+ <property name="shape">
+ <enum>Circular</enum>
+ </property>
+ <property name="look">
+ <enum>Sunken</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This symbol denotes, if the KMyMoney recovery key has been found in your keyring. It is green when found, dark otherwise.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Recover Key available in keyring</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_EncryptRecover</cstring>
+ </property>
+ <property name="text">
+ <string>Also encrypt with KMyMoney's recover key</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>You can specify to encrypt the data also with the KMyMoney recover key. Only the core KMyMoney developers are in posession of the respective private key required to read back such encrypted data.&lt;p&gt;
+
+This mechanism is provided for the case that you have lost your key and cannot access your data anymore. With this option activated, the KMyMoney developers can decrypt the data and supply you with it in a readable form. Please be prepared, that you have to answer a few detailed questions about the contents of your data before we will send it out..</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingshome.cpp b/kmymoney2/dialogs/settings/ksettingshome.cpp
new file mode 100644
index 0000000..d2f471b
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingshome.cpp
@@ -0,0 +1,173 @@
+/***************************************************************************
+ ksettingshome.cpp
+ --------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qstringlist.h>
+#include <qheader.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klistview.h>
+#include <kpushbutton.h>
+#include <kglobalsettings.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <ktextedit.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingshome.h"
+#include "kmymoney2/kmymoneyglobalsettings.h"
+#include "kmymoney2/kmymoneyutils.h"
+
+KSettingsHome::KSettingsHome(QWidget* parent, const char* name) :
+ KSettingsHomeDecl(parent, name),
+ m_noNeedToUpdateList(false)
+{
+ m_homePageList->addColumn("");
+ m_homePageList->setSorting(-1);
+ m_homePageList->header()->hide();
+ m_homePageList->setAllColumnsShowFocus(true);
+
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem upButtonItem( i18n( "&Up" ),
+ QIconSet(il->loadIcon("up", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Move selected item up"),
+ i18n("Use this to move the selected item up by one position in the list."));
+ KGuiItem downButtonItem( i18n( "&Down" ),
+ QIconSet(il->loadIcon("down", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Move selected item down"),
+ i18n("Use this to move the selected item down by one position in the list."));
+
+ m_upButton->setGuiItem(upButtonItem);
+ m_upButton->setEnabled(false);
+ m_downButton->setGuiItem(downButtonItem);
+ m_downButton->setEnabled(false);
+
+ // connect this, so that the list gets loaded once the edit field is filled
+ connect(kcfg_ItemList, SIGNAL(textChanged()), this, SLOT(slotLoadItems()));
+
+ connect(m_homePageList, SIGNAL(selectionChanged(QListViewItem*)),
+ this, SLOT(slotSelectHomePageItem(QListViewItem *)));
+ connect(m_homePageList, SIGNAL(pressed(QListViewItem*)), this, SLOT(slotUpdateItemList()));
+
+ connect(m_upButton, SIGNAL(clicked()), this, SLOT(slotMoveUp()));
+ connect(m_downButton, SIGNAL(clicked()), this, SLOT(slotMoveDown()));
+
+ // Don't show it to the user, we only need it to load and save the settings
+ kcfg_ItemList->hide();
+}
+
+KSettingsHome::~KSettingsHome()
+{
+}
+
+void KSettingsHome::slotLoadItems(void)
+{
+ if(m_noNeedToUpdateList)
+ return;
+
+ QStringList list = KMyMoneyGlobalSettings::itemList();
+ QStringList::ConstIterator it;
+ int w = 0;
+ m_homePageList->clear();
+ QCheckListItem *sel = 0;
+
+ QFontMetrics fm( KGlobalSettings::generalFont());
+ QCheckListItem* last = 0;
+
+ for(it = list.begin(); it != list.end(); ++it) {
+ int idx = (*it).toInt();
+ // skip over unknown item entries
+ if(idx == 0)
+ continue;
+ bool enabled = idx > 0;
+ if(!enabled) idx = -idx;
+ QCheckListItem* item = new QCheckListItem(m_homePageList, KMyMoneyUtils::homePageItemToString(idx), QCheckListItem::CheckBox);
+ if(last)
+ item->moveItem(last);
+
+ // qDebug("Adding %s", item->text(0).latin1());
+ item->setOn(enabled);
+ if(item->width(fm, m_homePageList, 0) > w)
+ w = item->width(fm, m_homePageList, 0);
+
+ if(sel == 0)
+ sel = item;
+ last = item;
+ }
+
+ if(sel) {
+ m_homePageList->setSelected(sel, true);
+ slotSelectHomePageItem(sel);
+ }
+}
+
+void KSettingsHome::slotUpdateItemList(void)
+{
+ QString list;
+ QListViewItem *it;
+
+ for(it = m_homePageList->firstChild(); it; ) {
+ int item = KMyMoneyUtils::stringToHomePageItem(it->text(0));
+ if(!(static_cast<QCheckListItem*>(it)->isOn()))
+ item = -item;
+ list += QString::number(item);
+ it = it->nextSibling();
+ if(it)
+ list += ",";
+ }
+
+ // don't update the list
+ m_noNeedToUpdateList = true;
+ kcfg_ItemList->setText(list);
+ m_noNeedToUpdateList = false;
+}
+
+void KSettingsHome::slotSelectHomePageItem(QListViewItem *item)
+{
+ m_upButton->setEnabled(m_homePageList->firstChild() != item);
+ m_downButton->setEnabled(item->nextSibling());
+}
+
+void KSettingsHome::slotMoveUp(void)
+{
+ QListViewItem *item = m_homePageList->currentItem();
+ QListViewItem *prev = item->itemAbove();
+ if(prev) {
+ prev->moveItem(item);
+ slotSelectHomePageItem(item);
+ slotUpdateItemList();
+ }
+}
+
+void KSettingsHome::slotMoveDown(void)
+{
+ QListViewItem *item = m_homePageList->currentItem();
+ QListViewItem *next = item->nextSibling();
+ if(next) {
+ item->moveItem(next);
+ slotSelectHomePageItem(item);
+ slotUpdateItemList();
+ }
+}
+
+#include "ksettingshome.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingshome.h b/kmymoney2/dialogs/settings/ksettingshome.h
new file mode 100644
index 0000000..c461210
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingshome.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ ksettingshome.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSHOME_H
+#define KSETTINGSHOME_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QListViewItem;
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingshomedecl.h"
+
+class KSettingsHome : public KSettingsHomeDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsHome(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsHome();
+
+protected slots:
+ void slotLoadItems(void);
+ void slotUpdateItemList(void);
+ void slotSelectHomePageItem(QListViewItem *);
+ void slotMoveUp(void);
+ void slotMoveDown(void);
+
+private:
+ bool m_noNeedToUpdateList;
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingshomedecl.ui b/kmymoney2/dialogs/settings/ksettingshomedecl.ui
new file mode 100644
index 0000000..49f6251
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingshomedecl.ui
@@ -0,0 +1,231 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsHomeDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsHomeDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>659</width>
+ <height>414</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Homepage Settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="2">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_upButton</cstring>
+ </property>
+ <property name="text">
+ <string>Up</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_downButton</cstring>
+ </property>
+ <property name="text">
+ <string>Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer row="0" column="3">
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Selected entries are shown on the home page of the application.&lt;p&gt;
+Use the buttons and checkboxes to customize the layout of the home page.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignTop</set>
+ </property>
+ </widget>
+ <widget class="KTextEdit" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>kcfg_ItemList</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KListView" row="0" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>m_homePageList</cstring>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupbox</cstring>
+ </property>
+ <property name="title">
+ <string>Homepage/Summary page font scaling</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>percentageLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Percentage of default font size:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_RememberFontSize</cstring>
+ </property>
+ <property name="text">
+ <string>Remember font size when leaving the program if manually changed with mouse-wheel</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_FontSizePercentage</cstring>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>1000</number>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupbox2</cstring>
+ </property>
+ <property name="title">
+ <string>Information display</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_ShowLimitInfo</cstring>
+ </property>
+ <property name="text">
+ <string>Show Account Limit Information</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsonlinequotes.cpp b/kmymoney2/dialogs/settings/ksettingsonlinequotes.cpp
new file mode 100644
index 0000000..db4dc1e
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsonlinequotes.cpp
@@ -0,0 +1,219 @@
+/***************************************************************************
+ kmymoneyonlinequoteconfig.cpp - description
+ -------------------
+ begin : Thu Dec 30 2004
+ copyright : (C) 2004 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qregexp.h>
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kconfig.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <klistview.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+#include <kpushbutton.h>
+#include <klineedit.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingsonlinequotes.h"
+#include "kmymoney2/converter/webpricequote.h"
+
+KSettingsOnlineQuotes::KSettingsOnlineQuotes(QWidget *parent, const char *name )
+ : KSettingsOnlineQuotesDecl(parent, name)
+{
+ QStringList groups = WebPriceQuote::quoteSources();
+
+ loadList(true /*updateResetList*/);
+
+ m_updateButton->setEnabled(false);
+
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem updateButtenItem( i18n("&Update" ),
+ QIconSet(il->loadIcon("button_ok", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Accepts the entered data and stores it"),
+ i18n("Use this to accept the modified data."));
+ m_updateButton->setGuiItem(updateButtenItem);
+
+ KGuiItem deleteButtenItem( i18n( "&Delete" ),
+ QIconSet(il->loadIcon("editdelete", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Delete the selected source entry"),
+ i18n("Use this to delete the selected online source entry"));
+ m_deleteButton->setGuiItem(deleteButtenItem);
+
+ KGuiItem newButtenItem( i18n( "&New..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new source entry for online quotes"),
+ i18n("Use this to create a new entry for online quotes"));
+ m_newButton->setGuiItem(newButtenItem);
+
+ connect(m_updateButton, SIGNAL(clicked()), this, SLOT(slotUpdateEntry()));
+ connect(m_newButton, SIGNAL(clicked()), this, SLOT(slotNewEntry()));
+
+ connect(m_quoteSourceList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotLoadWidgets(QListViewItem*)));
+ connect(m_quoteSourceList, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotLoadWidgets(QListViewItem*)));
+ connect(m_quoteSourceList, SIGNAL(itemRenamed(QListViewItem*,const QString&,int)), this, SLOT(slotEntryRenamed(QListViewItem*,const QString&,int)));
+
+ connect(m_editURL, SIGNAL(textChanged(const QString&)), this, SLOT(slotEntryChanged()));
+ connect(m_editSymbol, SIGNAL(textChanged(const QString&)), this, SLOT(slotEntryChanged()));
+ connect(m_editDate, SIGNAL(textChanged(const QString&)), this, SLOT(slotEntryChanged()));
+ connect(m_editDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slotEntryChanged()));
+ connect(m_editPrice, SIGNAL(textChanged(const QString&)), this, SLOT(slotEntryChanged()));
+ connect(m_skipStripping, SIGNAL(toggled(bool)), this, SLOT(slotEntryChanged()));
+
+ // FIXME deleting a source is not yet implemented
+ m_deleteButton->setEnabled(false);
+}
+
+void KSettingsOnlineQuotes::loadList(const bool updateResetList)
+{
+ QStringList groups = WebPriceQuote::quoteSources();
+
+ if(updateResetList)
+ m_resetList.clear();
+ m_quoteSourceList->clear();
+ QStringList::Iterator it;
+ for(it = groups.begin(); it != groups.end(); ++it) {
+ new QListViewItem(m_quoteSourceList, *it);
+ if(updateResetList)
+ m_resetList += WebPriceQuoteSource(*it);
+ }
+
+ QListViewItem* first = m_quoteSourceList->firstChild();
+ if(first)
+ m_quoteSourceList->setSelected(first, true);
+ slotLoadWidgets(first);
+
+ m_newButton->setEnabled(m_quoteSourceList->findItem(i18n("New Quote Source"), 0) == 0);
+}
+
+void KSettingsOnlineQuotes::resetConfig(void)
+{
+ QStringList::ConstIterator it;
+ QStringList groups = WebPriceQuote::quoteSources();
+
+ // delete all currently defined entries
+ for(it = groups.begin(); it != groups.end(); ++it) {
+ WebPriceQuoteSource(*it).remove();
+ }
+
+ // and write back the one's from the reset list
+ QValueList<WebPriceQuoteSource>::ConstIterator itr;
+ for(itr = m_resetList.begin(); itr != m_resetList.end(); ++itr) {
+ (*itr).write();
+ }
+
+ loadList();
+}
+
+void KSettingsOnlineQuotes::slotLoadWidgets(QListViewItem* item)
+{
+ m_editURL->setEnabled(true);
+ m_editSymbol->setEnabled(true);
+ m_editPrice->setEnabled(true);
+ m_editDate->setEnabled(true);
+ m_editDateFormat->setEnabled(true);
+ m_skipStripping->setEnabled(true);
+ m_editURL->setText(QString());
+ m_editSymbol->setText(QString());
+ m_editPrice->setText(QString());
+ m_editDate->setText(QString());
+ m_editDateFormat->setText(QString());
+
+ if(item) {
+ m_currentItem = WebPriceQuoteSource(item->text(0));
+ m_editURL->setText(m_currentItem.m_url);
+ m_editSymbol->setText(m_currentItem.m_sym);
+ m_editPrice->setText(m_currentItem.m_price);
+ m_editDate->setText(m_currentItem.m_date);
+ m_editDateFormat->setText(m_currentItem.m_dateformat);
+ m_skipStripping->setChecked(m_currentItem.m_skipStripping);
+ } else {
+ m_editURL->setEnabled(false);
+ m_editSymbol->setEnabled(false);
+ m_editPrice->setEnabled(false);
+ m_editDate->setEnabled(false);
+ m_editDateFormat->setEnabled(false);
+ m_skipStripping->setEnabled(false);
+ }
+
+ m_updateButton->setEnabled(false);
+
+}
+
+void KSettingsOnlineQuotes::slotEntryChanged(void)
+{
+ bool modified = m_editURL->text() != m_currentItem.m_url
+ || m_editSymbol->text() != m_currentItem.m_sym
+ || m_editDate->text() != m_currentItem.m_date
+ || m_editDateFormat->text() != m_currentItem.m_dateformat
+ || m_editPrice->text() != m_currentItem.m_price
+ || m_skipStripping->isChecked() != m_currentItem.m_skipStripping;
+
+ m_updateButton->setEnabled(modified);
+}
+
+void KSettingsOnlineQuotes::slotUpdateEntry(void)
+{
+ m_currentItem.m_url = m_editURL->text();
+ m_currentItem.m_sym = m_editSymbol->text();
+ m_currentItem.m_date = m_editDate->text();
+ m_currentItem.m_dateformat = m_editDateFormat->text();
+ m_currentItem.m_price = m_editPrice->text();
+ m_currentItem.m_skipStripping = m_skipStripping->isChecked();
+ m_currentItem.write();
+ slotEntryChanged();
+}
+
+void KSettingsOnlineQuotes::slotNewEntry(void)
+{
+ WebPriceQuoteSource newSource(i18n("New Quote Source"));
+ newSource.write();
+ loadList();
+ QListViewItem* item = m_quoteSourceList->findItem(i18n("New Quote Source"), 0);
+ if(item) {
+ m_quoteSourceList->setSelected(item, true);
+ slotLoadWidgets(item);
+ }
+}
+
+void KSettingsOnlineQuotes::slotEntryRenamed(QListViewItem* item, const QString& text, int /* col */)
+{
+ int nameCount = 0;
+ QListViewItemIterator it(m_quoteSourceList);
+ while(it.current()) {
+ if(it.current()->text(0) == text)
+ ++nameCount;
+ ++it;
+ }
+
+ // Make sure we get a non-empty and unique name
+ if(text.length() > 0 && nameCount == 1) {
+ m_currentItem.rename(text);
+ } else {
+ item->setText(0, m_currentItem.m_name);
+ }
+ m_newButton->setEnabled(m_quoteSourceList->findItem(i18n("New Quote Source"), 0) == 0);
+}
+
+#include "ksettingsonlinequotes.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsonlinequotes.h b/kmymoney2/dialogs/settings/ksettingsonlinequotes.h
new file mode 100644
index 0000000..8c0b6f0
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsonlinequotes.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ kmymoneyonlinequoteconfig.h - description
+ -------------------
+ begin : Thu Dec 30 2004
+ copyright : (C) 2004 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSONLINEQUOTES_H
+#define KSETTINGSONLINEQUOTES_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsonlinequotesdecl.h"
+#include "kmymoney2/converter/webpricequote.h"
+
+class KSettingsOnlineQuotes : public KSettingsOnlineQuotesDecl
+{
+ Q_OBJECT
+public:
+ KSettingsOnlineQuotes(QWidget* parent = 0, const char *name = 0);
+ virtual ~KSettingsOnlineQuotes() {}
+
+ void writeConfig(void) {}
+ void readConfig(void) {}
+ void resetConfig(void);
+
+protected slots:
+ void slotUpdateEntry(void);
+ void slotLoadWidgets(QListViewItem* item);
+ void slotEntryChanged(void);
+ void slotNewEntry(void);
+ void slotEntryRenamed(QListViewItem* item, const QString& text, int col);
+
+protected:
+ void loadList(const bool updateResetList = false);
+
+private:
+ QValueList<WebPriceQuoteSource> m_resetList;
+ WebPriceQuoteSource m_currentItem;
+};
+
+#endif
diff --git a/kmymoney2/dialogs/settings/ksettingsonlinequotesdecl.ui b/kmymoney2/dialogs/settings/ksettingsonlinequotesdecl.ui
new file mode 100644
index 0000000..3077b78
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsonlinequotesdecl.ui
@@ -0,0 +1,234 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsOnlineQuotesDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsOnlineQuotesDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>512</width>
+ <height>442</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Online Quotes</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_quoteSourceList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="defaultRenameAction">
+ <enum>Accept</enum>
+ </property>
+ <property name="itemsRenameable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupParsing</cstring>
+ </property>
+ <property name="title">
+ <string>Details</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;i&gt;Enter regular expressions which can be used to parse the data returned from the URL entered above. The symbol, price, and date must be found in the quote data to be usable. You may also try the KMyMoney user's mailinglist at &lt;a href="mailto:kmymoney2-user@lists.sourceforge.net"&gt;kmymoney2-user@lists.sourceforge.net&lt;/a&gt; to find what settings work for other users in your country.&lt;/i&gt;</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Date</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Symbol</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_editSymbol</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Regular Expression to extract the symbol from the downloaded data</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_editPrice</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Regular Expression to extract the price from the downloaded data</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_editURL</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>URL to be used to download the quote</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the URL from which stock quotes will be fetched. &lt;b&gt;%1&lt;/b&gt; will be replaced with the symbol for the security being quoted. For currency conversions, &lt;b&gt;%2&lt;/b&gt; will be replaced with the currency to be quoted and &lt;b&gt;%1&lt;/b&gt; with the currency the quote is based on.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Price</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_editDate</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Regular Expression to extract the date from the downloaded data</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Date Format</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>URL</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>m_editDateFormat</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Regular Expression to extract the date from the downloaded data</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="2">
+ <property name="name">
+ <cstring>m_skipStripping</cstring>
+ </property>
+ <property name="text">
+ <string>Skip HTML stripping</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;For easier processing of the data returned by the online source, KMyMoney usually strips unused parts before it is parsed with the regular expressions. If matching of the fields relies on those items, then use this option to turn stripping off.&lt;/p&gt;
+
+&lt;p&gt;The following items are usually removed by stripping:
+
+&lt;ul&gt;
+&lt;li&gt;HTML tags such as &lt;b&gt;&amp;lt;tag&amp;gt;&lt;/b&gt;&lt;/li&gt;
+&lt;li&gt;&amp; encoded characters such as &lt;b&gt;&amp;amp;nbsp;&lt;/b&gt;&lt;/li&gt;
+&lt;li&gt;duplicate whitespace&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_newButton</cstring>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_deleteButton</cstring>
+ </property>
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>240</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_updateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Update</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsplugins.cpp b/kmymoney2/dialogs/settings/ksettingsplugins.cpp
new file mode 100644
index 0000000..0887315
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsplugins.cpp
@@ -0,0 +1,66 @@
+/***************************************************************************
+ ksettingsplugins.cpp
+ -------------------
+ begin : Thu Feb 12 2009
+ copyright : (C) 2009 Cristian Onet
+ email : onet.cristian@gmail.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlayout.h>
+#include <qstring.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <kdialog.h>
+#include <kpluginselector.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/plugins/pluginloader.h"
+#include "ksettingsplugins.h"
+
+KSettingsPlugins::KSettingsPlugins(QWidget* parent)
+ : QWidget(parent)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ KMyMoneyPlugin::PluginLoader::instance()->pluginSelectorWidget()->reparent(this, QPoint());
+ layout->addWidget(KMyMoneyPlugin::PluginLoader::instance()->pluginSelectorWidget());
+ layout->setSpacing(KDialog::spacingHint());
+}
+
+KSettingsPlugins::~KSettingsPlugins()
+{
+}
+
+void KSettingsPlugins::slotLoadPlugins()
+{
+ KMyMoneyPlugin::PluginLoader::instance()->pluginSelectorWidget()->load();
+}
+
+void KSettingsPlugins::slotSavePlugins()
+{
+ KMyMoneyPlugin::PluginLoader::instance()->pluginSelectorWidget()->save();
+}
+
+void KSettingsPlugins::slotDefaultsPlugins()
+{
+ KMyMoneyPlugin::PluginLoader::instance()->pluginSelectorWidget()->defaults();
+}
+
+#include "ksettingsplugins.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsplugins.h b/kmymoney2/dialogs/settings/ksettingsplugins.h
new file mode 100644
index 0000000..9c36f67
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsplugins.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ ksettingsplugins.h
+ -------------------
+ begin : Thu Feb 12 2009
+ copyright : (C) 2009 Cristian Onet
+ email : onet.cristian@gmail.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSPLUGINS_H
+#define KSETTINGSPLUGINS_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qwidget.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+class KSettingsPlugins : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ KSettingsPlugins(QWidget* parent = 0);
+ ~KSettingsPlugins();
+
+public slots:
+ void slotLoadPlugins();
+ void slotSavePlugins();
+ void slotDefaultsPlugins();
+};
+
+#endif // KSETTINGSPLUGINS_H
diff --git a/kmymoney2/dialogs/settings/ksettingsregister.cpp b/kmymoney2/dialogs/settings/ksettingsregister.cpp
new file mode 100644
index 0000000..9f1fda2
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsregister.cpp
@@ -0,0 +1,75 @@
+/***************************************************************************
+ ksettingsregister.cpp
+ --------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <ktextedit.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingsregister.h"
+#include <kmymoney/transactionsortoption.h>
+
+KSettingsRegister::KSettingsRegister(QWidget* parent, const char* name) :
+ KSettingsRegisterDecl(parent, name)
+{
+ // hide the internally used text fields
+ kcfg_sortNormalView->hide();
+ kcfg_sortReconcileView->hide();
+ kcfg_sortSearchView->hide();
+
+ // setup connections, so that the sort optios get loaded once the edit fields are filled
+ connect(kcfg_sortNormalView, SIGNAL(textChanged()), this, SLOT(slotLoadNormal()));
+ connect(kcfg_sortReconcileView, SIGNAL(textChanged()), this, SLOT(slotLoadReconcile()));
+ connect(kcfg_sortSearchView, SIGNAL(textChanged()), this, SLOT(slotLoadSearch()));
+
+ // setup connections, so that changes by the user are forwarded to the (hidden) edit fields
+ connect(m_sortNormalView, SIGNAL(settingsChanged(const QString&)), kcfg_sortNormalView, SLOT(setText(const QString&)));
+ connect(m_sortReconcileView, SIGNAL(settingsChanged(const QString&)), kcfg_sortReconcileView, SLOT(setText(const QString&)));
+ connect(m_sortSearchView, SIGNAL(settingsChanged(const QString&)), kcfg_sortSearchView, SLOT(setText(const QString&)));
+}
+
+KSettingsRegister::~KSettingsRegister()
+{
+}
+
+void KSettingsRegister::slotLoadNormal(void)
+{
+ // only need this once
+ disconnect(kcfg_sortNormalView, SIGNAL(textChanged()), this, SLOT(slotLoadNormal()));
+ m_sortNormalView->setSettings(kcfg_sortNormalView->text());
+}
+
+void KSettingsRegister::slotLoadReconcile(void)
+{
+ // only need this once
+ disconnect(kcfg_sortReconcileView, SIGNAL(textChanged()), this, SLOT(slotLoadReconcile()));
+ m_sortReconcileView->setSettings(kcfg_sortReconcileView->text());
+}
+
+void KSettingsRegister::slotLoadSearch(void)
+{
+ // only need this once
+ disconnect(kcfg_sortSearchView, SIGNAL(textChanged()), this, SLOT(slotLoadSearch()));
+ m_sortSearchView->setSettings(kcfg_sortSearchView->text());
+}
+
+#include "ksettingsregister.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsregister.h b/kmymoney2/dialogs/settings/ksettingsregister.h
new file mode 100644
index 0000000..bcad7eb
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsregister.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+ ksettingsregister.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSREGISTER_H
+#define KSETTINGSREGISTER_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsregisterdecl.h"
+
+class KSettingsRegister : public KSettingsRegisterDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsRegister(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsRegister();
+
+protected slots:
+ void slotLoadNormal(void);
+ void slotLoadReconcile(void);
+ void slotLoadSearch(void);
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingsregisterdecl.ui b/kmymoney2/dialogs/settings/ksettingsregisterdecl.ui
new file mode 100644
index 0000000..c03807e
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsregisterdecl.ui
@@ -0,0 +1,549 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsRegisterDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsRegisterDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>632</width>
+ <height>403</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Register settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Display</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_ShowGrid</cstring>
+ </property>
+ <property name="text">
+ <string>Show a grid in the register</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_LedgerLens</cstring>
+ </property>
+ <property name="text">
+ <string>Use the ledger lens</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Using the ledger lens shows the details for the transaction that has focus in the ledger. Usually, when using the transaction form, only a one line summary is displayed for each transaction as the details are shown in the form.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_TransactionForm</cstring>
+ </property>
+ <property name="text">
+ <string>Show transaction form</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_AlwaysShowNrField</cstring>
+ </property>
+ <property name="text">
+ <string>Always show a No. field</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_ShowFancyMarker</cstring>
+ </property>
+ <property name="text">
+ <string>Show group header between transactions</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Draws a larger header above each group of transaction. The grouping depends on the current sort order.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_ShowFiscalMarker</cstring>
+ </property>
+ <property name="text">
+ <string>Show header for the previous and current fiscal year</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>sorting</cstring>
+ </property>
+ <attribute name="title">
+ <string>Sorting</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Normal view</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>kcfg_sortNormalView</cstring>
+ </property>
+ </widget>
+ <widget class="TransactionSortOption">
+ <property name="name">
+ <cstring>m_sortNormalView</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Reconciliation view</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>kcfg_sortReconcileView</cstring>
+ </property>
+ </widget>
+ <widget class="TransactionSortOption">
+ <property name="name">
+ <cstring>m_sortReconcileView</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Search view</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>kcfg_sortSearchView</cstring>
+ </property>
+ </widget>
+ <widget class="TransactionSortOption">
+ <property name="name">
+ <cstring>m_sortSearchView</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </widget>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Use the &lt;i&gt;left&lt;/i&gt; and &lt;i&gt;right&lt;/i&gt; buttons to add and remove sort options. Use the &lt;i&gt;up&lt;/i&gt; and &lt;i&gt;down&lt;/i&gt; buttons to modify the sort order. Double-Click a selected entry to toggle the sort order between &lt;i&gt;ascending&lt;/i&gt; and &lt;i&gt;descending&lt;/i&gt;.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Data entry</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_CopyTypeToNr</cstring>
+ </property>
+ <property name="text">
+ <string>Insert transaction type into No. field for new transactions</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_AutoIncCheckNumber</cstring>
+ </property>
+ <property name="text">
+ <string>Auto increment check number</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_FocusChangeIsEnter</cstring>
+ </property>
+ <property name="text">
+ <string>Keep changes when selecting a different transaction/split</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_EnterMovesBetweenFields</cstring>
+ </property>
+ <property name="text">
+ <string>Use Enter to move between fields</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_stringMatchFromStart</cstring>
+ </property>
+ <property name="text">
+ <string>Match names from start</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Mark this option, if you always want to match names e.g. for payees from the start. If unset, any substring is matched.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Default reconciliation state</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <item>
+ <property name="text">
+ <string>Not reconciled</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Cleared</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Reconciled</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kcfg_defaultReconciliationState</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Default reconciliation state for transactions entered during reconciliation of an account</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>kcfg_AutoFillTransaction</cstring>
+ </property>
+ <property name="title">
+ <string>Autofill</string>
+ </property>
+ <property name="exclusive">
+ <bool>false</bool>
+ </property>
+ <property name="selectedId" stdset="0">
+ <number>-1</number>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton1</cstring>
+ </property>
+ <property name="text">
+ <string>No Autofill</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Don't do autofill of transaction data at all.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2</cstring>
+ </property>
+ <property name="text">
+ <string>Same transaction if amount differs less than</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Collect all transactions for the given payee. Treat all transactions that refer to the same category and have an amount with +/- X % as identical. If more than one transaction is found, a list of them is presented to the user.
+
+Selecting 0% will list all transactions.</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>kcfg_AutoFillDifference</cstring>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Two transactions are usually treated identical for autofill, if they refer the same accounts. They are treated as different transactions though, when their amount varies by more than the percentage given here.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>percent.</string>
+ <comment>Same transaction if amount differs less than percent.</comment>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton3</cstring>
+ </property>
+ <property name="text">
+ <string>with previously most often used transaction for the payee</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The data of the last transaction assigned to the category used most often for this payee is autofilled into the transaction editor.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Import</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Match transactions within days</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>kcfg_matchInterval</cstring>
+ </property>
+ <property name="buttonSymbols">
+ <enum>UpDownArrows</enum>
+ </property>
+ <property name="maxValue">
+ <number>99</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Search for matching transactions within the range of the posting date of the imported transaction +/- the number of given days.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_askForPayeeCategory</cstring>
+ </property>
+ <property name="text">
+ <string>Ask for a new payee's default category</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Whenever a new payee is detected during import of a statement, the user will be asked to assign a default category for this user when this option is selected.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/settings/ksettingsschedules.cpp b/kmymoney2/dialogs/settings/ksettingsschedules.cpp
new file mode 100644
index 0000000..6f9a77c
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsschedules.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ ksettingsschedules.cpp
+ --------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "ksettingsschedules.h"
+
+KSettingsSchedules::KSettingsSchedules(QWidget* parent, const char* name) :
+ KSettingsSchedulesDecl(parent, name)
+{
+}
+
+KSettingsSchedules::~KSettingsSchedules()
+{
+}
+
+#include "ksettingsschedules.moc"
diff --git a/kmymoney2/dialogs/settings/ksettingsschedules.h b/kmymoney2/dialogs/settings/ksettingsschedules.h
new file mode 100644
index 0000000..caa7d33
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsschedules.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ ksettingsschedules.h
+ -------------------
+ copyright : (C) 2005 by Thomas Baumgart
+ email : ipwizard@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KSETTINGSSCHEDULES_H
+#define KSETTINGSSCHEDULES_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoney2/dialogs/settings/ksettingsschedulesdecl.h"
+
+class KSettingsSchedules : public KSettingsSchedulesDecl
+{
+ Q_OBJECT
+
+public:
+ KSettingsSchedules(QWidget* parent = 0, const char* name = 0);
+ ~KSettingsSchedules();
+};
+#endif
+
diff --git a/kmymoney2/dialogs/settings/ksettingsschedulesdecl.ui b/kmymoney2/dialogs/settings/ksettingsschedulesdecl.ui
new file mode 100644
index 0000000..fca9aa9
--- /dev/null
+++ b/kmymoney2/dialogs/settings/ksettingsschedulesdecl.ui
@@ -0,0 +1,145 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSettingsSchedulesDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSettingsSchedulesDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>482</width>
+ <height>236</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Schedule Settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox6</cstring>
+ </property>
+ <property name="title">
+ <string>Startup options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_CheckSchedule</cstring>
+ </property>
+ <property name="text">
+ <string>Check schedules on startup</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_dayCountFrame</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Enter transactions this number of days in advance</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>kcfg_CheckSchedulePreview</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Number of days to preview schedules in ledger</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>kcfg_SchedulePreview</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>kcfg_CheckSchedule</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_dayCountFrame</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/dialogs/transactioneditor.cpp b/kmymoney2/dialogs/transactioneditor.cpp
new file mode 100644
index 0000000..c53d3c6
--- /dev/null
+++ b/kmymoney2/dialogs/transactioneditor.cpp
@@ -0,0 +1,2156 @@
+/***************************************************************************
+ transactioneditor.cpp
+ ----------
+ begin : Wed Jun 07 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+#include <qapplication.h>
+#include <qeventloop.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qtooltip.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kglobal.h>
+#include <ktextedit.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <kpushbutton.h>
+#include <kmessagebox.h>
+#include <kstdguiitem.h>
+#include <kiconloader.h>
+#include <kguiitem.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/transactioneditor.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneylineedit.h>
+#include <kmymoney/kmymoneyaccountcompletion.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneyutils.h>
+#include <kmymoney/transactionform.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+
+#include "../dialogs/ksplittransactiondlg.h"
+#include "../dialogs/kcurrencycalculator.h"
+#include "../dialogs/kselecttransactionsdlg.h"
+
+using namespace KMyMoneyRegister;
+using namespace KMyMoneyTransactionForm;
+
+TransactionEditor::TransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::Transaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate) :
+ m_transactions(list),
+ m_regForm(regForm),
+ m_item(item),
+ m_transaction(item->transaction()),
+ m_split(item->split()),
+ m_lastPostDate(lastPostDate),
+ m_openEditSplits(false)
+{
+ m_item->startEditMode();
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotUpdateAccount()));
+}
+
+TransactionEditor::~TransactionEditor()
+{
+ // Make sure the widgets do not send out signals to the editor anymore
+ // After all, the editor is about to die
+ QMap<QString, QWidget*>::iterator it_w;
+ for(it_w = m_editWidgets.begin(); it_w != m_editWidgets.end(); ++it_w) {
+ (*it_w)->disconnect(this);
+ }
+
+ m_regForm->removeEditWidgets(m_editWidgets);
+ m_item->leaveEditMode();
+ emit finishEdit(m_transactions);
+}
+
+void TransactionEditor::slotUpdateAccount(const QString& id)
+{
+ m_account = MyMoneyFile::instance()->account(id);
+ setupPrecision();
+}
+
+void TransactionEditor::slotUpdateAccount(void)
+{
+ // reload m_account as it might have been changed
+ m_account = MyMoneyFile::instance()->account(m_account.id());
+ setupPrecision();
+}
+
+void TransactionEditor::setupPrecision(void)
+{
+ const int prec = (m_account.id().isEmpty()) ? 2 : MyMoneyMoney::denomToPrec(m_account.fraction());
+ QStringList widgets = QStringList::split(",", "amount,deposit,payment");
+ QStringList::const_iterator it_w;
+ for(it_w = widgets.begin(); it_w != widgets.end(); ++it_w) {
+ QWidget * w;
+ if((w = haveWidget(*it_w)) != 0) {
+ dynamic_cast<kMyMoneyEdit*>(w)->setPrecision(prec);
+ }
+ }
+}
+
+void TransactionEditor::setup(QWidgetList& tabOrderWidgets, const MyMoneyAccount& account, KMyMoneyRegister::Action action)
+{
+ m_account = account;
+ m_initialAction = action;
+ createEditWidgets();
+ m_regForm->arrangeEditWidgets(m_editWidgets, m_item);
+ m_regForm->tabOrder(tabOrderWidgets, m_item);
+ QWidget* w = haveWidget("tabbar");
+ if(w)
+ tabOrderWidgets.append(w);
+ loadEditWidgets(action);
+ m_editWidgets.removeOrphans();
+ clearFinalWidgets();
+ setupFinalWidgets();
+ slotUpdateButtonState();
+}
+
+void TransactionEditor::clearFinalWidgets(void)
+{
+ m_finalEditWidgets.clear();
+}
+
+void TransactionEditor::addFinalWidget(const QWidget* w)
+{
+ if(w) {
+ m_finalEditWidgets << w;
+ }
+}
+
+void TransactionEditor::slotReloadEditWidgets(void)
+{
+}
+
+bool TransactionEditor::eventFilter(QObject* o, QEvent* e)
+{
+ bool rc = false;
+ if(o == haveWidget("number")) {
+ if(e->type() == QEvent::MouseButtonDblClick) {
+ emit assignNumber();
+ rc = true;
+ }
+ }
+
+ // if the object is a widget, the event is a key press event and
+ // the object is one of our edit widgets, then ....
+ if(o->isWidgetType()
+ && (e->type() == QEvent::KeyPress)
+ && m_editWidgets.values().contains(dynamic_cast<QWidget*>(o))) {
+ QKeyEvent* k = dynamic_cast<QKeyEvent*>(e);
+ if((k->state() & Qt::KeyButtonMask) == 0) {
+ bool isFinal = false;
+ QValueList<const QWidget*>::const_iterator it_w;
+ switch(k->key()) {
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ // we check, if the object is one of the m_finalEditWidgets and if it's
+ // a kMyMoneyEdit object that the value is not 0. If any of that is the
+ // case, it's the final object. In other cases, we convert the enter
+ // key into a TAB key to move between the fields. Of course, we only need
+ // to do this as long as the appropriate option is set. In all other cases,
+ // we treat the return/enter key as such.
+ if(KMyMoneyGlobalSettings::enterMovesBetweenFields()) {
+ for(it_w = m_finalEditWidgets.begin(); !isFinal && it_w != m_finalEditWidgets.end(); ++it_w) {
+ if(*it_w == o) {
+ if(dynamic_cast<const kMyMoneyEdit*>(*it_w)) {
+ isFinal = !(dynamic_cast<const kMyMoneyEdit*>(*it_w)->value().isZero());
+ } else
+ isFinal = true;
+ }
+ }
+ } else
+ isFinal = true;
+
+ // for the non-final objects, we treat the return key as a TAB
+ if(!isFinal) {
+ QKeyEvent evt(e->type(),
+ Key_Tab, 0, k->state(), QString::null,
+ k->isAutoRepeat(), k->count());
+
+ QApplication::sendEvent( o, &evt );
+ // in case of a category item and the split button is visible
+ // send a second event so that we get passed the button.
+ if(dynamic_cast<KMyMoneyCategory*>(o) && dynamic_cast<KMyMoneyCategory*>(o)->splitButton())
+ QApplication::sendEvent( o, &evt );
+
+ } else {
+ QTimer::singleShot(0, this, SIGNAL(returnPressed()));
+ }
+ // don't process any further
+ rc = true;
+ break;
+
+ case Qt::Key_Escape:
+ QTimer::singleShot(0, this, SIGNAL(escapePressed()));
+ break;
+ }
+ }
+ }
+ return rc;
+}
+
+void TransactionEditor::slotNumberChanged(const QString& txt)
+{
+ kMyMoneyLineEdit* number = dynamic_cast<kMyMoneyLineEdit*>(haveWidget("number"));
+
+ if(number) {
+ if(MyMoneyFile::instance()->checkNoUsed(m_account.id(), txt)) {
+ if(KMessageBox::questionYesNo(m_regForm, QString("<qt>")+i18n("The number <b>%1</b> has already been used in account <b>%2</b>. Do you want to replace it with the next available number?").arg(txt).arg(m_account.name())+QString("</qt>"), i18n("Duplicate number")) == KMessageBox::Yes) {
+ number->loadText(KMyMoneyUtils::nextCheckNumber(m_account));
+ }
+ }
+ }
+}
+
+void TransactionEditor::slotUpdateButtonState(void)
+{
+ QString reason;
+ emit transactionDataSufficient(isComplete(reason));
+}
+
+QWidget* TransactionEditor::haveWidget(const QString& name) const
+{
+ return m_editWidgets.haveWidget(name);
+}
+
+int TransactionEditor::slotEditSplits(void)
+{
+ return QDialog::Rejected;
+}
+
+#if 0
+ // If we deal with multiple currencies we make sure, that for
+ // transactions with two splits, the transaction's commodity is the
+ // currency of the currently selected account. This saves us from a
+ // lot of grieve later on.
+ // Editing a transaction which has more than two splits and a commodity
+ // that differs from the currency of the current selected account is
+ // not a good idea. We will warn the user and give him a hint if there
+ // is an account where he can perfom the edit operation much better.
+ if(m_transaction.commodity() != m_account.currencyId()) {
+ if(m_transaction.splitCount() == 2) {
+ // in case of two splits, it's easy. We just have to switch the
+ // transactions commodity. Let's assume the following scenario:
+ // - transactions commodity is CA
+ // - account's currencyId is CB
+ // - second split is of course in CA (otherwise we have a real problem)
+ // - Value is V in both splits
+ // - Shares in this account's split is SB
+ // - Shares in the other account's split is SA (and equal to V)
+ //
+ // We do the following:
+ // - change transactions commodity to CB
+ // - set V in both splits to SB
+ // - modify the splits in the transaction
+ try {
+ MyMoneySplit split = m_transaction.splitByAccount(m_account.id(), false);
+ m_transaction.setCommodity(m_account.currencyId());
+ m_split.setValue(m_split.shares());
+ split.setValue(-m_split.shares());
+ m_transaction.modifySplit(m_split);
+ m_transaction.modifySplit(split);
+
+ if(m_transactionPtr) {
+ KMyMoneyTransaction k(m_transaction);
+ k.setSplitId(m_split.id());
+ *m_transactionPtr = k;
+ }
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to update commodity to second splits currency in %s: '%s'", m_transaction.id().data(), e->what().data());
+ delete e;
+ }
+
+ } else {
+ // Find a suitable account
+ MyMoneySecurity sec = MyMoneyFile::instance()->currency(m_transaction.commodity());
+ MyMoneyAccount acc;
+ for(it = m_transaction.splits().begin(); it != m_transaction.splits().end(); ++it) {
+ if((*it).id() == m_split.id())
+ continue;
+ acc = MyMoneyFile::instance()->account((*it).accountId());
+ if((acc.accountGroup() == MyMoneyAccount::Asset
+ || acc.accountGroup() == MyMoneyAccount::Liability)
+ && acc.accountType() != MyMoneyAccount::Stock) {
+ if(m_transaction.commodity() == acc.currencyId())
+ break;
+ }
+ acc = MyMoneyAccount();
+ }
+ QString msg;
+ msg = QString("<p>")+i18n("This transaction has more than two splits and is based on a different currency (%1). Using this account to modify the transaction is currently not very well supported by KMyMoney and may result in false results.").arg(sec.name())+QString(" ");
+ if(acc.id().isEmpty()) {
+ msg += i18n("KMyMoney was not able to find a more appropriate account to edit this transaction. Nevertheless, you are allowed to modify the transaction. If you don't want to edit this transaction, please cancel from editing next.");
+ } else {
+ msg += i18n("Using e.g. <b>%1</b> to edit this transaction is a better choice. Nevertheless, you are allowed to modify the transaction. If you want to use the suggested account instead, please cancel from editing next and change the view to the suggested account.").arg(acc.name());
+ }
+ KMessageBox::information(0, msg);
+ }
+ }
+#endif
+
+void TransactionEditor::setTransaction(const MyMoneyTransaction& t, const MyMoneySplit& s)
+{
+ m_transaction = t;
+ m_split = s;
+ loadEditWidgets();
+}
+
+bool TransactionEditor::fixTransactionCommodity(const MyMoneyAccount& account)
+{
+ bool rc = true;
+ bool firstTimeMultiCurrency = true;
+ m_account = account;
+
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ // determine the max fraction for this account
+ MyMoneySecurity sec = file->security(m_account.currencyId());
+ int fract = m_account.fraction();
+
+ // scan the list of selected transactions
+ KMyMoneyRegister::SelectedTransactions::iterator it_t;
+ for(it_t = m_transactions.begin(); (rc == true) && (it_t != m_transactions.end()); ++it_t) {
+ // there was a time when the schedule editor did not setup the transaction commodity
+ // let's give a helping hand here for those old schedules
+ if((*it_t).transaction().commodity().isEmpty())
+ (*it_t).transaction().setCommodity(m_account.currencyId());
+ // we need to check things only if a different commodity is used
+ if(m_account.currencyId() != (*it_t).transaction().commodity()) {
+ MyMoneySecurity osec = file->security((*it_t).transaction().commodity());
+ switch((*it_t).transaction().splitCount()) {
+ case 0:
+ // new transaction, guess nothing's here yet ;)
+ break;
+
+ case 1:
+ try {
+ // make sure, that the value is equal to the shares, don't forget our own copy
+ MyMoneySplit& splitB = (*it_t).split(); // reference usage wanted here
+ if(m_split == splitB)
+ m_split.setValue(splitB.shares());
+ splitB.setValue(splitB.shares());
+ (*it_t).transaction().modifySplit(splitB);
+
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to update commodity to second splits currency in %s: '%s'", (*it_t).transaction().id().data(), e->what().data());
+ delete e;
+ }
+ break;
+
+ case 2:
+ // If we deal with multiple currencies we make sure, that for
+ // transactions with two splits, the transaction's commodity is the
+ // currency of the currently selected account. This saves us from a
+ // lot of grieve later on. We just have to switch the
+ // transactions commodity. Let's assume the following scenario:
+ // - transactions commodity is CA
+ // - splitB and account's currencyId is CB
+ // - splitA is of course in CA (otherwise we have a real problem)
+ // - Value is V in both splits
+ // - Shares in splitB is SB
+ // - Shares in splitA is SA (and equal to V)
+ //
+ // We do the following:
+ // - change transactions commodity to CB
+ // - set V in both splits to SB
+ // - modify the splits in the transaction
+ try {
+ // retrieve the splits
+ MyMoneySplit& splitB = (*it_t).split(); // reference usage wanted here
+ MyMoneySplit splitA = (*it_t).transaction().splitByAccount(m_account.id(), false);
+
+ // - set V in both splits to SB. Don't forget our own copy
+ if(m_split == splitB) {
+ m_split.setValue(splitB.shares());
+ }
+ splitB.setValue(splitB.shares());
+ splitA.setValue(-splitB.shares());
+ (*it_t).transaction().modifySplit(splitA);
+ (*it_t).transaction().modifySplit(splitB);
+
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to update commodity to second splits currency in %s: '%s'", (*it_t).transaction().id().data(), e->what().data());
+ delete e;
+ }
+ break;
+
+ default:
+ // TODO: use new logic by adjusting all splits by the price
+ // extracted from the selected split. Inform the user that
+ // this will happen and allow him to stop the processing (rc = false)
+
+ try {
+ QString msg;
+ if(firstTimeMultiCurrency) {
+ firstTimeMultiCurrency = false;
+ if(!isMultiSelection()) {
+ msg = i18n("This transaction has more than two splits and is originally based on a different currency (%1). Using this account to modify the transaction may result in rounding errors. Do you want to continue?").arg(osec.name());
+ } else {
+ msg = i18n("At least one of the selected transactions has more than two splits and is originally based on a different currency (%1). Using this account to modify the transactions may result in rounding errors. Do you want to continue?").arg(osec.name());
+ }
+
+ if(KMessageBox::warningContinueCancel(0, QString("<qt>%1</qt>").arg(msg)) == KMessageBox::Cancel) {
+ rc = false;
+ }
+ }
+
+ if(rc == true) {
+ MyMoneyMoney price;
+ if(!(*it_t).split().shares().isZero() && !(*it_t).split().value().isZero())
+ price = (*it_t).split().shares() / (*it_t).split().value();
+ QValueList<MyMoneySplit>::iterator it_s;
+ MyMoneySplit& mySplit = (*it_t).split();
+ for(it_s = (*it_t).transaction().splits().begin(); it_s != (*it_t).transaction().splits().end(); ++it_s) {
+ MyMoneySplit s = (*it_s);
+ if(s == mySplit) {
+ s.setValue(s.shares());
+ if(mySplit == m_split) {
+ m_split = s;
+ }
+ mySplit = s;
+ } else {
+ s.setValue((s.value() * price).convert(fract));
+ }
+ (*it_t).transaction().modifySplit(s);
+ }
+ }
+ } catch(MyMoneyException *e) {
+ qDebug("Unable to update commodity of split currency in %s: '%s'", (*it_t).transaction().id().data(), e->what().data());
+ delete e;
+ }
+ break;
+ }
+
+ // set the transaction's ommodity to this account's currency
+ (*it_t).transaction().setCommodity(m_account.currencyId());
+
+ // update our copy of the transaction that has the focus
+ if((*it_t).transaction().id() == m_transaction.id()) {
+ m_transaction = (*it_t).transaction();
+ }
+ }
+ }
+ return rc;
+}
+
+void TransactionEditor::assignNextNumber(void)
+{
+ if(canAssignNumber()) {
+ kMyMoneyLineEdit* number = dynamic_cast<kMyMoneyLineEdit*>(haveWidget("number"));
+ number->loadText(KMyMoneyUtils::nextCheckNumber(m_account));
+ }
+}
+
+bool TransactionEditor::canAssignNumber(void) const
+{
+ kMyMoneyLineEdit* number = dynamic_cast<kMyMoneyLineEdit*>(haveWidget("number"));
+ return (number != 0) && (number->text().isEmpty());
+}
+
+void TransactionEditor::setupCategoryWidget(KMyMoneyCategory* category, const QValueList<MyMoneySplit>& splits, QString& categoryId, const char* splitEditSlot, bool /* allowObjectCreation */)
+{
+ disconnect(category, SIGNAL(focusIn()), this, splitEditSlot);
+#if 0
+ // FIXME must deal with the logic that suppressObjectCreation is
+ // automatically turned off when the createItem() signal is connected
+ if(allowObjectCreation)
+ category->setSuppressObjectCreation(false);
+#endif
+
+ switch(splits.count()) {
+ case 0:
+ categoryId = QString();
+ if(!category->currentText().isEmpty()) {
+ category->setCurrentText();
+ // make sure, we don't see the selector
+ category->completion()->hide();
+ }
+ category->completion()->setSelected(QString());
+ break;
+
+ case 1:
+ categoryId = splits[0].accountId();
+ category->completion()->setSelected(categoryId);
+ category->slotItemSelected(categoryId);
+ break;
+
+ default:
+ categoryId = QString();
+ category->setSplitTransaction();
+ connect(category, SIGNAL(focusIn()), this, splitEditSlot);
+#if 0
+ // FIXME must deal with the logic that suppressObjectCreation is
+ // automatically turned off when the createItem() signal is connected
+ if(allowObjectCreation)
+ category->setSuppressObjectCreation(true);
+#endif
+ break;
+ }
+}
+
+bool TransactionEditor::enterTransactions(QString& newId, bool askForSchedule, bool suppressBalanceWarnings)
+{
+ newId = QString();
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ // make sure to run through all stuff that is tied to 'focusout events'.
+ m_regForm->parentWidget()->setFocus();
+ QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 10);
+
+ // we don't need to update our widgets anymore, so we just disconnect the signal
+ disconnect(file, SIGNAL(dataChanged()), this, SLOT(slotReloadEditWidgets()));
+
+ KMyMoneyRegister::SelectedTransactions::iterator it_t;
+ MyMoneyTransaction t;
+ bool newTransactionCreated = false;
+
+ // make sure, that only a single new transaction can be created.
+ // we need to update m_transactions to contain the new transaction
+ // which is then stored in the variable t when we leave the loop.
+ // m_transactions will be sent out in finishEdit() and forces
+ // the new transaction to be selected in the ledger view
+
+ // collect the transactions to be stored in the engine in a local
+ // list first, so that the user has a chance to interrupt the storage
+ // process
+ QValueList<MyMoneyTransaction> list;
+ bool storeTransactions = true;
+
+ // collect transactions
+ for(it_t = m_transactions.begin(); storeTransactions && !newTransactionCreated && it_t != m_transactions.end(); ++it_t) {
+ storeTransactions = createTransaction(t, (*it_t).transaction(), (*it_t).split());
+ // if the transaction was created successfully, append it to the list
+ if(storeTransactions)
+ list.append(t);
+
+ // if we created a new transaction keep that in mind
+ if(t.id().isEmpty())
+ newTransactionCreated = true;
+ }
+
+ // if not interrupted by user, continue to store them in the engine
+ if(storeTransactions) {
+ int i = 0;
+ emit statusMsg(i18n("Storing transactions"));
+ emit statusProgress(0, list.count());
+
+ MyMoneyFileTransaction ft;
+
+ try {
+ QValueList<MyMoneyTransaction>::iterator it_ts;
+ QMap<QString, bool> minBalanceEarly;
+ QMap<QString, bool> minBalanceAbsolute;
+ QMap<QString, bool> maxCreditEarly;
+ QMap<QString, bool> maxCreditAbsolute;
+ QMap<QString, bool> accountIds;
+
+ for(it_ts = list.begin(); it_ts != list.end(); ++it_ts) {
+ // if we have a categorization, make sure we remove
+ // the 'imported' flag automagically
+ if((*it_ts).splitCount() > 1)
+ (*it_ts).setImported(false);
+
+ // create information about min and max balances
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = (*it_ts).splits().begin(); it_s != (*it_ts).splits().end(); ++it_s) {
+ MyMoneyAccount acc = file->account((*it_s).accountId());
+ accountIds[acc.id()] = true;
+ MyMoneyMoney balance = file->balance(acc.id());
+ if(!acc.value("minBalanceEarly").isEmpty()) {
+ minBalanceEarly[acc.id()] = balance < MyMoneyMoney(acc.value("minBalanceEarly"));
+ }
+ if(!acc.value("minBalanceAbsolute").isEmpty()) {
+ minBalanceAbsolute[acc.id()] = balance < MyMoneyMoney(acc.value("minBalanceAbsolute"));
+ minBalanceEarly[acc.id()] = false;
+ }
+ if(!acc.value("maxCreditEarly").isEmpty()) {
+ maxCreditEarly[acc.id()] = balance < MyMoneyMoney(acc.value("maxCreditEarly"));
+ }
+ if(!acc.value("maxCreditAbsolute").isEmpty()) {
+ maxCreditAbsolute[acc.id()] = balance < MyMoneyMoney(acc.value("maxCreditAbsolute"));
+ maxCreditEarly[acc.id()] = false;
+ }
+ }
+
+ if((*it_ts).id().isEmpty()) {
+ bool enter = true;
+ if(askForSchedule && (*it_ts).postDate() > QDate::currentDate()) {
+ KGuiItem enterItem;
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem enterButton( i18n("&Enter" ),
+ QIconSet(il->loadIcon("kontact_journal", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Accepts the entered data and stores it"),
+ i18n("Use this to enter the transaction into the ledger."));
+ KGuiItem scheduleButton( i18n("&Schedule" ),
+ QIconSet(il->loadIcon("kontact_date", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Accepts the entered data and stores it as schedule"),
+ i18n("Use this to schedule the transaction for later entry into the ledger."));
+
+ enter = KMessageBox::questionYesNo(m_regForm, QString("<qt>%1</qt>").arg(i18n("The transaction you are about to enter has a post date in the future.<br/><br/>Do you want to enter it in the ledger or add it to the schedules?")), i18n("Dialog caption for 'Enter or schedule' dialog", "Enter or schedule?"), enterButton, scheduleButton, "EnterOrScheduleTransactionInFuture") == KMessageBox::Yes;
+ }
+ if(enter) {
+ // add new transaction
+ file->addTransaction(*it_ts);
+ // pass the newly assigned id on to the caller
+ newId = (*it_ts).id();
+ // refresh account and transaction object because they might have changed
+ m_account = file->account(m_account.id());
+ t = (*it_ts);
+
+ // if a new transaction has a valid number, keep it with the account
+ QString number = (*it_ts).splits()[0].number();
+ if(!number.isEmpty()) {
+ m_account.setValue("lastNumberUsed", number);
+ file->modifyAccount(m_account);
+ }
+
+ } else {
+ // turn object creation on, so that moving the focus does
+ // not screw up the dialog that might be popping up
+ emit objectCreation(true);
+ emit scheduleTransaction(*it_ts, MyMoneySchedule::OCCUR_ONCE);
+ emit objectCreation(false);
+
+ newTransactionCreated = false;
+ }
+
+ // send out the post date of this transaction
+ emit lastPostDateUsed((*it_ts).postDate());
+ } else {
+ // modify existing transaction
+ file->modifyTransaction(*it_ts);
+ }
+ }
+ emit statusProgress(i++, 0);
+
+ // update m_transactions to contain the newly created transaction so that
+ // it is selected as the current one
+ // we need to do that before we commit the transaction to the engine
+ // as we need it during the update of the views that is caused by committing already.
+ if(newTransactionCreated) {
+ m_transactions.clear();
+ MyMoneySplit s;
+ // a transaction w/o a single split should not exist and adding it
+ // should throw an exception in MyMoneyFile::addTransaction, but we
+ // remain on the save side of things to check for it
+ if(t.splitCount() > 0)
+ s = t.splits()[0];
+ KMyMoneyRegister::SelectedTransaction st(t, s);
+ m_transactions.append(st);
+ }
+
+ ft.commit();
+
+ // now analyse the balances and spit out warnings to the user
+ QMap<QString, bool>::const_iterator it_a;
+
+ if(!suppressBalanceWarnings) {
+ for(it_a = accountIds.begin(); it_a != accountIds.end(); ++it_a) {
+ QString msg;
+ MyMoneyAccount acc = file->account(it_a.key());
+ MyMoneyMoney balance = file->balance(acc.id());
+ const MyMoneySecurity& sec = file->security(acc.currencyId());
+ QString key;
+ key = "minBalanceEarly";
+ if(!acc.value(key).isEmpty()) {
+ if(minBalanceEarly[acc.id()] == false && balance < MyMoneyMoney(acc.value(key))) {
+ msg = QString("<qt>%1</qt>").arg(i18n("The balance of account <b>%1</b> dropped below the warning balance of %2.").arg(acc.name(), MyMoneyMoney(acc.value(key)).formatMoney(acc, sec)));
+ }
+ }
+ key = "minBalanceAbsolute";
+ if(!acc.value(key).isEmpty()) {
+ if(minBalanceAbsolute[acc.id()] == false && balance < MyMoneyMoney(acc.value(key))) {
+ msg = QString("<qt>%1</qt>").arg(i18n("The balance of account <b>%1</b> dropped below the minimum balance of %2.").arg(acc.name(), MyMoneyMoney(acc.value(key)).formatMoney(acc, sec)));
+ }
+ }
+ key = "maxCreditEarly";
+ if(!acc.value(key).isEmpty()) {
+ if(maxCreditEarly[acc.id()] == false && balance < MyMoneyMoney(acc.value(key))) {
+ msg = QString("<qt>%1</qt>").arg(i18n("The balance of account <b>%1</b> dropped below the maximum credit warning limit of %2.").arg(acc.name(), MyMoneyMoney(acc.value(key)).formatMoney(acc, sec)));
+ }
+ }
+ key = "maxCreditAbsolute";
+ if(!acc.value(key).isEmpty()) {
+ if(maxCreditAbsolute[acc.id()] == false && balance < MyMoneyMoney(acc.value(key))) {
+ msg = QString("<qt>%1</qt>").arg(i18n("The balance of account <b>%1</b> dropped below the maximum credit limit of %2.").arg(acc.name(), MyMoneyMoney(acc.value(key)).formatMoney(acc, sec)));
+ }
+ }
+
+ if(!msg.isEmpty()) {
+ emit balanceWarning(m_regForm, acc, msg);
+ }
+ }
+ }
+ } catch(MyMoneyException * e) {
+ qDebug("Unable to store transaction within engine: %s", e->what().latin1());
+ delete e;
+ newTransactionCreated = false;
+ }
+
+ emit statusProgress(-1, -1);
+ emit statusMsg(QString());
+
+ }
+ return storeTransactions;
+}
+
+
+StdTransactionEditor::StdTransactionEditor()
+{
+}
+
+StdTransactionEditor::StdTransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::Transaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate) :
+ TransactionEditor(regForm, item, list, lastPostDate),
+ m_inUpdateVat(false)
+{
+}
+
+StdTransactionEditor::~StdTransactionEditor()
+{
+ KMyMoneyTransactionForm::TransactionForm* form = dynamic_cast<KMyMoneyTransactionForm::TransactionForm*>(m_regForm);
+ if(form) {
+ form->enableTabBar(true);
+ }
+}
+
+bool StdTransactionEditor::eventFilter(QObject* o, QEvent* e)
+{
+ bool rc = TransactionEditor::eventFilter(o, e);
+
+#if 0
+ // this is sofar dead code here, as the focus out event for Comboboxes
+ // never comes along here. I don't know why (ipwizard - 2009-10-03)
+ if((e->type() == QEvent::FocusOut)
+ && (haveWidget("payee") == dynamic_cast<QWidget*>(o))) {
+ // loosing the focus on the payee widget?
+ qDebug("Loosing focus on payee");
+ KMyMoneyPayeeCombo* p = dynamic_cast<KMyMoneyPayeeCombo*>(haveWidget("payee"));
+ if(!p->selectedItem().isEmpty())
+ slotUpdatePayee(p->selectedItem());
+ }
+#endif
+ return rc;
+}
+
+void StdTransactionEditor::createEditWidgets(void)
+{
+ KMyMoneyCategory* account = new KMyMoneyCategory;
+ account->setHint(i18n("Account"));
+ m_editWidgets["account"] = account;
+ connect(account, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(account, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateAccount(const QString&)));
+
+ KMyMoneyPayeeCombo* payee = new KMyMoneyPayeeCombo;
+ payee->setHint(i18n("Payer/Receiver"));
+ m_editWidgets["payee"] = payee;
+ connect(payee, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(payee, SIGNAL(createItem(const QString&, QString&)), this, SIGNAL(createPayee(const QString&, QString&)));
+ connect(payee, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+ connect(payee, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdatePayee(const QString&)));
+
+ KMyMoneyCategory* category = new KMyMoneyCategory(0, 0, true);
+ category->setHint(i18n("Category/Account"));
+ m_editWidgets["category"] = category;
+ connect(category, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateCategory(const QString&)));
+ connect(category, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+ connect(category, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateCategory(const QString&, QString&)));
+ connect(category, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+ connect(category->splitButton(), SIGNAL(clicked()), this, SLOT(slotEditSplits()));
+ category->splitButton()->setDisabled(true);
+
+ KTextEdit* memo = new KTextEdit;
+ memo->setTabChangesFocus(true);
+ m_editWidgets["memo"] = memo;
+
+ bool showNumberField = true;
+ switch(m_account.accountType()) {
+ case MyMoneyAccount::Savings:
+ case MyMoneyAccount::Cash:
+ case MyMoneyAccount::Loan:
+ case MyMoneyAccount::AssetLoan:
+ case MyMoneyAccount::Asset:
+ case MyMoneyAccount::Liability:
+ case MyMoneyAccount::Equity:
+ showNumberField = KMyMoneyGlobalSettings::alwaysShowNrField();
+ break;
+
+ case MyMoneyAccount::Income:
+ case MyMoneyAccount::Expense:
+ showNumberField = false;
+ break;
+
+ default:
+ break;
+ }
+
+ if(showNumberField) {
+ kMyMoneyLineEdit* number = new kMyMoneyLineEdit;
+ number->setHint(i18n("Number"));
+ m_editWidgets["number"] = number;
+ connect(number, SIGNAL(lineChanged(const QString&)), this, SLOT(slotNumberChanged(const QString&)));
+ // number->installEventFilter(this);
+ }
+
+ m_editWidgets["postdate"] = new kMyMoneyDateInput;
+ connect(m_editWidgets["postdate"], SIGNAL(dateChanged(const QDate&)), this, SLOT(slotUpdateButtonState()));
+
+ kMyMoneyEdit* value = new kMyMoneyEdit;
+ m_editWidgets["amount"] = value;
+ value->setResetButtonVisible(false);
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateAmount(const QString&)));
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+
+ value = new kMyMoneyEdit;
+ m_editWidgets["payment"] = value;
+ value->setResetButtonVisible(false);
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdatePayment(const QString&)));
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+
+ value = new kMyMoneyEdit;
+ m_editWidgets["deposit"] = value;
+ value->setResetButtonVisible(false);
+ connect(value, SIGNAL(valueChanged(const QString&)), this, SLOT(slotUpdateDeposit(const QString&)));
+ connect(value, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateButtonState()));
+
+ KMyMoneyCashFlowCombo* cashflow = new KMyMoneyCashFlowCombo(0, 0, m_account.accountGroup());
+ m_editWidgets["cashflow"] = cashflow;
+ connect(cashflow, SIGNAL(directionSelected(KMyMoneyRegister::CashFlowDirection)), this, SLOT(slotUpdateCashFlow(KMyMoneyRegister::CashFlowDirection)));
+ connect(cashflow, SIGNAL(directionSelected(KMyMoneyRegister::CashFlowDirection)), this, SLOT(slotUpdateButtonState()));
+
+ KMyMoneyReconcileCombo* reconcile = new KMyMoneyReconcileCombo;
+ m_editWidgets["status"] = reconcile;
+ connect(reconcile, SIGNAL(itemSelected(const QString&)), this, SLOT(slotUpdateButtonState()));
+
+ KMyMoneyRegister::QWidgetContainer::iterator it_w;
+ for(it_w = m_editWidgets.begin(); it_w != m_editWidgets.end(); ++it_w) {
+ (*it_w)->installEventFilter(this);
+ }
+ // if we don't have more than 1 selected transaction, we don't need
+ // the "don't change" item in some of the combo widgets
+ if(!isMultiSelection()) {
+ reconcile->removeDontCare();
+ cashflow->removeDontCare();
+ }
+
+ QLabel* label;
+ m_editWidgets["category-label"] = label = new QLabel(i18n("Category"), 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+
+ // create a copy of tabbar above the form (if we are created for a form)
+ KMyMoneyTransactionForm::TransactionForm* form = dynamic_cast<KMyMoneyTransactionForm::TransactionForm*>(m_regForm);
+ if(form) {
+ form->enableTabBar(false);
+ KMyMoneyTransactionForm::TabBar* tabbar = new KMyMoneyTransactionForm::TabBar;
+ m_editWidgets["tabbar"] = tabbar;
+ tabbar->copyTabs(form->tabBar());
+ connect(tabbar, SIGNAL(tabSelected(int)), this, SLOT(slotUpdateAction(int)));
+ }
+
+ label = new QLabel(i18n("Date"), 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["date-label"] = label;
+
+ label = new QLabel(i18n("Number"), 0);
+ label->setAlignment(Qt::AlignVCenter | Qt::DontClip);
+ m_editWidgets["number-label"] = label;
+
+ setupPrecision();
+}
+
+void StdTransactionEditor::setupCategoryWidget(QString& categoryId)
+{
+ TransactionEditor::setupCategoryWidget(dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]), m_splits, categoryId, SLOT(slotEditSplits()));
+
+ if(m_splits.count() == 1)
+ m_shares = m_splits[0].shares();
+}
+
+bool StdTransactionEditor::isTransfer(const QString& accId1, const QString& accId2) const
+{
+ if(accId1.isEmpty() || accId2.isEmpty())
+ return false;
+
+ return MyMoneyFile::instance()->account(accId1).isIncomeExpense() == MyMoneyFile::instance()->account(accId2).isIncomeExpense();
+}
+
+void StdTransactionEditor::loadEditWidgets(KMyMoneyRegister::Action action)
+{
+ // don't kick off VAT processing from here
+ m_inUpdateVat = true;
+
+ QMap<QString, QWidget*>::const_iterator it_w;
+ QWidget* w;
+ AccountSet aSet;
+
+ // load the account widget
+ KMyMoneyCategory* account = dynamic_cast<KMyMoneyCategory*>(haveWidget("account"));
+ if(account) {
+ aSet.addAccountGroup(MyMoneyAccount::Asset);
+ aSet.addAccountGroup(MyMoneyAccount::Liability);
+ aSet.removeAccountType(MyMoneyAccount::AssetLoan);
+ aSet.removeAccountType(MyMoneyAccount::CertificateDep);
+ aSet.removeAccountType(MyMoneyAccount::Investment);
+ aSet.removeAccountType(MyMoneyAccount::Stock);
+ aSet.removeAccountType(MyMoneyAccount::MoneyMarket);
+ aSet.removeAccountType(MyMoneyAccount::Loan);
+ aSet.load(account->selector());
+ account->completion()->setSelected(m_account.id());
+ account->slotItemSelected(m_account.id());
+ }
+
+ // load the payee widget
+ KMyMoneyPayeeCombo* payee = dynamic_cast<KMyMoneyPayeeCombo*>(m_editWidgets["payee"]);
+ payee->loadPayees(MyMoneyFile::instance()->payeeList());
+
+ // load the category widget
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ disconnect(category, SIGNAL(focusIn()), this, SLOT(slotEditSplits()));
+
+ // check if the current transaction has a reference to an equity account
+ bool haveEquityAccount = false;
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = m_transaction.splits().begin(); !haveEquityAccount && it_s != m_transaction.splits().end(); ++it_s) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId());
+ if(acc.accountType() == MyMoneyAccount::Equity)
+ haveEquityAccount = true;
+ }
+
+ aSet.clear();
+ aSet.addAccountGroup(MyMoneyAccount::Asset);
+ aSet.addAccountGroup(MyMoneyAccount::Liability);
+ aSet.addAccountGroup(MyMoneyAccount::Income);
+ aSet.addAccountGroup(MyMoneyAccount::Expense);
+ if(KMyMoneyGlobalSettings::expertMode() || haveEquityAccount)
+ aSet.addAccountGroup(MyMoneyAccount::Equity);
+
+ aSet.removeAccountType(MyMoneyAccount::CertificateDep);
+ aSet.removeAccountType(MyMoneyAccount::Investment);
+ aSet.removeAccountType(MyMoneyAccount::Stock);
+ aSet.removeAccountType(MyMoneyAccount::MoneyMarket);
+ aSet.load(category->selector());
+
+ // if an account is specified then remove it from the widget so that the user
+ // cannot create a transfer with from and to account being the same account
+ if(!m_account.id().isEmpty())
+ category->selector()->removeItem(m_account.id());
+
+ if(!isMultiSelection()) {
+ dynamic_cast<KTextEdit*>(m_editWidgets["memo"])->setText(m_split.memo());
+ if(m_transaction.postDate().isValid())
+ dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"])->setDate(m_transaction.postDate());
+ else if(m_lastPostDate.isValid())
+ dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"])->setDate(m_lastPostDate);
+ else
+ dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"])->setDate(QDate::currentDate());
+
+ if((w = haveWidget("number")) != 0) {
+ dynamic_cast<kMyMoneyLineEdit*>(w)->loadText(m_split.number());
+ if(m_transaction.id().isEmpty() // new transaction
+ && dynamic_cast<kMyMoneyLineEdit*>(w)->text().isEmpty() // no number filled in
+ && m_account.accountType() == MyMoneyAccount::Checkings // checkings account
+ && KMyMoneyGlobalSettings::autoIncCheckNumber()) { // and auto inc number turned on?
+ assignNextNumber();
+ }
+ }
+ dynamic_cast<KMyMoneyReconcileCombo*>(m_editWidgets["status"])->setState(m_split.reconcileFlag());
+
+ QString payeeId = m_split.payeeId();
+ if(!payeeId.isEmpty()) {
+ payee->setSelectedItem(payeeId);
+ }
+
+ m_splits.clear();
+ if(m_transaction.splitCount() < 2) {
+ category->completion()->setSelected(QString());
+ } else {
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = m_transaction.splits().begin(); it_s != m_transaction.splits().end(); ++it_s) {
+ if((*it_s) == m_split)
+ continue;
+ m_splits.append(*it_s);
+ }
+ }
+ QString categoryId;
+ setupCategoryWidget(categoryId);
+
+ if((w = haveWidget("cashflow")) != 0) {
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(w);
+ cashflow->setDirection(m_split.value().isNegative() ? KMyMoneyRegister::Payment : KMyMoneyRegister::Deposit);
+ }
+
+ if((w = haveWidget("category-label")) != 0) {
+ QLabel *categoryLabel = dynamic_cast<QLabel*>(w);
+ if(isTransfer(m_split.accountId(), categoryId)) {
+ if(m_split.value().isPositive())
+ categoryLabel->setText(i18n("Transfer from"));
+ else
+ categoryLabel->setText(i18n("Transfer to"));
+ }
+ }
+
+ MyMoneyMoney value = m_split.shares();
+
+ if(haveWidget("deposit")) {
+ if(m_split.shares().isNegative()) {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->loadText("");
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->setValue(value.abs());
+ } else {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->setValue(value.abs());
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->loadText("");
+ }
+ }
+ if((w = haveWidget("amount")) != 0) {
+ dynamic_cast<kMyMoneyEdit*>(w)->setValue(value.abs());
+ }
+
+ slotUpdateCategory(categoryId);
+
+ // try to preset for specific action if a new transaction is being started
+ if(m_transaction.id().isEmpty()) {
+ if((w = haveWidget("category-label")) != 0) {
+ TabBar* tabbar = dynamic_cast<TabBar*>(haveWidget("tabbar"));
+ if(action == KMyMoneyRegister::ActionNone) {
+ if(tabbar) {
+ action = static_cast<KMyMoneyRegister::Action>(tabbar->currentTab());
+ }
+ }
+ if(action != KMyMoneyRegister::ActionNone) {
+ QLabel *categoryLabel = dynamic_cast<QLabel*>(w);
+ if(action == KMyMoneyRegister::ActionTransfer) {
+ if(m_split.value().isPositive())
+ categoryLabel->setText(i18n("Transfer from"));
+ else
+ categoryLabel->setText(i18n("Transfer to"));
+ }
+ if((w = haveWidget("cashflow")) != 0) {
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(w);
+ if(action == KMyMoneyRegister::ActionDeposit || (action == KMyMoneyRegister::ActionTransfer && m_split.value().isPositive()))
+ cashflow->setDirection(KMyMoneyRegister::Deposit);
+ else
+ cashflow->setDirection(KMyMoneyRegister::Payment);
+ }
+ if(tabbar) {
+ tabbar->setCurrentTab(action);
+ }
+ }
+ }
+ } else {
+ TabBar* tabbar = dynamic_cast<TabBar*>(haveWidget("tabbar"));
+ if(tabbar) {
+ if(!isTransfer(m_split.accountId(), categoryId)) {
+ tabbar->setCurrentTab(m_split.value().isNegative() ? KMyMoneyRegister::ActionWithdrawal : KMyMoneyRegister::ActionDeposit);
+ } else {
+ tabbar->setCurrentTab(KMyMoneyRegister::ActionTransfer);
+ }
+ }
+ }
+
+ } else {
+ dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"])->loadDate(QDate());
+ dynamic_cast<KMyMoneyReconcileCombo*>(m_editWidgets["status"])->setState(MyMoneySplit::Unknown);
+ if(haveWidget("deposit")) {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->loadText("");
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->setAllowEmpty();
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->loadText("");
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->setAllowEmpty();
+ }
+ if((w = haveWidget("amount")) != 0) {
+ dynamic_cast<kMyMoneyEdit*>(w)->loadText("");
+ dynamic_cast<kMyMoneyEdit*>(w)->setAllowEmpty();
+ }
+
+ if((w = haveWidget("cashflow")) != 0) {
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(w);
+ cashflow->setDirection(KMyMoneyRegister::Unknown);
+ }
+ if((w = haveWidget("tabbar")) != 0) {
+ w->setEnabled(false);
+ }
+
+ category->completion()->setSelected(QString());
+ }
+
+ // allow kick off VAT processing again
+ m_inUpdateVat = false;
+}
+
+QWidget* StdTransactionEditor::firstWidget(void) const
+{
+ QWidget* w = 0;
+ if(m_initialAction != KMyMoneyRegister::ActionNone)
+ w = haveWidget("payee");
+ return w;
+}
+
+void StdTransactionEditor::slotReloadEditWidgets(void)
+{
+ // reload category widget
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ QString categoryId = category->selectedItem();
+
+ AccountSet aSet;
+ aSet.addAccountGroup(MyMoneyAccount::Asset);
+ aSet.addAccountGroup(MyMoneyAccount::Liability);
+ aSet.addAccountGroup(MyMoneyAccount::Income);
+ aSet.addAccountGroup(MyMoneyAccount::Expense);
+ if(KMyMoneyGlobalSettings::expertMode())
+ aSet.addAccountGroup(MyMoneyAccount::Equity);
+ aSet.load(category->selector());
+
+ // if an account is specified then remove it from the widget so that the user
+ // cannot create a transfer with from and to account being the same account
+ if(!m_account.id().isEmpty())
+ category->selector()->removeItem(m_account.id());
+
+ if(!categoryId.isEmpty())
+ category->setSelectedItem(categoryId);
+
+
+ // reload payee widget
+ KMyMoneyPayeeCombo* payee = dynamic_cast<KMyMoneyPayeeCombo*>(m_editWidgets["payee"]);
+ QString payeeId = payee->selectedItem();
+
+ payee->loadPayees(MyMoneyFile::instance()->payeeList());
+
+ if(!payeeId.isEmpty()) {
+ payee->setSelectedItem(payeeId);
+ }
+}
+
+void StdTransactionEditor::slotUpdatePayee(const QString& payeeId)
+{
+ // we have a new payee assigned to this transaction.
+ // retrieve some information about the state of the category widget
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ QStringList list;
+ category->selectedItems(list);
+
+ // If payee has associated default account (category), set that now if
+ // category is not filled
+ const MyMoneyPayee& payeeObj = MyMoneyFile::instance()->payee(payeeId);
+ if (payeeObj.defaultAccountEnabled() && list.isEmpty()) {
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ category->slotItemSelected(payeeObj.defaultAccountId());
+ return;
+ }
+
+ // in case there is no category assigned, no value entered and no
+ // memo available, we search for the last transaction of this payee
+ // in the account.
+ if(m_transaction.id().isEmpty()
+ && m_splits.count() == 0
+ && KMyMoneyGlobalSettings::autoFillTransaction() != 0
+ && list.isEmpty()) {
+ // check if memo is empty
+ KTextEdit* memo = dynamic_cast<KTextEdit*>(m_editWidgets["memo"]);
+ if(memo && !memo->text().isEmpty())
+ return;
+
+ // check if all value fields are empty
+ kMyMoneyEdit* amount;
+ QStringList fields;
+ fields << "amount" << "payment" << "deposit";
+ QStringList::const_iterator it_f;
+ for(it_f = fields.begin(); it_f != fields.end(); ++it_f) {
+ amount = dynamic_cast<kMyMoneyEdit*>(haveWidget(*it_f));
+ if(amount && !amount->value().isZero())
+ return;
+ }
+
+#if 0
+ // Tony mentioned, that autofill does not work when he changed the date. Well,
+ // that certainly makes sense when you enter transactions in register mode as
+ // opposed to form mode, because the date field is located prior to the date
+ // field in the tab order of the widgets and the user might have already
+ // changed it.
+ //
+ // So I commented out the code that checks the date but left it in for reference.
+ // (ipwizard, 2008-04-07)
+
+ // check if date has been altered by user
+ kMyMoneyDateInput* postDate = dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"]);
+ if((m_lastPostDate.isValid() && (postDate->date() != m_lastPostDate))
+ || (!m_lastPostDate.isValid() && (postDate->date() != QDate::currentDate())))
+ return;
+#endif
+
+ // if we got here, we have to autofill
+ autoFill(payeeId);
+ }
+}
+
+MyMoneyMoney StdTransactionEditor::shares(const MyMoneyTransaction& t) const
+{
+ MyMoneyMoney result;
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = t.splits().begin(); it_s != t.splits().end(); ++it_s) {
+ if((*it_s).accountId() == m_account.id()) {
+ result += (*it_s).shares();
+ }
+ }
+ return result;
+}
+
+struct uniqTransaction {
+ const MyMoneyTransaction* t;
+ int cnt;
+};
+
+void StdTransactionEditor::autoFill(const QString& payeeId)
+{
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> > list;
+ MyMoneyTransactionFilter filter(m_account.id());
+ filter.addPayee(payeeId);
+ MyMoneyFile::instance()->transactionList(list, filter);
+ if(!list.empty()) {
+ // ok, we found at least one previous transaction. now we clear out
+ // what we have collected so far and add those splits from
+ // the previous transaction.
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> >::const_iterator it_t;
+ QMap<QString, struct uniqTransaction> uniqList;
+
+ // collect the transactions and see if we have any duplicates
+ for(it_t = list.begin(); it_t != list.end(); ++it_t) {
+ QString key = (*it_t).first.accountSignature();
+ int cnt = 0;
+ QMap<QString, struct uniqTransaction>::iterator it_u;
+ do {
+ QString ukey = QString("%1-%2").arg(key).arg(cnt);
+ it_u = uniqList.find(ukey);
+ if(it_u == uniqList.end()) {
+ uniqList[ukey].t = &((*it_t).first);
+ uniqList[ukey].cnt = 1;
+ } else if (KMyMoneyGlobalSettings::autoFillTransaction() == 1) {
+ // we already have a transaction with this signature. we must
+ // now check, if we should really treat it as a duplicate according
+ // to the value comparison delta.
+ MyMoneyMoney s1 = shares(*((*it_u).t));
+ MyMoneyMoney s2 = shares((*it_t).first);
+ if(s2.abs() > s1.abs()) {
+ MyMoneyMoney t(s1);
+ s1 = s2;
+ s2 = t;
+ }
+ MyMoneyMoney diff;
+ if(s2.isZero())
+ diff = s1.abs();
+ else
+ diff = ((s1 - s2) / s2).convert(10000);
+ if(diff.isPositive() && diff <= MyMoneyMoney(KMyMoneyGlobalSettings::autoFillDifference(),100)) {
+ uniqList[ukey].t = &((*it_t).first);
+ break; // end while loop
+ }
+ } else if (KMyMoneyGlobalSettings::autoFillTransaction() == 2) {
+ (*it_u).cnt++;
+ break; // end while loop
+ }
+ ++cnt;
+ } while(it_u != uniqList.end());
+
+ }
+
+ MyMoneyTransaction t;
+ if (KMyMoneyGlobalSettings::autoFillTransaction() != 2) {
+#if 0
+ // I removed this code to allow cancellation of an autofill if
+ // it does not match even if there is only a single matching
+ // transaction for the payee in question. In case, we want to revert
+ // to the old behavior, don't forget to uncomment the closing
+ // brace further down in the code as well. (ipwizard 2009-01-16)
+ if(uniqList.count() == 1) {
+ t = list.last().first;
+ } else {
+#endif
+ KSelectTransactionsDlg dlg(m_account, m_regForm);
+ dlg.setCaption(i18n("Select autofill transaction"));
+
+ QMap<QString, struct uniqTransaction>::const_iterator it_u;
+ for(it_u = uniqList.begin(); it_u != uniqList.end(); ++it_u) {
+ dlg.addTransaction(*(*it_u).t);
+ }
+
+ // setup sort order
+ dlg.m_register->setSortOrder("1,-9,-4");
+ // sort the transactions according to the sort setting
+ dlg.m_register->sortItems();
+
+ // and select the last item
+ if(dlg.m_register->lastItem())
+ dlg.m_register->selectItem(dlg.m_register->lastItem());
+
+ if(dlg.exec() == QDialog::Accepted) {
+ t = dlg.transaction();
+ }
+#if 0
+ }
+#endif
+ } else {
+ int maxCnt = 0;
+ QMap<QString, struct uniqTransaction>::const_iterator it_u;
+ for(it_u = uniqList.begin(); it_u != uniqList.end(); ++it_u) {
+ if((*it_u).cnt > maxCnt) {
+ t = *(*it_u).t;
+ maxCnt = (*it_u).cnt;
+ }
+ }
+ }
+
+ if(t != MyMoneyTransaction()) {
+ m_transaction.removeSplits();
+ m_split = MyMoneySplit();
+ MyMoneySplit otherSplit;
+ QValueList<MyMoneySplit>::ConstIterator it;
+ for(it = t.splits().begin(); it != t.splits().end(); ++it) {
+ MyMoneySplit s(*it);
+ s.setReconcileFlag(MyMoneySplit::NotReconciled);
+ s.setReconcileDate(QDate());
+ s.clearId();
+ s.setBankID(QString());
+ // older versions of KMyMoney used to set the action
+ // we don't need this anymore
+ if(s.action() != MyMoneySplit::ActionAmortization
+ && s.action() != MyMoneySplit::ActionInterest) {
+ s.setAction(QString());
+ }
+
+ // FIXME update check number. The old comment contained
+ //
+ // <quote>
+ // If a check number is already specified by the user it is
+ // used. If the input field is empty and the previous transaction
+ // contains a checknumber, the next usuable check no will be assigned
+ // to the transaction.
+ // </quote>
+
+ kMyMoneyLineEdit* editNr = dynamic_cast<kMyMoneyLineEdit*>(haveWidget("number"));
+ if(editNr && !editNr->text().isEmpty()) {
+ s.setNumber(editNr->text());
+ } else if(!s.number().isEmpty()) {
+ s.setNumber(KMyMoneyUtils::nextCheckNumber(m_account));
+ }
+
+ // if the transaction has exactly two splits, remove
+ // the memo text of the split that does not reference
+ // the current account. This allows the user to change
+ // the autofilled memo text which will then also be used
+ // in this split. See createTransaction() for this logic.
+ if(s.accountId() != m_account.id() && t.splitCount() == 2)
+ s.setMemo(QString());
+
+ m_transaction.addSplit(s);
+ if(s.accountId() == m_account.id() && m_split == MyMoneySplit()) {
+ m_split = s;
+ } else {
+ otherSplit = s;
+ }
+ }
+
+ // make sure to extract the right action
+ KMyMoneyRegister::Action action;
+ action = m_split.shares().isNegative() ? KMyMoneyRegister::ActionWithdrawal : KMyMoneyRegister::ActionDeposit;
+
+ if(m_transaction.splitCount() == 2) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(otherSplit.accountId());
+ if(acc.isAssetLiability())
+ action = KMyMoneyRegister::ActionTransfer;
+ }
+
+ // now setup the widgets with the new data but keep the date
+ QDate date = dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"])->date();
+ loadEditWidgets(action);
+ dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"])->setDate(date);
+ }
+ }
+
+ // focus jumps into the category field
+ QWidget* w;
+ if((w = haveWidget("payee")) != 0) {
+ w->setFocus();
+ }
+}
+
+void StdTransactionEditor::slotUpdateAction(int action)
+{
+ TabBar* tabbar = dynamic_cast<TabBar*>(haveWidget("tabbar"));
+ if(tabbar) {
+ QLabel* categoryLabel = dynamic_cast<QLabel*>(haveWidget("category-label"));
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(m_editWidgets["cashflow"]);
+ switch(action) {
+ case KMyMoneyRegister::ActionDeposit:
+ categoryLabel->setText(i18n("Category"));
+ cashflow->setDirection(KMyMoneyRegister::Deposit);
+ break;
+ case KMyMoneyRegister::ActionTransfer:
+ categoryLabel->setText(i18n("Transfer from"));
+ slotUpdateCashFlow(cashflow->direction());
+ break;
+ case KMyMoneyRegister::ActionWithdrawal:
+ categoryLabel->setText(i18n("Category"));
+ cashflow->setDirection(KMyMoneyRegister::Payment);
+ break;
+ }
+ }
+}
+
+void StdTransactionEditor::slotUpdateCashFlow(KMyMoneyRegister::CashFlowDirection dir)
+{
+ QLabel* categoryLabel = dynamic_cast<QLabel*>(haveWidget("category-label"));
+
+ // qDebug("Update cashflow to %d", dir);
+ if(categoryLabel) {
+ TabBar* tabbar = dynamic_cast<TabBar*>(haveWidget("tabbar"));
+ if(categoryLabel->text() != i18n("Category")) {
+ tabbar->setCurrentTab(KMyMoneyRegister::ActionTransfer);
+ if(dir == KMyMoneyRegister::Deposit) {
+ categoryLabel->setText(i18n("Transfer from"));
+ } else {
+ categoryLabel->setText(i18n("Transfer to"));
+ }
+ } else {
+ if(dir == KMyMoneyRegister::Deposit)
+ tabbar->setCurrentTab(KMyMoneyRegister::ActionDeposit);
+ else
+ tabbar->setCurrentTab(KMyMoneyRegister::ActionWithdrawal);
+ }
+ }
+}
+
+void StdTransactionEditor::slotUpdateCategory(const QString& id)
+{
+ QLabel *categoryLabel = dynamic_cast<QLabel*>(haveWidget("category-label"));
+ // qDebug("Update category to %s", id.data());
+
+ if(categoryLabel) {
+ TabBar* tabbar = dynamic_cast<TabBar*>(haveWidget("tabbar"));
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(m_editWidgets["amount"]);
+ MyMoneyMoney val = amount->value();
+
+ if(categoryLabel->text() == i18n("Transfer from")) {
+ val = -val;
+ } else {
+ val = val.abs();
+ }
+
+ if(tabbar) {
+ tabbar->tab(KMyMoneyRegister::ActionTransfer)->setEnabled(true);
+ tabbar->tab(KMyMoneyRegister::ActionDeposit)->setEnabled(true);
+ tabbar->tab(KMyMoneyRegister::ActionWithdrawal)->setEnabled(true);
+ }
+
+ if(!id.isEmpty()) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(id);
+ if(acc.isAssetLiability()
+ || acc.accountGroup() == MyMoneyAccount::Equity) {
+ if(tabbar) {
+ tabbar->tab(KMyMoneyRegister::ActionDeposit)->setEnabled(false);
+ tabbar->tab(KMyMoneyRegister::ActionWithdrawal)->setEnabled(false);
+ }
+ // only change the label if an amount is already filled in
+ if(!val.isZero()) {
+ if(val.isNegative())
+ categoryLabel->setText(i18n("Transfer from"));
+ else
+ categoryLabel->setText(i18n("Transfer to"));
+ }
+ } else {
+ if(tabbar)
+ tabbar->tab(KMyMoneyRegister::ActionTransfer)->setEnabled(false);
+ categoryLabel->setText(i18n("Category"));
+ }
+ updateAmount(val.abs());
+ } else {
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ if(!category->currentText().isEmpty() && tabbar)
+ tabbar->tab(KMyMoneyRegister::ActionTransfer)->setEnabled(false);
+ categoryLabel->setText(i18n("Category"));
+ }
+ if(tabbar)
+ tabbar->update();
+ }
+ updateVAT(false);
+}
+
+void StdTransactionEditor::slotUpdatePayment(const QString& txt)
+{
+ MyMoneyMoney val(txt);
+
+ if(val.isNegative()) {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->setValue(val.abs());
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->clearText();
+ } else {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->clearText();
+ }
+ updateVAT();
+}
+
+void StdTransactionEditor::slotUpdateDeposit(const QString& txt)
+{
+ MyMoneyMoney val(txt);
+ if(val.isNegative()) {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->setValue(val.abs());
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"])->clearText();
+ } else {
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"])->clearText();
+ }
+ updateVAT();
+}
+
+void StdTransactionEditor::slotUpdateAmount(const QString& txt)
+{
+ // qDebug("Update amount to %s", txt.data());
+ MyMoneyMoney val(txt);
+ updateAmount(val);
+ updateVAT(true);
+}
+
+void StdTransactionEditor::updateAmount(const MyMoneyMoney& val)
+{
+ QLabel *categoryLabel = dynamic_cast<QLabel*>(haveWidget("category-label"));
+ if(categoryLabel) {
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(m_editWidgets["cashflow"]);
+
+ if(val.isNegative()) {
+ if(categoryLabel->text() != i18n("Category")) {
+ if(categoryLabel->text() == i18n("Transfer from")) {
+ categoryLabel->setText(i18n("Transfer to"));
+ cashflow->setDirection(KMyMoneyRegister::Payment);
+ } else {
+ categoryLabel->setText(i18n("Transfer from"));
+ cashflow->setDirection(KMyMoneyRegister::Deposit);
+ }
+ } else {
+ if(cashflow->direction() == KMyMoneyRegister::Deposit)
+ cashflow->setDirection(KMyMoneyRegister::Payment);
+ else
+ cashflow->setDirection(KMyMoneyRegister::Deposit);
+ slotUpdateCashFlow(cashflow->direction());
+ }
+ dynamic_cast<kMyMoneyEdit*>(m_editWidgets["amount"])->setValue(val.abs());
+ }
+ }
+}
+
+void StdTransactionEditor::updateVAT(bool amountChanged)
+{
+ // make sure that we don't do this recursively
+ if(m_inUpdateVat)
+ return;
+
+ // we don't do anything if we have multiple transactions selected
+ if(isMultiSelection())
+ return;
+
+ // if auto vat assignment for this account is turned off
+ // we don't care about taxes
+ if(m_account.value("NoVat") == "Yes")
+ return;
+
+ // more splits than category and tax are not supported
+ if(m_splits.count() > 2)
+ return;
+
+ // in order to do anything, we need an amount
+ MyMoneyMoney amount, newAmount;
+ bool amountOk;
+ amount = amountFromWidget(&amountOk);
+ if(!amountOk)
+ return;
+
+ // If the transaction has a tax and a category split, remove the tax split
+ if(m_splits.count() == 2) {
+ newAmount = removeVatSplit();
+ if(m_splits.count() == 2) // not removed?
+ return;
+
+ } else {
+ // otherwise, we need a category
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ if(category->selectedItem().isEmpty())
+ return;
+
+ // if no VAT account is associated with this category/account, then we bail out
+ MyMoneyAccount cat = MyMoneyFile::instance()->account(category->selectedItem());
+ if(cat.value("VatAccount").isEmpty())
+ return;
+
+ newAmount = amount;
+ }
+
+ // seems we have everything we need
+ if(amountChanged)
+ newAmount = amount;
+
+ MyMoneyTransaction transaction;
+ if(createTransaction(transaction, m_transaction, m_split)) {
+ if(addVatSplit(transaction, newAmount)) {
+ m_transaction = transaction;
+ m_split = m_transaction.splits()[0];
+
+ loadEditWidgets();
+
+ // if we made this a split transaction, then move the
+ // focus to the memo field
+ if(qApp->focusWidget() == haveWidget("category")) {
+ QWidget* w = haveWidget("memo");
+ if(w)
+ w->setFocus();
+ }
+ }
+ }
+}
+
+bool StdTransactionEditor::addVatSplit(MyMoneyTransaction& tr, const MyMoneyMoney& amount)
+{
+ if(tr.splitCount() != 2)
+ return false;
+
+ bool rc = false;
+ MyMoneyFile* file = MyMoneyFile::instance();
+
+ try {
+ MyMoneySplit cat; // category
+ MyMoneySplit tax; // tax
+
+ // extract the category split from the transaction
+ MyMoneyAccount category = file->account(tr.splitByAccount(m_account.id(), false).accountId());
+ if(category.value("VatAccount").isEmpty())
+ return false;
+ MyMoneyAccount vatAcc = file->account(category.value("VatAccount").latin1());
+ const MyMoneySecurity& asec = file->security(m_account.currencyId());
+ const MyMoneySecurity& csec = file->security(category.currencyId());
+ const MyMoneySecurity& vsec = file->security(vatAcc.currencyId());
+ if(asec.id() != csec.id() || asec.id() != vsec.id()) {
+ qDebug("Auto VAT assignment only works if all three accounts use the same currency.");
+ return false;
+ }
+
+ MyMoneyMoney vatRate(vatAcc.value("VatRate"));
+ MyMoneyMoney gv, nv; // gross value, net value
+ int fract = m_account.fraction();
+
+ if(!vatRate.isZero()) {
+
+ tax.setAccountId(vatAcc.id());
+
+ // qDebug("vat amount is '%s'", category.value("VatAmount").latin1());
+ if(category.value("VatAmount").lower() != QString("net")) {
+ // split value is the gross value
+ gv = amount;
+ nv = gv / (MyMoneyMoney(1,1) + vatRate);
+ MyMoneySplit catSplit = tr.splitByAccount(m_account.id(), false);
+ catSplit.setShares(-nv.convert(fract));
+ catSplit.setValue(catSplit.shares());
+ tr.modifySplit(catSplit);
+
+ } else {
+ // split value is the net value
+ nv = amount;
+ gv = nv * (MyMoneyMoney(1,1) + vatRate);
+ MyMoneySplit accSplit = tr.splitByAccount(m_account.id());
+ accSplit.setValue(gv.convert(fract));
+ accSplit.setShares(accSplit.value());
+ tr.modifySplit(accSplit);
+ }
+
+ tax.setValue(-(gv - nv).convert(fract));
+ tax.setShares(tax.value());
+ tr.addSplit(tax);
+ rc = true;
+ }
+ } catch(MyMoneyException *e) {
+ delete e;
+ }
+ return rc;
+}
+
+MyMoneyMoney StdTransactionEditor::removeVatSplit(void)
+{
+ // we only deal with splits that have three splits
+ if(m_splits.count() != 2)
+ return amountFromWidget();
+
+ MyMoneySplit c; // category split
+ MyMoneySplit t; // tax split
+
+ bool netValue = false;
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = m_splits.begin(); it_s != m_splits.end(); ++it_s) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId());
+ if(!acc.value("VatAccount").isEmpty()) {
+ netValue = (acc.value("VatAmount").lower() == "net");
+ c = (*it_s);
+ } else if(!acc.value("VatRate").isEmpty()) {
+ t = (*it_s);
+ }
+ }
+
+ // bail out if not all splits are setup
+ if(c.id().isEmpty() || t.id().isEmpty())
+ return amountFromWidget();
+
+ MyMoneyMoney amount;
+ // reduce the splits
+ if(netValue) {
+ amount = -c.shares();
+ } else {
+ amount = -(c.shares() + t.shares());
+ }
+
+ // remove tax split from the list, ...
+ m_splits.clear();
+ m_splits.append(c);
+
+ // ... make sure that the widget is updated ...
+ // block the signals to avoid popping up the split editor dialog
+ // for nothing
+ m_editWidgets["category"]->blockSignals(true);
+ QString id;
+ setupCategoryWidget(id);
+ m_editWidgets["category"]->blockSignals(false);
+
+ // ... and return the updated amount
+ return amount;
+}
+
+bool StdTransactionEditor::isComplete(QString& reason) const
+{
+ reason = QString();
+ // reason.clear(); // for Qt4
+
+ QMap<QString, QWidget*>::const_iterator it_w;
+ kMyMoneyDateInput* postDate = dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"]);
+ if(postDate) {
+ postDate->markAsBadDate();
+ QToolTip::remove(postDate);
+ if(postDate->date().isValid() && (postDate->date() < m_account.openingDate())) {
+ postDate->markAsBadDate(true, KMyMoneyGlobalSettings::listNegativeValueColor());
+ reason = i18n("Cannot enter transaction with postdate prior to account's opening date.");
+ QToolTip::add(postDate, reason);
+ return false;
+ }
+ }
+
+ for(it_w = m_editWidgets.begin(); it_w != m_editWidgets.end(); ++it_w) {
+ KMyMoneyPayeeCombo* payee = dynamic_cast<KMyMoneyPayeeCombo*>(*it_w);
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(*it_w);
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(*it_w);
+ KMyMoneyReconcileCombo* reconcile = dynamic_cast<KMyMoneyReconcileCombo*>(*it_w);
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(*it_w);
+
+ if(payee && !(payee->currentText().isEmpty()))
+ break;
+
+ if(category && !category->lineEdit()->text().isEmpty())
+ break;
+
+ if(amount && !(amount->value().isZero()))
+ break;
+
+ // the following two widgets are only checked if we are editing multiple transactions
+ if(isMultiSelection()) {
+ if(reconcile && reconcile->state() != MyMoneySplit::Unknown)
+ break;
+
+ if(cashflow && cashflow->direction() != KMyMoneyRegister::Unknown)
+ break;
+ }
+ }
+ return it_w != m_editWidgets.end();
+}
+
+void StdTransactionEditor::slotCreateCategory(const QString& name, QString& id)
+{
+ MyMoneyAccount acc, parent;
+ acc.setName(name);
+
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(haveWidget("cashflow"));
+ if(cashflow) {
+ // form based input
+ if(cashflow->direction() == KMyMoneyRegister::Deposit)
+ parent = MyMoneyFile::instance()->income();
+ else
+ parent = MyMoneyFile::instance()->expense();
+
+ } else if(haveWidget("deposit")) {
+ // register based input
+ kMyMoneyEdit* deposit = dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"]);
+ if(deposit->value().isPositive())
+ parent = MyMoneyFile::instance()->income();
+ else
+ parent = MyMoneyFile::instance()->expense();
+
+ } else
+ parent = MyMoneyFile::instance()->expense();
+
+ // TODO extract possible first part of a hierarchy and check if it is one
+ // of our top categories. If so, remove it and select the parent
+ // according to this information.
+
+ emit createCategory(acc, parent);
+
+ // return id
+ id = acc.id();
+}
+
+int StdTransactionEditor::slotEditSplits(void)
+{
+ int rc = QDialog::Rejected;
+
+ if(!m_openEditSplits) {
+ // only get in here in a single instance
+ m_openEditSplits = true;
+
+ // force focus change to update all data
+ QWidget* w = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"])->splitButton();
+ if(w)
+ w->setFocus();
+
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(haveWidget("amount"));
+ kMyMoneyEdit* deposit = dynamic_cast<kMyMoneyEdit*>(haveWidget("deposit"));
+ kMyMoneyEdit* payment = dynamic_cast<kMyMoneyEdit*>(haveWidget("payment"));
+ KMyMoneyCashFlowCombo* cashflow = 0;
+ KMyMoneyRegister::CashFlowDirection dir = KMyMoneyRegister::Unknown;
+ bool isValidAmount = false;
+
+ if(amount) {
+ isValidAmount = amount->lineedit()->text().length() != 0;
+ cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(haveWidget("cashflow"));
+ if(cashflow)
+ dir = cashflow->direction();
+
+ } else {
+ if(deposit) {
+ if (deposit->lineedit()->text().length() != 0) {
+ isValidAmount = true;
+ dir = KMyMoneyRegister::Deposit;
+ }
+ }
+ if(payment) {
+ if (payment->lineedit()->text().length() != 0) {
+ isValidAmount = true;
+ dir = KMyMoneyRegister::Payment;
+ }
+ }
+ if(!deposit || !payment) {
+ qDebug("Internal error: deposit(%p) & payment(%p) widgets not found but required", deposit, payment);
+ return rc;
+ }
+ }
+
+ if(dir == KMyMoneyRegister::Unknown)
+ dir = KMyMoneyRegister::Payment;
+
+ MyMoneyTransaction transaction;
+ if(createTransaction(transaction, m_transaction, m_split)) {
+ MyMoneyMoney value;
+
+ KSplitTransactionDlg* dlg = new KSplitTransactionDlg(transaction,
+ transaction.splits()[0],
+ m_account,
+ isValidAmount,
+ dir == KMyMoneyRegister::Deposit,
+ 0,
+ m_priceInfo,
+ m_regForm);
+ connect(dlg, SIGNAL(objectCreation(bool)), this, SIGNAL(objectCreation(bool)));
+ connect(dlg, SIGNAL(createCategory(MyMoneyAccount&, const MyMoneyAccount&)), this, SIGNAL(createCategory(MyMoneyAccount&, const MyMoneyAccount&)));
+
+ if((rc = dlg->exec()) == QDialog::Accepted) {
+ m_transaction = dlg->transaction();
+ m_split = m_transaction.splits()[0];
+ loadEditWidgets();
+ }
+
+ delete dlg;
+ }
+
+ // focus jumps into the memo field
+ if((w = haveWidget("memo")) != 0) {
+ w->setFocus();
+ }
+
+ m_openEditSplits = false;
+ }
+
+ return rc;
+}
+
+void StdTransactionEditor::checkPayeeInSplit(MyMoneySplit& s, const QString& payeeId)
+{
+ if(s.accountId().isEmpty())
+ return;
+
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(s.accountId());
+ if(acc.isIncomeExpense()) {
+ s.setPayeeId(payeeId);
+ } else {
+ if(s.payeeId().isEmpty())
+ s.setPayeeId(payeeId);
+ }
+}
+
+MyMoneyMoney StdTransactionEditor::amountFromWidget(bool* update) const
+{
+ bool updateValue = false;
+ MyMoneyMoney value;
+
+ KMyMoneyCashFlowCombo* cashflow = dynamic_cast<KMyMoneyCashFlowCombo*>(haveWidget("cashflow"));
+ if(cashflow) {
+ // form based input
+ kMyMoneyEdit* amount = dynamic_cast<kMyMoneyEdit*>(m_editWidgets["amount"]);
+ // if both fields do not contain changes -> no need to update
+ if(cashflow->direction() != KMyMoneyRegister::Unknown
+ && !amount->lineedit()->text().isEmpty())
+ updateValue = true;
+ value = amount->value();
+ if(cashflow->direction() == KMyMoneyRegister::Payment)
+ value = -value;
+
+ } else if(haveWidget("deposit")) {
+ // register based input
+ kMyMoneyEdit* deposit = dynamic_cast<kMyMoneyEdit*>(m_editWidgets["deposit"]);
+ kMyMoneyEdit* payment = dynamic_cast<kMyMoneyEdit*>(m_editWidgets["payment"]);
+ // if both fields do not contain text -> no need to update
+ if(!(deposit->lineedit()->text().isEmpty() && payment->lineedit()->text().isEmpty()))
+ updateValue = true;
+
+ if(deposit->value().isPositive())
+ value = deposit->value();
+ else
+ value = -(payment->value());
+ }
+
+ if(update)
+ *update = updateValue;
+
+ // determine the max fraction for this account and
+ // adjust the value accordingly
+ return value.convert(m_account.fraction());
+}
+
+bool StdTransactionEditor::createTransaction(MyMoneyTransaction& t, const MyMoneyTransaction& torig, const MyMoneySplit& sorig, bool skipPriceDialog)
+{
+ // extract price info from original transaction
+ m_priceInfo.clear();
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ if(!torig.id().isEmpty()) {
+ for(it_s = torig.splits().begin(); it_s != torig.splits().end(); ++it_s) {
+ if((*it_s).id() != sorig.id()) {
+ MyMoneyAccount cat = MyMoneyFile::instance()->account((*it_s).accountId());
+ if(cat.currencyId() != m_account.currencyId()) {
+ if(!(*it_s).shares().isZero() && !(*it_s).value().isZero()) {
+ m_priceInfo[cat.currencyId()] = ((*it_s).shares() / (*it_s).value()).reduce();
+ }
+ }
+ }
+ }
+ }
+
+ t = torig;
+
+ t.removeSplits();
+ t.setCommodity(m_account.currencyId());
+
+ kMyMoneyDateInput* postDate = dynamic_cast<kMyMoneyDateInput*>(m_editWidgets["postdate"]);
+ if(postDate->date().isValid()) {
+ t.setPostDate(postDate->date());
+ }
+
+ // we start with the previous values, make sure we can add them later on
+ MyMoneySplit s0 = sorig;
+ s0.clearId();
+
+ // make sure we reference this account here
+ s0.setAccountId(m_account.id());
+
+ // memo and number field are special: if we have multiple transactions selected
+ // and the edit field is empty, we treat it as "not modified".
+ // FIXME a better approach would be to have a 'dirty' flag with the widgets
+ // which identifies if the originally loaded value has been modified
+ // by the user
+ KTextEdit* memo = dynamic_cast<KTextEdit*>(m_editWidgets["memo"]);
+ if(memo) {
+ if(!isMultiSelection() || (isMultiSelection() && !memo->text().isEmpty() ) )
+ s0.setMemo(memo->text());
+ }
+
+ kMyMoneyLineEdit* number = dynamic_cast<kMyMoneyLineEdit*>(haveWidget("number"));
+ if(number) {
+ if(!isMultiSelection() || (isMultiSelection() && !number->text().isEmpty() ) )
+ s0.setNumber(number->text());
+ }
+
+ KMyMoneyPayeeCombo* payee = dynamic_cast<KMyMoneyPayeeCombo*>(m_editWidgets["payee"]);
+ QString payeeId;
+ if(!isMultiSelection() || (isMultiSelection() && !payee->currentText().isEmpty())) {
+ payeeId = payee->selectedItem();
+ s0.setPayeeId(payeeId);
+ }
+
+ bool updateValue;
+ MyMoneyMoney value = amountFromWidget(&updateValue);
+
+ if(updateValue) {
+ // for this account, the shares and value is the same
+ s0.setValue(value);
+ s0.setShares(value);
+ } else {
+ value = s0.value();
+ }
+
+ // if we mark the split reconciled here, we'll use today's date if no reconciliation date is given
+ KMyMoneyReconcileCombo* status = dynamic_cast<KMyMoneyReconcileCombo*>(m_editWidgets["status"]);
+ if(status->state() != MyMoneySplit::Unknown)
+ s0.setReconcileFlag(status->state());
+
+ if(s0.reconcileFlag() == MyMoneySplit::Reconciled && !s0.reconcileDate().isValid())
+ s0.setReconcileDate(QDate::currentDate());
+
+ checkPayeeInSplit(s0, payeeId);
+
+ // add the split to the transaction
+ t.addSplit(s0);
+
+ // if we have no other split we create it
+ // if we have none or only one other split, we reconstruct it here
+ // if we have more than one other split, we take them as they are
+ // make sure to perform all those changes on a local copy
+ QValueList<MyMoneySplit> splits = m_splits;
+
+ MyMoneySplit s1;
+ if(splits.count() == 0) {
+ s1.setMemo(s0.memo());
+ splits.append(s1);
+
+ // make sure we will fill the value and share fields later on
+ updateValue = true;
+ }
+
+ // FIXME in multiSelection we currently only support transactions with one
+ // or two splits. So we check the original transaction and extract the other
+ // split or create it
+ if(isMultiSelection()) {
+ if(torig.splitCount() == 2) {
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = torig.splits().begin(); it_s != torig.splits().end(); ++it_s) {
+ if((*it_s).id() == sorig.id())
+ continue;
+ s1 = *it_s;
+ s1.clearId();
+ break;
+ }
+ }
+ } else {
+ if(splits.count() == 1) {
+ s1 = splits[0];
+ s1.clearId();
+ }
+ }
+
+ if(isMultiSelection() || splits.count() == 1) {
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ if(!isMultiSelection() || (isMultiSelection() && !category->currentText().isEmpty())) {
+ s1.setAccountId(category->selectedItem());
+ }
+
+ // if the first split has a memo but the second split is empty,
+ // we just copy the memo text over
+ if(memo) {
+ if(!isMultiSelection() || (isMultiSelection() && !memo->text().isEmpty())) {
+ // if the memo is filled, we check if the
+ // account referenced by s1 is a regular account or a category.
+ // in case of a regular account, we just leave the memo as is
+ // in case of a category we simply copy the new value over the old.
+ // in case we don't even have an account id, we just skip because
+ // the split will be removed later on anyway.
+ if(!s1.memo().isEmpty()) {
+ if(!s1.accountId().isEmpty()) {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(s1.accountId());
+ if(acc.isIncomeExpense()) {
+ s1.setMemo(s0.memo());
+ }
+ }
+ } else {
+ s1.setMemo(s0.memo());
+ }
+ }
+ }
+
+ if(updateValue && !s1.accountId().isEmpty()) {
+ s1.setValue(-value);
+ MyMoneyMoney shares;
+ if(!skipPriceDialog) {
+ if(!KCurrencyCalculator::setupSplitPrice(shares, t, s1, m_priceInfo, m_regForm))
+ return false;
+ } else {
+ MyMoneyAccount cat = MyMoneyFile::instance()->account(s1.accountId());
+ if(m_priceInfo.find(cat.currencyId()) != m_priceInfo.end()) {
+ shares = (s1.value() * m_priceInfo[cat.currencyId()]).reduce().convert(cat.fraction());
+ }
+ else
+ shares = s1.value();
+ }
+ s1.setShares(shares);
+ }
+
+ checkPayeeInSplit(s1, payeeId);
+
+ if(!s1.accountId().isEmpty())
+ t.addSplit(s1);
+
+ } else {
+ QValueList<MyMoneySplit>::iterator it_s;
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ s1 = *it_s;
+ s1.clearId();
+ checkPayeeInSplit(s1, payeeId);
+ t.addSplit(s1);
+ }
+ }
+ return true;
+}
+
+void StdTransactionEditor::setupFinalWidgets(void)
+{
+ addFinalWidget(haveWidget("deposit"));
+ addFinalWidget(haveWidget("payment"));
+ addFinalWidget(haveWidget("amount"));
+ addFinalWidget(haveWidget("status"));
+}
+
+void StdTransactionEditor::slotUpdateAccount(const QString& id)
+{
+ TransactionEditor::slotUpdateAccount(id);
+ KMyMoneyCategory* category = dynamic_cast<KMyMoneyCategory*>(m_editWidgets["category"]);
+ if(category && category->splitButton()) {
+ category->splitButton()->setDisabled(id.isEmpty());
+ }
+}
+
+#include "transactioneditor.moc"
+
diff --git a/kmymoney2/dialogs/transactioneditor.h b/kmymoney2/dialogs/transactioneditor.h
new file mode 100644
index 0000000..bf47598
--- /dev/null
+++ b/kmymoney2/dialogs/transactioneditor.h
@@ -0,0 +1,416 @@
+/***************************************************************************
+ transactioneditor.h
+ ----------
+ begin : Wed Jun 07 2006
+ copyright : (C) 2006 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef TRANSACTIONEDITOR_H
+#define TRANSACTIONEDITOR_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qobject.h>
+#include <qwidgetlist.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneyscheduled.h>
+#include <kmymoney/transactioneditorcontainer.h>
+#include <kmymoney/register.h>
+
+class KCurrencyExchange;
+class KMyMoneyCategory;
+
+class TransactionEditor : public QObject
+{
+ Q_OBJECT
+public:
+ TransactionEditor() {}
+ TransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::Transaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate);
+ virtual ~TransactionEditor();
+
+ /**
+ * This method is used as a helper because virtual methods cannot be
+ * called within a constructor. Thus setup() should be called immediately
+ * after a TransactionEditor() object or one of its derivatives is
+ * constructed. The parameter @a account identifies the account that
+ * is currently opened in the calling ledger view.
+ *
+ * This account will not be included in category sets. The default is
+ * no account so all will be shown. I have no idea anymore, what I
+ * tried to say with the first sentence above. :( Maybe this is crap.
+ *
+ * @param tabOrderWidgets QWidgetList which will be filled with the pointers
+ * to the editWidgets in their tab order
+ * @param account account that is currently shown in the calling ledger view
+ * @param action default action (defaults to ActionNone).
+ */
+ void setup(QWidgetList& tabOrderWidgets, const MyMoneyAccount& account = MyMoneyAccount(), KMyMoneyRegister::Action action = KMyMoneyRegister::ActionNone);
+
+ /**
+ * Enter the transactions into the ledger. In case of a newly created
+ * transaction @a newId contains the assigned id. In case @a askForSchedule
+ * is true (the default), the user will be asked if he wants to enter new
+ * transactions with a post date in the future into the ledger or rather
+ * create a schedule for them. In case @a suppressBalanceWarnings is @p false
+ * (the default) a warning will be displayed when the balance crosses the minimum
+ * or maximum balance settings for the account.
+ */
+ virtual bool enterTransactions(QString& newId, bool askForSchedule = true, bool suppressBalanceWarnings = false);
+
+ /**
+ * This method creates a transaction based on the contents of the current widgets,
+ * the splits in m_split in single selection mode or an existing transaction/split
+ * and the contents of the widgets in multi selection mode.
+ *
+ * The split referencing the current account is returned as the first split in the
+ * transaction's split list.
+ *
+ * @param t reference to created transaction
+ * @param torig the original transaction
+ * @param sorig the original split
+ * @param skipPriceDialog if @p true the user will not be requested for price information
+ * (defaults to @p false)
+ *
+ * @return @p false if aborted by user, @p true otherwise
+ *
+ * @note Usually not used directly. If unsure, use enterTransactions() instead.
+ */
+ virtual bool createTransaction(MyMoneyTransaction& t, const MyMoneyTransaction& torig, const MyMoneySplit& sorig, bool skipPriceDialog = false) = 0;
+
+ /**
+ * This method returns information about the completeness of the data
+ * entered. This can be used to control the availability of the
+ * 'Enter transaction' action.
+ *
+ * @retval true if entering the transaction into the engine
+ * @retval false if not enough information is present to enter the
+ * transaction into the engine
+ *
+ * @param reason will be filled with a string about the reason why the
+ * completeness is not reached. Empty if the return value
+ * is @c true.
+ *
+ * @sa transactionDataSufficient()
+ */
+ virtual bool isComplete(QString& reason) const = 0;
+
+ /**
+ * This method returns information if the editor is started with multiple transactions
+ * being selected or not.
+ *
+ * @retval false only a single transaction was selected when the editor was started
+ * @retval true multiple transactions were selected when the editor was started
+ */
+ virtual bool isMultiSelection(void) const { return m_transactions.count() > 1; }
+
+ virtual bool fixTransactionCommodity(const MyMoneyAccount& account);
+
+ virtual bool canAssignNumber(void) const;
+ virtual void assignNextNumber(void);
+
+ /**
+ * Returns a pointer to the widget that should receive
+ * the focus after the editor has been started.
+ */
+ virtual QWidget* firstWidget(void) const = 0;
+
+ /**
+ * Returns a pointer to a widget by name
+ */
+ QWidget* haveWidget(const QString& name) const;
+
+ void setTransaction(const MyMoneyTransaction& t, const MyMoneySplit& s);
+
+ bool eventFilter(QObject* o, QEvent* e);
+
+ const MyMoneyAccount& account(void) const { return m_account; }
+
+ void clearFinalWidgets(void);
+
+ void addFinalWidget(const QWidget*);
+
+public slots:
+ void slotReloadEditWidgets(void);
+
+ /**
+ * The default implementation returns QDialog::Rejected
+ */
+ virtual int slotEditSplits(void);
+
+ /**
+ * Modify the account which the transaction should be based on. The
+ * initial value for the account is passed during setup().
+ *
+ * @param id of the account to be used
+ */
+ void slotUpdateAccount(const QString& id);
+
+protected:
+ virtual void createEditWidgets(void) = 0;
+ virtual void setupFinalWidgets(void) = 0;
+ virtual void loadEditWidgets(KMyMoneyRegister::Action action = KMyMoneyRegister::ActionNone) = 0;
+ void setupCategoryWidget(KMyMoneyCategory* category, const QValueList<MyMoneySplit>& splits, QString& categoryId, const char* splitEditSlot, bool allowObjectCreation = true);
+
+ /**
+ * This method sets the precision of the value widgets to reflect
+ * the account in m_account. If m_account has no id, the precision
+ * defaults to 2.
+ */
+ void setupPrecision(void);
+
+protected slots:
+ virtual void slotUpdateButtonState(void);
+ virtual void slotUpdateAccount(void);
+ virtual void slotNumberChanged(const QString&);
+
+signals:
+ /**
+ * This signal is sent out by the destructor to inform other entities
+ * that editing has been finished. The parameter @a t contains the list
+ * of transactions that were processed.
+ */
+ void finishEdit(const KMyMoneyRegister::SelectedTransactions& t);
+
+ /**
+ * This signal is sent out whenever enough data is present to enter the
+ * transaction into the ledger. This signal can be used to control the
+ * KAction which implements entering the transaction.
+ *
+ * @sa isComplete()
+ *
+ * @param state @a true if enough data is present, @a false otherwise.
+ */
+ void transactionDataSufficient(bool state);
+
+ /**
+ * This signal is sent out, when a new payee needs to be created
+ * @sa KMyMoneyCombo::createItem()
+ *
+ * @param txt The name of the payee to be created
+ * @param id A connected slot should store the id of the created object in this variable
+ */
+ void createPayee(const QString& txt, QString& id);
+
+ /**
+ * This signal is sent out, when a new category needs to be created
+ * Depending on the setting of either a payment or deposit, the parent
+ * account will be preset to Expense or Income.
+ *
+ * @param account reference to account info. Will be filled by called slot
+ * @param parent reference to parent account
+ */
+ void createCategory(MyMoneyAccount& account, const MyMoneyAccount& parent);
+
+ /**
+ * This signal is sent out, when a new security (e.g. stock )needs to be created
+ * @a Parent should be the investment account under which the security account
+ * will be created.
+ *
+ * @param account reference to account info. Will be filled by called slot
+ * @param parent reference to parent account
+ */
+ void createSecurity(MyMoneyAccount& account, const MyMoneyAccount& parent);
+
+ /**
+ * Signal is emitted, if any of the widgets enters (@a state equals @a true)
+ * or leaves (@a state equals @a false) object creation mode.
+ *
+ * @param state Enter (@a true) or leave (@a false) object creation
+ */
+ void objectCreation(bool state);
+
+ void statusMsg(const QString& txt);
+
+ void statusProgress(int cnt, int base);
+
+ /**
+ * This signal is sent out for each newly added transaction
+ *
+ * @param date the post date of the newly created transaction
+ */
+ void lastPostDateUsed(const QDate& date);
+
+ /**
+ * This signal is sent out, if the user decides to schedule the transaction @a t
+ * rather then adding it to the ledger right away.
+ */
+ void scheduleTransaction(const MyMoneyTransaction& t, MyMoneySchedule::occurenceE occurence);
+
+ /**
+ * This signal is sent out, if the user double clicks the number field
+ */
+ void assignNumber(void);
+
+ /**
+ * This signal is sent out, if the user has pressed the ESC key.
+ */
+ void escapePressed(void);
+
+ /**
+ * This signal is sent out, if the user has pressed the Return or Enter
+ * key and asks to end editing the transaction
+ */
+ void returnPressed(void);
+
+ /**
+ * This signal is sent out, if any of the balance warning levels
+ * for @p account has been reached. @p msg contains the message text.
+ * @p parent points to the parent widget to be used for the warning message box.
+ */
+ void balanceWarning(QWidget* parent, const MyMoneyAccount& account, const QString& msg);
+
+protected:
+ QValueList<MyMoneySplit> m_splits;
+ KMyMoneyRegister::SelectedTransactions m_transactions;
+ QValueList<const QWidget*> m_finalEditWidgets;
+ TransactionEditorContainer* m_regForm;
+ KMyMoneyRegister::Transaction* m_item;
+ KMyMoneyRegister::QWidgetContainer m_editWidgets;
+ MyMoneyAccount m_account;
+ MyMoneyTransaction m_transaction;
+ MyMoneySplit m_split;
+ QDate m_lastPostDate;
+ QMap<QString, MyMoneyMoney> m_priceInfo;
+ KMyMoneyRegister::Action m_initialAction;
+ bool m_openEditSplits;
+};
+
+
+class StdTransactionEditor : public TransactionEditor
+{
+ Q_OBJECT
+public:
+ StdTransactionEditor();
+ StdTransactionEditor(TransactionEditorContainer* regForm, KMyMoneyRegister::Transaction* item, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate);
+ ~StdTransactionEditor();
+
+ bool isComplete(QString& reason) const;
+ QWidget* firstWidget(void) const;
+
+ bool eventFilter(QObject* o, QEvent* e);
+
+ /**
+ * This method creates a transaction based on the contents of the current widgets,
+ * the splits in m_split in single selection mode or an existing transaction/split
+ * and the contents of the widgets in multi selection mode.
+ *
+ * The split referencing the current account is returned as the first split in the
+ * transaction's split list.
+ *
+ * @param t reference to created transaction
+ * @param torig the original transaction
+ * @param sorig the original split
+ * @param skipPriceDialog if @p true the user will not be requested for price information
+ * (defaults to @p false)
+ *
+ * @return @p false if aborted by user, @p true otherwise
+ *
+ * @note Usually not used directly. If unsure, use enterTransactions() instead.
+ */
+ bool createTransaction(MyMoneyTransaction& t, const MyMoneyTransaction& torig, const MyMoneySplit& sorig, bool skipPriceDialog = false);
+
+public slots:
+ int slotEditSplits(void);
+ void slotUpdateAmount(const QString&);
+
+protected slots:
+ void slotReloadEditWidgets(void);
+ void slotUpdatePayment(const QString&);
+ void slotUpdateDeposit(const QString&);
+ void slotUpdateCategory(const QString&);
+ void slotUpdatePayee(const QString&);
+ void slotUpdateCashFlow(KMyMoneyRegister::CashFlowDirection);
+ void slotCreateCategory(const QString&, QString&);
+ void slotUpdateAction(int action);
+ void slotUpdateAccount(const QString& id);
+
+protected:
+ /**
+ * This method creates all necessary widgets for this transaction editor.
+ * All signals will be connected to the relevant slots.
+ */
+ void createEditWidgets(void);
+
+ /**
+ * This method (re-)loads the widgets with the transaction information
+ * contained in @a m_transaction and @a m_split.
+ *
+ * @param action preset the edit wigdets for @a action if no transaction
+ * is present
+ */
+ void loadEditWidgets(KMyMoneyRegister::Action action = KMyMoneyRegister::ActionNone);
+
+ void setupCategoryWidget(QString&);
+ void updateAmount(const MyMoneyMoney& value);
+ bool isTransfer(const QString& accId1, const QString& accId2) const;
+
+ void checkPayeeInSplit(MyMoneySplit& s, const QString& payeeId);
+
+ /**
+ * This method fills the editor widgets with the last transaction
+ * that can be found for payee @a payeeId in the account @a m_account.
+ */
+ void autoFill(const QString& payeeId);
+
+ /**
+ * Extracts the amount of the transaction from the widgets depending
+ * if form or register based input method is used.
+ * Returns if an amount has been found in @a update.
+ *
+ * @param update pointer to update information flag
+ * @return amount of transaction (deposit positive, payment negative)
+ */
+ MyMoneyMoney amountFromWidget(bool* update = 0) const;
+
+ /**
+ * Create or update a VAT split
+ */
+ void updateVAT(bool amountChanged = true);
+
+ MyMoneyMoney removeVatSplit(void);
+
+ /**
+ * This method adds a VAT split to transaction @a tr if necessary.
+ *
+ * @param tr transaction that the split should be added to
+ * @param amount Amount to be used for the calculation. Depending upon the
+ * setting of the resp. category, this value is treated as
+ * either gross or net value.
+ * @retval false VAT split has not been added
+ * @retval true VAT split has been added
+ */
+ bool addVatSplit(MyMoneyTransaction& tr, const MyMoneyMoney& amount);
+
+ void setupFinalWidgets(void);
+
+ /**
+ * This method returns the sum of all splits of transaction @a t that
+ * reference account m_account.
+ */
+ MyMoneyMoney shares(const MyMoneyTransaction& t) const;
+
+private:
+ MyMoneyMoney m_shares;
+ bool m_inUpdateVat;
+};
+
+
+#endif
diff --git a/kmymoney2/dialogs/transactionmatcher.cpp b/kmymoney2/dialogs/transactionmatcher.cpp
new file mode 100644
index 0000000..5b8d4b5
--- /dev/null
+++ b/kmymoney2/dialogs/transactionmatcher.cpp
@@ -0,0 +1,361 @@
+/***************************************************************************
+ transactionmatcher.cpp
+ ----------
+ begin : Tue Jul 08 2008
+ copyright : (C) 2008 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "transactionmatcher.h"
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/mymoneyscheduled.h>
+#include <kmymoney/kmymoneyutils.h>
+
+TransactionMatcher::TransactionMatcher(const MyMoneyAccount& acc) :
+ m_account(acc),
+ m_days(3)
+{
+}
+
+void TransactionMatcher::match(MyMoneyTransaction tm, MyMoneySplit sm, MyMoneyTransaction ti, MyMoneySplit si, bool allowImportedTransactions)
+{
+ const MyMoneySecurity& sec = MyMoneyFile::instance()->security(m_account.currencyId());
+
+ // Now match the transactions.
+ //
+ // 'Matching' the transactions entails DELETING the end transaction,
+ // and MODIFYING the start transaction as needed.
+ //
+ // There are a variety of ways that a transaction can conflict.
+ // Post date, splits, amount are the ones that seem to matter.
+ // TODO: Handle these conflicts intelligently, at least warning
+ // the user, or better yet letting the user choose which to use.
+ //
+ // For now, we will just use the transaction details from the start
+ // transaction. The only thing we'll take from the end transaction
+ // are the bank ID's.
+ //
+ // What we have to do here is iterate over the splits in the end
+ // transaction, and find the corresponding split in the start
+ // transaction. If there is a bankID in the end split but not the
+ // start split, add it to the start split. If there is a bankID
+ // in BOTH, then this transaction cannot be merged (both transactions
+ // were imported!!) If the corresponding start split cannot be
+ // found and the end split has a bankID, we should probably just fail.
+ // Although we could ADD it to the transaction.
+
+ // ipwizard: Don't know if iterating over the transactions is a good idea.
+ // In case of a split transaction recorded with KMyMoney and the transaction
+ // data being imported consisting only of a single category assignment, this
+ // does not make much sense. The same applies for investment transactions
+ // stored in KMyMoney against imported transactions. I think a better solution
+ // is to just base the match on the splits referencing the same (currently
+ // selected) account.
+
+ // verify, that tm is a manually (non-matched) transaction and ti an imported one
+ if(sm.isMatched() || (!allowImportedTransactions && tm.isImported()))
+ throw new MYMONEYEXCEPTION(i18n("First transaction does not match requirement for matching"));
+ if(!ti.isImported())
+ throw new MYMONEYEXCEPTION(i18n("Second transaction does not match requirement for matching"));
+
+ // verify that the amounts are the same, otherwise we should not be matching!
+ if(sm.shares() != si.shares()) {
+ throw new MYMONEYEXCEPTION(i18n("Splits for %1 have conflicting values (%2,%3)").arg(m_account.name()).arg(sm.shares().formatMoney(m_account, sec), si.shares().formatMoney(m_account, sec)));
+ }
+
+ // ipwizard: I took over the code to keep the bank id found in the endMatchTransaction
+ // This might not work for QIF imports as they don't setup this information. It sure
+ // makes sense for OFX and HBCI.
+ const QString& bankID = si.bankID();
+ if (!bankID.isEmpty()) {
+ try {
+ if (sm.bankID().isEmpty() ) {
+ sm.setBankID( bankID );
+ tm.modifySplit(sm);
+ } else if(sm.bankID() != bankID) {
+ throw new MYMONEYEXCEPTION(i18n("Both of these transactions have been imported into %1. Therefore they cannot be matched. Matching works with one imported transaction and one non-imported transaction.").arg(m_account.name()));
+ }
+ } catch(MyMoneyException *e) {
+ QString estr = e->what();
+ delete e;
+ throw new MYMONEYEXCEPTION(i18n("Unable to match all splits (%1)").arg(estr));
+ }
+ }
+
+#if 0 // Ace's original code
+ // TODO (Ace) Add in another error to catch the case where a user
+ // tries to match two hand-entered transactions.
+ QValueList<MyMoneySplit> endSplits = endMatchTransaction.splits();
+ QValueList<MyMoneySplit>::const_iterator it_split = endSplits.begin();
+ while (it_split != endSplits.end())
+ {
+ // find the corresponding split in the start transaction
+ MyMoneySplit startSplit;
+ QString accountid = (*it_split).accountId();
+ try
+ {
+ startSplit = startMatchTransaction.splitByAccount( accountid );
+ }
+ // only exception is thrown if we cannot find a split like this
+ catch(MyMoneyException *e)
+ {
+ delete e;
+ startSplit = (*it_split);
+ startSplit.clearId();
+ startMatchTransaction.addSplit(startSplit);
+ }
+
+ // verify that the amounts are the same, otherwise we should not be
+ // matching!
+ if ( (*it_split).value() != startSplit.value() )
+ {
+ QString accountname = MyMoneyFile::instance()->account(accountid).name();
+ throw new MYMONEYEXCEPTION(i18n("Splits for %1 have conflicting values (%2,%3)").arg(accountname).arg((*it_split).value().formatMoney(),startSplit.value().formatMoney()));
+ }
+
+ QString bankID = (*it_split).bankID();
+ if ( ! bankID.isEmpty() )
+ {
+ try
+ {
+ if ( startSplit.bankID().isEmpty() )
+ {
+ startSplit.setBankID( bankID );
+ startMatchTransaction.modifySplit(startSplit);
+ }
+ else
+ {
+ QString accountname = MyMoneyFile::instance()->account(accountid).name();
+ throw new MYMONEYEXCEPTION(i18n("Both of these transactions have been imported into %1. Therefore they cannot be matched. Matching works with one imported transaction and one non-imported transaction.").arg(accountname));
+ }
+ }
+ catch(MyMoneyException *e)
+ {
+ QString estr = e->what();
+ delete e;
+ throw new MYMONEYEXCEPTION(i18n("Unable to match all splits (%1)").arg(estr));
+ }
+ }
+ ++it_split;
+ }
+#endif
+
+ // mark the split as cleared if it does not have a reconciliation information yet
+ if(sm.reconcileFlag() == MyMoneySplit::NotReconciled) {
+ sm.setReconcileFlag(MyMoneySplit::Cleared);
+ }
+
+ // if we don't have a payee assigned to the manually entered transaction
+ // we use the one we found in the imported transaction
+ if(sm.payeeId().isEmpty() && !si.payeeId().isEmpty()) {
+ sm.setValue("kmm-orig-payee", sm.payeeId());
+ sm.setPayeeId(si.payeeId());
+ }
+
+ // We use the imported postdate and keep the previous one for unmatch
+ if(tm.postDate() != ti.postDate()) {
+ sm.setValue("kmm-orig-postdate", tm.postDate().toString(Qt::ISODate));
+ tm.setPostDate(ti.postDate());
+ }
+
+ // combine the two memos into one
+ QString memo = sm.memo();
+ if(!si.memo().isEmpty() && si.memo() != memo) {
+ sm.setValue("kmm-orig-memo", memo);
+ if(!memo.isEmpty())
+ memo += "\n";
+ memo += si.memo();
+ }
+ sm.setMemo(memo);
+
+ // remember the split we matched
+ sm.setValue("kmm-match-split", si.id());
+
+ sm.addMatch(ti);
+ tm.modifySplit(sm);
+
+ MyMoneyFile::instance()->modifyTransaction(tm);
+ // Delete the end transaction if it was stored in the engine
+ if(!ti.id().isEmpty())
+ MyMoneyFile::instance()->removeTransaction(ti);
+}
+
+void TransactionMatcher::unmatch(const MyMoneyTransaction& _t, const MyMoneySplit& _s)
+{
+ if(_s.isMatched()) {
+ MyMoneyTransaction tm(_t);
+ MyMoneySplit sm(_s);
+ MyMoneyTransaction ti(sm.matchedTransaction());
+ MyMoneySplit si;
+ // if we don't have a split, then we don't have a memo
+ try {
+ si = ti.splitById(sm.value("kmm-match-split"));
+ } catch(MyMoneyException* e) {
+ delete e;
+ }
+ sm.removeMatch();
+
+ // restore the postdate if modified
+ if(!sm.value("kmm-orig-postdate").isEmpty()) {
+ tm.setPostDate(QDate::fromString(sm.value("kmm-orig-postdate"), Qt::ISODate));
+ }
+
+ // restore payee if modified
+ if(!sm.value("kmm-orig-payee").isEmpty()) {
+ sm.setPayeeId(sm.value("kmm-orig-payee"));
+ }
+
+ // restore memo if modified
+ if(!sm.value("kmm-orig-memo").isEmpty()) {
+ sm.setMemo(sm.value("kmm-orig-memo"));
+ }
+
+ sm.deletePair("kmm-orig-postdate");
+ sm.deletePair("kmm-orig-payee");
+ sm.deletePair("kmm-orig-memo");
+ sm.deletePair("kmm-match-split");
+ tm.modifySplit(sm);
+
+ MyMoneyFile::instance()->modifyTransaction(tm);
+ MyMoneyFile::instance()->addTransaction(ti);
+ }
+}
+
+void TransactionMatcher::accept(const MyMoneyTransaction& _t, const MyMoneySplit& _s)
+{
+ if(_s.isMatched()) {
+ MyMoneyTransaction tm(_t);
+ MyMoneySplit sm(_s);
+ sm.removeMatch();
+ sm.deletePair("kmm-orig-postdate");
+ sm.deletePair("kmm-orig-payee");
+ sm.deletePair("kmm-orig-memo");
+ sm.deletePair("kmm-match-split");
+ tm.modifySplit(sm);
+
+ MyMoneyFile::instance()->modifyTransaction(tm);
+ }
+}
+
+void TransactionMatcher::checkTransaction(const MyMoneyTransaction& tm, const MyMoneyTransaction& ti, const MyMoneySplit& si, QPair<MyMoneyTransaction, MyMoneySplit>& lastMatch, TransactionMatcher::autoMatchResultE& result, int variation) const
+{
+ Q_UNUSED(ti);
+
+
+ const QValueList<MyMoneySplit>& splits = tm.splits();
+ QValueList<MyMoneySplit>::const_iterator it_s;
+ for(it_s = splits.begin(); it_s != splits.end(); ++it_s) {
+ MyMoneyMoney upper((*it_s).shares());
+ MyMoneyMoney lower(upper);
+ if((variation > 0) && (variation < 100)) {
+ lower = lower - (lower.abs() * MyMoneyMoney(variation, 100));
+ upper = upper + (upper.abs() * MyMoneyMoney(variation, 100));
+ }
+ // we only check for duplicates / matches if the sign
+ // of the amount for this split is identical
+ if((si.shares() >= lower) && (si.shares() <= upper)) {
+ // check for duplicate (we can only do that, if we have a bankID)
+ if(!si.bankID().isEmpty()) {
+ if((*it_s).bankID() == si.bankID()) {
+ lastMatch = QPair<MyMoneyTransaction, MyMoneySplit>(tm, *it_s);
+ result = matchedDuplicate;
+ break;
+ }
+ // in case the stored split already has a bankid
+ // assigned, it must be a different one and therefore
+ // will certainly not match
+ if(!(*it_s).bankID().isEmpty())
+ continue;
+ }
+ // check if this is the one that matches
+ if((*it_s).accountId() == si.accountId()
+ && (si.shares() >= lower) && (si.shares() <= upper)
+ && !(*it_s).isMatched()) {
+ if(tm.postDate() == ti.postDate()) {
+ lastMatch = QPair<MyMoneyTransaction, MyMoneySplit>(tm, *it_s);
+ result = matchedExact;
+ } else if(result != matchedExact) {
+ lastMatch = QPair<MyMoneyTransaction, MyMoneySplit>(tm, *it_s);
+ result = matched;
+ }
+ }
+ }
+ }
+}
+
+MyMoneyObject const * TransactionMatcher::findMatch(const MyMoneyTransaction& ti, const MyMoneySplit& si, MyMoneySplit& sm, autoMatchResultE& result)
+{
+ result = notMatched;
+ sm = MyMoneySplit();
+
+ MyMoneyTransactionFilter filter(si.accountId());
+ filter.setReportAllSplits(false);
+ filter.setDateFilter(ti.postDate().addDays(-m_days), ti.postDate().addDays(m_days));
+ filter.setAmountFilter(si.shares(), si.shares());
+
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> > list;
+ MyMoneyFile::instance()->transactionList(list, filter);
+
+ // parse list
+ QValueList<QPair<MyMoneyTransaction, MyMoneySplit> >::iterator it_l;
+ QPair<MyMoneyTransaction, MyMoneySplit> lastMatch;
+
+ for(it_l = list.begin(); (result != matchedDuplicate) && (it_l != list.end()); ++it_l) {
+ // just skip myself
+ if((*it_l).first.id() == ti.id()) {
+ continue;
+ }
+
+ checkTransaction((*it_l).first, ti, si, lastMatch, result);
+ }
+
+ MyMoneyObject* rc = 0;
+ if(result != notMatched) {
+ sm = lastMatch.second;
+ rc = new MyMoneyTransaction(lastMatch.first);
+
+ } else {
+ // if we did not find anything, we need to scan for scheduled transactions
+ QValueList<MyMoneySchedule> list;
+ QValueList<MyMoneySchedule>::iterator it_sch;
+ // find all schedules that have a reference to the current account
+ list = MyMoneyFile::instance()->scheduleList(m_account.id());
+ for(it_sch = list.begin(); (result != matched && result != matchedExact) && (it_sch != list.end()); ++it_sch) {
+ // get the next due date adjusted by the weekend switch
+ QDate nextDueDate = (*it_sch).nextDueDate();
+ if((*it_sch).isOverdue() ||
+ (nextDueDate >= ti.postDate().addDays(-m_days)
+ && nextDueDate <= ti.postDate().addDays(m_days))) {
+ MyMoneyTransaction st = KMyMoneyUtils::scheduledTransaction(*it_sch);
+ checkTransaction(st, ti, si, lastMatch, result, (*it_sch).variation());
+ if(result == matched || result == matchedExact) {
+ sm = lastMatch.second;
+ rc = new MyMoneySchedule(*it_sch);
+ }
+ }
+ }
+ }
+
+ return rc;
+}
+
diff --git a/kmymoney2/dialogs/transactionmatcher.h b/kmymoney2/dialogs/transactionmatcher.h
new file mode 100644
index 0000000..e5e036c
--- /dev/null
+++ b/kmymoney2/dialogs/transactionmatcher.h
@@ -0,0 +1,145 @@
+/***************************************************************************
+ transactionmatcher.h
+ ----------
+ begin : Tue Jul 08 2008
+ copyright : (C) 2008 by Thomas Baumgart
+ email : Thomas Baumgart <ipwizard@users.sourceforge.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef TRANSACTIONMATCHER_H
+#define TRANSACTIONMATCHER_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/mymoneytransaction.h>
+#include <kmymoney/mymoneyaccount.h>
+class MyMoneySchedule;
+
+class TransactionMatcher
+{
+public:
+ typedef enum {
+ notMatched = 0, ///< no matching transaction found
+ matched, ///< matching transaction found
+ matchedExact, ///< matching transaction found with exact same date
+ matchedDuplicate ///< duplicate matching transaction found
+ } autoMatchResultE;
+
+ TransactionMatcher(const MyMoneyAccount& acc);
+
+ /**
+ * This method matches the manual entered transaction @p tm with the imported
+ * transaction @p ti based on the splits @p sm and @p si. If the match can be applied,
+ * MyMoneyTransaction::addMatch() is used to include @p ti inside @p tm and the
+ * engine data (MyMoneyFile) is updated. A possible bankid found in the imported
+ * split is carried over into the manual transaction.
+ *
+ * The following things will be done in case of a match:
+ *
+ * - if the postdate differs between the two transactions
+ * - the postdate of the manual entered transaction is stored in kmm-orig-postdate
+ * - the postdate of the imported transaction is assigned to the resulting transaction
+ * - if the payee differs between the two splits
+ * - the payee of the manual split is stored in kmm-orig-payee
+ * - the payee of the imported split is assigned to the resulting split
+ * - if the reconciliation state is not-reconciled
+ * - the reconciliation state is set to cleared
+ * - the bankid of the imported transaction is assigned to the resulting transaction
+ * - the resulting transaction will be updated and the imported transaction removed
+ * from the engine
+ *
+ * The application of the match depends on the following items:
+ *
+ * - both share values of @p sm and @p si must be identical
+ * - @p tm must be a non-imported (see below), non-matched transaction
+ * - @p ti must be an imported transaction
+ *
+ * If @p allowImportedTransactions is true, @p tm may be an imported transaction. The
+ * default of @p allowImportedTransactions is @p false.
+ *
+ * In case of errors, an exception is thrown.
+ */
+ void match(MyMoneyTransaction tm, MyMoneySplit sm, MyMoneyTransaction ti, MyMoneySplit si, bool allowImportedTransactions = false);
+
+ /**
+ * This method is used to unmatch a previously matched transaction (see match() and findMatch() )
+ * and restore the original and imported transaction in the engine.
+ *
+ * The following things will be done in case @p t is a matched transaction:
+ *
+ * - the enclosed imported transaction is extracted and restored
+ * - if the kvp contains a kmm-orig-payee record
+ * - the payee is updated to this value if it still exists, otherwise the payee is left empty
+ * - if the kvp contains a kmm-orig-postdate record
+ * - the postdate of the transaction is changed to the value stored in this record
+ * - a matching bankid is removed from the transaction
+ * - the resulting transaction will be updated and the imported transaction inserted
+ * into the engine
+ *
+ * In case of errors, an exception is thrown.
+ */
+ void unmatch(const MyMoneyTransaction& t, const MyMoneySplit& s);
+
+ /**
+ * This method is used to accept a previously matched transaction (see match() and findMatch())
+ *
+ * The following things will be done in case @p _t is a matched transaction
+ *
+ * - the enclosed imported transaction is removed
+ * - the kvps kmm-orig-payee and kmm-orig-postdate are removed
+ * - the resulting transaction will be updated
+ *
+ * In case of errors, an exception is thrown
+ */
+ void accept(const MyMoneyTransaction& t, const MyMoneySplit& s);
+
+ /**
+ * This method is used to automatically find a matching transaction in the ledger or the schedules.
+ * It should also detect duplicate imports according to the splits bankid.
+ *
+ * To be designed
+ *
+ * @param ti the imported transaction we want to match
+ * @param si the split of that transaction referencing the account we import into
+ * @param sm the split of the object returned that matches the split @a si. In case
+ * the returned pointer is not 0 this object contains the split. In other
+ * cases it contains an empty MyMoneySplit.
+ * @param result reference to the result details
+ *
+ * @returns pointer to MyMoneyObject (either a MyMoneyTransaction or a MyMoneySchedule). The
+ * caller of this method becomes the owner of the object pointed to and is responsible
+ * to delete the object
+ */
+ MyMoneyObject const * findMatch(const MyMoneyTransaction& ti, const MyMoneySplit& si, MyMoneySplit& sm, autoMatchResultE& result);
+
+ /**
+ * Sets the number of @a days to look for matching transactions. The default after object creation is 3 days.
+ */
+ void setMatchWindow(int days) { m_days = days; }
+
+private:
+ void checkTransaction(const MyMoneyTransaction& tm, const MyMoneyTransaction& ti, const MyMoneySplit& si, QPair<MyMoneyTransaction, MyMoneySplit>& lastMatch, autoMatchResultE& result, int variation = 0) const;
+
+private:
+ MyMoneyAccount m_account;
+ int m_days;
+};
+
+
+#endif