summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/newaccount.cpp
Unidiff
Diffstat (limited to 'noncore/apps/qashmoney/newaccount.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/newaccount.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/qashmoney/newaccount.cpp b/noncore/apps/qashmoney/newaccount.cpp
index 7e57a18..5932182 100755
--- a/noncore/apps/qashmoney/newaccount.cpp
+++ b/noncore/apps/qashmoney/newaccount.cpp
@@ -1,180 +1,180 @@
1#include "newaccount.h" 1#include "newaccount.h"
2#include "calculator.h" 2#include "calculator.h"
3#include "datepicker.h" 3#include "datepicker.h"
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5 5
6extern Preferences *preferences; 6extern Preferences *preferences;
7 7
8NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDialog ( parent, name, modal ) 8NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDialog ( parent, name, modal )
9 { 9 {
10 accountdescription = ""; 10 accountdescription = "";
11 dateedited = FALSE; 11 dateedited = FALSE;
12 setCaption( tr( "Account" ) ); 12 setCaption( tr( "Account" ) );
13 13
14 namelabel = new QLabel ( "Account Name", this ); 14 namelabel = new QLabel ( "Account Name", this );
15 15
16 accountbox = new QHBox ( this ); 16 accountbox = new QHBox ( this );
17 accountname = new QLineEdit ( accountbox ); 17 accountname = new QLineEdit ( accountbox );
18 descriptionbutton = new QPushButton ( accountbox ); 18 descriptionbutton = new QPushButton ( accountbox );
19 descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); 19 descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) );
20 20
21 datelabel = new QLabel ( "Date", this ); 21 datelabel = new QLabel ( "Date", this );
22 22
23 datebox = new QHBox ( this ); 23 datebox = new QHBox ( this );
24 startdate = new QLineEdit ( datebox ); 24 startdate = new QLineEdit ( datebox );
25 startdate->setDisabled ( TRUE ); 25 startdate->setDisabled ( TRUE );
26 datebutton = new QPushButton ( datebox ); 26 datebutton = new QPushButton ( datebox );
27 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); 27 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
28 28
29 childcheckbox = new QCheckBox ( this ); 29 childcheckbox = new QCheckBox ( this );
30 childcheckbox->setText( tr ( "Child Account" ) ); 30 childcheckbox->setText( tr ( "Child Account" ) );
31 31
32 childlabel = new QLabel ( "Child of", this ); 32 childlabel = new QLabel ( "Child of", this );
33 childbox = new QComboBox ( FALSE, this ); 33 childbox = new QComboBox ( FALSE, this );
34 hideChildPulldownMenu (); 34 hideChildPulldownMenu ();
35 35
36 balancelabel = new QLabel ( "Balance", this ); 36 balancelabel = new QLabel ( "Balance", this );
37 37
38 balancebox = new QHBox ( this ); 38 balancebox = new QHBox ( this );
39 accountbalance = new QLineEdit ( balancebox ); 39 accountbalance = new QLineEdit ( balancebox );
40 accountbalance->setText ( "0.00" ); 40 accountbalance->setText ( "0.00" );
41 balancecalculator = new QPushButton( balancebox ); 41 balancecalculator = new QPushButton( balancebox );
42 balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 42 balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
43 43
44 creditlimitlabel = new QLabel ( "Credit Limit", this ); 44 creditlimitlabel = new QLabel ( "Credit Limit", this );
45 45
46 creditlimitbox = new QHBox ( this ); 46 creditlimitbox = new QHBox ( this );
47 creditlimit = new QLineEdit ( creditlimitbox ); 47 creditlimit = new QLineEdit ( creditlimitbox );
48 creditlimitbox->setEnabled ( FALSE ); 48 creditlimitbox->setEnabled ( FALSE );
49 creditlimitcalculator = new QPushButton( creditlimitbox ); 49 creditlimitcalculator = new QPushButton( creditlimitbox );
50 creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 50 creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
51 51
52 currencybox = new Currency ( this ); 52 currencybox = new Currency ( this );
53 53
54 typelabel = new QLabel ( "Type", this ); 54 typelabel = new QLabel ( "Type", this );
55 accounttype = new QComboBox ( FALSE, this ); 55 accounttype = new QComboBox ( FALSE, this );
56 accounttype->insertItem( tr( "Bank" ) ); 56 accounttype->insertItem( tr( "Bank" ) );
57 accounttype->insertItem( tr( "Cash" ) ); 57 accounttype->insertItem( tr( "Cash" ) );
58 accounttype->insertItem( tr( "Credit Card" ) ); 58 accounttype->insertItem( tr( "Credit Card" ) );
59 accounttype->insertItem( tr( "Equity" ) ); 59 accounttype->insertItem( tr( "Equity" ) );
60 accounttype->insertItem( tr( "Asset" ) ); 60 accounttype->insertItem( tr( "Asset" ) );
61 accounttype->insertItem( tr( "Liability" ) ); 61 accounttype->insertItem( tr( "Liability" ) );
62 62
63 layout = new QGridLayout ( this, 7, 2, 4, 2 ); 63 layout = new QGridLayout ( this, 7, 2, 4, 2 );
64 layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft ); 64 layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft );
65 layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft ); 65 layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft );
66 layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft ); 66 layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft );
67 layout->addWidget ( datebox, 3, 0, Qt::AlignLeft ); 67 layout->addWidget ( datebox, 3, 0, Qt::AlignLeft );
68 layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft ); 68 layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft );
69 layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft ); 69 layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft );
70 layout->addWidget ( childbox, 6, 0, Qt::AlignLeft ); 70 layout->addWidget ( childbox, 6, 0, Qt::AlignLeft );
71 layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft ); 71 layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft );
72 layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft ); 72 layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft );
73 layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft ); 73 layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft );
74 layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft ); 74 layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft );
75 layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft ); 75 layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft );
76 layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft ); 76 layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft );
77 layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft ); 77 layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft );
78 78
79 connect ( childcheckbox, SIGNAL ( clicked () ), this, SLOT ( showChildPulldownMenu() ) ); 79 connect ( childcheckbox, SIGNAL ( clicked() ), this, SLOT ( showChildPulldownMenu() ) );
80 connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); 80 connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
81 connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) ); 81 connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) );
82 connect ( accounttype, SIGNAL ( activated ( int ) ), this, SLOT ( activateCreditLimit ( int ) ) ); 82 connect ( accounttype, SIGNAL ( activated(int) ), this, SLOT ( activateCreditLimit(int) ) );
83 connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); 83 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
84 connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addAccountDescription() ) ); 84 connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addAccountDescription() ) );
85} 85}
86 86
87NewAccount::~NewAccount () 87NewAccount::~NewAccount ()
88 { 88 {
89 } 89 }
90 90
91void NewAccount::showChildPulldownMenu () 91void NewAccount::showChildPulldownMenu ()
92 { 92 {
93 if ( childcheckbox->isChecked() == TRUE ) 93 if ( childcheckbox->isChecked() == TRUE )
94 { 94 {
95 childlabel->setEnabled ( TRUE ); 95 childlabel->setEnabled ( TRUE );
96 childbox->setEnabled ( TRUE ); 96 childbox->setEnabled ( TRUE );
97 } 97 }
98 else 98 else
99 hideChildPulldownMenu(); 99 hideChildPulldownMenu();
100 } 100 }
101 101
102void NewAccount::hideChildPulldownMenu () 102void NewAccount::hideChildPulldownMenu ()
103 { 103 {
104 childlabel->setEnabled ( FALSE ); 104 childlabel->setEnabled ( FALSE );
105 childbox->setEnabled ( FALSE ); 105 childbox->setEnabled ( FALSE );
106 } 106 }
107 107
108void NewAccount::showCalculator () 108void NewAccount::showCalculator ()
109 { 109 {
110 Calculator *calculator = new Calculator ( this ); 110 Calculator *calculator = new Calculator ( this );
111 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 111 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
112 if ( calculator->exec () == QDialog::Accepted ) 112 if ( calculator->exec () == QDialog::Accepted )
113 accountbalance->setText ( calculator->display->text() ); 113 accountbalance->setText ( calculator->display->text() );
114 } 114 }
115 115
116void NewAccount::showCreditLimitCalculator () 116void NewAccount::showCreditLimitCalculator ()
117 { 117 {
118 Calculator *calculator = new Calculator ( this ); 118 Calculator *calculator = new Calculator ( this );
119 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 119 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
120 if ( calculator->exec () == QDialog::Accepted ) 120 if ( calculator->exec () == QDialog::Accepted )
121 creditlimit->setText ( calculator->display->text() ); 121 creditlimit->setText ( calculator->display->text() );
122 } 122 }
123 123
124void NewAccount::activateCreditLimit ( int index ) 124void NewAccount::activateCreditLimit ( int index )
125 { 125 {
126 if ( index == 2 || index == 5 ) 126 if ( index == 2 || index == 5 )
127 creditlimitbox->setEnabled ( TRUE ); 127 creditlimitbox->setEnabled ( TRUE );
128 else 128 else
129 { 129 {
130 creditlimit->clear (); 130 creditlimit->clear ();
131 creditlimitbox->setEnabled ( FALSE ); 131 creditlimitbox->setEnabled ( FALSE );
132 } 132 }
133 } 133 }
134 134
135void NewAccount::showCalendar () 135void NewAccount::showCalendar ()
136 { 136 {
137 QDate newDate = QDate::currentDate (); 137 QDate newDate = QDate::currentDate ();
138 DatePicker *dp = new DatePicker ( newDate ); 138 DatePicker *dp = new DatePicker ( newDate );
139 dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 139 dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
140 140
141 int response = dp->exec(); 141 int response = dp->exec();
142 if ( response == QDialog::Accepted ) 142 if ( response == QDialog::Accepted )
143 { 143 {
144 // Set date integers 144 // Set date integers
145 year = dp->getYear(); 145 year = dp->getYear();
146 month = dp->getMonth(); 146 month = dp->getMonth();
147 day = dp->getDay(); 147 day = dp->getDay();
148 148
149 // Set dateedited to TRUE 149 // Set dateedited to TRUE
150 // This tells the accountdisplay object that the user edited an account 150 // This tells the accountdisplay object that the user edited an account
151 // and did change the date 151 // and did change the date
152 dateedited = TRUE; 152 dateedited = TRUE;
153 153
154 // Display date with our selected format 154 // Display date with our selected format
155 startdate->setText ( preferences->getDate ( year, month, day ) ); 155 startdate->setText ( preferences->getDate ( year, month, day ) );
156 } 156 }
157 } 157 }
158 158
159bool NewAccount::getDateEdited () 159bool NewAccount::getDateEdited ()
160 { 160 {
161 return dateedited; 161 return dateedited;
162 } 162 }
163 163
164int NewAccount::getDay () 164int NewAccount::getDay ()
165 { 165 {
166 return day; 166 return day;
167 } 167 }
168 168
169int NewAccount::getMonth () 169int NewAccount::getMonth ()
170 { 170 {
171 return month; 171 return month;
172 } 172 }
173 173
174int NewAccount::getYear () 174int NewAccount::getYear ()
175 { 175 {
176 return year; 176 return year;
177 } 177 }
178 178
179QString NewAccount::getDescription () 179QString NewAccount::getDescription ()
180 { 180 {