diff options
Diffstat (limited to 'kmymoney2/wizards/newuserwizard')
-rw-r--r-- | kmymoney2/wizards/newuserwizard/Makefile.am | 18 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kaccountpagedecl.ui | 268 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kcurrencypagedecl.ui | 82 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kfilepagedecl.ui | 86 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kgeneralpagedecl.ui | 258 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kintropagedecl.ui | 66 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/knewuserwizard.cpp | 363 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/knewuserwizard.h | 123 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/knewuserwizard_p.h | 140 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kpasswordpagedecl.ui | 33 | ||||
-rw-r--r-- | kmymoney2/wizards/newuserwizard/kpreferencepagedecl.ui | 96 |
11 files changed, 1533 insertions, 0 deletions
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> |