diff options
Diffstat (limited to 'kmymoney2/wizards')
37 files changed, 6593 insertions, 0 deletions
diff --git a/kmymoney2/wizards/Makefile.am b/kmymoney2/wizards/Makefile.am new file mode 100644 index 0000000..96afbe6 --- /dev/null +++ b/kmymoney2/wizards/Makefile.am @@ -0,0 +1,5 @@ +KDE_OPTIONS = noautodist + +INCLUDES = $(all_includes) -I$(top_srcdir) -I. + +SUBDIRS = wizardpages newuserwizard newaccountwizard 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 <b>Finish</b> to create the account, schedules, etc. or use <b>Back</b> 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 <b>What's this?</b> 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. +<br> +<i>Note</i>: 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><p><b>Checking</b> +Use the checking account type to manage activities on your checking account e.g. payments, checks and cash card purchases.</p> + +<p><b>Savings</b> +Use the savings account type to manage activities on your savings account.</p> + +<p><b>Credit Card</b> +Use the credit card account type to manage activities on your credit card.</p> + +<p><b>Cash</b> + +Use the cash account type to manage activities in your wallet.</p> + +<p><b>Loan</b> +Use the loan account type to manage amortization loans (e.g. mortgages, car loan, money you lend, private loans etc.).</p> + +<p><b>Investment</b> +Use the investment account to manage your stock, mutual fund and other investments.</p> + +<p><b>Asset</b> +Use the asset account type to manage assets (e.g. your house, car or art collection).</p> + +<p><b>Liability</b> +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.</p></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 <b>Preferred Account</b> 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?<p> + +<b>Check</b> the mark if this investment account has an associated account for money that is not invested.<br> + +<b>Uncheck</b> 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 <b>What's this?</b> 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><qt>Select which transactions should be recorded. + +<b>All payments</b> allows you to enter all payments made for this loan. + +The option to <b>start from the beginning of the current year</b> 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. +</qt></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 <b>What do you want to record?</b> this field means the following:<p> + +<b>All payments</b><br> +Enter the due date of the very first payment<p> + +<b>Start with this year's payments</b><br> +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 <b>New Institution</b> 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 <b>Calculate</b> button. Before you can continue with the next page you also need to press <b>Calculate</b> 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 <b>Additional fees</b> 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.<p> +If you selected to record all payments this date has already been supplied. If you selected to record only this years payments, then the <b>First payment due date</b> 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 <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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> diff --git a/kmymoney2/wizards/newuserwizard/Makefile.am b/kmymoney2/wizards/newuserwizard/Makefile.am new file mode 100644 index 0000000..36b9fdd --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/Makefile.am @@ -0,0 +1,18 @@ +noinst_LIBRARIES = libnewuserwizard.a +KDE_OPTIONS = noautodist + +INCLUDES = $(all_includes) -I../wizardpages -I$(top_srcdir) -I. + +libnewuserwizard_a_METASOURCES = AUTO + +libnewuserwizard_a_SOURCES = knewuserwizard.cpp kgeneralpagedecl.ui kcurrencypagedecl.ui kpasswordpagedecl.ui kaccountpagedecl.ui kpreferencepagedecl.ui kfilepagedecl.ui kintropagedecl.ui + +EXTRA_DIST = kgeneralpagedecl.ui kcurrencypagedecl.ui kpasswordpagedecl.ui kaccountpagedecl.ui kpreferencepagedecl.ui kfilepagedecl.ui kintropagedecl.ui + +DISTCLEANFILES= kgeneralpagedecl.cpp kgeneralpagedecl.h kcurrencypagedecl.cpp kcurrencypagedecl.h kpasswordpagedecl.cpp kpasswordpagedecl.h kaccountpagedecl.cpp kaccountpagedecl.h kpreferencepagedecl.cpp kpreferencepagedecl.h kfilepagedecl.cpp kfilepagedecl.h kintropagedecl.cpp kintropagedecl.h + +noinst_HEADERS = knewuserwizard.h knewuserwizard_p.h + +SUBDIRS = + +messages: rc.cpp diff --git a/kmymoney2/wizards/newuserwizard/kaccountpagedecl.ui b/kmymoney2/wizards/newuserwizard/kaccountpagedecl.ui new file mode 100644 index 0000000..e0e3620 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kaccountpagedecl.ui @@ -0,0 +1,268 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KAccountPageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KAccountPageDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>481</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>A typical KMyMoney user maintains a checking a account with some institution and uses it to receive money or pay bills. If this is not the case, please deselect the checkbox below and continue on the next page.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_haveCheckingAccountButton</cstring> + </property> + <property name="text"> + <string>I have a checking account that I want to manage with KMyMoney</string> + </property> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>m_accountDataFrame</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="KLineEdit" row="5" column="1"> + <property name="name"> + <cstring>m_institutionNameEdit</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>The name of the instititution that issued the account.</string> + </property> + </widget> + <widget class="KLineEdit" row="6" column="1"> + <property name="name"> + <cstring>m_institutionNumberEdit</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Each institution has a routing number. Enter it here. If uncertain, leave the field blank. You can modify it later.</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Name of the institution</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Routing number</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_accountNumberEdit</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>In general the institution that issued the account also issued a number for it. Enter it here. If uncertain, you can modify this entry later.</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_accountNameEdit</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Enter a descriptive name that will be used by KMyMoney to identify your checking account.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Opening date</string> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="kMyMoneyDateInput"> + <property name="name"> + <cstring>m_openingDateEdit</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Enter the date from when on you plan to keep track of the transactions in that account. This is usually the date of the last statement. If uncertain, leave as is.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>81</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Number of the account</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Name of the account</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>Opening balance</string> + </property> + </widget> + <widget class="QLayoutWidget" row="4" column="1"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_accountCurrencyLabel</cstring> + </property> + <property name="text"> + <string>xxx</string> + </property> + </widget> + <widget class="kMyMoneyEdit"> + <property name="name"> + <cstring>m_openingBalanceEdit</cstring> + </property> + <property name="resetButtonVisibility" stdset="0"> + <bool>false</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Enter the opening balance of the account. This is usually the ending balance of the last statement. If uncertain, leave as is.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="KActiveLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>The fields below allow you to enter some information about your checking account. Once this wizard finishes, the account will be created for you within KMyMoney.</string> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>m_haveCheckingAccountButton</sender> + <signal>toggled(bool)</signal> + <receiver>m_accountDataFrame</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>m_accountNameEdit</tabstop> + <tabstop>m_accountNumberEdit</tabstop> + <tabstop>m_openingDateEdit</tabstop> + <tabstop>m_openingBalanceEdit</tabstop> + <tabstop>m_institutionNameEdit</tabstop> + <tabstop>m_institutionNumberEdit</tabstop> + <tabstop>m_haveCheckingAccountButton</tabstop> + <tabstop>kActiveLabel2</tabstop> + <tabstop>kActiveLabel1</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/newuserwizard/kcurrencypagedecl.ui b/kmymoney2/wizards/newuserwizard/kcurrencypagedecl.ui new file mode 100644 index 0000000..579bf1e --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kcurrencypagedecl.ui @@ -0,0 +1,82 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KCurrencyPageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KCurrencyPageDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>626</width> + <height>186</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel3</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>KMyMoney supports multiple currencies. Your reports will be based on a default curreny which you can select here. The default for new accounts is also the currency you select here.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout19</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KMyMoneySecuritySelector"> + <property name="name"> + <cstring>m_baseCurrencyEdit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/newuserwizard/kfilepagedecl.ui b/kmymoney2/wizards/newuserwizard/kfilepagedecl.ui new file mode 100644 index 0000000..dcae784 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kfilepagedecl.ui @@ -0,0 +1,86 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KFilePageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KFilePageDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>350</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>KMyMoney will store your financial data in a file on the disk. A standard filename within your KDE user environment will be the default. This is just provided for convenience and you can choose any other location here.</string> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>m_dataFileEdit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>m_existingFileLabel</cstring> + </property> + <property name="paletteForegroundColor"> + <color> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="text"> + <string>Either the currently selected file exists or the selected directory does not exist. Please make sure, that + +<ul> +<li>the selected directory exists and</li> +<li>the filename is not currently used in this directory.</li> +</ul></string> + </property> + </widget> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>m_finishLabel</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>This finishes the setup of your KMyMoney environment. You can now press the Finish button and start using KMyMoney to record your financial transactions.</string> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/newuserwizard/kgeneralpagedecl.ui b/kmymoney2/wizards/newuserwizard/kgeneralpagedecl.ui new file mode 100644 index 0000000..916493d --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kgeneralpagedecl.ui @@ -0,0 +1,258 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>KGeneralPageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KGeneralPageDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>415</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel2</cstring> + </property> + <property name="text"> + <string>Please enter some information about yourself.<br><br> + +This information will be seen and used only by you. The information is used to personalize KMyMoney, to encrypt your file, etc.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout18</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>frame8</cstring> + </property> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout20</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>County/State:</string> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>m_userNameEdit</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>m_countyEdit</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_townEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Street:</string> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_streetEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Email:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Your name:</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Telephone:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Town:</string> + </property> + </widget> + <widget class="QLineEdit" row="6" column="1"> + <property name="name"> + <cstring>m_emailEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel5</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Zip code</string> + </property> + </widget> + <widget class="QLineEdit" row="5" column="1"> + <property name="name"> + <cstring>m_telephoneEdit</cstring> + </property> + </widget> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>m_zipcodeEdit</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_loadAddressButton</cstring> + </property> + <property name="text"> + <string>Load from Addressbook</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frame8_2</cstring> + </property> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/newuserwizard/kintropagedecl.ui b/kmymoney2/wizards/newuserwizard/kintropagedecl.ui new file mode 100644 index 0000000..d9dd326 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kintropagedecl.ui @@ -0,0 +1,66 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KIntroPageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KIntroPageDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>415</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Welcome to KMyMoney!</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="text"> + <string>You have started KMyMoney for the first time on this computer. Before this program can help you to manage your finances, it needs to collect some data from you.<p> + +On the next few pages you will be guided through the steps necessary to setup the program. This will happen only once.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>41</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/newuserwizard/knewuserwizard.cpp b/kmymoney2/wizards/newuserwizard/knewuserwizard.cpp new file mode 100644 index 0000000..608afb6 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/knewuserwizard.cpp @@ -0,0 +1,363 @@ +/*************************************************************************** + knewuserwizard.cpp + ------------------- + begin : Sat Feb 18 2006 + copyright : (C) 2006 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <qpixmap.h> +#include <qbitmap.h> +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <qdir.h> +#include <qlabel.h> + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include <klocale.h> +#include <klistview.h> +#include <kstandarddirs.h> +#include <klineedit.h> +#include <ktextedit.h> +#include <kuser.h> +#include <kurlrequester.h> +#include <kio/netaccess.h> +#include <kurl.h> +#include <kabc/addressee.h> +#include <kabc/stdaddressbook.h> +#include <kmessagebox.h> +#include <kactivelabel.h> + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "knewuserwizard.h" +#include "knewuserwizard_p.h" +#include <kmymoney/mymoneysecurity.h> +#include <kmymoney/mymoneyfile.h> +#include <kmymoney/kguiutils.h> +#include <kmymoney/kmymoneyaccounttree.h> +#include <kmymoney/mymoneypayee.h> +#include <kmymoney/mymoneymoney.h> +#include <kmymoney/mymoneyinstitution.h> +#include <kmymoney/mymoneyaccount.h> +#include <kmymoney/kmymoneydateinput.h> +#include <kmymoney/kmymoneyedit.h> +#include <kmymoney/kaccounttemplateselector.h> + +#include "../../kmymoney2.h" +#include "../../kmymoneyglobalsettings.h" + +using namespace NewUserWizard; + +static int stepCount; + +NewUserWizard::Wizard::Wizard(QWidget *parent, const char *name, bool modal, WFlags flags) : + KMyMoneyWizard(parent, name, modal, flags), + m_introPage(0) +{ + bool isFirstTime = KMyMoneyGlobalSettings::firstTimeRun(); + + stepCount = 1; + + setTitle(i18n("KMyMoney New File Setup")); + if(isFirstTime) + addStep(i18n("Introduction")); + addStep(i18n("Personal Data")); + addStep(i18n("Select Currency")); + addStep(i18n("Select Accounts")); + addStep(i18n("Set preferences")); + addStep(i18n("Finish")); + + if(isFirstTime) + m_introPage = new IntroPage(this); + m_generalPage = new GeneralPage(this); + m_currencyPage = new CurrencyPage(this); + m_accountPage = new AccountPage(this); + m_categoriesPage = new CategoriesPage(this); + m_preferencePage = new PreferencePage(this); + m_filePage = new FilePage(this); + + m_accountPage->m_haveCheckingAccountButton->setChecked(true); + if(isFirstTime) + setFirstPage(m_introPage); + else + setFirstPage(m_generalPage); + + setHelpContext("firsttime-3"); +} + +MyMoneyPayee NewUserWizard::Wizard::user(void) const +{ + return m_generalPage->user(); +} + +QString NewUserWizard::Wizard::url(void) const +{ + return m_filePage->m_dataFileEdit->url(); +} + +MyMoneyInstitution NewUserWizard::Wizard::institution(void) const +{ + MyMoneyInstitution inst; + if(m_accountPage->m_haveCheckingAccountButton->isChecked()) { + if(m_accountPage->m_institutionNameEdit->text().length()) { + inst.setName(m_accountPage->m_institutionNameEdit->text()); + if(m_accountPage->m_institutionNumberEdit->text().length()) + inst.setSortcode(m_accountPage->m_institutionNumberEdit->text()); + } + } + return inst; +} + +MyMoneyAccount NewUserWizard::Wizard::account(void) const +{ + MyMoneyAccount acc; + if(m_accountPage->m_haveCheckingAccountButton->isChecked()) { + acc.setName(m_accountPage->m_accountNameEdit->text()); + if(m_accountPage->m_accountNumberEdit->text().length()) + acc.setNumber(m_accountPage->m_accountNumberEdit->text()); + acc.setOpeningDate(m_accountPage->m_openingDateEdit->date()); + acc.setCurrencyId(m_baseCurrency.id()); + acc.setAccountType(MyMoneyAccount::Checkings); + } + return acc; +} + +MyMoneyMoney NewUserWizard::Wizard::openingBalance(void) const +{ + return m_accountPage->m_openingBalanceEdit->value(); +} + +MyMoneySecurity NewUserWizard::Wizard::baseCurrency(void) const +{ + return m_baseCurrency; +} + +QValueList<MyMoneyTemplate> NewUserWizard::Wizard::templates(void) const +{ + return m_categoriesPage->selectedTemplates(); +} + +IntroPage::IntroPage(Wizard* wizard, const char* name) : + KIntroPageDecl(wizard), + WizardPage<Wizard>(stepCount++, this, wizard, name) +{ +} + +KMyMoneyWizardPage* IntroPage::nextPage(void) const +{ + return m_wizard->m_generalPage; +} + +GeneralPage::GeneralPage(Wizard* wizard, const char* name) : + UserInfo(wizard), + WizardPage<Wizard>(stepCount++, this, wizard, name) +{ + m_userNameEdit->setFocus(); + KABC::StdAddressBook *ab = KABC::StdAddressBook::self(true); + connect(ab, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotAddressBookLoaded())); + connect(m_loadAddressButton, SIGNAL(clicked()), this, SLOT(slotLoadFromKABC())); + m_loadAddressButton->setEnabled(false); +} + +void GeneralPage::slotAddressBookLoaded(void) +{ + KABC::StdAddressBook *ab = KABC::StdAddressBook::self(); + if (!ab) + return; + + m_loadAddressButton->setEnabled(!ab->whoAmI().isEmpty()); +} + +void GeneralPage::slotLoadFromKABC(void) +{ + KABC::StdAddressBook *ab = KABC::StdAddressBook::self(); + if (!ab) + return; + + KABC::Addressee addr = ab->whoAmI(); + if ( addr.isEmpty() ) { + KMessageBox::sorry(this, i18n("Unable to load data, because no contact has been associated with the owner of the standard addressbook."), i18n("Addressbook import")); + return; + } + + m_userNameEdit->setText( addr.formattedName() ); + m_emailEdit->setText( addr.preferredEmail() ); + + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Home ); + m_telephoneEdit->setText( phone.number() ); + + KABC::Address a = addr.address( KABC::Address::Home ); + QString sep; + if(!a.country().isEmpty() && !a.region().isEmpty()) + sep = " / "; + m_countyEdit->setText(QString("%1%2%3").arg(a.country(), sep, a.region())); + m_postcodeEdit->setText( a.postalCode() ); + m_townEdit->setText( a.locality() ); + m_streetEdit->setText( a.street() ); +} + +KMyMoneyWizardPage* GeneralPage::nextPage(void) const +{ + return m_wizard->m_currencyPage; +} + +CurrencyPage::CurrencyPage(Wizard* wizard, const char* name) : + Currency(wizard), + WizardPage<Wizard>(stepCount++, this, wizard, name) +{ + QListViewItem *first = 0; + QValueList<MyMoneySecurity> list = MyMoneyFile::instance()->currencyList(); + QValueList<MyMoneySecurity>::const_iterator it; + + QString localCurrency(localeconv()->int_curr_symbol); + localCurrency.truncate(3); + + QString baseCurrency = MyMoneyFile::instance()->baseCurrency().id(); + + // construct a transparent 16x16 pixmap + QPixmap empty(16, 16); + empty.setMask(QBitmap(16, 16, true)); + + m_currencyList->clear(); + for(it = list.begin(); it != list.end(); ++it) { + QListViewItem* p = insertCurrency(*it); + if((*it).id() == baseCurrency) { + first = p; + p->setPixmap(0, QPixmap( locate("icon","hicolor/16x16/apps/kmymoney2.png"))); + } else { + p->setPixmap(0, empty); + } + if(!first && (*it).id() == localCurrency) + first = p; + } + + if(first == 0) + first = m_currencyList->firstChild(); + if(first != 0) { + m_currencyList->setCurrentItem(first); + m_currencyList->setSelected(first, true); + m_currencyList->ensureItemVisible(first); + } +} + +void CurrencyPage::enterPage(void) +{ + m_currencyList->setFocus(); +} + + +KMyMoneyWizardPage* CurrencyPage::nextPage(void) const +{ + m_wizard->m_baseCurrency = MyMoneyFile::instance()->security(selectedCurrency()); + m_wizard->m_accountPage->m_accountCurrencyLabel->setText(m_wizard->m_baseCurrency.tradingSymbol()); + return m_wizard->m_accountPage; +} + +AccountPage::AccountPage(Wizard* wizard, const char* name) : + KAccountPageDecl(wizard, name), + WizardPage<Wizard>(stepCount, this, wizard, name) // don't inc. the step count here +{ + m_mandatoryGroup->add(m_accountNameEdit); + connect(m_mandatoryGroup, SIGNAL(stateChanged()), object(), SIGNAL(completeStateChanged())); + connect(m_haveCheckingAccountButton, SIGNAL(toggled(bool)), object(), SIGNAL(completeStateChanged())); + m_accountNameEdit->setFocus(); + m_openingDateEdit->setDate(QDate(QDate::currentDate().year(),1,1)); +} + +KMyMoneyWizardPage* AccountPage::nextPage(void) const +{ + return m_wizard->m_categoriesPage; +} + +bool AccountPage::isComplete(void) const +{ + return !m_haveCheckingAccountButton->isChecked() || m_mandatoryGroup->isEnabled(); +} + +CategoriesPage::CategoriesPage(Wizard* wizard, const char* name) : + Accounts(wizard), + WizardPage<Wizard>(stepCount++, this, wizard, name) +{ +} + +KMyMoneyWizardPage* CategoriesPage::nextPage(void) const +{ + return m_wizard->m_preferencePage; +} + +QValueList<MyMoneyTemplate> CategoriesPage::selectedTemplates(void) const +{ + return m_templateSelector->selectedTemplates(); +} + +PreferencePage::PreferencePage(Wizard* wizard, const char* name) : + KPreferencePageDecl(wizard), + WizardPage<Wizard>(stepCount++, this, wizard, name) +{ + connect(m_openConfigButton, SIGNAL(clicked()), kmymoney2, SLOT(slotSettings())); +} + +KMyMoneyWizardPage* PreferencePage::nextPage(void) const +{ + return m_wizard->m_filePage; +} + +FilePage::FilePage(Wizard* wizard, const char* name) : + KFilePageDecl(wizard), + WizardPage<Wizard>(stepCount++, this, wizard, name) +{ + m_mandatoryGroup->add(m_dataFileEdit->lineEdit()); + connect(m_mandatoryGroup, SIGNAL(stateChanged()), object(), SIGNAL(completeStateChanged())); + + KUser user; + m_dataFileEdit->setShowLocalProtocol(false); + m_dataFileEdit->setURL(QString("%1/%2.kmy").arg(QDir::homeDirPath(), user.loginName())); + + // allow selection of non-existing files + m_dataFileEdit->setMode(KFile::File); +} + +bool FilePage::isComplete(void) const +{ + bool rc = m_mandatoryGroup->isEnabled(); + m_existingFileLabel->hide(); + m_finishLabel->show(); + if(rc) { + // if a filename is present, check that + // a) the file does not exist + // b) the directory does exist + rc = !KIO::NetAccess::exists(m_dataFileEdit->url(), false, m_wizard); + if(rc) { + QRegExp exp("(.*)/(.*)"); + rc = false; + if(exp.search(m_dataFileEdit->url()) != -1) { + if(exp.cap(2).length() > 0) { + rc = KIO::NetAccess::exists(exp.cap(1), true, m_wizard); + } + } + } + m_existingFileLabel->setHidden(rc); + m_finishLabel->setShown(rc); + } + return rc; +} + +#include "knewuserwizard.moc" diff --git a/kmymoney2/wizards/newuserwizard/knewuserwizard.h b/kmymoney2/wizards/newuserwizard/knewuserwizard.h new file mode 100644 index 0000000..a8cd8d5 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/knewuserwizard.h @@ -0,0 +1,123 @@ +/*************************************************************************** + knewuserwizard.h + ------------------- + begin : Sat Feb 18 2006 + copyright : (C) 2006 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KNEWUSERWIZARD_H +#define KNEWUSERWIZARD_H + +// ---------------------------------------------------------------------------- +// QT Includes + +class QString; + +// ---------------------------------------------------------------------------- +// Project Includes + +#include <kmymoney/kmymoneywizard.h> +#include <kmymoney/mymoneysecurity.h> +class MyMoneyPayee; +class MyMoneyInstitution; +class MyMoneyAccount; +class MyMoneyMoney; +class MyMoneyTemplate; + +/** + * @author Thomas Baumgart + */ +namespace NewUserWizard { + +class IntroPage; +class GeneralPage; +class CurrencyPage; +class AccountPage; +class CategoriesPage; +class PreferencePage; +class FilePage; + +/** + * @author Thomas Baumgart + * + * This class implements the new user wizard which is used to gather + * some initial information from the user who creates a new KMyMoney + * 'file'. + */ +class Wizard : public KMyMoneyWizard +{ + friend class IntroPage; + friend class GeneralPage; + friend class CurrencyPage; + friend class AccountPage; + friend class CategoriesPage; + friend class PreferencePage; + friend class FilePage; + + Q_OBJECT +public: + Wizard(QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags flags = 0); + /** + * Returns the personal information of the user (e.g. name, address, etc.) + */ + MyMoneyPayee user(void) const; + + /** + * Returns the URL that the user has chosen to store the file + */ + QString url(void) const; + + /** + * Returns the information about an institution if entered by + * the user. If the name field is empty, then he did not enter + * such information. + */ + MyMoneyInstitution institution(void) const; + + /** + * Returns the information about a checking account if entered by + * the user. If the name field is empty, then he did not enter + * such information. + */ + MyMoneyAccount account(void) const; + + /** + * Returns the opening balance value provided by the user. not enter + */ + MyMoneyMoney openingBalance(void) const; + + /** + * Returns the security to be used as base currency. + */ + MyMoneySecurity baseCurrency(void) const; + + /** + * Returns a list of templates including accounts to be created + */ + QValueList<MyMoneyTemplate> templates(void) const; + +private: + MyMoneySecurity m_baseCurrency; + IntroPage* m_introPage; + GeneralPage* m_generalPage; + CurrencyPage* m_currencyPage; + AccountPage* m_accountPage; + CategoriesPage* m_categoriesPage; + PreferencePage* m_preferencePage; + FilePage* m_filePage; +}; + +}; // namespace + + +#endif diff --git a/kmymoney2/wizards/newuserwizard/knewuserwizard_p.h b/kmymoney2/wizards/newuserwizard/knewuserwizard_p.h new file mode 100644 index 0000000..aa62725 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/knewuserwizard_p.h @@ -0,0 +1,140 @@ +/*************************************************************************** + knewuserwizard_p.h + ------------------- + begin : Sat Feb 18 2006 + copyright : (C) 2006 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KNEWUSERWIZARD_P_H +#define KNEWUSERWIZARD_P_H + +// ---------------------------------------------------------------------------- +// QT Includes + +// ---------------------------------------------------------------------------- +// Project Includes + +#include <kmymoney/kmymoneywizard.h> + +#include "kintropagedecl.h" +#include "kaccountpagedecl.h" +#include "kpreferencepagedecl.h" +#include "kfilepagedecl.h" + +#include "../wizardpages/userinfo.h" +#include "../wizardpages/currency.h" +#include "../wizardpages/accounts.h" + +#include <kmymoney/mymoneytemplate.h> + +class Wizard; + +namespace NewUserWizard { + +class IntroPage : public KIntroPageDecl, public WizardPage<Wizard> +{ + Q_OBJECT +public: + IntroPage(Wizard* parent, const char* name = 0); + KMyMoneyWizardPage* nextPage(void) const; +}; + +/** + * Wizard page collecting information about the user + * + * @author Thomas Baumgart + */ +class GeneralPage : public UserInfo, public WizardPage<Wizard> +{ + Q_OBJECT +public: + GeneralPage(Wizard* parent, const char* name = 0); + KMyMoneyWizardPage* nextPage(void) const; + +protected slots: + void slotLoadFromKABC(void); + void slotAddressBookLoaded(void); + +}; + +/** + * Wizard page collecting information about the base currency + * + * @author Thomas Baumgart + */ +class CurrencyPage : public Currency, public WizardPage<Wizard> +{ + Q_OBJECT +public: + CurrencyPage(Wizard* parent, const char* name = 0); + void enterPage(void); + KMyMoneyWizardPage* nextPage(void) const; +}; + +/** + * Wizard page collecting information about the checking account + */ +class AccountPage : public KAccountPageDecl, public WizardPage<Wizard> +{ + Q_OBJECT +public: + AccountPage(Wizard* parent, const char* name = 0); + KMyMoneyWizardPage* nextPage(void) const; + + virtual bool isComplete(void) const; +}; + +/** + * Wizard page collecting information about the account templates. + * + * @author Thomas Baumgart + */ +class CategoriesPage : public Accounts, public WizardPage<Wizard> +{ + Q_OBJECT +public: + CategoriesPage(Wizard* parent, const char* name = 0); + KMyMoneyWizardPage* nextPage(void) const; + QValueList<MyMoneyTemplate> selectedTemplates(void) const; +}; + +/** + * Wizard page to allow changing the preferences during setup + * + * @author Thomas Baumgart + */ +class PreferencePage : public KPreferencePageDecl, public WizardPage<Wizard> +{ + Q_OBJECT +public: + PreferencePage(Wizard* parent, const char* name = 0); + KMyMoneyWizardPage* nextPage(void) const; +}; + +/** + * Wizard page to allow selecting the filename + * + * @author Thomas Baumgart + */ +class FilePage : public KFilePageDecl, public WizardPage<Wizard> +{ + Q_OBJECT +public: + FilePage(Wizard* parent, const char* name = 0); + + virtual bool isComplete(void) const; +}; + +} // namespace + +#endif diff --git a/kmymoney2/wizards/newuserwizard/kpasswordpagedecl.ui b/kmymoney2/wizards/newuserwizard/kpasswordpagedecl.ui new file mode 100644 index 0000000..3d3c062 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kpasswordpagedecl.ui @@ -0,0 +1,33 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>KPasswordPageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KPasswordPageDecl</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>599</width> + <height>149</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="text"> + <string><p>KMyMoney can encrypt your datafile using GPG Encryption. GPG encryption is one of the most secure methods in the world for protecting data. All of your account numbers and other important financial information will be very secure.</p></string> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/newuserwizard/kpreferencepagedecl.ui b/kmymoney2/wizards/newuserwizard/kpreferencepagedecl.ui new file mode 100644 index 0000000..bfe6446 --- /dev/null +++ b/kmymoney2/wizards/newuserwizard/kpreferencepagedecl.ui @@ -0,0 +1,96 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KPreferencePageDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KPreferencePageDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>288</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 you would like to review or change any preference settings for KMyMoney at this time, you can do so here. If not just click <b>Next</b>.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_openConfigButton</cstring> + </property> + <property name="text"> + <string>Configure preferences now</string> + </property> + </widget> + </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>31</height> + </size> + </property> + </spacer> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel2</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>You can change the configuration options at any time using the configuration dialog. Just select the <b>Configure KMyMoney...</b> option in the <b>Settings</b> menu.</string> + </property> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/wizardpages/Makefile.am b/kmymoney2/wizards/wizardpages/Makefile.am new file mode 100644 index 0000000..65ea6a7 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/Makefile.am @@ -0,0 +1,18 @@ +noinst_LIBRARIES = libwizardpages.a +KDE_OPTIONS = noautodist + +INCLUDES = $(all_includes) -I$(top_srcdir) -I. + +libwizardpages_a_METASOURCES = AUTO + +libwizardpages_a_SOURCES = userinfodecl.ui userinfo.cpp currencydecl.ui currency.cpp accountsdecl.ui accounts.cpp + +EXTRA_DIST = userinfodecl.ui currencydecl.ui accountsdecl.ui + +DISTCLEANFILES= userinfodecl.cpp userinfodecl.h currencydecl.cpp currencydecl.h accountsdecl.cpp accountsdecl.h + +noinst_HEADERS = userinfo.h currency.h accounts.h + +SUBDIRS = + +messages: rc.cpp diff --git a/kmymoney2/wizards/wizardpages/accounts.cpp b/kmymoney2/wizards/wizardpages/accounts.cpp new file mode 100644 index 0000000..0a6c82b --- /dev/null +++ b/kmymoney2/wizards/wizardpages/accounts.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + accounts.cpp + ------------------- + begin : Fri Jun 1 2007 + copyright : (C) 2007 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +// ---------------------------------------------------------------------------- +// QT Includes + +#include <qheader.h> + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include <klistview.h> +#include <kmymoney/kmymoneyaccounttree.h> + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "accounts.h" + +Accounts::Accounts(QWidget* parent, const char* name) : + AccountsDecl(parent, name) +{ +} + +#include "accounts.moc" diff --git a/kmymoney2/wizards/wizardpages/accounts.h b/kmymoney2/wizards/wizardpages/accounts.h new file mode 100644 index 0000000..d1f3175 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/accounts.h @@ -0,0 +1,42 @@ +/*************************************************************************** + accounts.h + ------------------- + begin : Fri Jun 1 2007 + copyright : (C) 2007 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 ACCOUNTS_H +#define ACCOUNTS_H + +// ---------------------------------------------------------------------------- +// QT Includes + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "accountsdecl.h" + +/** + * @author Thomas Baumgart + */ +class Accounts : public AccountsDecl +{ + Q_OBJECT +public: + Accounts(QWidget* parent = 0, const char* name = 0); + +private: +}; + + +#endif diff --git a/kmymoney2/wizards/wizardpages/accountsdecl.ui b/kmymoney2/wizards/wizardpages/accountsdecl.ui new file mode 100644 index 0000000..9e7b7c9 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/accountsdecl.ui @@ -0,0 +1,54 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>AccountsDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>AccountsDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>550</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel2</cstring> + </property> + <property name="text"> + <string>Select groups of accounts that correspond to the ways that you will use KMyMoney. Each group you select will cause several accounts and categories to be created. Select the groups that are relevant to you. You can always create additional accounts manually later.</string> + </property> + </widget> + <widget class="KAccountTemplateSelector"> + <property name="name"> + <cstring>m_templateSelector</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/wizardpages/currency.cpp b/kmymoney2/wizards/wizardpages/currency.cpp new file mode 100644 index 0000000..8693089 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/currency.cpp @@ -0,0 +1,66 @@ +/*************************************************************************** + userinfo.cpp + ------------------- + begin : Fri Jun 1 2007 + copyright : (C) 2007 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +// ---------------------------------------------------------------------------- +// QT Includes + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include <klocale.h> +#include <klistview.h> + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "currency.h" + +Currency::Currency(QWidget* parent, const char* name) : + CurrencyDecl(parent, name) +{ + m_currencyList->setAllColumnsShowFocus(true); + m_currencyList->setMultiSelection(false); +} + +QListViewItem* Currency::insertCurrency(const MyMoneySecurity& sec) +{ + return new KListViewItem(m_currencyList, sec.name(), QString(sec.id()), sec.tradingSymbol()); +} + +void Currency::selectCurrency(const MyMoneySecurity& sec) +{ + QListViewItem* it_v; + QListViewItemIterator it(m_currencyList); + while((it_v = it.current()) != 0) { + if(it_v->text(1) == QString(sec.id())) { + m_currencyList->setSelected(it_v, true); + m_currencyList->ensureItemVisible(it_v); + break; + } + } +} + +QString Currency::selectedCurrency(void) const +{ + QString id; + if(m_currencyList->selectedItem()) { + id = m_currencyList->selectedItem()->text(1); + } + return id; +} + +#include "currency.moc" diff --git a/kmymoney2/wizards/wizardpages/currency.h b/kmymoney2/wizards/wizardpages/currency.h new file mode 100644 index 0000000..1ce2649 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/currency.h @@ -0,0 +1,45 @@ +/*************************************************************************** + currency.h + ------------------- + begin : Fri Jun 1 2007 + copyright : (C) 2007 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 CURRENCY_H +#define CURRENCY_H + +// ---------------------------------------------------------------------------- +// QT Includes + +class KListViewItem; + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "currencydecl.h" +#include <kmymoney/mymoneysecurity.h> + +/** + * @author Thomas Baumgart + */ +class Currency : public CurrencyDecl +{ + Q_OBJECT +public: + Currency(QWidget* parent = 0, const char* name = 0); + QListViewItem* insertCurrency(const MyMoneySecurity& sec); + void selectCurrency(const MyMoneySecurity& sec); + QString selectedCurrency(void) const; +}; + +#endif diff --git a/kmymoney2/wizards/wizardpages/currencydecl.ui b/kmymoney2/wizards/wizardpages/currencydecl.ui new file mode 100644 index 0000000..f2b857a --- /dev/null +++ b/kmymoney2/wizards/wizardpages/currencydecl.ui @@ -0,0 +1,96 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CurrencyDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>CurrencyDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>573</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="text"> + <string><p>KMyMoney supports multiple currencies, nevertheless one of them will be used as your base currency. The base currency is used as default for new accounts and reports. Please select the base currency from the following list.</string> + </property> + </widget> + <widget class="KListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>ISO Code</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Symbol</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_currencyList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmymoney2/wizards/wizardpages/userinfo.cpp b/kmymoney2/wizards/wizardpages/userinfo.cpp new file mode 100644 index 0000000..412c5a1 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/userinfo.cpp @@ -0,0 +1,52 @@ +/*************************************************************************** + userinfo.cpp + ------------------- + begin : Fri Jun 1 2007 + copyright : (C) 2007 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +// ---------------------------------------------------------------------------- +// QT Includes + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include <klocale.h> +#include <klineedit.h> + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "userinfo.h" +#include <kmymoney/mymoneypayee.h> + +UserInfo::UserInfo(QWidget* parent, const char* name) : + UserInfoDecl(parent, name) +{ + m_userNameEdit->setFocus(); +} + +MyMoneyPayee UserInfo::user(void) const +{ + MyMoneyPayee user; + user.setName(m_userNameEdit->text()); + user.setAddress(m_streetEdit->text()); + user.setCity(m_townEdit->text()); + user.setState(m_countyEdit->text()); + user.setPostcode(m_postcodeEdit->text()); + user.setTelephone(m_telephoneEdit->text()); + user.setEmail(m_emailEdit->text()); + return user; +} + +#include "userinfo.moc" diff --git a/kmymoney2/wizards/wizardpages/userinfo.h b/kmymoney2/wizards/wizardpages/userinfo.h new file mode 100644 index 0000000..9242868 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/userinfo.h @@ -0,0 +1,44 @@ +/*************************************************************************** + userinfo.h + ------------------- + begin : Fri Jun 1 2007 + copyright : (C) 2007 Thomas Baumgart + email : Thomas Baumgart <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 USERINFO_H +#define USERINFO_H + +// ---------------------------------------------------------------------------- +// QT Includes + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "userinfodecl.h" +class MyMoneyPayee; + +/** + * @author Thomas Baumgart + */ +class UserInfo : public UserInfoDecl +{ + Q_OBJECT +public: + UserInfo(QWidget* parent = 0, const char* name = 0); + MyMoneyPayee user(void) const; + +private: +}; + + +#endif diff --git a/kmymoney2/wizards/wizardpages/userinfodecl.ui b/kmymoney2/wizards/wizardpages/userinfodecl.ui new file mode 100644 index 0000000..4240d49 --- /dev/null +++ b/kmymoney2/wizards/wizardpages/userinfodecl.ui @@ -0,0 +1,225 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>UserInfoDecl</class> +<widget class="QWidget"> + <property name="name"> + <cstring>UserInfoDecl</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>603</width> + <height>374</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string><p>Use the fields below to enter some information about yourself.</p> + +<p>All information is optional and only used to personalize your KMyMoney file.</p></string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>m_userNameEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Town:</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>County/State:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Street:</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>m_streetEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="6" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>m_emailEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>m_townEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="5" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>m_telephoneEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Email:</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Telephone:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Your name:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>layout22</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_loadAddressButton</cstring> + </property> + <property name="text"> + <string>Load from Addressbook</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>305</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer row="8" column="2"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="KLineEdit" row="4" column="1"> + <property name="name"> + <cstring>m_countyEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="2"> + <property name="name"> + <cstring>TextLabel5</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Postal Code:</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="3"> + <property name="name"> + <cstring>m_postcodeEdit</cstring> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>m_userNameEdit</tabstop> + <tabstop>m_streetEdit</tabstop> + <tabstop>m_townEdit</tabstop> + <tabstop>m_countyEdit</tabstop> + <tabstop>m_postcodeEdit</tabstop> + <tabstop>m_telephoneEdit</tabstop> + <tabstop>m_emailEdit</tabstop> + <tabstop>m_loadAddressButton</tabstop> + <tabstop>kActiveLabel1</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> |