summaryrefslogtreecommitdiffstats
path: root/kmymoney2/wizards/newaccountwizard
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/wizards/newaccountwizard')
-rw-r--r--kmymoney2/wizards/newaccountwizard/Makefile.am20
-rw-r--r--kmymoney2/wizards/newaccountwizard/kaccountsummarypagedecl.ui80
-rw-r--r--kmymoney2/wizards/newaccountwizard/kaccounttypepagedecl.ui289
-rw-r--r--kmymoney2/wizards/newaccountwizard/kbrokeragepagedecl.ui172
-rw-r--r--kmymoney2/wizards/newaccountwizard/kgeneralloaninfopagedecl.ui358
-rw-r--r--kmymoney2/wizards/newaccountwizard/khierarchypagedecl.ui82
-rw-r--r--kmymoney2/wizards/newaccountwizard/kinstitutionpagedecl.ui156
-rw-r--r--kmymoney2/wizards/newaccountwizard/kloandetailspagedecl.ui288
-rw-r--r--kmymoney2/wizards/newaccountwizard/kloanpaymentpagedecl.ui184
-rw-r--r--kmymoney2/wizards/newaccountwizard/kloanpayoutpagedecl.ui198
-rw-r--r--kmymoney2/wizards/newaccountwizard/kloanschedulepagedecl.ui160
-rw-r--r--kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp1691
-rw-r--r--kmymoney2/wizards/newaccountwizard/knewaccountwizard.h182
-rw-r--r--kmymoney2/wizards/newaccountwizard/knewaccountwizard_p.h327
-rw-r--r--kmymoney2/wizards/newaccountwizard/kschedulepagedecl.ui187
15 files changed, 4374 insertions, 0 deletions
diff --git a/kmymoney2/wizards/newaccountwizard/Makefile.am b/kmymoney2/wizards/newaccountwizard/Makefile.am
new file mode 100644
index 0000000..42afe78
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/Makefile.am
@@ -0,0 +1,20 @@
+noinst_LIBRARIES = libnewaccountwizard.a
+KDE_OPTIONS = noautodist
+
+INCLUDES = $(all_includes) -I../wizardpages -I.. -I$(top_srcdir) -I.
+
+libnewaccountwizard_a_METASOURCES = AUTO
+
+UI_FILES =
+
+libnewaccountwizard_a_SOURCES = knewaccountwizard.cpp kinstitutionpagedecl.ui kaccounttypepagedecl.ui kbrokeragepagedecl.ui kschedulepagedecl.ui kgeneralloaninfopagedecl.ui kloandetailspagedecl.ui kloanpaymentpagedecl.ui kloanschedulepagedecl.ui kloanpayoutpagedecl.ui khierarchypagedecl.ui kaccountsummarypagedecl.ui
+
+EXTRA_DIST = kinstitutionpagedecl.ui kaccounttypepagedecl.ui kbrokeragepagedecl.ui kschedulepagedecl.ui kgeneralloaninfopagedecl.ui kloandetailspagedecl.ui kloanpaymentpagedecl.ui kloanschedulepagedecl.ui kloanpayoutpagedecl.ui khierarchypagedecl.ui kaccountsummarypagedecl.ui
+
+DISTCLEANFILES= kinstitutionpagedecl.cpp kinstitutionpagedecl.h kaccounttypepagedecl.cpp kaccounttypepagedecl.h kbrokeragepagedecl.cpp kbrokeragepagedecl.h kschedulepagedecl.cpp kschedulepagedecl.h kgeneralloaninfopagedecl.cpp kgeneralloaninfopagedecl.h kloandetailspagedecl.cpp kloandetailspagedecl.h kloanpaymentpagedecl.cpp kloanpaymentpagedecl.h kloanschedulepagedecl.cpp kloanschedulepagedecl.h kloanpayoutpagedecl.cpp kloanpayoutpagedecl.h kaccountsummarypagedecl.cpp khierarchypagedecl.h kaccountsummarypagedecl.h
+
+noinst_HEADERS = knewaccountwizard.h knewaccountwizard_p.h
+
+SUBDIRS =
+
+messages: rc.cpp
diff --git a/kmymoney2/wizards/newaccountwizard/kaccountsummarypagedecl.ui b/kmymoney2/wizards/newaccountwizard/kaccountsummarypagedecl.ui
new file mode 100644
index 0000000..d68bc4b
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kaccountsummarypagedecl.ui
@@ -0,0 +1,80 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAccountSummaryPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KAccountSummaryPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>This page summarizes the data you have entered. Press &lt;b&gt;Finish&lt;/b&gt; to create the account, schedules, etc. or use &lt;b&gt;Back&lt;/b&gt; to modify your entries.</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Item</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_dataList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="hScrollBarMode">
+ <enum>AlwaysOff</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ <property name="fullWidth">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kaccounttypepagedecl.ui b/kmymoney2/wizards/newaccountwizard/kaccounttypepagedecl.ui
new file mode 100644
index 0000000..bb6c5b7
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kaccounttypepagedecl.ui
@@ -0,0 +1,289 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAccountTypePageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KAccountTypePageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>555</width>
+ <height>404</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel4</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Enter the name of the account under which it is known within KMyMoney.
+Select the type for the new account. Use the &lt;b&gt;What's this?&lt;/b&gt; feature to see more details about the various account types.
+Enter the date the account was opened and its currency.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KMyMoneySecuritySelector" row="2" column="1">
+ <property name="name">
+ <cstring>m_currencyComboBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the currency in which this account is denominated.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Currency</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Opening date</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="4" column="1">
+ <property name="name">
+ <cstring>m_openingBalance</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The opening balance is the balance of the account when you start using it with KMyMoney. For new accounts this is usually 0 but for existing accounts this may well differ. Please consult the account statements to figure out this value. The opening balance is to be provided in the currency of the account as selected with the currency button.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>m_conversionLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Conversion rate</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="3" column="1">
+ <property name="name">
+ <cstring>m_openingDate</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The opening date would be the date of the last statement. In case you want to keep track of transactions prior to this date, enter the ending balance and statement date of a prior statement and add all following transactions into KMyMoney.
+&lt;br&gt;
+&lt;i&gt;Note&lt;/i&gt;: If you do not know the exact amount of the opening balance, enter an estimate. You can change this value later before you reconcile this account for the first time.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="1">
+ <property name="name">
+ <cstring>m_conversionExample</cstring>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Account type</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="5" column="1">
+ <property name="name">
+ <cstring>m_conversionRate</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>For foreign currencies an initial conversion rate needs to be provided. This should be the price of the foreign currency in the base currency on the opening date of the account.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Account name</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Opening balance</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo" row="1" column="1">
+ <property name="name">
+ <cstring>m_typeSelection</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;&lt;b&gt;Checking&lt;/b&gt;
+Use the checking account type to manage activities on your checking account e.g. payments, checks and cash card purchases.&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Savings&lt;/b&gt;
+Use the savings account type to manage activities on your savings account.&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Credit Card&lt;/b&gt;
+Use the credit card account type to manage activities on your credit card.&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Cash&lt;/b&gt;
+
+Use the cash account type to manage activities in your wallet.&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Loan&lt;/b&gt;
+Use the loan account type to manage amortization loans (e.g. mortgages, car loan, money you lend, private loans etc.).&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Investment&lt;/b&gt;
+Use the investment account to manage your stock, mutual fund and other investments.&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Asset&lt;/b&gt;
+Use the asset account type to manage assets (e.g. your house, car or art collection).&lt;/p&gt;
+
+&lt;p&gt;&lt;b&gt;Liability&lt;/b&gt;
+Use the liability account type to manage any type of liability except amortization loans. Use it for taxes you owe or money you borrowed from friends. For amortization loans like mortgages you should create a loan account.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_preferredAccount</cstring>
+ </property>
+ <property name="text">
+ <string>Preferred account</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Mark this checkbox if the account should be maintained as preferred account</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Selecting the &lt;b&gt;Preferred Account&lt;/b&gt; checkbox will allow preferred access in some dialogs and views of KMyMoney.</string>
+ </property>
+ </widget>
+ <spacer row="2" column="2" rowspan="1" colspan="2">
+ <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>231</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_accountName</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter a name under which this account is known within KMyMoney.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="5" column="2">
+ <property name="name">
+ <cstring>m_onlineQuote</cstring>
+ </property>
+ <property name="text">
+ <string>Online quote</string>
+ </property>
+ </widget>
+ <spacer row="5" column="3">
+ <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>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer18</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>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kbrokeragepagedecl.ui b/kmymoney2/wizards/newaccountwizard/kbrokeragepagedecl.ui
new file mode 100644
index 0000000..bc388a8
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kbrokeragepagedecl.ui
@@ -0,0 +1,172 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KBrokeragePageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KBrokeragePageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>594</width>
+ <height>398</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel14</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Does this investment account have a brokerage account?&lt;p&gt;
+
+&lt;b&gt;Check&lt;/b&gt; the mark if this investment account has an associated account for money that is not invested.&lt;br&gt;
+
+&lt;b&gt;Uncheck&lt;/b&gt; it if you don't use this account for active stock brokerage. You should also uncheck it if this account is not maintained by a bank or broker.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_createBrokerageButton</cstring>
+ </property>
+ <property name="text">
+ <string>Create brokerage account</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_currencyFrame</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </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>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</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>Currency</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCurrencySelector" row="0" column="1">
+ <property name="name">
+ <cstring>m_brokerageCurrency</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>m_accountNumberLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Account number</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_accountNumber</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>m_ibanLabel</cstring>
+ </property>
+ <property name="text">
+ <string>IBAN</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_iban</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>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <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>21</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>m_createBrokerageButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_currencyFrame</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>m_createBrokerageButton</tabstop>
+ <tabstop>m_brokerageCurrency</tabstop>
+ <tabstop>m_accountNumber</tabstop>
+ <tabstop>m_iban</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kgeneralloaninfopagedecl.ui b/kmymoney2/wizards/newaccountwizard/kgeneralloaninfopagedecl.ui
new file mode 100644
index 0000000..db13917
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kgeneralloaninfopagedecl.ui
@@ -0,0 +1,358 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KGeneralLoanInfoPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KGeneralLoanInfoPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>675</width>
+ <height>494</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Please select the required options. Please use the &lt;b&gt;What's this?&lt;/b&gt; feature to see more information about the items.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</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>What is the type of the loan?</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>I am borrowing money</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>I am lending money</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_loanDirection</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Who is the payee/payer of the loan?</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyPayeeCombo" row="1" column="1">
+ <property name="name">
+ <cstring>m_payee</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the name of the person or bank you owe money or who owes you money.
+
+If the name does not exist within KMyMoney's database, you are asked if you want to create it.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Did you make/receive any payments yet?</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>No</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Yes</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_anyPayments</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Were there any payments for this loan whether they are entered into KMyMoney or not?
+
+Note: Payments made to obtain the loan (e.g. Disagio) are not considered as payments in this context.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Which payments do you want to record?</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>All payments</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Start with this year's payments</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_recordings</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Select which transactions should be recorded.
+
+&lt;b&gt;All payments&lt;/b&gt; allows you to enter all payments made for this loan.
+
+The option to &lt;b&gt;start from the beginning of the current year&lt;/b&gt; is meant for loans that are active for a longer period of time already and you don't want to enter all transactions of the past.
+&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Balance before start of recording</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the ending balance found on the statement that is the last one before you want to start recording this loan in KMyMoney.</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="4" column="1">
+ <property name="name">
+ <cstring>m_openingBalance</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>You have selected to record only payments from the beginning of this year. Since prior transactions will not be recorded, you need to supply the balance of the loan on January 1st of this year.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Payment frequency</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyFrequencyCombo" row="5" column="1">
+ <property name="name">
+ <cstring>m_paymentFrequency</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>TabFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Interest Compounding frequency</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyFrequencyCombo" row="6" column="1">
+ <property name="name">
+ <cstring>m_compoundFrequency</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the frequency with which the interest is compounded. If uncertain, select the same as the payment frequency. Consult your loan contract for details.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Due date of first payment to be recorded</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="7" column="1">
+ <property name="name">
+ <cstring>m_firstPaymentDate</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Depending on the answer to &lt;b&gt;What do you want to record?&lt;/b&gt; this field means the following:&lt;p&gt;
+
+&lt;b&gt;All payments&lt;/b&gt;&lt;br&gt;
+Enter the due date of the very first payment&lt;p&gt;
+
+&lt;b&gt;Start with this year's payments&lt;/b&gt;&lt;br&gt;
+Enter the due date of the first payment in the current year</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Type of interest rate</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="8" column="1">
+ <item>
+ <property name="text">
+ <string>Fixed</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Variable</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_interestType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="9" column="0">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Time between interest changes</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="9" column="1">
+ <property name="name">
+ <cstring>layout48</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>m_interestFrequencyAmountEdit</cstring>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <item>
+ <property name="text">
+ <string>Days</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Weeks</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Months</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Years</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_interestFrequencyUnitEdit</cstring>
+ </property>
+ <property name="currentItem">
+ <number>3</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="10" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>Next interest change is due</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="10" column="1">
+ <property name="name">
+ <cstring>m_interestChangeDateEdit</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </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>29</width>
+ <height>20</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>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/khierarchypagedecl.ui b/kmymoney2/wizards/newaccountwizard/khierarchypagedecl.ui
new file mode 100644
index 0000000..00602e4
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/khierarchypagedecl.ui
@@ -0,0 +1,82 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KHierarchyPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KHierarchyPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>674</width>
+ <height>419</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>This page allows you to select the parent account.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>m_subAccountLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Subaccount of</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyAccountTreeBase">
+ <header location="global">kmymoney/kmymoneyaccounttreebase.h</header>
+ <property name="name">
+ <cstring>m_qlistviewParentAccounts</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer18</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kinstitutionpagedecl.ui b/kmymoney2/wizards/newaccountwizard/kinstitutionpagedecl.ui
new file mode 100644
index 0000000..ee38d48
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kinstitutionpagedecl.ui
@@ -0,0 +1,156 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KInstitutionPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KInstitutionPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>586</width>
+ <height>322</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>If this account is managed by an institution please select the institution from the list. If the institution does not exist yet, please choose the &lt;b&gt;New Institution&lt;/b&gt; button to create it. Otherwise, leave this field empty.
+Enter the account number used by the institution to identify the account.</string>
+ </property>
+ </widget>
+ <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="0" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Institution</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>m_institutionComboBox</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select the institution which manages this account or leave empty</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>m_newInstitutionButton</cstring>
+ </property>
+ <property name="text">
+ <string>New Institution</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Account number</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_accountNumber</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Accounts managed by an institution are usually referenced by a unique number the so called account number. Enter that number here.
+
+KMyMoney currently uses this number only for some online banking functions.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>IBAN</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" colspan="2">
+ <property name="name">
+ <cstring>m_iban</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter the International Bank Account Number into this field</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>You can enter the IBAN (International Bank Account Number) into this field if you know it. Usually, people at your institution can tell you the number or it is printed on your statements.
+
+See also http://en.wikipedia.org/wiki/International_Bank_Account_Number for more information.
+
+KMyMoney keeps this field only for documentation purposes and does not use it otherwise.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <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>132</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </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>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kloandetailspagedecl.ui b/kmymoney2/wizards/newaccountwizard/kloandetailspagedecl.ui
new file mode 100644
index 0000000..eebb158
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kloandetailspagedecl.ui
@@ -0,0 +1,288 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KLoanDetailsPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KLoanDetailsPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>592</width>
+ <height>434</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel2</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Now enter the details for your loan. You can leave one of the fields empty and KMyMoney will calculate it when you press the &lt;b&gt;Calculate&lt;/b&gt; button. Before you can continue with the next page you also need to press &lt;b&gt;Calculate&lt;/b&gt; so that KMyMoney can check the logical correctness of the values you have supplied.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer89</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <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="0" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>The interest rate gets calculated</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1" rowspan="1" colspan="3">
+ <item>
+ <property name="text">
+ <string>when the payment is received</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>when the payment is due</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_paymentDue</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Loan amount</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="1" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_loanAmount</cstring>
+ </property>
+ <property name="resetButtonVisibility" stdset="0">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the amount of the loan in this field. If you want to calculate this field out of the other parameters, please leave it empty. If the field is marked as required (colored background) you have informed KMyMoney about the fact that there were already some payments towards the loan. In this case, please enter the ending balance of your last statement.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Interest rate</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="2" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_interestRate</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Please enter the interest rate in percent or leave the field empty to calculate it.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Term</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntSpinBox">
+ <property name="name">
+ <cstring>m_termAmount</cstring>
+ </property>
+ <property name="maxValue">
+ <number>999</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Please enter the term of this loan or enter 0 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>
+ </widget>
+ <widget class="KMyMoneyFrequencyCombo">
+ <property name="name">
+ <cstring>m_termUnit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>Payment (principal and interest)</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="4" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_paymentAmount</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Please enter the amount you pay for principal and interest or leave the field empty to calculate it.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Balloon payment</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="5" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_balloonAmount</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Please enter the amount of a final amortization payment or leave the field empty to calculate it.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="6" column="1">
+ <property name="name">
+ <cstring>layout53</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer86</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_calculateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Calculate</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Press this button to calculate/verify your loan details.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Pressing this button calculates a possibly missing parameter for your loan or verifies that the values entered match. If something is not correct you will receive information about it.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="6" column="2">
+ <property name="name">
+ <cstring>spacer88_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>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer87</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>27</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer88</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>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kloanpaymentpagedecl.ui b/kmymoney2/wizards/newaccountwizard/kloanpaymentpagedecl.ui
new file mode 100644
index 0000000..51ac286
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kloanpaymentpagedecl.ui
@@ -0,0 +1,184 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KLoanPaymentPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KLoanPaymentPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>525</width>
+ <height>373</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Now enter the information required for the periodic loan payments. If your regular payments contains any additional fees, click on the &lt;b&gt;Additional fees&lt;/b&gt; button to enter them.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </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>63</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Principal + Interest</string>
+ </property>
+ </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>xxx</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>+</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>m_additionalFeesButton</cstring>
+ </property>
+ <property name="text">
+ <string>Additional fees</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>m_additionalFees</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>= periodical payments</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>m_totalPayment</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>xxx</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </grid>
+ </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>62</width>
+ <height>21</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>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kloanpayoutpagedecl.ui b/kmymoney2/wizards/newaccountwizard/kloanpayoutpagedecl.ui
new file mode 100644
index 0000000..1270efe
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kloanpayoutpagedecl.ui
@@ -0,0 +1,198 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KLoanPayoutPageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KLoanPayoutPageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>384</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel1</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </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>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_noPayoutTransaction</cstring>
+ </property>
+ <property name="text">
+ <string>Don't create payout transaction</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_payoutDetailFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>m_refinanceLoan</cstring>
+ </property>
+ <property name="text">
+ <string>Refinance existing loan</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Check this if you are refinancing a loan that already exists in KMyMoney</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Asset Account</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_assetAccount</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="3">
+ <property name="name">
+ <cstring>m_createAssetButton</cstring>
+ </property>
+ <property name="text">
+ <string>Create</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Loan account</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>m_loanAccount</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>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Date of payment</string>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer88</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>
+ <widget class="kMyMoneyDateInput" row="3" column="2">
+ <property name="name">
+ <cstring>m_payoutDate</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer89</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>
+<connections>
+ <connection>
+ <sender>m_noPayoutTransaction</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_payoutDetailFrame</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>m_refinanceLoan</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_assetAccount</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>m_refinanceLoan</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_loanAccount</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>m_refinanceLoan</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_createAssetButton</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/kloanschedulepagedecl.ui b/kmymoney2/wizards/newaccountwizard/kloanschedulepagedecl.ui
new file mode 100644
index 0000000..bead410
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kloanschedulepagedecl.ui
@@ -0,0 +1,160 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KLoanSchedulePageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KLoanSchedulePageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>545</width>
+ <height>370</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel2</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>KMyMoney creates a schedule for this payment and reminds you whenever a payment must be made. Please select the account to/from which payments will be made and the category the interest will be assigned to.&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>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout54</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout53</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Interest category</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory" row="0" column="1">
+ <property name="name">
+ <cstring>m_interestCategory</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The category the interest part of the payment will be assigned to. If you borrow money you usually have to pay interest, so this should be an expense category. If you lend the money, you receive the interest. In this case, select an income category here.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Payment account</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory" row="1" column="1">
+ <property name="name">
+ <cstring>m_paymentAccount</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the account from which you make your periodical payments or where you receive regular payments in case you lend the money. In most cases, this is a checking account.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>First payment due on</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout52</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer89</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="kMyMoneyDateInput">
+ <property name="name">
+ <cstring>m_firstPaymentDueDate</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer88</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>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp b/kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp
new file mode 100644
index 0000000..1bfae86
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp
@@ -0,0 +1,1691 @@
+/***************************************************************************
+ knewaccountwizard.cpp
+ -------------------
+ begin : Tue Sep 25 2006
+ copyright : (C) 2007 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 <locale.h>
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+#include <qfocusdata.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <klocale.h>
+#include <klistbox.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+#include <knuminput.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/kmymoneycombo.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneycurrencyselector.h>
+#include <kmymoney/kmymoneyaccountselector.h>
+#include <kmymoney/kmymoneyaccounttree.h>
+#include <kmymoney/mymoneyfinancialcalculator.h>
+#include <kmymoney/kmymoneychecklistitem.h>
+#include <kmymoney/kmymoneylistviewitem.h>
+#include <kmymoney/kcurrencycalculator.h>
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/kmymoneyglobalsettings.h>
+
+#include "knewaccountwizard.h"
+#include "knewaccountwizard_p.h"
+#include <kmymoney/kguiutils.h>
+
+#include "../../dialogs/ksplittransactiondlg.h"
+#include "../../dialogs/kequitypriceupdatedlg.h"
+#include "../../kmymoney2.h"
+
+using namespace NewAccountWizard;
+
+namespace NewAccountWizard {
+ enum steps {
+ StepInstitution = 1,
+ StepAccount,
+ StepBroker,
+ StepDetails,
+ StepPayments,
+ StepFees,
+ StepSchedule,
+ StepPayout,
+ StepParentAccount,
+ StepFinish
+ };
+};
+NewAccountWizard::Wizard::Wizard(QWidget *parent, const char *name, bool modal, WFlags flags)
+ : KMyMoneyWizard(parent, name, modal, flags)
+{
+ setTitle(i18n("KMyMoney New Account Setup"));
+ addStep(i18n("Institution"));
+ addStep(i18n("Account"));
+ addStep(i18n("Broker"));
+ addStep(i18n("Details"));
+ addStep(i18n("Payments"));
+ addStep(i18n("Fees"));
+ addStep(i18n("Schedule"));
+ addStep(i18n("Payout"));
+ addStep(i18n("Parent Account"));
+ addStep(i18n("Finish"));
+ setStepHidden(StepBroker);
+ setStepHidden(StepSchedule);
+ setStepHidden(StepPayout);
+ setStepHidden(StepDetails);
+ setStepHidden(StepPayments);
+ setStepHidden(StepFees);
+
+ m_institutionPage = new InstitutionPage(this);
+ m_accountTypePage = new AccountTypePage(this);
+ // Investment Pages
+ m_brokeragepage = new BrokeragePage(this);
+ // Credit Card Pages
+ m_schedulePage = new CreditCardSchedulePage(this);
+ // Loan Pages
+ m_generalLoanInfoPage = new GeneralLoanInfoPage(this);
+ m_loanDetailsPage = new LoanDetailsPage(this);
+ m_loanPaymentPage = new LoanPaymentPage(this);
+ m_loanSchedulePage = new LoanSchedulePage(this);
+ m_loanPayoutPage = new LoanPayoutPage(this);
+ // Not a loan page
+ m_hierarchyPage = new HierarchyPage(this);
+ // Finish
+ m_accountSummaryPage = new AccountSummaryPage(this);
+
+ setFirstPage(m_institutionPage);
+}
+
+void NewAccountWizard::Wizard::setAccount(const MyMoneyAccount& acc)
+{
+ m_account = acc;
+ m_accountTypePage->setAccount(m_account);
+}
+
+const MyMoneySecurity& NewAccountWizard::Wizard::currency(void) const
+{
+ return m_accountTypePage->currency();
+}
+
+MyMoneyMoney NewAccountWizard::Wizard::interestRate(void) const
+{
+ return m_loanDetailsPage->m_interestRate->value() / MyMoneyMoney(100,1);
+}
+
+int NewAccountWizard::Wizard::precision(void) const
+{
+ return MyMoneyMoney::denomToPrec(currency().smallestAccountFraction());
+}
+
+const MyMoneyAccount& NewAccountWizard::Wizard::account(void)
+{
+ m_account = MyMoneyAccountLoan();
+ m_account.setName(m_accountTypePage->m_accountName->text());
+ m_account.setOpeningDate(m_accountTypePage->m_openingDate->date());
+ m_account.setAccountType(m_accountTypePage->accountType());
+ m_account.setInstitutionId(m_institutionPage->institution().id());
+ m_account.setNumber(m_institutionPage->m_accountNumber->text());
+ m_account.setValue("IBAN", m_institutionPage->m_iban->text());
+ if(m_accountTypePage->m_preferredAccount->isChecked())
+ m_account.setValue("PreferredAccount", "Yes");
+ else
+ m_account.deletePair("PreferredAccount");
+
+ m_account.setCurrencyId(currency().id());
+ if(m_account.isLoan()) {
+ // in case we lend the money we adjust the account type
+ if(!moneyBorrowed())
+ m_account.setAccountType(MyMoneyAccount::AssetLoan);
+ m_account.setLoanAmount(m_loanDetailsPage->m_loanAmount->value());
+ m_account.setInterestRate(m_account.openingDate(), m_loanDetailsPage->m_interestRate->value());
+ m_account.setInterestCalculation(m_loanDetailsPage->m_paymentDue->currentItem() == 0 ? MyMoneyAccountLoan::paymentReceived : MyMoneyAccountLoan::paymentDue);
+ m_account.setFixedInterestRate(m_generalLoanInfoPage->m_interestType->currentItem() == 0);
+ m_account.setFinalPayment(m_loanDetailsPage->m_balloonAmount->value());
+ m_account.setTerm(m_loanDetailsPage->term());
+ m_account.setPeriodicPayment(m_loanDetailsPage->m_paymentAmount->value());
+ m_account.setPayee(m_generalLoanInfoPage->m_payee->selectedItem());
+ m_account.setInterestCompounding(m_generalLoanInfoPage->m_compoundFrequency->currentItem());
+
+ if(!m_account.fixedInterestRate()) {
+ m_account.setNextInterestChange(m_generalLoanInfoPage->m_interestChangeDateEdit->date());
+ m_account.setInterestChangeFrequency(m_generalLoanInfoPage->m_interestFrequencyAmountEdit->value(), m_generalLoanInfoPage->m_interestFrequencyUnitEdit->currentItem());
+ }
+ }
+ return m_account;
+}
+
+MyMoneyTransaction NewAccountWizard::Wizard::payoutTransaction(void)
+{
+ MyMoneyTransaction t;
+ if(m_account.isLoan() // we're creating a loan
+ && openingBalance().isZero() // and don't have an opening balance
+ && !m_loanPayoutPage->m_noPayoutTransaction->isChecked()) { // and the user wants to have a payout transaction
+ t.setPostDate(m_loanPayoutPage->m_payoutDate->date());
+ t.setCommodity(m_account.currencyId());
+ MyMoneySplit s;
+ s.setAccountId(m_account.id());
+ s.setShares(m_loanDetailsPage->m_loanAmount->value());
+ if(moneyBorrowed())
+ s.setShares(-s.shares());
+ s.setValue(s.shares());
+ t.addSplit(s);
+
+ s.clearId();
+ s.setValue(-s.value());
+ s.setAccountId(m_loanPayoutPage->payoutAccountId());
+ MyMoneyMoney shares;
+ KCurrencyCalculator::setupSplitPrice(shares, t, s, QMap<QString, MyMoneyMoney>(), this);
+ s.setShares(shares);
+ t.addSplit(s);
+ }
+ return t;
+}
+
+const MyMoneyAccount& NewAccountWizard::Wizard::parentAccount(void)
+{
+ return m_accountTypePage->allowsParentAccount()
+ ? m_hierarchyPage->parentAccount()
+ : ( m_accountTypePage->accountType() == MyMoneyAccount::Loan
+ ? m_generalLoanInfoPage->parentAccount()
+ : m_accountTypePage->parentAccount() );
+}
+
+MyMoneyAccount NewAccountWizard::Wizard::brokerageAccount(void) const
+{
+ MyMoneyAccount account;
+ if(m_account.accountType() == MyMoneyAccount::Investment
+ && m_brokeragepage->m_createBrokerageButton->isChecked()) {
+ account.setName(m_account.brokerageName());
+ account.setAccountType(MyMoneyAccount::Checkings);
+ account.setInstitutionId(m_account.institutionId());
+ account.setOpeningDate(m_account.openingDate());
+ account.setCurrencyId(m_brokeragepage->m_brokerageCurrency->security().id());
+ if(m_brokeragepage->m_accountNumber->isEnabled() && !m_brokeragepage->m_accountNumber->text().isEmpty())
+ account.setNumber(m_brokeragepage->m_accountNumber->text());
+ if(m_brokeragepage->m_iban->isEnabled() && !m_brokeragepage->m_iban->text().isEmpty())
+ account.setValue("IBAN", m_brokeragepage->m_iban->text());
+ }
+ return account;
+}
+
+const MyMoneySchedule& NewAccountWizard::Wizard::schedule(void)
+{
+ m_schedule = MyMoneySchedule();
+
+ if(!m_account.id().isEmpty()) {
+ if(m_schedulePage->m_reminderCheckBox->isChecked() && (m_account.accountType() == MyMoneyAccount::CreditCard)) {
+ m_schedule.setName(m_schedulePage->m_name->text());
+ m_schedule.setType(MyMoneySchedule::TYPE_TRANSFER);
+ m_schedule.setPaymentType(static_cast<MyMoneySchedule::paymentTypeE>(m_schedulePage->m_method->currentItem()));
+ m_schedule.setFixed(false);
+ m_schedule.setOccurencePeriod(MyMoneySchedule::OCCUR_MONTHLY);
+ m_schedule.setOccurenceMultiplier(1);
+ MyMoneyTransaction t;
+ MyMoneySplit s;
+ s.setPayeeId(m_schedulePage->m_payee->selectedItem());
+ s.setAccountId(m_schedulePage->m_paymentAccount->selectedItem());
+ s.setMemo(i18n("Credit card payment"));
+ s.setShares(-m_schedulePage->m_amount->value());
+ s.setValue(s.shares());
+ t.addSplit(s);
+
+ s.clearId();
+ s.setAccountId(m_account.id());
+ s.setShares(m_schedulePage->m_amount->value());
+ s.setValue(s.shares());
+ t.addSplit(s);
+
+ // setup the next due date
+ t.setPostDate(m_schedulePage->m_date->date());
+ m_schedule.setTransaction(t);
+
+ } else if(m_account.isLoan()) {
+ m_schedule.setName(i18n("Loan payment for %1").arg(m_accountTypePage->m_accountName->text()));
+ m_schedule.setType(MyMoneySchedule::TYPE_LOANPAYMENT);
+ if(moneyBorrowed())
+ m_schedule.setPaymentType(MyMoneySchedule::STYPE_DIRECTDEBIT);
+ else
+ m_schedule.setPaymentType(MyMoneySchedule::STYPE_DIRECTDEPOSIT);
+
+ m_schedule.setFixed(true);
+ m_schedule.setOccurence(m_generalLoanInfoPage->m_paymentFrequency->currentItem());
+
+ MyMoneyTransaction t;
+ MyMoneySplit s;
+ // payment split
+ s.setPayeeId(m_generalLoanInfoPage->m_payee->selectedItem());
+ s.setAccountId(m_loanSchedulePage->m_paymentAccount->selectedItem());
+ s.setMemo(i18n("Loan payment"));
+ if(moneyBorrowed()) {
+ s.setShares(-(m_loanPaymentPage->basePayment() + m_loanPaymentPage->additionalFees()));
+ } else {
+ s.setShares(m_loanPaymentPage->basePayment() + m_loanPaymentPage->additionalFees());
+ }
+ s.setValue(s.shares());
+ t.addSplit(s);
+
+ // principal split
+ s.clearId();
+ s.setAccountId(m_account.id());
+ s.setShares(MyMoneyMoney::autoCalc);
+ s.setValue(MyMoneyMoney::autoCalc);
+ s.setMemo(i18n("Amortization"));
+ s.setAction(MyMoneySplit::ActionAmortization);
+ t.addSplit(s);
+
+ // interest split
+ s.clearId();
+ s.setAccountId(m_loanSchedulePage->m_interestCategory->selectedItem());
+ s.setShares(MyMoneyMoney::autoCalc);
+ s.setValue(MyMoneyMoney::autoCalc);
+ s.setMemo(i18n("Interest"));
+ s.setAction(MyMoneySplit::ActionInterest);
+ t.addSplit(s);
+
+ // additional fee splits
+ QValueList<MyMoneySplit> additionalSplits;
+ m_loanPaymentPage->additionalFeesSplits(additionalSplits);
+ QValueList<MyMoneySplit>::const_iterator it;
+ MyMoneyMoney factor(moneyBorrowed() ? 1 : -1, 1);
+
+ for(it = additionalSplits.begin(); it != additionalSplits.end(); ++it) {
+ s = (*it);
+ s.clearId();
+ s.setShares(s.shares() * factor);
+ s.setValue(s.value() * factor);
+ t.addSplit(s);
+ }
+
+ // setup the next due date
+ t.setPostDate(m_loanSchedulePage->firstPaymentDueDate());
+ m_schedule.setTransaction(t);
+ }
+ }
+ return m_schedule;
+}
+
+MyMoneyMoney NewAccountWizard::Wizard::openingBalance(void) const
+{
+ // equity accounts don't have an opening balance
+ if(m_accountTypePage->accountType() == MyMoneyAccount::Equity)
+ return MyMoneyMoney();
+
+ if(m_accountTypePage->accountType() == MyMoneyAccount::Loan) {
+ if(m_generalLoanInfoPage->recordAllPayments())
+ return MyMoneyMoney(0, 1);
+ if(moneyBorrowed())
+ return -(m_generalLoanInfoPage->m_openingBalance->value());
+ return m_generalLoanInfoPage->m_openingBalance->value();
+ }
+ return m_accountTypePage->m_openingBalance->value();
+}
+
+MyMoneyPrice NewAccountWizard::Wizard::conversionRate(void) const
+{
+ if(MyMoneyFile::instance()->baseCurrency().id() == m_accountTypePage->m_currencyComboBox->security().id())
+ return MyMoneyPrice(MyMoneyFile::instance()->baseCurrency().id(),
+ m_accountTypePage->m_currencyComboBox->security().id(),
+ m_accountTypePage->m_openingDate->date(),
+ MyMoneyMoney(1,1),
+ i18n("User"));
+ return MyMoneyPrice(MyMoneyFile::instance()->baseCurrency().id(),
+ m_accountTypePage->m_currencyComboBox->security().id(),
+ m_accountTypePage->m_openingDate->date(),
+ m_accountTypePage->m_conversionRate->value(),
+ i18n("User"));
+}
+
+bool NewAccountWizard::Wizard::moneyBorrowed(void) const
+{
+ return m_generalLoanInfoPage->m_loanDirection->currentItem() == 0;
+}
+
+class NewAccountWizard::InstitutionPage::Private
+{
+public:
+ QValueList<MyMoneyInstitution> m_list;
+};
+
+InstitutionPage::InstitutionPage(Wizard* wizard, const char* name) :
+ KInstitutionPageDecl(wizard),
+ WizardPage<Wizard>(StepInstitution, this, wizard, name),
+ d(new Private())
+{
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+ connect(m_newInstitutionButton, SIGNAL(clicked()), this, SLOT(slotNewInstitution()));
+ connect(m_institutionComboBox, SIGNAL(activated(int)), this, SLOT(slotSelectInstitution(int)));
+
+ slotLoadWidgets();
+ m_institutionComboBox->setCurrentItem(0);
+ slotSelectInstitution(0);
+}
+
+InstitutionPage::~InstitutionPage()
+{
+ delete d;
+}
+
+void InstitutionPage::slotLoadWidgets(void)
+{
+ m_institutionComboBox->clear();
+
+ d->m_list.clear();
+ MyMoneyFile::instance()->institutionList(d->m_list);
+ qHeapSort(d->m_list);
+
+ QValueList<MyMoneyInstitution>::const_iterator it_l;
+ m_institutionComboBox->insertItem("");
+ for(it_l = d->m_list.begin(); it_l != d->m_list.end(); ++it_l) {
+ m_institutionComboBox->insertItem((*it_l).name());
+ }
+}
+
+void InstitutionPage::slotNewInstitution(void)
+{
+ MyMoneyInstitution institution;
+
+ emit m_wizard->createInstitution(institution);
+
+ if(!institution.id().isEmpty()) {
+ QValueList<MyMoneyInstitution>::const_iterator it_l;
+ int i = 0;
+ for(it_l = d->m_list.begin(); it_l != d->m_list.end(); ++it_l) {
+ if((*it_l).id() == institution.id()) {
+ // select the item and remember that the very first one is the empty item
+ m_institutionComboBox->setCurrentItem(i+1);
+ slotSelectInstitution(i+1);
+ m_accountNumber->setFocus();
+ break;
+ }
+ ++i;
+ }
+ }
+}
+
+void InstitutionPage::slotSelectInstitution(int id)
+{
+ m_accountNumber->setEnabled(id != 0);
+ m_iban->setEnabled(id != 0);
+}
+
+const MyMoneyInstitution& InstitutionPage::institution(void) const
+{
+ static MyMoneyInstitution emptyInstitution;
+ if(m_institutionComboBox->currentItem() == 0)
+ return emptyInstitution;
+
+ return d->m_list[m_institutionComboBox->currentItem()-1];
+}
+
+KMyMoneyWizardPage* InstitutionPage::nextPage(void) const
+{
+ return m_wizard->m_accountTypePage;
+}
+
+AccountTypePage::AccountTypePage(Wizard* wizard, const char* name) :
+ KAccountTypePageDecl(wizard),
+ WizardPage<Wizard>(StepAccount, this, wizard, name),
+ m_showPriceWarning(true)
+{
+ m_typeSelection->insertItem(i18n("Checking"), MyMoneyAccount::Checkings);
+ m_typeSelection->insertItem(i18n("Savings"), MyMoneyAccount::Savings);
+ m_typeSelection->insertItem(i18n("Credit Card"), MyMoneyAccount::CreditCard);
+ m_typeSelection->insertItem(i18n("Cash"), MyMoneyAccount::Cash);
+ m_typeSelection->insertItem(i18n("Loan"), MyMoneyAccount::Loan);
+ m_typeSelection->insertItem(i18n("Investment"), MyMoneyAccount::Investment);
+ m_typeSelection->insertItem(i18n("Asset"), MyMoneyAccount::Asset);
+ m_typeSelection->insertItem(i18n("Liability"), MyMoneyAccount::Liability);
+ if(KMyMoneyGlobalSettings::expertMode()) {
+ m_typeSelection->insertItem(i18n("Equity"), MyMoneyAccount::Equity);
+ }
+
+ m_typeSelection->setCurrentItem(MyMoneyAccount::Checkings);
+
+ m_currencyComboBox->setSecurity(MyMoneyFile::instance()->baseCurrency());
+
+ m_mandatoryGroup->add(m_accountName);
+ m_mandatoryGroup->add(m_conversionRate->lineedit());
+
+ m_conversionRate->setPrecision(KMyMoneyGlobalSettings::pricePrecision());
+ m_conversionRate->setValue(MyMoneyMoney(1,1));
+ slotUpdateCurrency();
+
+ connect(m_typeSelection, SIGNAL(itemSelected(int)), this, SLOT(slotUpdateType(int)));
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+ connect(m_currencyComboBox, SIGNAL(activated(int)), this, SLOT(slotUpdateCurrency()));
+ connect(m_conversionRate, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateConversionRate(const QString&)));
+ connect(m_conversionRate, SIGNAL(valueChanged(const QString&)), this, SLOT(slotPriceWarning()));
+ connect(m_onlineQuote, SIGNAL(clicked()), this, SLOT(slotGetOnlineQuote()));
+}
+
+void AccountTypePage::slotUpdateType(int i)
+{
+ hideShowPages(static_cast<MyMoneyAccount::accountTypeE> (i));
+ m_openingBalance->setDisabled(static_cast<MyMoneyAccount::accountTypeE> (i) == MyMoneyAccount::Equity);
+}
+
+void AccountTypePage::hideShowPages(MyMoneyAccount::accountTypeE accountType) const
+{
+ bool hideSchedulePage = (accountType != MyMoneyAccount::CreditCard)
+ && (accountType != MyMoneyAccount::Loan);
+ bool hideLoanPage = (accountType != MyMoneyAccount::Loan);
+ m_wizard->setStepHidden(StepDetails, hideLoanPage);
+ m_wizard->setStepHidden(StepPayments, hideLoanPage);
+ m_wizard->setStepHidden(StepFees, hideLoanPage);
+ m_wizard->setStepHidden(StepSchedule, hideSchedulePage);
+ m_wizard->setStepHidden(StepPayout, (accountType != MyMoneyAccount::Loan));
+ m_wizard->setStepHidden(StepBroker, accountType != MyMoneyAccount::Investment);
+ m_wizard->setStepHidden(StepParentAccount, accountType == MyMoneyAccount::Loan);
+ // Force an update of the steps in case the list has changed
+ m_wizard->reselectStep();
+};
+
+KMyMoneyWizardPage* AccountTypePage::nextPage(void) const
+{
+ if(accountType() == MyMoneyAccount::Loan)
+ return m_wizard->m_generalLoanInfoPage;
+ if(accountType() == MyMoneyAccount::CreditCard)
+ return m_wizard->m_schedulePage;
+ if(accountType() == MyMoneyAccount::Investment)
+ return m_wizard->m_brokeragepage;
+ return m_wizard->m_hierarchyPage;
+}
+
+void AccountTypePage::slotUpdateCurrency(void)
+{
+ MyMoneyAccount acc;
+ acc.setAccountType(accountType());
+
+ m_openingBalance->setPrecision(MyMoneyMoney::denomToPrec(acc.fraction(currency())));
+
+ bool show = m_currencyComboBox->security().id() != MyMoneyFile::instance()->baseCurrency().id();
+ m_conversionLabel->setShown(show);
+ m_conversionRate->setShown(show);
+ m_conversionExample->setShown(show);
+ m_onlineQuote->setShown(show);
+ m_conversionRate->setEnabled(show); // make sure to include/exclude in mandatoryGroup
+ m_mandatoryGroup->changed();
+ slotUpdateConversionRate(m_conversionRate->lineedit()->text());
+}
+
+void AccountTypePage::slotGetOnlineQuote(void)
+{
+ QString id = MyMoneyFile::instance()->baseCurrency().id()+" "+m_currencyComboBox->security().id();
+ KEquityPriceUpdateDlg dlg(this, id);
+ if(dlg.exec() == QDialog::Accepted) {
+ MyMoneyPrice price = dlg.price(id);
+ if(price.isValid()) {
+ m_conversionRate->setValue(price.rate(m_currencyComboBox->security().id()));
+ if(price.date() != m_openingDate->date()) {
+ priceWarning(true);
+ }
+ }
+ }
+}
+
+void AccountTypePage::slotPriceWarning(void)
+{
+ priceWarning(false);
+}
+
+void AccountTypePage::priceWarning(bool always)
+{
+ if(m_showPriceWarning || always) {
+ KMessageBox::information(this, i18n("Please make sure to enter the correct conversion for the selected opening date. If you requested an online quote it might be provided for a different date."), i18n("Check date"));
+ }
+ m_showPriceWarning = false;
+}
+
+void AccountTypePage::slotUpdateConversionRate(const QString& txt)
+{
+ m_conversionExample->setText(i18n("1 %1 equals %2").
+ arg(MyMoneyFile::instance()->baseCurrency().tradingSymbol()).
+ arg(MyMoneyMoney(txt).formatMoney(m_currencyComboBox->security().tradingSymbol(), KMyMoneyGlobalSettings::pricePrecision())));
+}
+
+void AccountTypePage::slotLoadWidgets(void)
+{
+ m_currencyComboBox->update(QString("x"));
+}
+
+bool AccountTypePage::isComplete(void) const
+{
+ // check that the conversion rate is positive if enabled
+ bool rc = !m_conversionRate->isVisible() || (!m_conversionRate->value().isZero() && !m_conversionRate->value().isNegative());
+ if(!rc) {
+ QToolTip::add(m_wizard->m_nextButton, i18n("Conversion rate is not positive"));
+
+ } else {
+ rc = KMyMoneyWizardPage::isComplete();
+
+ if(!rc) {
+ QToolTip::add(m_wizard->m_nextButton, i18n("No account name supplied"));
+ }
+ }
+ hideShowPages(accountType());
+ return rc;
+}
+
+MyMoneyAccount::accountTypeE AccountTypePage::accountType(void) const
+{
+ return static_cast<MyMoneyAccount::accountTypeE>(m_typeSelection->currentItem());
+}
+
+const MyMoneySecurity& AccountTypePage::currency(void) const
+{
+ return m_currencyComboBox->security();
+}
+
+void AccountTypePage::setAccount(const MyMoneyAccount& acc)
+{
+ m_typeSelection->setCurrentItem(acc.accountType());
+ m_openingDate->setDate(acc.openingDate());
+ m_accountName->setText(acc.name());
+}
+
+const MyMoneyAccount& AccountTypePage::parentAccount(void)
+{
+ switch(accountType()) {
+ case MyMoneyAccount::CreditCard:
+ case MyMoneyAccount::Liability:
+ case MyMoneyAccount::Loan: // Can be either but we return liability here
+ return MyMoneyFile::instance()->liability();
+ break;
+ case MyMoneyAccount::Equity:
+ return MyMoneyFile::instance()->equity();
+ default:
+ break;
+ }
+ return MyMoneyFile::instance()->asset();
+}
+
+bool AccountTypePage::allowsParentAccount(void) const
+{
+ return accountType() != MyMoneyAccount::Loan;
+}
+
+BrokeragePage::BrokeragePage(Wizard* wizard, const char* name) :
+ KBrokeragePageDecl(wizard),
+ WizardPage<Wizard>(StepBroker, this, wizard, name)
+{
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+}
+
+void BrokeragePage::slotLoadWidgets(void)
+{
+ m_brokerageCurrency->update(QString("x"));
+}
+
+void BrokeragePage::enterPage(void)
+{
+ // assign the currency of the investment account to the
+ // brokerage account if nothing else has ever been selected
+ if(m_brokerageCurrency->security().id().isEmpty()) {
+ m_brokerageCurrency->setSecurity(m_wizard->m_accountTypePage->m_currencyComboBox->security());
+ }
+
+ // check if the institution relevant fields should be enabled or not
+ bool enabled = m_wizard->m_institutionPage->m_accountNumber->isEnabled();
+ m_accountNumberLabel->setEnabled(enabled);
+ m_accountNumber->setEnabled(enabled);
+ m_ibanLabel->setEnabled(enabled);
+ m_iban->setEnabled(enabled);
+}
+
+KMyMoneyWizardPage* BrokeragePage::nextPage(void) const
+{
+ return m_wizard->m_hierarchyPage;
+}
+
+CreditCardSchedulePage::CreditCardSchedulePage(Wizard* wizard, const char* name) :
+ KSchedulePageDecl(wizard),
+ WizardPage<Wizard>(StepSchedule, this, wizard, name)
+{
+ m_mandatoryGroup->add(m_name);
+ m_mandatoryGroup->add(m_payee);
+ m_mandatoryGroup->add(m_amount->lineedit());
+ m_mandatoryGroup->add(m_paymentAccount);
+ connect(m_paymentAccount, SIGNAL(itemSelected(const QString&)), object(), SIGNAL(completeStateChanged()));
+ connect(m_payee, SIGNAL(itemSelected(const QString&)), object(), SIGNAL(completeStateChanged()));
+ connect(m_date, SIGNAL(dateChanged(const QDate&)), object(), SIGNAL(completeStateChanged()));
+
+ connect(m_payee, SIGNAL(createItem(const QString&, QString&)), wizard, SIGNAL(createPayee(const QString&, QString&)));
+
+ m_reminderCheckBox->setChecked(true);
+ connect(m_reminderCheckBox, SIGNAL(toggled(bool)), object(), SIGNAL(completeStateChanged()));
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+
+ m_method->insertItem(i18n("Write check"), MyMoneySchedule::STYPE_WRITECHEQUE);
+#if 0
+ m_method->insertItem(i18n("Direct debit"), MyMoneySchedule::STYPE_DIRECTDEBIT);
+ m_method->insertItem(i18n("Bank transfer"), MyMoneySchedule::STYPE_BANKTRANSFER);
+#endif
+ m_method->insertItem(i18n("Standing order"), MyMoneySchedule::STYPE_STANDINGORDER);
+ m_method->insertItem(i18n("Manual deposit"), MyMoneySchedule::STYPE_MANUALDEPOSIT);
+ m_method->insertItem(i18n("Direct deposit"), MyMoneySchedule::STYPE_DIRECTDEPOSIT);
+ m_method->insertItem(i18n("Other"), MyMoneySchedule::STYPE_OTHER);
+ m_method->setCurrentItem(MyMoneySchedule::STYPE_DIRECTDEBIT);
+
+ slotLoadWidgets();
+}
+
+void CreditCardSchedulePage::enterPage(void)
+{
+ if(m_name->text().isEmpty())
+ m_name->setText(i18n("CreditCard %1 monthly payment").arg(m_wizard->m_accountTypePage->m_accountName->text()));
+}
+
+bool CreditCardSchedulePage::isComplete(void) const
+{
+ bool rc = true;
+ QString msg = i18n("Finish entry and create account");
+ if(m_reminderCheckBox->isChecked()) {
+ msg = i18n("Finish entry and create account and schedule");
+ if(m_date->date() < m_wizard->m_accountTypePage->m_openingDate->date()) {
+ rc = false;
+ msg = i18n("Next due date is prior to opening date");
+ }
+ if(m_paymentAccount->selectedItem().isEmpty()) {
+ rc = false;
+ msg = i18n("No account selected");
+ }
+ if(m_amount->lineedit()->text().isEmpty()) {
+ rc = false;
+ msg = i18n("No amount for payment selected");
+ }
+ if(m_payee->selectedItem().isEmpty()) {
+ rc = false;
+ msg = i18n("No payee for payment selected");
+ }
+ if(m_name->text().isEmpty()) {
+ rc = false;
+ msg = i18n("No name assigned for schedule");
+ }
+ }
+ QToolTip::add(m_wizard->m_finishButton, msg);
+
+ return rc;
+}
+
+void CreditCardSchedulePage::slotLoadWidgets(void)
+{
+ AccountSet set;
+ set.addAccountGroup(MyMoneyAccount::Asset);
+ set.load(m_paymentAccount->selector());
+
+ m_payee->loadPayees(MyMoneyFile::instance()->payeeList());
+}
+
+KMyMoneyWizardPage* CreditCardSchedulePage::nextPage(void) const
+{
+ return m_wizard->m_hierarchyPage;
+}
+
+GeneralLoanInfoPage::GeneralLoanInfoPage(Wizard* wizard, const char* name) :
+ KGeneralLoanInfoPageDecl(wizard),
+ WizardPage<Wizard>(StepDetails, this, wizard, name),
+ m_firstTime(true)
+{
+ m_mandatoryGroup->add(m_payee);
+
+ // remove the unsupported payment and compounding frequencies and setup default
+ m_paymentFrequency->removeItem(MyMoneySchedule::OCCUR_ONCE);
+ m_paymentFrequency->removeItem(MyMoneySchedule::OCCUR_EVERYOTHERYEAR);
+ m_paymentFrequency->setCurrentItem(MyMoneySchedule::OCCUR_MONTHLY);
+ m_compoundFrequency->removeItem(MyMoneySchedule::OCCUR_ONCE);
+ m_compoundFrequency->removeItem(MyMoneySchedule::OCCUR_EVERYOTHERYEAR);
+ m_compoundFrequency->setCurrentItem(MyMoneySchedule::OCCUR_MONTHLY);
+
+ slotLoadWidgets();
+
+ connect(m_payee, SIGNAL(createItem(const QString&, QString&)), wizard, SIGNAL(createPayee(const QString&, QString&)));
+ connect(m_anyPayments, SIGNAL(activated(int)), object(), SIGNAL(completeStateChanged()));
+ connect(m_recordings, SIGNAL(activated(int)), object(), SIGNAL(completeStateChanged()));
+
+ connect(m_interestType, SIGNAL(activated(int)), object(), SIGNAL(completeStateChanged()));
+ connect(m_interestChangeDateEdit, SIGNAL(dateChanged(const QDate&)), object(), SIGNAL(completeStateChanged()));
+ connect(m_openingBalance, SIGNAL(textChanged(const QString&)), object(), SIGNAL(completeStateChanged()));
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+}
+
+KMyMoneyWizardPage* GeneralLoanInfoPage::nextPage(void) const
+{
+ return m_wizard->m_loanDetailsPage;
+}
+
+bool GeneralLoanInfoPage::recordAllPayments(void) const
+{
+ bool rc = true; // all payments
+ if(m_recordings->isEnabled()) {
+ if(m_recordings->currentItem() != 0)
+ rc = false;
+ }
+ return rc;
+}
+
+void GeneralLoanInfoPage::enterPage(void)
+{
+ if(m_firstTime) {
+ // setup default dates to last of this month and one year on top
+ QDate firstDay(QDate::currentDate().year(), QDate::currentDate().month(), 1);
+ m_firstPaymentDate->setDate(firstDay.addMonths(1).addDays(-1));
+ m_interestChangeDateEdit->setDate(m_firstPaymentDate->date().addYears(1));;
+ m_firstTime = false;
+ }
+}
+
+bool GeneralLoanInfoPage::isComplete(void) const
+{
+ m_wizard->setStepHidden(StepPayout, !m_wizard->openingBalance().isZero());
+ bool rc = KMyMoneyWizardPage::isComplete();
+ if(!rc) {
+ QToolTip::add(m_wizard->m_nextButton, i18n("No payee supplied"));
+ }
+
+ // fixup availability of items on this page
+ m_recordings->setDisabled(m_anyPayments->currentItem() == 0);
+
+ m_interestFrequencyAmountEdit->setDisabled(m_interestType->currentItem() == 0);
+ m_interestFrequencyUnitEdit->setDisabled(m_interestType->currentItem() == 0);
+ m_interestChangeDateEdit->setDisabled(m_interestType->currentItem() == 0);
+
+ m_openingBalance->setDisabled(recordAllPayments());
+
+ if(m_openingBalance->isEnabled() && m_openingBalance->lineedit()->text().length() == 0) {
+ rc = false;
+ QToolTip::add(m_wizard->m_nextButton, i18n("No opening balance supplied"));
+ }
+
+ if(rc
+ && (m_interestType->currentItem() != 0)
+ && (m_interestChangeDateEdit->date() <= m_firstPaymentDate->date())) {
+ rc = false;
+ QToolTip::add(m_wizard->m_nextButton, i18n("An interest change can only happen after the first payment"));
+ }
+ return rc;
+}
+
+const MyMoneyAccount& GeneralLoanInfoPage::parentAccount(void)
+{
+ return ( m_loanDirection->currentItem() == 0 )
+ ? MyMoneyFile::instance()->liability()
+ : MyMoneyFile::instance()->asset();
+}
+
+void GeneralLoanInfoPage::slotLoadWidgets(void)
+{
+ m_payee->loadPayees(MyMoneyFile::instance()->payeeList());
+}
+
+LoanDetailsPage::LoanDetailsPage(Wizard* wizard, const char* name) :
+ KLoanDetailsPageDecl(wizard),
+ WizardPage<Wizard>(StepPayments, this, wizard, name),
+ m_needCalculate(true)
+{
+ // force the balloon payment to zero (default)
+ m_balloonAmount->setValue(MyMoneyMoney());
+ // allow any precision for the interest rate
+ m_interestRate->setPrecision(-1);
+
+ connect(m_paymentDue, SIGNAL(activated(int)), this, SLOT(slotValuesChanged()));
+
+ connect(m_termAmount, SIGNAL(valueChanged(int)), this, SLOT(slotValuesChanged()));
+ connect(m_termUnit, SIGNAL(highlighted(int)), this, SLOT(slotValuesChanged()));
+ connect(m_loanAmount, SIGNAL(textChanged(const QString&)), this, SLOT(slotValuesChanged()));
+ connect(m_interestRate, SIGNAL(textChanged(const QString&)), this, SLOT(slotValuesChanged()));
+ connect(m_paymentAmount, SIGNAL(textChanged(const QString&)), this, SLOT(slotValuesChanged()));
+ connect(m_balloonAmount, SIGNAL(textChanged(const QString&)), this, SLOT(slotValuesChanged()));
+
+ connect(m_calculateButton, SIGNAL(clicked()), this, SLOT(slotCalculate()));
+}
+
+void LoanDetailsPage::enterPage(void)
+{
+ // we need to remove a bunch of entries of the payment frequencies
+ m_termUnit->clear();
+
+ m_mandatoryGroup->clear();
+ if(!m_wizard->openingBalance().isZero()) {
+ m_mandatoryGroup->add(m_loanAmount->lineedit());
+ if(m_loanAmount->lineedit()->text().length() == 0) {
+ m_loanAmount->setValue(m_wizard->openingBalance().abs());
+ }
+ }
+
+ switch(m_wizard->m_generalLoanInfoPage->m_paymentFrequency->currentItem()) {
+ default:
+ m_termUnit->insertItem(i18n("Payments"), MyMoneySchedule::OCCUR_ONCE);
+ m_termUnit->setCurrentItem(MyMoneySchedule::OCCUR_ONCE);
+ break;
+ case MyMoneySchedule::OCCUR_MONTHLY:
+ m_termUnit->insertItem(i18n("Months"), MyMoneySchedule::OCCUR_MONTHLY);
+ m_termUnit->insertItem(i18n("Years"), MyMoneySchedule::OCCUR_YEARLY);
+ m_termUnit->setCurrentItem(MyMoneySchedule::OCCUR_MONTHLY);
+ break;
+ case MyMoneySchedule::OCCUR_YEARLY:
+ m_termUnit->insertItem(i18n("Years"), MyMoneySchedule::OCCUR_YEARLY);
+ m_termUnit->setCurrentItem(MyMoneySchedule::OCCUR_YEARLY);
+ break;
+ }
+}
+
+void LoanDetailsPage::slotValuesChanged(void)
+{
+ m_needCalculate = true;
+ m_wizard->completeStateChanged();
+}
+
+void LoanDetailsPage::slotCalculate(void)
+{
+ MyMoneyFinancialCalculator calc;
+ long double val;
+ int PF, CF;
+ QString result;
+ bool moneyBorrowed = m_wizard->moneyBorrowed();
+ bool moneyLend = !moneyBorrowed;
+
+ // 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 = m_wizard->m_generalLoanInfoPage->m_paymentFrequency->eventsPerYear();
+ CF = m_wizard->m_generalLoanInfoPage->m_compoundFrequency->eventsPerYear();
+
+ if(PF == 0 || CF == 0)
+ return;
+
+ calc.setPF(PF);
+ calc.setCF(CF);
+
+
+ if(!m_loanAmount->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_loanAmount->value().abs().toDouble());
+ if(moneyBorrowed)
+ val = -val;
+ calc.setPv(val);
+ }
+
+ if(!m_interestRate->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_interestRate->value().abs().toDouble());
+ calc.setIr(val);
+ }
+
+ if(!m_paymentAmount->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_paymentAmount->value().abs().toDouble());
+ if(moneyLend)
+ val = -val;
+ calc.setPmt(val);
+ }
+
+ if(!m_balloonAmount->lineedit()->text().isEmpty()) {
+ val = static_cast<long double> (m_balloonAmount->value().abs().toDouble());
+ if(moneyLend)
+ val = -val;
+ calc.setFv(val);
+ }
+
+ if(m_termAmount->value() != 0) {
+ calc.setNpp(static_cast<long double>(term()));
+ }
+
+ // setup of parameters is done, now do the calculation
+ try {
+ if(m_loanAmount->lineedit()->text().isEmpty()) {
+ // calculate the amount of the loan out of the other information
+ val = calc.presentValue();
+ m_loanAmount->loadText(MyMoneyMoney(static_cast<double>(val)).abs().formatMoney("", m_wizard->precision()));
+ result = i18n("KMyMoney has calculated the amount of the loan as %1.")
+ .arg(m_loanAmount->lineedit()->text());
+
+ } else if(m_interestRate->lineedit()->text().isEmpty()) {
+ // calculate the interest rate out of the other information
+ val = calc.interestRate();
+ m_interestRate->loadText(MyMoneyMoney(static_cast<double>(val)).abs().formatMoney("", 3));
+ result = i18n("KMyMoney has calculated the interest rate to %1%.")
+ .arg(m_interestRate->lineedit()->text());
+
+ } else if(m_paymentAmount->lineedit()->text().isEmpty()) {
+ // calculate the periodical amount of the payment out of the other information
+ val = calc.payment();
+ m_paymentAmount->setValue(MyMoneyMoney(static_cast<double>(val)).abs());
+ // reset payment as it might have changed due to rounding
+ val = static_cast<long double> (m_paymentAmount->value().abs().toDouble());
+ if(moneyLend)
+ val = -val;
+ calc.setPmt(val);
+
+ result = i18n("KMyMoney has calculated a periodic payment of %1 to cover principal and interest.")
+ .arg(m_paymentAmount->lineedit()->text());
+
+ val = calc.futureValue();
+ if((moneyBorrowed && val < 0 && fabsl(val) >= fabsl(calc.payment()))
+ || (moneyLend && 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_balloonAmount->loadText(refVal.abs().formatMoney("", m_wizard->precision()));
+ result += QString(" ");
+ result += i18n("The number of payments has been decremented and the balloon payment has been modified to %1.")
+ .arg(m_balloonAmount->lineedit()->text());
+ } else if((moneyBorrowed && val < 0 && fabsl(val) < fabsl(calc.payment()))
+ || (moneyLend && val > 0 && fabs(val) < fabs(calc.payment()))) {
+ m_balloonAmount->loadText(MyMoneyMoney(0,1).formatMoney("", m_wizard->precision()));
+ } else {
+ MyMoneyMoney refVal(static_cast<double>(val));
+ m_balloonAmount->loadText(refVal.abs().formatMoney("", m_wizard->precision()));
+ result += i18n("The balloon payment has been modified to %1.")
+ .arg(m_balloonAmount->lineedit()->text());
+ }
+
+ } else if(m_termAmount->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_balloonAmount->loadText(refVal.abs().formatMoney("", m_wizard->precision()));
+ result += i18n("The balloon payment has been modified to %1.")
+ .arg(m_balloonAmount->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((moneyBorrowed && val < 0 && fabsl(val) > fabsl(calc.payment()))
+ || (moneyLend && val > 0 && fabs(val) > fabs(calc.payment()))) {
+ // case a)
+ qDebug("Future Value is %Lf", val);
+ throw new MYMONEYEXCEPTION("incorrect fincancial calculation");
+
+ } else if((moneyBorrowed && val < 0 && fabsl(val) <= fabsl(calc.payment()))
+ || (moneyLend && val > 0 && fabs(val) <= fabs(calc.payment()))) {
+ // case b)
+ val = 0;
+ }
+
+ MyMoneyMoney refVal(static_cast<double>(val));
+ result = i18n("KMyMoney has calculated a balloon payment of %1 for this loan.")
+ .arg(refVal.abs().formatMoney("", m_wizard->precision()));
+
+ if(!m_balloonAmount->lineedit()->text().isEmpty()) {
+ if((m_balloonAmount->value().abs() - refVal.abs()).abs().toDouble() > 1) {
+ throw new MYMONEYEXCEPTION("incorrect fincancial calculation");
+ }
+ result = i18n("KMyMoney has successfully verified your loan information.");
+ }
+ m_balloonAmount->loadText(refVal.abs().formatMoney("", m_wizard->precision()));
+ }
+
+ } catch (MyMoneyException *e) {
+ delete e;
+ KMessageBox::error(0,
+ i18n("You have entered mis-matching information. Please modify "
+ "your figures or leave one value empty "
+ "to let KMyMoney calculate it for you"),
+ i18n("Calculation error"));
+ return;
+ }
+
+ result += i18n("\n\nAccept this or modify the loan information and recalculate.");
+
+ KMessageBox::information(0, result, i18n("Calculation successful"));
+ m_needCalculate = false;
+
+ // now update change
+ m_wizard->completeStateChanged();
+}
+
+int LoanDetailsPage::term(void) const
+{
+ int factor = 0;
+
+ if(m_termAmount->value() != 0) {
+ factor = 1;
+ switch(m_termUnit->currentItem()) {
+ case MyMoneySchedule::OCCUR_YEARLY: // years
+ factor = 12;
+ // tricky fall through here
+
+ case MyMoneySchedule::OCCUR_MONTHLY: // months
+ factor *= 30;
+ factor *= m_termAmount->value();
+ // factor now is the duration in days. we divide this by the
+ // payment frequency and get the number of payments
+ factor /= m_wizard->m_generalLoanInfoPage->m_paymentFrequency->daysBetweenEvents();
+ break;
+
+ default:
+ qDebug("Unknown term unit %d in LoanDetailsPage::term(). Using payments.", m_termUnit->currentItem());
+ // tricky fall through here
+
+ case MyMoneySchedule::OCCUR_ONCE: // payments
+ factor = m_termAmount->value();
+ break;
+ }
+ }
+ return factor;
+}
+
+QString LoanDetailsPage::updateTermWidgets(const long double val)
+{
+ long long vl = static_cast<long long>(floorl(val));
+
+ QString valString;
+ MyMoneySchedule::occurenceE unit = m_termUnit->currentItem();
+
+ 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_termUnit->setCurrentItem(MyMoneySchedule::OCCUR_MONTHLY);
+ break;
+ case MyMoneySchedule::OCCUR_YEARLY:
+ valString = i18n("one year", "%n years", vl);
+ m_termUnit->setCurrentItem(MyMoneySchedule::OCCUR_YEARLY);
+ break;
+ default:
+ valString = i18n("one payment", "%n payments", vl);
+ m_termUnit->setCurrentItem(MyMoneySchedule::OCCUR_ONCE);
+ break;
+ }
+ m_termAmount->setValue(vl);
+ return valString;
+}
+
+bool LoanDetailsPage::isComplete(void) const
+{
+ // bool rc = KMyMoneyWizardPage::isComplete();
+
+ int fieldCnt = 0;
+ QWidget* calculatedField = 0;
+
+ if(m_loanAmount->lineedit()->text().length() > 0) {
+ fieldCnt++;
+ } else {
+ calculatedField = m_loanAmount;
+ }
+
+ if(m_interestRate->lineedit()->text().length() > 0) {
+ fieldCnt++;
+ } else {
+ calculatedField = m_interestRate;
+ }
+
+ if(m_termAmount->value() != 0) {
+ fieldCnt++;
+ } else {
+ calculatedField = m_termAmount;
+ }
+
+ if(m_paymentAmount->lineedit()->text().length() > 0) {
+ fieldCnt++;
+ } else {
+ calculatedField = m_paymentAmount;
+ }
+
+ if(m_balloonAmount->lineedit()->text().length() > 0) {
+ fieldCnt++;
+ } else {
+ calculatedField = m_balloonAmount;
+ }
+
+ if(fieldCnt == 5)
+ calculatedField = 0;
+
+ m_calculateButton->setEnabled(fieldCnt == 4 || (fieldCnt == 5 && m_needCalculate));
+
+ m_calculateButton->setAutoDefault(false);
+ m_calculateButton->setDefault(false);
+ if(m_needCalculate && fieldCnt == 4) {
+ QToolTip::add(m_wizard->m_nextButton, i18n("Press Calculate to verify the values"));
+ m_calculateButton->setAutoDefault(true);
+ m_calculateButton->setDefault(true);
+ } else if(fieldCnt != 5) {
+ QToolTip::add(m_wizard->m_nextButton, i18n("Not all details supplied"));
+ m_calculateButton->setAutoDefault(true);
+ m_calculateButton->setDefault(true);
+ }
+ m_wizard->m_nextButton->setAutoDefault(!m_calculateButton->autoDefault());
+ m_wizard->m_nextButton->setDefault(!m_calculateButton->autoDefault());
+
+ return (fieldCnt == 5) && !m_needCalculate;
+}
+
+KMyMoneyWizardPage* LoanDetailsPage::nextPage(void) const
+{
+ return m_wizard->m_loanPaymentPage;
+}
+
+
+class NewAccountWizard::LoanPaymentPage::Private
+{
+public:
+ MyMoneyAccount phonyAccount;
+ MyMoneySplit phonySplit;
+ MyMoneyTransaction additionalFeesTransaction;
+ MyMoneyMoney additionalFees;
+};
+
+LoanPaymentPage::LoanPaymentPage(Wizard* wizard, const char* name) :
+ KLoanPaymentPageDecl(wizard),
+ WizardPage<Wizard>(StepFees, this, wizard, name),
+ d(new Private)
+{
+ d->phonyAccount = MyMoneyAccount(QString("Phony-ID"), MyMoneyAccount());
+
+ d->phonySplit.setAccountId(d->phonyAccount.id());
+ d->phonySplit.setValue(0);
+ d->phonySplit.setShares(0);
+
+ d->additionalFeesTransaction.addSplit(d->phonySplit);
+
+ connect(m_additionalFeesButton, SIGNAL(clicked()), this, SLOT(slotAdditionalFees()));
+}
+
+LoanPaymentPage::~LoanPaymentPage()
+{
+ delete d;
+}
+
+MyMoneyMoney LoanPaymentPage::basePayment(void) const
+{
+ return m_wizard->m_loanDetailsPage->m_paymentAmount->value();
+}
+
+MyMoneyMoney LoanPaymentPage::additionalFees(void) const
+{
+ return d->additionalFees;
+}
+
+void LoanPaymentPage::additionalFeesSplits(QValueList<MyMoneySplit>& list)
+{
+ list.clear();
+
+ QValueList<MyMoneySplit>::ConstIterator it;
+ for(it = d->additionalFeesTransaction.splits().begin(); it != d->additionalFeesTransaction.splits().end(); ++it) {
+ if((*it).accountId() != d->phonyAccount.id()) {
+ list << (*it);
+ }
+ }
+}
+
+void LoanPaymentPage::updateAmounts(void)
+{
+ m_additionalFees->setText(d->additionalFees.formatMoney(m_wizard->currency().tradingSymbol(), m_wizard->precision()));
+ m_totalPayment->setText((basePayment() + d->additionalFees).formatMoney(m_wizard->currency().tradingSymbol(), m_wizard->precision()));
+}
+
+void LoanPaymentPage::enterPage(void)
+{
+ const MyMoneySecurity& currency = m_wizard->currency();
+
+ m_basePayment->setText(basePayment().formatMoney(currency.tradingSymbol(), m_wizard->precision()));
+ d->phonyAccount.setCurrencyId(currency.id());
+ d->additionalFeesTransaction.setCommodity(currency.id());
+
+ updateAmounts();
+}
+
+void LoanPaymentPage::slotAdditionalFees(void)
+{
+ QMap<QString, MyMoneyMoney> priceInfo;
+ KSplitTransactionDlg* dlg = new KSplitTransactionDlg(d->additionalFeesTransaction, d->phonySplit, d->phonyAccount, false, !m_wizard->moneyBorrowed(), MyMoneyMoney(0), priceInfo);
+
+ // connect(dlg, SIGNAL(newCategory(MyMoneyAccount&)), this, SIGNAL(newCategory(MyMoneyAccount&)));
+
+ if(dlg->exec() == QDialog::Accepted) {
+ d->additionalFeesTransaction = dlg->transaction();
+ // sum up the additional fees
+ QValueList<MyMoneySplit>::ConstIterator it;
+
+ d->additionalFees = MyMoneyMoney(0);
+ for(it = d->additionalFeesTransaction.splits().begin(); it != d->additionalFeesTransaction.splits().end(); ++it) {
+ if((*it).accountId() != d->phonyAccount.id()) {
+ d->additionalFees += (*it).shares();
+ }
+ }
+ updateAmounts();
+ }
+
+ delete dlg;
+}
+
+KMyMoneyWizardPage* LoanPaymentPage::nextPage(void) const
+{
+ return m_wizard->m_loanSchedulePage;
+}
+
+
+LoanSchedulePage::LoanSchedulePage(Wizard* wizard, const char* name) :
+ KLoanSchedulePageDecl(wizard),
+ WizardPage<Wizard>(StepSchedule, this, wizard, name)
+{
+ m_mandatoryGroup->add(m_interestCategory->lineEdit());
+ m_mandatoryGroup->add(m_paymentAccount->lineEdit());
+ connect(m_interestCategory, SIGNAL(createItem(const QString&, QString&)), this, SLOT(slotCreateCategory(const QString&, QString&)));
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+}
+
+void LoanSchedulePage::slotCreateCategory(const QString& name, QString& id)
+{
+ MyMoneyAccount acc, parent;
+ acc.setName(name);
+
+ if(m_wizard->moneyBorrowed())
+ parent = MyMoneyFile::instance()->expense();
+ else
+ parent = MyMoneyFile::instance()->income();
+
+ emit m_wizard->createCategory(acc, parent);
+
+ // return id
+ id = acc.id();
+}
+
+QDate LoanSchedulePage::firstPaymentDueDate(void) const
+{
+ if(m_firstPaymentDueDate->isEnabled())
+ return m_firstPaymentDueDate->date();
+ return m_wizard->m_generalLoanInfoPage->m_firstPaymentDate->date();
+}
+
+void LoanSchedulePage::enterPage(void)
+{
+ m_interestCategory->setFocus();
+ m_firstPaymentDueDate->setDisabled(m_wizard->m_generalLoanInfoPage->recordAllPayments());
+ slotLoadWidgets();
+}
+
+void LoanSchedulePage::slotLoadWidgets(void)
+{
+ AccountSet set;
+ if(m_wizard->moneyBorrowed())
+ set.addAccountGroup(MyMoneyAccount::Expense);
+ else
+ set.addAccountGroup(MyMoneyAccount::Income);
+ set.load(m_interestCategory->selector());
+
+ set.clear();
+ set.addAccountGroup(MyMoneyAccount::Asset);
+ set.load(m_paymentAccount->selector());
+}
+
+KMyMoneyWizardPage* LoanSchedulePage::nextPage(void) const
+{
+ // if the balance widget of the general loan info page is enabled and
+ // the value is not zero, then the payout already happened and we don't
+ // aks for it.
+ if(m_wizard->openingBalance().isZero())
+ return m_wizard->m_loanPayoutPage;
+ return m_wizard->m_accountSummaryPage;
+}
+
+LoanPayoutPage::LoanPayoutPage(Wizard* wizard, const char* name) :
+ KLoanPayoutPageDecl(wizard),
+ WizardPage<Wizard>(StepPayout, this, wizard, name)
+{
+ m_mandatoryGroup->add(m_assetAccount->lineEdit());
+ m_mandatoryGroup->add(m_loanAccount->lineEdit());
+
+ KIconLoader* il = KGlobal::iconLoader();
+ KGuiItem createAssetButtenItem( i18n( "&Create..." ),
+ QIconSet(il->loadIcon("filenew", KIcon::Small, KIcon::SizeSmall)),
+ i18n("Create a new asset account"),
+ i18n("If the asset account does not yet exist, press this button to create it."));
+ m_createAssetButton->setGuiItem(createAssetButtenItem);
+ QToolTip::add(m_createAssetButton, createAssetButtenItem.toolTip());
+ QWhatsThis::add(m_createAssetButton, createAssetButtenItem.whatsThis());
+ connect(m_createAssetButton, SIGNAL(clicked()), this, SLOT(slotCreateAssetAccount()));
+
+ connect(m_noPayoutTransaction, SIGNAL(toggled(bool)), this, SLOT(slotButtonsToggled()));
+ connect(m_refinanceLoan, SIGNAL(toggled(bool)), this, SLOT(slotButtonsToggled()));
+
+ connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this, SLOT(slotLoadWidgets()));
+ slotLoadWidgets();
+}
+
+void LoanPayoutPage::slotButtonsToggled(void)
+{
+ // we don't go directly, as the order of the emission of signals to slots is
+ // not defined. Using a single shot timer postpones the call of m_mandatoryGroup::changed()
+ // until the next round of the main loop so we can be sure to see all relevant changes
+ // that happened in the meantime (eg. widgets are enabled and disabled)
+ QTimer::singleShot(0, m_mandatoryGroup, SLOT(changed()));
+}
+
+void LoanPayoutPage::slotCreateAssetAccount(void)
+{
+ MyMoneyAccount acc;
+ acc.setAccountType(MyMoneyAccount::Asset);
+ acc.setOpeningDate(m_wizard->m_accountTypePage->m_openingDate->date());
+
+ emit m_wizard->createAccount(acc);
+
+ if(!acc.id().isEmpty()) {
+ m_assetAccount->setSelectedItem(acc.id());
+ }
+}
+
+void LoanPayoutPage::slotLoadWidgets(void)
+{
+ AccountSet set;
+ set.addAccountGroup(MyMoneyAccount::Asset);
+ set.load(m_assetAccount->selector());
+
+ set.clear();
+ set.addAccountType(MyMoneyAccount::Loan);
+ set.load(m_loanAccount->selector());
+}
+
+void LoanPayoutPage::enterPage(void)
+{
+ // only allow to create new asset accounts for liability loans
+ m_createAssetButton->setEnabled(m_wizard->moneyBorrowed());
+ m_refinanceLoan->setEnabled(m_wizard->moneyBorrowed());
+ if(!m_wizard->moneyBorrowed()) {
+ m_refinanceLoan->setChecked(false);
+ }
+ m_payoutDetailFrame->setDisabled(m_noPayoutTransaction->isChecked());
+}
+
+KMyMoneyWizardPage* LoanPayoutPage::nextPage(void) const
+{
+ return m_wizard->m_accountSummaryPage;
+}
+
+bool LoanPayoutPage::isComplete(void) const
+{
+ return KMyMoneyWizardPage::isComplete() | m_noPayoutTransaction->isChecked();
+}
+
+const QString& LoanPayoutPage::payoutAccountId(void) const
+{
+ if(m_refinanceLoan->isChecked()) {
+ return m_loanAccount->selectedItem();
+ } else {
+ return m_assetAccount->selectedItem();
+ }
+}
+
+HierarchyPage::HierarchyPage(Wizard* wizard, const char* name) :
+ KHierarchyPageDecl(wizard),
+ WizardPage<Wizard>(StepParentAccount, this, wizard, name)
+{
+ // the next line causes a warning to be shown in the console output
+ // since at least one of the major groups is selected, and the user
+ // cannot deselect an account, at least one is selected all the time
+ // and we don't need this check
+ // m_mandatoryGroup->add(m_qlistviewParentAccounts);
+ m_qlistviewParentAccounts->setEnabled(true);
+ m_qlistviewParentAccounts->setRootIsDecorated(true);
+ m_qlistviewParentAccounts->setAllColumnsShowFocus(true);
+ m_qlistviewParentAccounts->addColumn("Accounts");
+ m_qlistviewParentAccounts->setMultiSelection(false);
+ m_qlistviewParentAccounts->header()->setResizeEnabled(true);
+ m_qlistviewParentAccounts->setColumnWidthMode(0, QListView::Maximum);
+ // never show the horizontal scroll bar
+ // m_qlistviewParentAccounts->setHScrollBarMode(QScrollView::AlwaysOff);
+}
+
+void HierarchyPage::enterPage(void)
+{
+ // Ensure that the list reflects the Account Type
+ // - if the type has changed
+ // - - clear the list
+ // - - populate the account list (also occurs first time we come here)
+ MyMoneyAccount topAccount = m_wizard->m_accountTypePage->parentAccount();
+
+ // If the list was not populated with this top account we populate it now
+ if ( &m_topAccount == NULL || m_topAccount.id() != topAccount.id())
+ {
+ if ( &m_topAccount != NULL )
+ {
+ // If the list has alrady been populated clear it
+ if ( (*m_qlistviewParentAccounts).childCount() > 0 )
+ (*m_qlistviewParentAccounts).clear();
+ }
+
+ // Add the Tree for the Top Account
+ KMyMoneyAccountTreeItem *topAccountTree = buildAccountTree(m_qlistviewParentAccounts, topAccount, false);
+ topAccountTree->setOpen(true);
+ // Record the top account used to populate the list
+ m_topAccount = topAccount;
+ }
+}
+
+KMyMoneyAccountTreeItem* HierarchyPage::buildAccountTree
+ ( KMyMoneyAccountTreeBase* parent
+ , const MyMoneyAccount& account
+ , bool open ) const
+{
+ // Recursively add child accounts to the list
+ if ( account.accountType() == MyMoneyAccount::Investment)
+ return NULL;
+ KMyMoneyAccountTreeItem* childItem = new KMyMoneyAccountTreeItem( parent, account );
+ if ( open )
+ childItem->setOpen(true);
+ for ( QStringList::ConstIterator it = account.accountList().begin();
+ it != account.accountList().end();
+ ++it )
+ {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(*it);
+ if(acc.isClosed())
+ continue;
+ if(acc.accountType() == MyMoneyAccount::Investment)
+ continue;
+ buildAccountTree( childItem, acc, open );
+ }
+ return childItem;
+}
+
+KMyMoneyAccountTreeItem* HierarchyPage::buildAccountTree
+ ( KMyMoneyAccountTreeItem* parent
+ , const MyMoneyAccount& account
+ , bool open ) const
+{
+ // Recursively add child accounts to the list
+ if ( account.accountType() == MyMoneyAccount::Investment)
+ return NULL;
+ KMyMoneyAccountTreeItem* childItem = new KMyMoneyAccountTreeItem( parent, account );
+ if ( open )
+ childItem->setOpen(true);
+ for ( QStringList::ConstIterator it = account.accountList().begin();
+ it != account.accountList().end();
+ ++it )
+ {
+ MyMoneyAccount acc = MyMoneyFile::instance()->account(*it);
+ if(acc.isClosed())
+ continue;
+ if (account.accountType() == MyMoneyAccount::Investment)
+ continue;
+ buildAccountTree( childItem, acc, open );
+ }
+ return childItem;
+}
+
+KMyMoneyWizardPage* HierarchyPage::nextPage(void) const
+{
+ return m_wizard->m_accountSummaryPage;
+}
+
+const MyMoneyAccount& HierarchyPage::parentAccount(void)
+{
+ // TODO
+ // Instead of returning the Parent Account we can simply
+ // return the account associated with the current item
+ // in the ListView
+ KMyMoneyAccountTreeItem* item = dynamic_cast<KMyMoneyAccountTreeItem*>(m_qlistviewParentAccounts->currentItem());
+ return dynamic_cast<const MyMoneyAccount&>(item->itemObject());
+}
+
+AccountSummaryPage::AccountSummaryPage(Wizard* wizard, const char* name) :
+ KAccountSummaryPageDecl(wizard),
+ WizardPage<Wizard>(StepFinish, this, wizard, name)
+{
+ m_dataList->setSorting(-1);
+ m_dataList->setColumnWidthMode(1, QListView::Maximum);
+ m_dataList->setResizeMode(QListView::LastColumn);
+}
+
+void AccountSummaryPage::enterPage(void)
+{
+ MyMoneyAccount acc = m_wizard->account();
+ MyMoneySecurity sec = m_wizard->currency();
+ acc.fraction(sec);
+
+ // assign an id to the account inside the wizard which is required for a schedule
+ // get the schedule and clear the id again in the wizards object.
+ MyMoneyAccount tmp(QString("Phony-ID"), acc);
+ m_wizard->setAccount(tmp);
+ MyMoneySchedule sch = m_wizard->schedule();
+ m_wizard->setAccount(acc);
+
+ m_dataList->clear();
+
+ // Account data
+ QListViewItem* group = new KMyMoneyCheckListItem(m_dataList, i18n("Account information"), QString(), QString(), QCheckListItem::RadioButtonController);
+ group->setOpen(true);
+ QListViewItem* p;
+ p = new KListViewItem(group, i18n("Name"), acc.name());
+ if(!acc.isLoan())
+ p = new KListViewItem(group, p, i18n("Subaccount of"),
+ m_wizard->parentAccount().name());
+ if(acc.accountType() == MyMoneyAccount::AssetLoan)
+ p = new KListViewItem(group, p, i18n("Type"), i18n("Loan"));
+ else
+ p = new KListViewItem(group, p, i18n("Type"), m_wizard->m_accountTypePage->m_typeSelection->currentText());
+ p = new KListViewItem(group, p, i18n("Currency"), m_wizard->currency().name());
+ p = new KListViewItem(group, p, i18n("Opening date"), KGlobal::locale()->formatDate(acc.openingDate()));
+ if(m_wizard->currency().id() != MyMoneyFile::instance()->baseCurrency().id()) {
+ p = new KListViewItem(group, p, i18n("Conversion rate"), m_wizard->conversionRate().rate(QString()).formatMoney("", KMyMoneyGlobalSettings::pricePrecision()));
+ }
+ if(!acc.isLoan() || !m_wizard->openingBalance().isZero())
+ p = new KListViewItem(group, p, i18n("Opening balance"), m_wizard->openingBalance().formatMoney(acc, sec));
+
+ if(!m_wizard->m_institutionPage->institution().id().isEmpty()) {
+ p = new KListViewItem(group, p, i18n("Institution"), m_wizard->m_institutionPage->institution().name());
+ if(!acc.number().isEmpty()) {
+ p = new KListViewItem(group, p, i18n("Number"), acc.number());
+ }
+ if(!acc.value("IBAN").isEmpty()) {
+ p = new KListViewItem(group, p, i18n("IBAN"), acc.value("IBAN"));
+ }
+ }
+
+ if(acc.accountType() == MyMoneyAccount::Investment) {
+ if(m_wizard->m_brokeragepage->m_createBrokerageButton->isChecked()) {
+ group = new KMyMoneyCheckListItem(m_dataList, group, i18n("Brokerage Account"), QString(), QString(), QCheckListItem::RadioButtonController);
+ group->setOpen(true);
+ p = new KListViewItem(group, p, i18n("Name"), QString("%1 (Brokerage)").arg(acc.name()));
+ p = new KListViewItem(group, p, i18n("Currency"), m_wizard->m_brokeragepage->m_brokerageCurrency->security().name());
+ if(m_wizard->m_brokeragepage->m_accountNumber->isEnabled() && !m_wizard->m_brokeragepage->m_accountNumber->text().isEmpty())
+ p = new KListViewItem(group, p, i18n("Number"), m_wizard->m_brokeragepage->m_accountNumber->text());
+ if(m_wizard->m_brokeragepage->m_iban->isEnabled() && !m_wizard->m_brokeragepage->m_iban->text().isEmpty())
+ p = new KListViewItem(group, p, i18n("IBAN"), m_wizard->m_brokeragepage->m_iban->text());
+ }
+ }
+
+ // Loan
+ if(acc.isLoan()) {
+ group = new KMyMoneyCheckListItem(m_dataList, group, i18n("Loan information"), QString(), QString(), QCheckListItem::RadioButtonController);
+ group->setOpen(true);
+ if(m_wizard->moneyBorrowed()) {
+ p = new KListViewItem(group, p, i18n("Amount borrowed"), m_wizard->m_loanDetailsPage->m_loanAmount->value().formatMoney(m_wizard->currency().tradingSymbol(), m_wizard->precision()));
+ } else {
+ p = new KListViewItem(group, p, i18n("Amount lent"), m_wizard->m_loanDetailsPage->m_loanAmount->value().formatMoney(m_wizard->currency().tradingSymbol(), m_wizard->precision()));
+ }
+ p = new KListViewItem(group, p, i18n("Interest rate"), QString("%1 %").arg(m_wizard->m_loanDetailsPage->m_interestRate->value().formatMoney("", -1)));
+ p = new KListViewItem(group, p, i18n("Interest rate is"), m_wizard->m_generalLoanInfoPage->m_interestType->currentText());
+ p = new KListViewItem(group, p, i18n("Principal and interest"), m_wizard->m_loanDetailsPage->m_paymentAmount->value().formatMoney(acc, sec));
+ p = new KListViewItem(group, p, i18n("Additional fees"), m_wizard->m_loanPaymentPage->additionalFees().formatMoney(acc, sec));
+ p = new KListViewItem(group, p, i18n("Payment frequency"), m_wizard->m_generalLoanInfoPage->m_paymentFrequency->currentText());
+ p = new KListViewItem(group, p, i18n("Payment account"), m_wizard->m_loanSchedulePage->m_paymentAccount->currentText());
+
+ if(!m_wizard->m_loanPayoutPage->m_noPayoutTransaction->isChecked() && m_wizard->openingBalance().isZero()) {
+ group = new KMyMoneyCheckListItem(m_dataList, group, i18n("Payout information"), QString(), QString(), QCheckListItem::RadioButtonController);
+ group->setOpen(true);
+ if(m_wizard->m_loanPayoutPage->m_refinanceLoan->isChecked()) {
+ p = new KListViewItem(group, p, i18n("Refinance"), m_wizard->m_loanPayoutPage->m_loanAccount->currentText());
+ } else {
+ if(m_wizard->moneyBorrowed())
+ p = new KListViewItem(group, p, i18n("Transfer amount to"), m_wizard->m_loanPayoutPage->m_assetAccount->currentText());
+ else
+ p = new KListViewItem(group, p, i18n("Transfer amount from"), m_wizard->m_loanPayoutPage->m_assetAccount->currentText());
+ }
+ p = new KListViewItem(group, p, i18n("Payment date"), KGlobal::locale()->formatDate(m_wizard->m_loanPayoutPage->m_payoutDate->date()));
+ }
+ }
+
+ // Schedule
+ if(!(sch == MyMoneySchedule())) {
+ group = new KMyMoneyCheckListItem(m_dataList, group, i18n("Schedule information"), QString(), QString(), QCheckListItem::RadioButtonController);
+ group->setOpen(true);
+ p = new KListViewItem(group, i18n("Name"), sch.name());
+ if(acc.accountType() == MyMoneyAccount::CreditCard) {
+ MyMoneyAccount paymentAccount = MyMoneyFile::instance()->account(m_wizard->m_schedulePage->m_paymentAccount->selectedItem());
+ p = new KListViewItem(group, p, i18n("Occurence"), i18n("Monthly"));
+ p = new KListViewItem(group, p, i18n("Paid from"), paymentAccount.name());
+ p = new KListViewItem(group, p, i18n("Pay to"), m_wizard->m_schedulePage->m_payee->currentText());
+ p = new KListViewItem(group, p, i18n("Amount"), m_wizard->m_schedulePage->m_amount->value().formatMoney(acc, sec));
+ p = new KListViewItem(group, p, i18n("First payment due"), KGlobal::locale()->formatDate(sch.nextDueDate()));
+ p = new KListViewItem(group, p, i18n("Payment method"), m_wizard->m_schedulePage->m_method->currentText());
+ }
+ if(acc.isLoan()) {
+ p = new KListViewItem(group, p, i18n("Occurence"), m_wizard->m_generalLoanInfoPage->m_paymentFrequency->currentText());
+ p = new KListViewItem(group, p, i18n("Amount"), (m_wizard->m_loanPaymentPage->basePayment() + m_wizard->m_loanPaymentPage->additionalFees()).formatMoney(acc, sec));
+ p = new KListViewItem(group, p, i18n("First payment due"), KGlobal::locale()->formatDate(m_wizard->m_loanSchedulePage->firstPaymentDueDate()));
+ }
+ }
+}
+
+#include "knewaccountwizard.moc"
diff --git a/kmymoney2/wizards/newaccountwizard/knewaccountwizard.h b/kmymoney2/wizards/newaccountwizard/knewaccountwizard.h
new file mode 100644
index 0000000..c8a149c
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/knewaccountwizard.h
@@ -0,0 +1,182 @@
+/***************************************************************************
+ knewaccountwizard.h
+ -------------------
+ begin : Tue Sep 25 2007
+ copyright : (C) 2007 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 KNEWACCOUNTWIZARD_H
+#define KNEWACCOUNTWIZARD_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+class QString;
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/kmymoneywizard.h>
+class MyMoneyPrice;
+
+/**
+ * @author Thomas Baumgart
+ */
+namespace NewAccountWizard {
+
+class AccountTypePage;
+class InstitutionPage;
+class BrokeragePage;
+class CreditCardSchedulePage;
+class GeneralLoanInfoPage;
+class LoanDetailsPage;
+class LoanPaymentPage;
+class LoanSchedulePage;
+class LoanPayoutPage;
+class HierarchyPage;
+class AccountSummaryPage;
+
+/**
+ * @author Thomas Baumgart
+ *
+ * This class implements the new account wizard which is used to gather
+ * the required information from the user to create a new account
+ */
+class Wizard : public KMyMoneyWizard
+{
+ friend class AccountTypePage;
+ friend class InstitutionPage;
+ friend class BrokeragePage;
+ friend class CreditCardSchedulePage;
+ friend class GeneralLoanInfoPage;
+ friend class LoanDetailsPage;
+ friend class LoanPaymentPage;
+ friend class LoanSchedulePage;
+ friend class LoanPayoutPage;
+ friend class HierarchyPage;
+ friend class AccountSummaryPage;
+
+ Q_OBJECT
+public:
+ Wizard(QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags flags = 0);
+
+ /**
+ * Returns the information about the account as entered by
+ * the user.
+ */
+ const MyMoneyAccount& account(void);
+
+ /**
+ * Method to load the generated account information back into the widget
+ */
+ void setAccount(const MyMoneyAccount& acc);
+
+ /**
+ * Returns the information about the parent account as entered by
+ * the user.
+ * @note For now it's either fixed as Asset or Liability. We will provide
+ * user selected parent accounts later.
+ */
+ const MyMoneyAccount& parentAccount(void);
+
+ /**
+ * Returns information about the schedule. If the returned value
+ * equals MyMoneySchedule() then the user did not select to create
+ * a schedule.
+ */
+ const MyMoneySchedule& schedule(void);
+
+ /**
+ * This method returns the value of the opening balance
+ * entered by the user
+ */
+ MyMoneyMoney openingBalance(void) const;
+
+ /**
+ * This method returns the interest rate as factor, ie an
+ * interest rate of 6.5% will be returned as 0.065
+ */
+ MyMoneyMoney interestRate(void) const;
+
+ /**
+ * This method returns the payout transaction for loans.
+ * If the account to be created is not a loan or no
+ * payout transaction should be generated, this method
+ * returns an emtpy transaction.
+ */
+ MyMoneyTransaction payoutTransaction(void);
+
+ /**
+ * This method returns a MyMoneyAccount() object filled
+ * with the data to create a brokerage account. If the
+ * user selected not to create a brokerage account or
+ * the account type is not able to create a brokerage
+ * account, an empty MyMoneyAccount() object is returned.
+ *
+ * @note Make sure to call the account() method before you call this method.
+ * Otherwise the returned object might contain unexpected results.
+ */
+ MyMoneyAccount brokerageAccount(void) const;
+
+ /**
+ * This method returns the conversion rate
+ */
+ MyMoneyPrice conversionRate(void) const;
+
+protected:
+ /**
+ * This method returns the currently selected currency for the account
+ */
+ const MyMoneySecurity& currency(void) const;
+
+ /**
+ * This method returns the precision in digits for the selected currency.
+ * @sa currency()
+ */
+ int precision(void) const;
+
+ /**
+ * This method returns information about the selection of the user
+ * if the loan is for borrowing or lending money.
+ *
+ * @retval true loan is for money borrowed
+ * @retval false loan is for money lent
+ */
+ bool moneyBorrowed() const;
+
+signals:
+ void createInstitution(MyMoneyInstitution& institution);
+ void createAccount(MyMoneyAccount& account);
+ void createCategory(MyMoneyAccount&, const MyMoneyAccount&);
+
+private:
+ InstitutionPage* m_institutionPage;
+ AccountTypePage* m_accountTypePage;
+ BrokeragePage* m_brokeragepage;
+ CreditCardSchedulePage* m_schedulePage;
+ GeneralLoanInfoPage* m_generalLoanInfoPage;
+ LoanDetailsPage* m_loanDetailsPage;
+ LoanPaymentPage* m_loanPaymentPage;
+ LoanSchedulePage* m_loanSchedulePage;
+ LoanPayoutPage* m_loanPayoutPage;
+ HierarchyPage* m_hierarchyPage;
+ AccountSummaryPage* m_accountSummaryPage;
+
+ MyMoneyAccountLoan m_account;
+ MyMoneySchedule m_schedule;
+};
+
+}; // namespace
+
+
+#endif
diff --git a/kmymoney2/wizards/newaccountwizard/knewaccountwizard_p.h b/kmymoney2/wizards/newaccountwizard/knewaccountwizard_p.h
new file mode 100644
index 0000000..b8a7cb1
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/knewaccountwizard_p.h
@@ -0,0 +1,327 @@
+/***************************************************************************
+ knewaccountwizard_p.h
+ -------------------
+ begin : Tue Sep 25 2007
+ copyright : (C) 2007 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 KNEWACCOUNTWIZARD_P_H
+#define KNEWACCOUNTWIZARD_P_H
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qcheckbox.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <klistview.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include <kmymoney/kmymoneywizard.h>
+#include <kmymoney/kmymoneydateinput.h>
+#include <kmymoney/kmymoneycurrencyselector.h>
+#include <kmymoney/mymoneyaccount.h>
+#include <kmymoney/kmymoneyedit.h>
+#include <kmymoney/kmymoneycategory.h>
+#include <kmymoney/kmymoneyaccounttreebase.h>
+
+#include "kinstitutionpagedecl.h"
+#include "kaccounttypepagedecl.h"
+#include "kbrokeragepagedecl.h"
+#include "kschedulepagedecl.h"
+#include "kgeneralloaninfopagedecl.h"
+#include "kloandetailspagedecl.h"
+#include "kloanpaymentpagedecl.h"
+#include "kloanschedulepagedecl.h"
+#include "kloanpayoutpagedecl.h"
+#include "khierarchypagedecl.h"
+#include "kaccountsummarypagedecl.h"
+
+class Wizard;
+class MyMoneyInstitution;
+class KMyMoneyAccountTreeItem;
+
+namespace NewAccountWizard {
+
+class InstitutionPage : public KInstitutionPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ InstitutionPage(Wizard* parent, const char* name = 0);
+ ~InstitutionPage();
+ KMyMoneyWizardPage* nextPage(void) const;
+
+ QWidget* initialFocusWidget(void) const { return m_institutionComboBox; }
+
+ /**
+ * Returns the information about an institution if entered by
+ * the user. If the id field is empty, then he did not enter
+ * such information.
+ */
+ const MyMoneyInstitution& institution(void) const;
+
+private slots:
+ void slotLoadWidgets(void);
+ void slotNewInstitution(void);
+ void slotSelectInstitution(int id);
+
+private:
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+class AccountTypePage : public KAccountTypePageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ AccountTypePage(Wizard* parent, const char* name = 0);
+ virtual bool isComplete(void) const;
+ KMyMoneyWizardPage* nextPage(void) const;
+
+ QWidget* initialFocusWidget(void) const { return m_accountName; }
+
+ MyMoneyAccount::accountTypeE accountType(void) const;
+ const MyMoneyAccount& parentAccount(void);
+ bool allowsParentAccount(void) const;
+ const MyMoneySecurity& currency(void) const;
+
+ void setAccount(const MyMoneyAccount& acc);
+
+private:
+ void hideShowPages(MyMoneyAccount::accountTypeE i) const;
+ void priceWarning(bool);
+
+private slots:
+ void slotLoadWidgets(void);
+ void slotUpdateType(int i);
+ void slotUpdateCurrency(void);
+ void slotUpdateConversionRate(const QString&);
+ void slotGetOnlineQuote(void);
+ void slotPriceWarning(void);
+
+private:
+ bool m_showPriceWarning;
+};
+
+class BrokeragePage : public KBrokeragePageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ BrokeragePage(Wizard* parent, const char* name = 0);
+ KMyMoneyWizardPage* nextPage(void) const;
+ void enterPage(void);
+
+ QWidget* initialFocusWidget(void) const { return m_createBrokerageButton; }
+
+private slots:
+ void slotLoadWidgets(void);
+};
+
+class CreditCardSchedulePage : public KSchedulePageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ CreditCardSchedulePage(Wizard* parent, const char* name = 0);
+ KMyMoneyWizardPage* nextPage(void) const;
+ virtual bool isComplete(void) const;
+ void enterPage(void);
+
+ QWidget* initialFocusWidget(void) const { return m_reminderCheckBox; }
+
+private slots:
+ void slotLoadWidgets(void);
+};
+
+class GeneralLoanInfoPage : public KGeneralLoanInfoPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ GeneralLoanInfoPage(Wizard* parent, const char* name = 0);
+ KMyMoneyWizardPage* nextPage(void) const;
+ virtual bool isComplete(void) const;
+ void enterPage(void);
+ const MyMoneyAccount& parentAccount(void);
+
+ QWidget* initialFocusWidget(void) const { return m_loanDirection; }
+
+ /**
+ * Returns @p true if the user decided to record all payments, @p false otherwise.
+ */
+ bool recordAllPayments(void) const;
+
+private slots:
+ void slotLoadWidgets(void);
+
+private:
+ bool m_firstTime;
+};
+
+class LoanDetailsPage : public KLoanDetailsPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ LoanDetailsPage(Wizard* parent, const char* name = 0);
+ void enterPage(void);
+ KMyMoneyWizardPage* nextPage(void) const;
+ virtual bool isComplete(void) const;
+
+ QWidget* initialFocusWidget(void) const { return m_paymentDue; }
+
+ /**
+ * This method returns the number of payments depending on
+ * the settings of m_termAmount and m_termUnit widgets
+ */
+ int term(void) const;
+
+private:
+ /**
+ * This method is used to update the term widgets
+ * according to the length of the given @a term.
+ * The term is also converted into a string and returned.
+ */
+ QString updateTermWidgets(const long double term);
+
+private:
+ bool m_needCalculate;
+
+private slots:
+ void slotValuesChanged(void);
+ void slotCalculate(void);
+};
+
+class LoanPaymentPage : public KLoanPaymentPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ LoanPaymentPage(Wizard* parent, const char* name = 0);
+ ~LoanPaymentPage();
+
+ KMyMoneyWizardPage* nextPage(void) const;
+
+ void enterPage(void);
+
+ /**
+ * This method returns the sum of the additional fees
+ */
+ MyMoneyMoney additionalFees(void) const;
+
+ /**
+ * This method returns the base payment, that's principal and interest
+ */
+ MyMoneyMoney basePayment(void) const;
+
+ /**
+ * This method returns the splits that make up the additional fees in @p list.
+ * @note The splits may contain assigned ids which the caller must remove before
+ * adding the splits to a MyMoneyTransaction object.
+ */
+ void additionalFeesSplits(QValueList<MyMoneySplit>& list);
+
+protected slots:
+ void slotAdditionalFees(void);
+
+protected:
+ void updateAmounts(void);
+
+private:
+ /// \internal d-pointer class.
+ class Private;
+ /// \internal d-pointer instance.
+ Private* const d;
+};
+
+class LoanSchedulePage : public KLoanSchedulePageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ LoanSchedulePage(Wizard* parent, const char* name = 0);
+ void enterPage(void);
+
+ KMyMoneyWizardPage* nextPage(void) const;
+
+ /**
+ * This method returns the due date of the first payment to be recorded.
+ */
+ QDate firstPaymentDueDate(void) const;
+
+ QWidget* initialFocusWidget(void) const { return m_interestCategory; }
+
+private slots:
+ void slotLoadWidgets(void);
+ void slotCreateCategory(const QString& name, QString& id);
+};
+
+
+class LoanPayoutPage : public KLoanPayoutPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ LoanPayoutPage(Wizard* parent, const char* name = 0);
+ void enterPage(void);
+ virtual bool isComplete(void) const;
+
+ KMyMoneyWizardPage* nextPage(void) const;
+
+ QWidget* initialFocusWidget(void) const { return m_noPayoutTransaction; }
+
+ const QString& payoutAccountId(void) const;
+
+private slots:
+ void slotLoadWidgets(void);
+ void slotCreateAssetAccount(void);
+ void slotButtonsToggled(void);
+};
+
+class HierarchyPage : public KHierarchyPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ HierarchyPage(Wizard* parent, const char* name = 0);
+ void enterPage(void);
+ KMyMoneyWizardPage* nextPage(void) const;
+ QWidget* initialFocusWidget(void) const { return m_qlistviewParentAccounts; }
+ const MyMoneyAccount& parentAccount(void);
+
+private:
+ KMyMoneyAccountTreeItem* buildAccountTree
+ ( KMyMoneyAccountTreeBase* parent
+ , const MyMoneyAccount& account
+ , bool open = false ) const;
+ KMyMoneyAccountTreeItem* buildAccountTree
+ ( KMyMoneyAccountTreeItem* parent
+ , const MyMoneyAccount& account
+ , bool open = false ) const;
+ MyMoneyAccount m_topAccount; // Last populated top account
+ bool bFirstTime;
+};
+
+class AccountSummaryPage : public KAccountSummaryPageDecl, public WizardPage<Wizard>
+{
+ Q_OBJECT
+public:
+ AccountSummaryPage(Wizard* parent, const char* name = 0);
+ void enterPage(void);
+ QWidget* initialFocusWidget(void) const { return m_dataList; }
+};
+
+} // namespace
+
+#endif
diff --git a/kmymoney2/wizards/newaccountwizard/kschedulepagedecl.ui b/kmymoney2/wizards/newaccountwizard/kschedulepagedecl.ui
new file mode 100644
index 0000000..fd4f886
--- /dev/null
+++ b/kmymoney2/wizards/newaccountwizard/kschedulepagedecl.ui
@@ -0,0 +1,187 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSchedulePageDecl</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KSchedulePageDecl</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>544</width>
+ <height>391</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KActiveLabel">
+ <property name="name">
+ <cstring>kActiveLabel16</cstring>
+ </property>
+ <property name="text">
+ <string>For credit card accounts you can create a monthly schedule which will automatically remind you about the payment. Please fill in the details about this payment here.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_reminderCheckBox</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="text">
+ <string>Yes, remind me when the payment is due</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>m_paymentFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</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>180</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Name of schedule</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>m_name</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Payee</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyPayeeCombo" row="1" column="1">
+ <property name="name">
+ <cstring>m_payee</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Estimated monthly payment</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyEdit" row="2" column="1">
+ <property name="name">
+ <cstring>m_amount</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>TextLabel4_3</cstring>
+ </property>
+ <property name="text">
+ <string>Due date of next payment</string>
+ </property>
+ </widget>
+ <widget class="kMyMoneyDateInput" row="3" column="1">
+ <property name="name">
+ <cstring>m_date</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel3_3</cstring>
+ </property>
+ <property name="text">
+ <string>Payment should be made
+from account</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <widget class="KMyMoneyCategory" row="4" column="1">
+ <property name="name">
+ <cstring>m_paymentAccount</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Payment method</string>
+ </property>
+ </widget>
+ <widget class="KMyMoneyGeneralCombo" row="5" column="1">
+ <property name="name">
+ <cstring>m_method</cstring>
+ </property>
+ </widget>
+ </grid>
+ </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>20</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>m_reminderCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_paymentFrame</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>