-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.cpp | 22 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/calculator.cpp | 24 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/datepicker.cpp | 6 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/memorydialog.cpp | 6 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/newaccount.cpp | 8 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/newtransaction.cpp | 8 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 18 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transferdialog.cpp | 2 |
11 files changed, 77 insertions, 77 deletions
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index 5ef5454..0fe5b09 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp | |||
@@ -1,390 +1,390 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qheader.h> | 2 | #include <qheader.h> |
3 | 3 | ||
4 | #include "accountdisplay.h" | 4 | #include "accountdisplay.h" |
5 | #include "newaccount.h" | 5 | #include "newaccount.h" |
6 | #include "transaction.h" | 6 | #include "transaction.h" |
7 | #include "transferdialog.h" | 7 | #include "transferdialog.h" |
8 | #include "transfer.h" | 8 | #include "transfer.h" |
9 | 9 | ||
10 | extern Account *account; | 10 | extern Account *account; |
11 | extern Transaction *transaction; | 11 | extern Transaction *transaction; |
12 | extern Transfer *transfer; | 12 | extern Transfer *transfer; |
13 | extern Preferences *preferences; | 13 | extern Preferences *preferences; |
14 | 14 | ||
15 | AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) | 15 | AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) |
16 | { | 16 | { |
17 | cleared = 0; | 17 | cleared = 0; |
18 | 18 | ||
19 | firstline = new QHBox ( this ); | 19 | firstline = new QHBox ( this ); |
20 | firstline->setSpacing ( 2 ); | 20 | firstline->setSpacing ( 2 ); |
21 | 21 | ||
22 | newaccount = new QPushButton ( firstline ); | 22 | newaccount = new QPushButton ( firstline ); |
23 | newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); | 23 | newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); |
24 | connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); | 24 | connect ( newaccount, SIGNAL ( released() ), this, SLOT ( addAccount() ) ); |
25 | 25 | ||
26 | editaccount = new QPushButton ( firstline ); | 26 | editaccount = new QPushButton ( firstline ); |
27 | editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); | 27 | editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); |
28 | connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); | 28 | connect ( editaccount, SIGNAL ( released() ), this, SLOT ( editAccount() ) ); |
29 | 29 | ||
30 | deleteaccount = new QPushButton ( firstline ); | 30 | deleteaccount = new QPushButton ( firstline ); |
31 | deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); | 31 | deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); |
32 | connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); | 32 | connect ( deleteaccount, SIGNAL ( released() ), this, SLOT ( deleteAccount() ) ); |
33 | 33 | ||
34 | transferbutton = new QPushButton ( firstline ); | 34 | transferbutton = new QPushButton ( firstline ); |
35 | transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); | 35 | transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); |
36 | transferbutton->setToggleButton ( TRUE ); | 36 | transferbutton->setToggleButton ( TRUE ); |
37 | connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); | 37 | connect ( transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( accountTransfer(bool) ) ); |
38 | 38 | ||
39 | listview = new QListView ( this ); | 39 | listview = new QListView ( this ); |
40 | listview->setAllColumnsShowFocus ( TRUE ); | 40 | listview->setAllColumnsShowFocus ( TRUE ); |
41 | listview->setShowSortIndicator ( TRUE ); | 41 | listview->setShowSortIndicator ( TRUE ); |
42 | listview->setRootIsDecorated ( TRUE ); | 42 | listview->setRootIsDecorated ( TRUE ); |
43 | listview->setMultiSelection ( FALSE ); | 43 | listview->setMultiSelection ( FALSE ); |
44 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); | 44 | connect ( listview, SIGNAL ( expanded(QListViewItem*) ), this, SLOT ( setAccountExpanded(QListViewItem*) ) ); |
45 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); | 45 | connect ( listview, SIGNAL ( collapsed(QListViewItem*) ), this, SLOT ( setAccountCollapsed(QListViewItem*) ) ); |
46 | 46 | ||
47 | listview->header()->setTracking ( FALSE ); | 47 | listview->header()->setTracking ( FALSE ); |
48 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 48 | connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); |
49 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | 49 | connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); |
50 | 50 | ||
51 | layout = new QVBoxLayout ( this, 2, 5 ); | 51 | layout = new QVBoxLayout ( this, 2, 5 ); |
52 | layout->addWidget ( firstline ); | 52 | layout->addWidget ( firstline ); |
53 | layout->addWidget ( listview ); | 53 | layout->addWidget ( listview ); |
54 | } | 54 | } |
55 | 55 | ||
56 | void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) | 56 | void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) |
57 | { | 57 | { |
58 | tab2 = newtab2; | 58 | tab2 = newtab2; |
59 | maintabs = newtabs; | 59 | maintabs = newtabs; |
60 | } | 60 | } |
61 | 61 | ||
62 | void AccountDisplay::addAccount () | 62 | void AccountDisplay::addAccount () |
63 | { | 63 | { |
64 | // initialize local variables | 64 | // initialize local variables |
65 | int parentid = 0; | 65 | int parentid = 0; |
66 | type = 0; | 66 | type = 0; |
67 | QString parentlist [ listview->childCount() + 1 ] [ 3 ] ; | 67 | QString parentlist [ listview->childCount() + 1 ] [ 3 ] ; |
68 | 68 | ||
69 | // create new account window for entering data | 69 | // create new account window for entering data |
70 | NewAccount *newaccount = new NewAccount ( this ); | 70 | NewAccount *newaccount = new NewAccount ( this ); |
71 | int width = this->width(); | 71 | int width = this->width(); |
72 | newaccount->accountbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); | 72 | newaccount->accountbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); |
73 | newaccount->datebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 73 | newaccount->datebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
74 | newaccount->childbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); | 74 | newaccount->childbox->setMaximumWidth ( ( int ) ( width * 0.5 ) ); |
75 | newaccount->balancebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 75 | newaccount->balancebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
76 | newaccount->creditlimitbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 76 | newaccount->creditlimitbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
77 | 77 | ||
78 | // if there are no accounts, disable the child check box | 78 | // if there are no accounts, disable the child check box |
79 | if ( account->getNumberOfAccounts () == 0 ) | 79 | if ( account->getNumberOfAccounts () == 0 ) |
80 | newaccount->childcheckbox->setEnabled ( FALSE ); | 80 | newaccount->childcheckbox->setEnabled ( FALSE ); |
81 | 81 | ||
82 | // if there are accounts, fill up the pulldown menu for | 82 | // if there are accounts, fill up the pulldown menu for |
83 | // selecting a parent account. We should only add those parents without transactions | 83 | // selecting a parent account. We should only add those parents without transactions |
84 | else | 84 | else |
85 | { | 85 | { |
86 | int c = 0; | 86 | int c = 0; |
87 | QListViewItemIterator it ( listview ); | 87 | QListViewItemIterator it ( listview ); |
88 | for ( ; it.current(); ++it ) | 88 | for ( ; it.current(); ++it ) |
89 | { | 89 | { |
90 | int id = it.current()->text ( getIDColumn() ).toInt(); | 90 | int id = it.current()->text ( getIDColumn() ).toInt(); |
91 | // iterate through accountdisplay listview and add parents with no transactions | 91 | // iterate through accountdisplay listview and add parents with no transactions |
92 | // add this item to the list box only if it is a parent and has no transactions | 92 | // add this item to the list box only if it is a parent and has no transactions |
93 | if ( transfer->getNumberOfTransfers ( id ) == 0 && transaction->getNumberOfTransactions ( id ) == 0 && it.current()->parent() == 0 ) | 93 | if ( transfer->getNumberOfTransfers ( id ) == 0 && transaction->getNumberOfTransactions ( id ) == 0 && it.current()->parent() == 0 ) |
94 | { | 94 | { |
95 | newaccount->childbox->insertItem ( it.current()->text ( 0 ) ); | 95 | newaccount->childbox->insertItem ( it.current()->text ( 0 ) ); |
96 | parentlist [ c ] [ 0 ] = it.current()->text ( 0 ); | 96 | parentlist [ c ] [ 0 ] = it.current()->text ( 0 ); |
97 | parentlist [ c ] [ 1 ] = it.current()->text ( getIDColumn() ); | 97 | parentlist [ c ] [ 1 ] = it.current()->text ( getIDColumn() ); |
98 | parentlist [ c ] [ 2 ] = QString::number ( c ); | 98 | parentlist [ c ] [ 2 ] = QString::number ( c ); |
99 | c++; | 99 | c++; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | if ( preferences->getPreference ( 4 ) == 0 ) | 104 | if ( preferences->getPreference ( 4 ) == 0 ) |
105 | newaccount->currencybox->setEnabled ( FALSE ); | 105 | newaccount->currencybox->setEnabled ( FALSE ); |
106 | 106 | ||
107 | // enter today's date in the date box as default | 107 | // enter today's date in the date box as default |
108 | QDate today = QDate::currentDate (); | 108 | QDate today = QDate::currentDate (); |
109 | int defaultday = today.day(); | 109 | int defaultday = today.day(); |
110 | int defaultmonth = today.month(); | 110 | int defaultmonth = today.month(); |
111 | int defaultyear = today.year(); | 111 | int defaultyear = today.year(); |
112 | newaccount->startdate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); | 112 | newaccount->startdate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); |
113 | 113 | ||
114 | //add account information if user pushes OK button | 114 | //add account information if user pushes OK button |
115 | if ( newaccount->exec() == QDialog::Accepted ) | 115 | if ( newaccount->exec() == QDialog::Accepted ) |
116 | { | 116 | { |
117 | if ( newaccount->childcheckbox->isChecked () == TRUE ) // set a parent id and type for a child account | 117 | if ( newaccount->childcheckbox->isChecked () == TRUE ) // set a parent id and type for a child account |
118 | { | 118 | { |
119 | // go through the parentlist we created and determine the parent accountid | 119 | // go through the parentlist we created and determine the parent accountid |
120 | // we can't use the name of the account because there may be two accounts | 120 | // we can't use the name of the account because there may be two accounts |
121 | // with the same name. This function does it all by accountid | 121 | // with the same name. This function does it all by accountid |
122 | int counter; | 122 | int counter; |
123 | for ( counter = 0; counter < listview->childCount() + 1; counter++ ) | 123 | for ( counter = 0; counter < listview->childCount() + 1; counter++ ) |
124 | if ( ( parentlist [ counter ] [ 2 ].toInt() ) == newaccount->childbox->currentItem() ) | 124 | if ( ( parentlist [ counter ] [ 2 ].toInt() ) == newaccount->childbox->currentItem() ) |
125 | { | 125 | { |
126 | parentid = parentlist [ counter ] [ 1 ].toInt(); | 126 | parentid = parentlist [ counter ] [ 1 ].toInt(); |
127 | break; | 127 | break; |
128 | } | 128 | } |
129 | type = ( newaccount->accounttype->currentItem() ) + 6; // sets account ids for child accounts. See accountdisplay.h for types | 129 | type = ( newaccount->accounttype->currentItem() ) + 6; // sets account ids for child accounts. See accountdisplay.h for types |
130 | } | 130 | } |
131 | else | 131 | else |
132 | { | 132 | { |
133 | parentid = -1; | 133 | parentid = -1; |
134 | type = newaccount->accounttype->currentItem(); // sets account ids for parent accounts | 134 | type = newaccount->accounttype->currentItem(); // sets account ids for parent accounts |
135 | } | 135 | } |
136 | 136 | ||
137 | // add the new account | 137 | // add the new account |
138 | if ( newaccount->getDateEdited () == TRUE ) | 138 | if ( newaccount->getDateEdited () == TRUE ) |
139 | account->addAccount ( newaccount->accountname->text(), parentid, newaccount->accountbalance->text().toFloat(), type, | 139 | account->addAccount ( newaccount->accountname->text(), parentid, newaccount->accountbalance->text().toFloat(), type, |
140 | newaccount->getDescription(), newaccount->creditlimit->text().toFloat(), newaccount->getYear(), | 140 | newaccount->getDescription(), newaccount->creditlimit->text().toFloat(), newaccount->getYear(), |
141 | newaccount->getMonth(), newaccount->getDay(), newaccount->accountbalance->text().toFloat(), newaccount->currencybox->currencybox->currentText() ); | 141 | newaccount->getMonth(), newaccount->getDay(), newaccount->accountbalance->text().toFloat(), newaccount->currencybox->currencybox->currentText() ); |
142 | else | 142 | else |
143 | account->addAccount ( newaccount->accountname->text (), parentid, newaccount->accountbalance->text().toFloat(), type, | 143 | account->addAccount ( newaccount->accountname->text (), parentid, newaccount->accountbalance->text().toFloat(), type, |
144 | newaccount->getDescription(), newaccount->creditlimit->text().toFloat(), defaultyear, | 144 | newaccount->getDescription(), newaccount->creditlimit->text().toFloat(), defaultyear, |
145 | defaultmonth, defaultday, newaccount->accountbalance->text().toFloat(), newaccount->currencybox->currencybox->currentText() ); | 145 | defaultmonth, defaultday, newaccount->accountbalance->text().toFloat(), newaccount->currencybox->currencybox->currentText() ); |
146 | 146 | ||
147 | if ( parentid != -1 ) | 147 | if ( parentid != -1 ) |
148 | account->changeParentAccountBalance ( parentid ); | 148 | account->changeParentAccountBalance ( parentid ); |
149 | 149 | ||
150 | // redisplay accounts | 150 | // redisplay accounts |
151 | // this function clears the account display first | 151 | // this function clears the account display first |
152 | account->displayAccounts ( listview ); | 152 | account->displayAccounts ( listview ); |
153 | setToggleButton(); | 153 | setToggleButton(); |
154 | } | 154 | } |
155 | maintabs->setTabEnabled ( tab2, FALSE ); | 155 | maintabs->setTabEnabled ( tab2, FALSE ); |
156 | } | 156 | } |
157 | 157 | ||
158 | void AccountDisplay::deleteAccount () | 158 | void AccountDisplay::deleteAccount () |
159 | { | 159 | { |
160 | if ( listview->selectedItem() == 0 ) | 160 | if ( listview->selectedItem() == 0 ) |
161 | QMessageBox::warning ( this, "QashMoney", "Please select an account\nto delete."); | 161 | QMessageBox::warning ( this, "QashMoney", "Please select an account\nto delete."); |
162 | else if ( listview->selectedItem()->parent() == 0 && listview->selectedItem()->childCount() != 0 ) | 162 | else if ( listview->selectedItem()->parent() == 0 && listview->selectedItem()->childCount() != 0 ) |
163 | QMessageBox::warning ( this, "QashMoney", "Can't delete parent accounts\nwith children"); | 163 | QMessageBox::warning ( this, "QashMoney", "Can't delete parent accounts\nwith children"); |
164 | else | 164 | else |
165 | { | 165 | { |
166 | QMessageBox mb ( "Delete Account", "This will delete all transactions\nand transfers for this account.", QMessageBox::Information, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton ); | 166 | QMessageBox mb ( "Delete Account", "This will delete all transactions\nand transfers for this account.", QMessageBox::Information, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton ); |
167 | if ( mb.exec() == QMessageBox::Ok ) | 167 | if ( mb.exec() == QMessageBox::Ok ) |
168 | { | 168 | { |
169 | int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt (); | 169 | int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt (); |
170 | int parentid = account->getParentAccountID ( accountid ); | 170 | int parentid = account->getParentAccountID ( accountid ); |
171 | 171 | ||
172 | // delete all the transactions and transfers for the account | 172 | // delete all the transactions and transfers for the account |
173 | transaction->deleteAllTransactions ( accountid ); | 173 | transaction->deleteAllTransactions ( accountid ); |
174 | transfer->deleteAllTransfers ( accountid ); | 174 | transfer->deleteAllTransfers ( accountid ); |
175 | 175 | ||
176 | // delete the account | 176 | // delete the account |
177 | account->deleteAccount ( accountid ); | 177 | account->deleteAccount ( accountid ); |
178 | 178 | ||
179 | // update account balances | 179 | // update account balances |
180 | if ( parentid != -1 ) | 180 | if ( parentid != -1 ) |
181 | account->changeParentAccountBalance ( parentid ); | 181 | account->changeParentAccountBalance ( parentid ); |
182 | 182 | ||
183 | //redisplay accounts | 183 | //redisplay accounts |
184 | account->displayAccounts ( listview ); | 184 | account->displayAccounts ( listview ); |
185 | 185 | ||
186 | //remove all the columns from the accountdisplay if there are not any accounts | 186 | //remove all the columns from the accountdisplay if there are not any accounts |
187 | if ( account->getNumberOfAccounts() == 0 ) | 187 | if ( account->getNumberOfAccounts() == 0 ) |
188 | { | 188 | { |
189 | int columns = listview->columns(); | 189 | int columns = listview->columns(); |
190 | int counter; | 190 | int counter; |
191 | for ( counter = 0; counter <= columns; counter++ ) | 191 | for ( counter = 0; counter <= columns; counter++ ) |
192 | listview->removeColumn ( 0 ); | 192 | listview->removeColumn ( 0 ); |
193 | } | 193 | } |
194 | 194 | ||
195 | setToggleButton(); | 195 | setToggleButton(); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | maintabs->setTabEnabled ( tab2, FALSE ); | 198 | maintabs->setTabEnabled ( tab2, FALSE ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void AccountDisplay::setToggleButton () | 201 | void AccountDisplay::setToggleButton () |
202 | { | 202 | { |
203 | // iterate through account display and determine how many "transferable" accounts we have | 203 | // iterate through account display and determine how many "transferable" accounts we have |
204 | // if there are less than two, disable the transfer button | 204 | // if there are less than two, disable the transfer button |
205 | QListViewItemIterator it ( listview ); | 205 | QListViewItemIterator it ( listview ); |
206 | int counter = 0; | 206 | int counter = 0; |
207 | for ( ; it.current(); ++it ) | 207 | for ( ; it.current(); ++it ) |
208 | { | 208 | { |
209 | // add one to counter if we find a transferable account | 209 | // add one to counter if we find a transferable account |
210 | if ( it.current()->parent() != 0 || ( it.current()->childCount() ) == 0 ) | 210 | if ( it.current()->parent() != 0 || ( it.current()->childCount() ) == 0 ) |
211 | counter++; | 211 | counter++; |
212 | } | 212 | } |
213 | if ( counter > 1 ) | 213 | if ( counter > 1 ) |
214 | transferbutton->show(); | 214 | transferbutton->show(); |
215 | else | 215 | else |
216 | transferbutton->hide(); | 216 | transferbutton->hide(); |
217 | } | 217 | } |
218 | 218 | ||
219 | void AccountDisplay::accountTransfer ( bool state ) | 219 | void AccountDisplay::accountTransfer ( bool state ) |
220 | { | 220 | { |
221 | if ( state == TRUE ) | 221 | if ( state == TRUE ) |
222 | { | 222 | { |
223 | firstaccountid = -1; | 223 | firstaccountid = -1; |
224 | secondaccountid = -1; | 224 | secondaccountid = -1; |
225 | listview->clearSelection (); | 225 | listview->clearSelection (); |
226 | listview->setMultiSelection ( TRUE ); | 226 | listview->setMultiSelection ( TRUE ); |
227 | disableParentsWithChildren (); | 227 | disableParentsWithChildren (); |
228 | connect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); | 228 | connect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) ); |
229 | } | 229 | } |
230 | else | 230 | else |
231 | { | 231 | { |
232 | firstaccountid = -1; | 232 | firstaccountid = -1; |
233 | secondaccountid = -1; | 233 | secondaccountid = -1; |
234 | listview->clearSelection (); | 234 | listview->clearSelection (); |
235 | listview->setMultiSelection ( FALSE ); | 235 | listview->setMultiSelection ( FALSE ); |
236 | enableAccounts (); | 236 | enableAccounts (); |
237 | disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); | 237 | disconnect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) ); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
241 | void AccountDisplay::getTransferAccounts ( QListViewItem * item ) | 241 | void AccountDisplay::getTransferAccounts ( QListViewItem * item ) |
242 | { | 242 | { |
243 | if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children | 243 | if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children |
244 | { | 244 | { |
245 | if ( firstaccountid == -1 ) | 245 | if ( firstaccountid == -1 ) |
246 | firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account | 246 | firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account |
247 | else | 247 | else |
248 | if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first | 248 | if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first |
249 | secondaccountid = item->text ( getIDColumn() ).toInt(); | 249 | secondaccountid = item->text ( getIDColumn() ).toInt(); |
250 | } | 250 | } |
251 | 251 | ||
252 | // open transfer window if both accounts are set | 252 | // open transfer window if both accounts are set |
253 | if ( firstaccountid != -1 && secondaccountid != -1 ) | 253 | if ( firstaccountid != -1 && secondaccountid != -1 ) |
254 | { | 254 | { |
255 | // construct the transferdialog window | 255 | // construct the transferdialog window |
256 | TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid ); | 256 | TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid ); |
257 | 257 | ||
258 | // enter today's date in the date box as default | 258 | // enter today's date in the date box as default |
259 | QDate today = QDate::currentDate (); | 259 | QDate today = QDate::currentDate (); |
260 | int defaultday = today.day(); | 260 | int defaultday = today.day(); |
261 | int defaultmonth = today.month(); | 261 | int defaultmonth = today.month(); |
262 | int defaultyear = today.year(); | 262 | int defaultyear = today.year(); |
263 | td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); | 263 | td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); |
264 | 264 | ||
265 | if ( td->exec() == QDialog::Accepted ) | 265 | if ( td->exec() == QDialog::Accepted ) |
266 | { | 266 | { |
267 | // set the cleared integer if the checkbox is checked | 267 | // set the cleared integer if the checkbox is checked |
268 | if ( td->clearedcheckbox->isChecked() == TRUE ) | 268 | if ( td->clearedcheckbox->isChecked() == TRUE ) |
269 | cleared = 1; | 269 | cleared = 1; |
270 | qDebug("Year from transferdialog = %i",td->getYear()); | 270 | qDebug("Year from transferdialog = %i",td->getYear()); |
271 | // add the transfer with a new date if its been edited or use the default date | 271 | // add the transfer with a new date if its been edited or use the default date |
272 | if ( td->getDateEdited () == TRUE ) | 272 | if ( td->getDateEdited () == TRUE ) |
273 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); | 273 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); |
274 | else | 274 | else |
275 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); | 275 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); |
276 | 276 | ||
277 | // update account balances of both accounts and parents if necessary | 277 | // update account balances of both accounts and parents if necessary |
278 | account->updateAccountBalance ( firstaccountid ); | 278 | account->updateAccountBalance ( firstaccountid ); |
279 | if ( account->getParentAccountID ( firstaccountid ) != -1 ) | 279 | if ( account->getParentAccountID ( firstaccountid ) != -1 ) |
280 | account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); | 280 | account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); |
281 | account->updateAccountBalance ( secondaccountid ); | 281 | account->updateAccountBalance ( secondaccountid ); |
282 | if ( account->getParentAccountID ( secondaccountid ) != -1 ) | 282 | if ( account->getParentAccountID ( secondaccountid ) != -1 ) |
283 | account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); | 283 | account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); |
284 | 284 | ||
285 | // redisplay accounts | 285 | // redisplay accounts |
286 | account->displayAccounts ( listview ); | 286 | account->displayAccounts ( listview ); |
287 | } | 287 | } |
288 | else | 288 | else |
289 | { | 289 | { |
290 | firstaccountid = -1; | 290 | firstaccountid = -1; |
291 | secondaccountid = -1; | 291 | secondaccountid = -1; |
292 | listview->clearSelection (); | 292 | listview->clearSelection (); |
293 | listview->setMultiSelection ( FALSE ); | 293 | listview->setMultiSelection ( FALSE ); |
294 | disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); | 294 | disconnect ( listview, SIGNAL ( clicked(QListViewItem*) ), this, SLOT ( getTransferAccounts(QListViewItem*) ) ); |
295 | } | 295 | } |
296 | 296 | ||
297 | // reset the accounts display window | 297 | // reset the accounts display window |
298 | transferbutton->toggle(); // toggling this button with clear the window as well | 298 | transferbutton->toggle(); // toggling this button with clear the window as well |
299 | 299 | ||
300 | // reenable all the accounts so the transaction tab will be properly set | 300 | // reenable all the accounts so the transaction tab will be properly set |
301 | enableAccounts (); | 301 | enableAccounts (); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | void AccountDisplay::disableParentsWithChildren () | 305 | void AccountDisplay::disableParentsWithChildren () |
306 | { | 306 | { |
307 | // iterate through accountdisplay listview and disable all the parents that have children | 307 | // iterate through accountdisplay listview and disable all the parents that have children |
308 | QListViewItemIterator it ( listview ); | 308 | QListViewItemIterator it ( listview ); |
309 | for ( ; it.current(); ++it ) | 309 | for ( ; it.current(); ++it ) |
310 | { | 310 | { |
311 | if ( it.current()->parent() == 0 && it.current()->childCount() != 0 ) | 311 | if ( it.current()->parent() == 0 && it.current()->childCount() != 0 ) |
312 | it.current()->setSelectable ( FALSE ); | 312 | it.current()->setSelectable ( FALSE ); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | void AccountDisplay::enableAccounts () | 316 | void AccountDisplay::enableAccounts () |
317 | { | 317 | { |
318 | // iterate through accountdisplay listview and enable all accounts | 318 | // iterate through accountdisplay listview and enable all accounts |
319 | QListViewItemIterator it ( listview ); | 319 | QListViewItemIterator it ( listview ); |
320 | for ( ; it.current(); ++it ) | 320 | for ( ; it.current(); ++it ) |
321 | it.current()->setSelectable ( TRUE ); | 321 | it.current()->setSelectable ( TRUE ); |
322 | } | 322 | } |
323 | 323 | ||
324 | void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | 324 | void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) |
325 | { | 325 | { |
326 | switch ( column ) | 326 | switch ( column ) |
327 | { | 327 | { |
328 | case 0: | 328 | case 0: |
329 | if ( listview->columns() == 3 ) | 329 | if ( listview->columns() == 3 ) |
330 | preferences->changeColumnPreference ( 1, newsize ); | 330 | preferences->changeColumnPreference ( 1, newsize ); |
331 | else | 331 | else |
332 | preferences->changeColumnPreference ( 10, newsize ); | 332 | preferences->changeColumnPreference ( 10, newsize ); |
333 | break; | 333 | break; |
334 | case 1: | 334 | case 1: |
335 | if ( listview->columns() == 3 ) | 335 | if ( listview->columns() == 3 ) |
336 | preferences->changeColumnPreference ( 2, newsize ); | 336 | preferences->changeColumnPreference ( 2, newsize ); |
337 | else | 337 | else |
338 | preferences->changeColumnPreference ( 11, newsize ); | 338 | preferences->changeColumnPreference ( 11, newsize ); |
339 | break; | 339 | break; |
340 | case 2: | 340 | case 2: |
341 | preferences->changeColumnPreference ( 12, newsize ); | 341 | preferences->changeColumnPreference ( 12, newsize ); |
342 | break; | 342 | break; |
343 | } | 343 | } |
344 | 344 | ||
345 | } | 345 | } |
346 | 346 | ||
347 | void AccountDisplay::saveSortingPreference ( int column ) | 347 | void AccountDisplay::saveSortingPreference ( int column ) |
348 | { | 348 | { |
349 | preferences->changeSortingPreference ( 1, column ); | 349 | preferences->changeSortingPreference ( 1, column ); |
350 | } | 350 | } |
351 | 351 | ||
352 | int AccountDisplay::getIDColumn () | 352 | int AccountDisplay::getIDColumn () |
353 | { | 353 | { |
354 | int counter; | 354 | int counter; |
355 | int columns = listview->columns(); | 355 | int columns = listview->columns(); |
356 | for ( counter = 0; counter <= columns; counter++ ) | 356 | for ( counter = 0; counter <= columns; counter++ ) |
357 | if ( listview->header()->label ( counter ).length() == 0 ) | 357 | if ( listview->header()->label ( counter ).length() == 0 ) |
358 | return counter; | 358 | return counter; |
359 | } | 359 | } |
360 | 360 | ||
361 | void AccountDisplay::editAccount () | 361 | void AccountDisplay::editAccount () |
362 | { | 362 | { |
363 | if ( listview->selectedItem() == 0 ) | 363 | if ( listview->selectedItem() == 0 ) |
364 | QMessageBox::warning ( this, "QashMoney", "Please select an account\nto edit."); | 364 | QMessageBox::warning ( this, "QashMoney", "Please select an account\nto edit."); |
365 | else | 365 | else |
366 | { | 366 | { |
367 | // set the accountid | 367 | // set the accountid |
368 | int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt(); | 368 | int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt(); |
369 | 369 | ||
370 | //construct new dialog box | 370 | //construct new dialog box |
371 | QDialog *editaccountwindow = new QDialog ( this, 0, TRUE ); | 371 | QDialog *editaccountwindow = new QDialog ( this, 0, TRUE ); |
372 | editaccountwindow->setCaption ( "Edit Account" ); | 372 | editaccountwindow->setCaption ( "Edit Account" ); |
373 | 373 | ||
374 | // construct the items which will go in the dialog bix | 374 | // construct the items which will go in the dialog bix |
375 | QLabel *namelabel = new QLabel ( "Account Name", editaccountwindow ); | 375 | QLabel *namelabel = new QLabel ( "Account Name", editaccountwindow ); |
376 | QLineEdit *accountname = new QLineEdit ( editaccountwindow ); | 376 | QLineEdit *accountname = new QLineEdit ( editaccountwindow ); |
377 | QLabel *descriptionlabel = new QLabel ( "Account Description", editaccountwindow ); | 377 | QLabel *descriptionlabel = new QLabel ( "Account Description", editaccountwindow ); |
378 | QLineEdit *accountdescription = new QLineEdit ( editaccountwindow ); | 378 | QLineEdit *accountdescription = new QLineEdit ( editaccountwindow ); |
379 | Currency *currencybox = new Currency ( editaccountwindow ); | 379 | Currency *currencybox = new Currency ( editaccountwindow ); |
380 | 380 | ||
381 | QVBoxLayout *layout = new QVBoxLayout ( editaccountwindow, 5, 2 ); | 381 | QVBoxLayout *layout = new QVBoxLayout ( editaccountwindow, 5, 2 ); |
382 | layout->addWidget ( namelabel ); | 382 | layout->addWidget ( namelabel ); |
383 | layout->addWidget ( accountname ); | 383 | layout->addWidget ( accountname ); |
384 | layout->addWidget ( descriptionlabel ); | 384 | layout->addWidget ( descriptionlabel ); |
385 | layout->addWidget ( accountdescription ); | 385 | layout->addWidget ( accountdescription ); |
386 | layout->addWidget ( currencybox ); | 386 | layout->addWidget ( currencybox ); |
387 | 387 | ||
388 | //set the account name | 388 | //set the account name |
389 | accountname->setText ( listview->selectedItem()->text ( 0 ) ); | 389 | accountname->setText ( listview->selectedItem()->text ( 0 ) ); |
390 | 390 | ||
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp index d4047bf..3fc4e6c 100755 --- a/noncore/apps/qashmoney/budgetdisplay.cpp +++ b/noncore/apps/qashmoney/budgetdisplay.cpp | |||
@@ -1,178 +1,178 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qheader.h> | 2 | #include <qheader.h> |
3 | #include <sqlite.h> | 3 | #include <sqlite.h> |
4 | 4 | ||
5 | #include "budgetdisplay.h" | 5 | #include "budgetdisplay.h" |
6 | #include "budget.h" | 6 | #include "budget.h" |
7 | #include "datepicker.h" | 7 | #include "datepicker.h" |
8 | #include "transaction.h" | 8 | #include "transaction.h" |
9 | 9 | ||
10 | extern Preferences *preferences; | 10 | extern Preferences *preferences; |
11 | extern Budget *budget; | 11 | extern Budget *budget; |
12 | extern Transaction *transaction; | 12 | extern Transaction *transaction; |
13 | 13 | ||
14 | BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) | 14 | BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) |
15 | { | 15 | { |
16 | QFont font = this->font(); | 16 | QFont font = this->font(); |
17 | font.setWeight ( QFont::Bold ); | 17 | font.setWeight ( QFont::Bold ); |
18 | 18 | ||
19 | //set the default date to today | 19 | //set the default date to today |
20 | newDate = QDate::currentDate (); | 20 | newDate = QDate::currentDate (); |
21 | year = newDate.year(); | 21 | year = newDate.year(); |
22 | month = newDate.month(); | 22 | month = newDate.month(); |
23 | day = newDate.day(); | 23 | day = newDate.day(); |
24 | datelabel = preferences->getDate ( year, month ); | 24 | datelabel = preferences->getDate ( year, month ); |
25 | 25 | ||
26 | setCaption ( "Budget" ); | 26 | setCaption ( "Budget" ); |
27 | 27 | ||
28 | firstline = new QHBox ( this ); | 28 | firstline = new QHBox ( this ); |
29 | firstline->setSpacing ( 2 ); | 29 | firstline->setSpacing ( 2 ); |
30 | secondline = new QHBox ( this ); | 30 | secondline = new QHBox ( this ); |
31 | secondline->setSpacing ( 10 ); | 31 | secondline->setSpacing ( 10 ); |
32 | 32 | ||
33 | menu = new QMenuBar ( this ); | 33 | menu = new QMenuBar ( this ); |
34 | menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); | 34 | menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); |
35 | budgetmenu = new QPopupMenu ( this ); | 35 | budgetmenu = new QPopupMenu ( this ); |
36 | lineitemsmenu = new QPopupMenu ( this ); | 36 | lineitemsmenu = new QPopupMenu ( this ); |
37 | datemenu = new QPopupMenu ( this ); | 37 | datemenu = new QPopupMenu ( this ); |
38 | menu->insertItem ( "Budget", budgetmenu ); | 38 | menu->insertItem ( "Budget", budgetmenu ); |
39 | menu->insertItem ( "Line Item", lineitemsmenu ); | 39 | menu->insertItem ( "Line Item", lineitemsmenu ); |
40 | menu->insertItem ( "Date", datemenu ); | 40 | menu->insertItem ( "Date", datemenu ); |
41 | budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 ); | 41 | budgetmenu->insertItem ( "New", this, SLOT ( newBudget() ), 0, 1 ); |
42 | budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 ); | 42 | budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget() ), 0, 2 ); |
43 | budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 ); | 43 | budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget() ), 0, 3 ); |
44 | lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 ); | 44 | lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem() ), 0, 1 ); |
45 | lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 ); | 45 | lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem() ), 0, 2 ); |
46 | lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 ); | 46 | lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem() ), 0, 3 ); |
47 | datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); | 47 | datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); |
48 | 48 | ||
49 | budgetbox = new QComboBox ( firstline ); | 49 | budgetbox = new QComboBox ( firstline ); |
50 | connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); | 50 | connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) ); |
51 | 51 | ||
52 | budgetview = new QComboBox ( firstline ); | 52 | budgetview = new QComboBox ( firstline ); |
53 | budgetview->insertItem ( "Month" ); | 53 | budgetview->insertItem ( "Month" ); |
54 | budgetview->insertItem ( "Year" ); | 54 | budgetview->insertItem ( "Year" ); |
55 | connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) ); | 55 | connect ( budgetview, SIGNAL ( activated(int) ), this, SLOT ( setCurrentView(int) ) ); |
56 | 56 | ||
57 | budgeted = new QLabel ( secondline ); | 57 | budgeted = new QLabel ( secondline ); |
58 | budgeted->setFont ( font ); | 58 | budgeted->setFont ( font ); |
59 | actual = new QLabel ( secondline ); | 59 | actual = new QLabel ( secondline ); |
60 | actual->setFont ( font ); | 60 | actual->setFont ( font ); |
61 | date = new QLabel ( secondline ); | 61 | date = new QLabel ( secondline ); |
62 | date->setFont ( font ); | 62 | date->setFont ( font ); |
63 | 63 | ||
64 | listview = new QListView ( this ); | 64 | listview = new QListView ( this ); |
65 | listview->setAllColumnsShowFocus ( TRUE ); | 65 | listview->setAllColumnsShowFocus ( TRUE ); |
66 | listview->setShowSortIndicator ( TRUE ); | 66 | listview->setShowSortIndicator ( TRUE ); |
67 | listview->setRootIsDecorated ( TRUE ); | 67 | listview->setRootIsDecorated ( TRUE ); |
68 | listview->setMultiSelection ( FALSE ); | 68 | listview->setMultiSelection ( FALSE ); |
69 | listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 | 69 | listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 |
70 | listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 | 70 | listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 |
71 | listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 | 71 | listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 |
72 | listview->addColumn ( "", 0 ); // line item ids | 72 | listview->addColumn ( "", 0 ); // line item ids |
73 | listview->setColumnWidthMode ( 0, QListView::Manual ); | 73 | listview->setColumnWidthMode ( 0, QListView::Manual ); |
74 | listview->setColumnWidthMode ( 1, QListView::Manual ); | 74 | listview->setColumnWidthMode ( 1, QListView::Manual ); |
75 | listview->setColumnWidthMode ( 2, QListView::Manual ); | 75 | listview->setColumnWidthMode ( 2, QListView::Manual ); |
76 | listview->setColumnAlignment ( 1, Qt::AlignRight ); | 76 | listview->setColumnAlignment ( 1, Qt::AlignRight ); |
77 | listview->setColumnAlignment ( 2, Qt::AlignRight ); | 77 | listview->setColumnAlignment ( 2, Qt::AlignRight ); |
78 | listview->setColumnWidthMode ( 3, QListView::Manual ); | 78 | listview->setColumnWidthMode ( 3, QListView::Manual ); |
79 | 79 | ||
80 | listview->header()->setTracking ( FALSE ); | 80 | listview->header()->setTracking ( FALSE ); |
81 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 81 | connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); |
82 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | 82 | connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); |
83 | 83 | ||
84 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | 84 | // pull the column sorting preference from the preferences table, and configure the listview accordingly |
85 | int column = 0; | 85 | int column = 0; |
86 | int direction = 0; | 86 | int direction = 0; |
87 | preferences->getSortingPreference ( 3, &column, &direction ); | 87 | preferences->getSortingPreference ( 3, &column, &direction ); |
88 | listview->setSorting ( column, direction ); | 88 | listview->setSorting ( column, direction ); |
89 | 89 | ||
90 | displayBudgetNames(); | 90 | displayBudgetNames(); |
91 | 91 | ||
92 | layout = new QVBoxLayout ( this, 2, 2 ); | 92 | layout = new QVBoxLayout ( this, 2, 2 ); |
93 | layout->setMenuBar ( menu ); | 93 | layout->setMenuBar ( menu ); |
94 | layout->addWidget ( firstline ); | 94 | layout->addWidget ( firstline ); |
95 | layout->addWidget ( secondline ); | 95 | layout->addWidget ( secondline ); |
96 | layout->addWidget ( listview ); | 96 | layout->addWidget ( listview ); |
97 | } | 97 | } |
98 | 98 | ||
99 | void BudgetDisplay::deleteBudget () | 99 | void BudgetDisplay::deleteBudget () |
100 | { | 100 | { |
101 | listview->clear(); | 101 | listview->clear(); |
102 | transaction->clearBudgetIDs ( currentbudget ); | 102 | transaction->clearBudgetIDs ( currentbudget ); |
103 | budget->deleteBudget ( currentbudget ); | 103 | budget->deleteBudget ( currentbudget ); |
104 | if ( budgetbox->count() != 0 ) | 104 | if ( budgetbox->count() != 0 ) |
105 | displayBudgetNames(); | 105 | displayBudgetNames(); |
106 | checkBudgets(); | 106 | checkBudgets(); |
107 | } | 107 | } |
108 | 108 | ||
109 | void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | 109 | void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) |
110 | { | 110 | { |
111 | switch ( column ) | 111 | switch ( column ) |
112 | { | 112 | { |
113 | case 0: | 113 | case 0: |
114 | preferences->changeColumnPreference ( 13, newsize ); | 114 | preferences->changeColumnPreference ( 13, newsize ); |
115 | break; | 115 | break; |
116 | case 1: | 116 | case 1: |
117 | preferences->changeColumnPreference ( 14, newsize ); | 117 | preferences->changeColumnPreference ( 14, newsize ); |
118 | break; | 118 | break; |
119 | case 2: | 119 | case 2: |
120 | preferences->changeColumnPreference ( 15, newsize ); | 120 | preferences->changeColumnPreference ( 15, newsize ); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | void BudgetDisplay::saveSortingPreference ( int column ) | 125 | void BudgetDisplay::saveSortingPreference ( int column ) |
126 | { | 126 | { |
127 | preferences->changeSortingPreference ( 3, column ); | 127 | preferences->changeSortingPreference ( 3, column ); |
128 | } | 128 | } |
129 | 129 | ||
130 | int BudgetDisplay::getIDColumn () | 130 | int BudgetDisplay::getIDColumn () |
131 | { | 131 | { |
132 | int counter; | 132 | int counter; |
133 | int columns = listview->columns(); | 133 | int columns = listview->columns(); |
134 | for ( counter = 0; counter <= columns; counter++ ) | 134 | for ( counter = 0; counter <= columns; counter++ ) |
135 | if ( listview->header()->label ( counter ).length() == 0 ) | 135 | if ( listview->header()->label ( counter ).length() == 0 ) |
136 | return counter; | 136 | return counter; |
137 | } | 137 | } |
138 | 138 | ||
139 | void BudgetDisplay::newBudget () | 139 | void BudgetDisplay::newBudget () |
140 | { | 140 | { |
141 | constructBudgetWindow(); | 141 | constructBudgetWindow(); |
142 | int response = nb->exec(); | 142 | int response = nb->exec(); |
143 | if ( response == 1 ) | 143 | if ( response == 1 ) |
144 | { | 144 | { |
145 | // open a new budget object | 145 | // open a new budget object |
146 | int addedbudget = budget->addBudget ( budgetname->text(), 0, description->text(), currencybox->currencybox->currentText(), day, month, year, day, month, year, 0 ); | 146 | int addedbudget = budget->addBudget ( budgetname->text(), 0, description->text(), currencybox->currencybox->currentText(), day, month, year, day, month, year, 0 ); |
147 | transaction->clearBudgetIDs ( addedbudget ); | 147 | transaction->clearBudgetIDs ( addedbudget ); |
148 | displayBudgetNames(); | 148 | displayBudgetNames(); |
149 | } | 149 | } |
150 | checkBudgets(); | 150 | checkBudgets(); |
151 | } | 151 | } |
152 | 152 | ||
153 | void BudgetDisplay::constructBudgetWindow () | 153 | void BudgetDisplay::constructBudgetWindow () |
154 | { | 154 | { |
155 | //construct and format the new budget window | 155 | //construct and format the new budget window |
156 | nb = new QDialog ( this, 0, TRUE ); | 156 | nb = new QDialog ( this, 0, TRUE ); |
157 | nb->setCaption ( "Budget" ); | 157 | nb->setCaption ( "Budget" ); |
158 | QLabel *namelabel = new QLabel ( "Budget Name", nb ); | 158 | QLabel *namelabel = new QLabel ( "Budget Name", nb ); |
159 | budgetname = new QLineEdit ( nb ); | 159 | budgetname = new QLineEdit ( nb ); |
160 | QLabel *descriptionlabel = new QLabel ( "Description", nb ); | 160 | QLabel *descriptionlabel = new QLabel ( "Description", nb ); |
161 | description = new QLineEdit ( nb ); | 161 | description = new QLineEdit ( nb ); |
162 | currencybox = new Currency ( nb ); | 162 | currencybox = new Currency ( nb ); |
163 | QBoxLayout *layout = new QVBoxLayout ( nb, 2, 2 ); | 163 | QBoxLayout *layout = new QVBoxLayout ( nb, 2, 2 ); |
164 | layout->addWidget ( namelabel ); | 164 | layout->addWidget ( namelabel ); |
165 | layout->addWidget ( budgetname ); | 165 | layout->addWidget ( budgetname ); |
166 | layout->addWidget ( descriptionlabel ); | 166 | layout->addWidget ( descriptionlabel ); |
167 | layout->addWidget ( description ); | 167 | layout->addWidget ( description ); |
168 | layout->addWidget ( currencybox ); | 168 | layout->addWidget ( currencybox ); |
169 | } | 169 | } |
170 | 170 | ||
171 | void BudgetDisplay::displayBudgetNames () | 171 | void BudgetDisplay::displayBudgetNames () |
172 | { | 172 | { |
173 | budgetbox->clear(); | 173 | budgetbox->clear(); |
174 | if ( budget->getNumberOfBudgets() != 0 ) | 174 | if ( budget->getNumberOfBudgets() != 0 ) |
175 | { | 175 | { |
176 | ids = budget->getBudgetIDs(); | 176 | ids = budget->getBudgetIDs(); |
177 | for ( QStringList::Iterator it = ids->begin(); it != ids->end(); ++it ) | 177 | for ( QStringList::Iterator it = ids->begin(); it != ids->end(); ++it ) |
178 | { | 178 | { |
diff --git a/noncore/apps/qashmoney/calculator.cpp b/noncore/apps/qashmoney/calculator.cpp index 0e0a043..2c92103 100755 --- a/noncore/apps/qashmoney/calculator.cpp +++ b/noncore/apps/qashmoney/calculator.cpp | |||
@@ -1,113 +1,113 @@ | |||
1 | #include "calculator.h" | 1 | #include "calculator.h" |
2 | 2 | ||
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | 4 | ||
5 | Calculator::Calculator ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 5 | Calculator::Calculator ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
6 | { | 6 | { |
7 | 7 | ||
8 | display = new QLineEdit ( this, "display" ); | 8 | display = new QLineEdit ( this, "display" ); |
9 | display->setFrame ( FALSE ); | 9 | display->setFrame ( FALSE ); |
10 | display->setAlignment ( Qt::AlignRight ); | 10 | display->setAlignment ( Qt::AlignRight ); |
11 | 11 | ||
12 | QPushButton *one = new QPushButton ( "1", this, "one" ); // make buttons for first row | 12 | QPushButton *one = new QPushButton ( "1", this, "one" ); // make buttons for first row |
13 | one->setFlat ( TRUE ); | 13 | one->setFlat ( TRUE ); |
14 | connect ( one, SIGNAL ( released () ), this, SLOT ( displayOne () ) ); | 14 | connect ( one, SIGNAL ( released() ), this, SLOT ( displayOne() ) ); |
15 | 15 | ||
16 | QPushButton *two = new QPushButton ( "2", this, "two" ); | 16 | QPushButton *two = new QPushButton ( "2", this, "two" ); |
17 | two->setFlat ( TRUE ); | 17 | two->setFlat ( TRUE ); |
18 | connect ( two, SIGNAL ( released () ), this, SLOT ( displayTwo () ) ); | 18 | connect ( two, SIGNAL ( released() ), this, SLOT ( displayTwo() ) ); |
19 | 19 | ||
20 | QPushButton *three = new QPushButton ( "3", this, "three" ); | 20 | QPushButton *three = new QPushButton ( "3", this, "three" ); |
21 | three->setFlat ( TRUE ); | 21 | three->setFlat ( TRUE ); |
22 | connect ( three, SIGNAL ( released () ), this, SLOT ( displayThree () ) ); | 22 | connect ( three, SIGNAL ( released() ), this, SLOT ( displayThree() ) ); |
23 | 23 | ||
24 | QPushButton *four = new QPushButton ( "4", this, "four" ); // make buttons for second row | 24 | QPushButton *four = new QPushButton ( "4", this, "four" ); // make buttons for second row |
25 | four->setFlat ( TRUE ); | 25 | four->setFlat ( TRUE ); |
26 | connect ( four, SIGNAL ( released () ), this, SLOT ( displayFour () ) ); | 26 | connect ( four, SIGNAL ( released() ), this, SLOT ( displayFour() ) ); |
27 | 27 | ||
28 | QPushButton *five = new QPushButton ( "5", this, "five" ); | 28 | QPushButton *five = new QPushButton ( "5", this, "five" ); |
29 | five->setFlat ( TRUE ); | 29 | five->setFlat ( TRUE ); |
30 | connect ( five, SIGNAL ( released () ), this, SLOT ( displayFive () ) ); | 30 | connect ( five, SIGNAL ( released() ), this, SLOT ( displayFive() ) ); |
31 | 31 | ||
32 | QPushButton *six = new QPushButton ( "6", this, "six" ); | 32 | QPushButton *six = new QPushButton ( "6", this, "six" ); |
33 | six->setFlat ( TRUE ); | 33 | six->setFlat ( TRUE ); |
34 | connect ( six, SIGNAL ( released () ), this, SLOT ( displaySix () ) ); | 34 | connect ( six, SIGNAL ( released() ), this, SLOT ( displaySix() ) ); |
35 | 35 | ||
36 | QPushButton *seven = new QPushButton ( "7", this, "seven" ); // make buttons for third row | 36 | QPushButton *seven = new QPushButton ( "7", this, "seven" ); // make buttons for third row |
37 | seven->setFlat ( TRUE ); | 37 | seven->setFlat ( TRUE ); |
38 | connect ( seven, SIGNAL ( released () ), this, SLOT ( displaySeven () ) ); | 38 | connect ( seven, SIGNAL ( released() ), this, SLOT ( displaySeven() ) ); |
39 | 39 | ||
40 | QPushButton *eight = new QPushButton ( "8", this, "eight" ); | 40 | QPushButton *eight = new QPushButton ( "8", this, "eight" ); |
41 | eight->setFlat ( TRUE ); | 41 | eight->setFlat ( TRUE ); |
42 | connect ( eight, SIGNAL ( released () ), this, SLOT ( displayEight () ) ); | 42 | connect ( eight, SIGNAL ( released() ), this, SLOT ( displayEight() ) ); |
43 | 43 | ||
44 | QPushButton *nine = new QPushButton ( "9", this, "nine" ); | 44 | QPushButton *nine = new QPushButton ( "9", this, "nine" ); |
45 | nine->setFlat ( TRUE ); | 45 | nine->setFlat ( TRUE ); |
46 | connect ( nine, SIGNAL ( released () ), this, SLOT ( displayNine () ) ); | 46 | connect ( nine, SIGNAL ( released() ), this, SLOT ( displayNine() ) ); |
47 | 47 | ||
48 | QPushButton *zero = new QPushButton ( "0", this, "zero" ); | 48 | QPushButton *zero = new QPushButton ( "0", this, "zero" ); |
49 | zero->setFlat ( TRUE ); | 49 | zero->setFlat ( TRUE ); |
50 | connect ( zero, SIGNAL ( released () ), this, SLOT ( displayZero () ) ); | 50 | connect ( zero, SIGNAL ( released() ), this, SLOT ( displayZero() ) ); |
51 | 51 | ||
52 | QPushButton *dp = new QPushButton ( ".", this, "dp" ); | 52 | QPushButton *dp = new QPushButton ( ".", this, "dp" ); |
53 | dp->setFlat ( TRUE ); | 53 | dp->setFlat ( TRUE ); |
54 | connect ( dp, SIGNAL ( released () ), this, SLOT ( displayPoint () ) ); | 54 | connect ( dp, SIGNAL ( released() ), this, SLOT ( displayPoint() ) ); |
55 | 55 | ||
56 | QPushButton *back = new QPushButton ( "<-", this, "back" ); | 56 | QPushButton *back = new QPushButton ( "<-", this, "back" ); |
57 | back->setFlat ( TRUE ); | 57 | back->setFlat ( TRUE ); |
58 | connect ( back, SIGNAL ( released () ), this, SLOT ( back () ) ); | 58 | connect ( back, SIGNAL ( released() ), this, SLOT ( back() ) ); |
59 | 59 | ||
60 | layout = new QGridLayout ( this, 5, 3, 5, 1, "calculatorlayout" ); | 60 | layout = new QGridLayout ( this, 5, 3, 5, 1, "calculatorlayout" ); |
61 | layout->addMultiCellWidget ( display, 0, 0, 0, 2 ); | 61 | layout->addMultiCellWidget ( display, 0, 0, 0, 2 ); |
62 | layout->addWidget ( one, 1, 0 ); | 62 | layout->addWidget ( one, 1, 0 ); |
63 | layout->addWidget ( two, 1, 1 ); | 63 | layout->addWidget ( two, 1, 1 ); |
64 | layout->addWidget ( three, 1, 2 ); | 64 | layout->addWidget ( three, 1, 2 ); |
65 | layout->addWidget ( four, 2, 0 ); | 65 | layout->addWidget ( four, 2, 0 ); |
66 | layout->addWidget ( five, 2, 1 ); | 66 | layout->addWidget ( five, 2, 1 ); |
67 | layout->addWidget ( six, 2, 2 ); | 67 | layout->addWidget ( six, 2, 2 ); |
68 | layout->addWidget ( seven, 3, 0 ); | 68 | layout->addWidget ( seven, 3, 0 ); |
69 | layout->addWidget ( eight, 3, 1 ); | 69 | layout->addWidget ( eight, 3, 1 ); |
70 | layout->addWidget ( nine, 3, 2 ); | 70 | layout->addWidget ( nine, 3, 2 ); |
71 | layout->addWidget ( zero, 4, 0 ); | 71 | layout->addWidget ( zero, 4, 0 ); |
72 | layout->addWidget ( dp, 4, 1 ); | 72 | layout->addWidget ( dp, 4, 1 ); |
73 | layout->addWidget ( back, 4, 2 ); | 73 | layout->addWidget ( back, 4, 2 ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | void Calculator::displayOne () | 77 | void Calculator::displayOne () |
78 | { display->insert ( "1" ); } | 78 | { display->insert ( "1" ); } |
79 | 79 | ||
80 | void Calculator::displayTwo () | 80 | void Calculator::displayTwo () |
81 | { display->insert ( "2" ); } | 81 | { display->insert ( "2" ); } |
82 | 82 | ||
83 | void Calculator::displayThree () | 83 | void Calculator::displayThree () |
84 | { display->insert ( "3" ); } | 84 | { display->insert ( "3" ); } |
85 | 85 | ||
86 | void Calculator::displayFour () | 86 | void Calculator::displayFour () |
87 | { display->insert ( "4" ); } | 87 | { display->insert ( "4" ); } |
88 | 88 | ||
89 | void Calculator::displayFive () | 89 | void Calculator::displayFive () |
90 | { display->insert ( "5" ); } | 90 | { display->insert ( "5" ); } |
91 | 91 | ||
92 | void Calculator::displaySix () | 92 | void Calculator::displaySix () |
93 | { display->insert ( "6" ); } | 93 | { display->insert ( "6" ); } |
94 | 94 | ||
95 | void Calculator::displaySeven () | 95 | void Calculator::displaySeven () |
96 | { display->insert ( "7" ); } | 96 | { display->insert ( "7" ); } |
97 | 97 | ||
98 | void Calculator::displayEight () | 98 | void Calculator::displayEight () |
99 | { display->insert ( "8" ); } | 99 | { display->insert ( "8" ); } |
100 | 100 | ||
101 | void Calculator::displayNine () | 101 | void Calculator::displayNine () |
102 | { display->insert ( "9" ); } | 102 | { display->insert ( "9" ); } |
103 | 103 | ||
104 | void Calculator::displayZero () | 104 | void Calculator::displayZero () |
105 | { display->insert ( "0" ); } | 105 | { display->insert ( "0" ); } |
106 | 106 | ||
107 | void Calculator::displayPoint () | 107 | void Calculator::displayPoint () |
108 | { display->insert ( "." ); } | 108 | { display->insert ( "." ); } |
109 | 109 | ||
110 | void Calculator::back () | 110 | void Calculator::back () |
111 | { display->backspace(); } | 111 | { display->backspace(); } |
112 | 112 | ||
113 | 113 | ||
diff --git a/noncore/apps/qashmoney/datepicker.cpp b/noncore/apps/qashmoney/datepicker.cpp index 02fbcf3..7997c0b 100755 --- a/noncore/apps/qashmoney/datepicker.cpp +++ b/noncore/apps/qashmoney/datepicker.cpp | |||
@@ -1,95 +1,95 @@ | |||
1 | #include "datepicker.h" | 1 | #include "datepicker.h" |
2 | 2 | ||
3 | DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) | 3 | DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) |
4 | { | 4 | { |
5 | setCaption ( "Select Date" ); | 5 | setCaption ( "Select Date" ); |
6 | date = entrydate; | 6 | date = entrydate; |
7 | day = date.day(); | 7 | day = date.day(); |
8 | month = date.month(); | 8 | month = date.month(); |
9 | year = date.year(); | 9 | year = date.year(); |
10 | 10 | ||
11 | daylabel = new QLabel ( "Day", this ); | 11 | daylabel = new QLabel ( "Day", this ); |
12 | monthlabel = new QLabel ( "Month", this ); | 12 | monthlabel = new QLabel ( "Month", this ); |
13 | yearlabel = new QLabel ( "Year", this ); | 13 | yearlabel = new QLabel ( "Year", this ); |
14 | 14 | ||
15 | daybox = new QComboBox ( this, "daybox" ); | 15 | daybox = new QComboBox ( this, "daybox" ); |
16 | connect ( daybox, SIGNAL ( activated ( int ) ), this, SLOT ( setDay ( int ) ) ); | 16 | connect ( daybox, SIGNAL ( activated(int) ), this, SLOT ( setDay(int) ) ); |
17 | displayDays ( daybox ); | 17 | displayDays ( daybox ); |
18 | monthbox = new QComboBox ( this, "monthbox" ); | 18 | monthbox = new QComboBox ( this, "monthbox" ); |
19 | connect ( monthbox, SIGNAL ( activated ( int ) ), this, SLOT ( setMonth ( int ) ) ); | 19 | connect ( monthbox, SIGNAL ( activated(int) ), this, SLOT ( setMonth(int) ) ); |
20 | displayMonths ( monthbox ); | 20 | displayMonths ( monthbox ); |
21 | yearbox = new QComboBox ( this, "yearbox" ); | 21 | yearbox = new QComboBox ( this, "yearbox" ); |
22 | connect ( yearbox, SIGNAL ( activated ( int ) ), this, SLOT ( setYear ( int ) ) ); | 22 | connect ( yearbox, SIGNAL ( activated(int) ), this, SLOT ( setYear(int) ) ); |
23 | displayYears ( yearbox ); | 23 | displayYears ( yearbox ); |
24 | 24 | ||
25 | layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" ); | 25 | layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" ); |
26 | layout->addWidget ( daylabel, 0, 2 ); | 26 | layout->addWidget ( daylabel, 0, 2 ); |
27 | layout->addWidget ( monthlabel, 0, 1 ); | 27 | layout->addWidget ( monthlabel, 0, 1 ); |
28 | layout->addWidget ( yearlabel, 0, 0 ); | 28 | layout->addWidget ( yearlabel, 0, 0 ); |
29 | layout->addWidget ( daybox, 1, 2 ); | 29 | layout->addWidget ( daybox, 1, 2 ); |
30 | layout->addWidget ( monthbox, 1, 1 ); | 30 | layout->addWidget ( monthbox, 1, 1 ); |
31 | layout->addWidget ( yearbox, 1, 0 ); | 31 | layout->addWidget ( yearbox, 1, 0 ); |
32 | } | 32 | } |
33 | 33 | ||
34 | void DatePicker::displayDays ( QComboBox *daybox ) | 34 | void DatePicker::displayDays ( QComboBox *daybox ) |
35 | { | 35 | { |
36 | int counter; | 36 | int counter; |
37 | int days = date.daysInMonth(); | 37 | int days = date.daysInMonth(); |
38 | for ( counter = 1; counter <= days; counter++ ) | 38 | for ( counter = 1; counter <= days; counter++ ) |
39 | daybox->insertItem ( QString::number ( counter ) ); | 39 | daybox->insertItem ( QString::number ( counter ) ); |
40 | daybox->setCurrentItem ( ( date.day() ) - 1 ); | 40 | daybox->setCurrentItem ( ( date.day() ) - 1 ); |
41 | } | 41 | } |
42 | 42 | ||
43 | void DatePicker::displayMonths ( QComboBox *monthbox ) | 43 | void DatePicker::displayMonths ( QComboBox *monthbox ) |
44 | { | 44 | { |
45 | int counter; | 45 | int counter; |
46 | for ( counter = 1; counter <= 12; counter++ ) | 46 | for ( counter = 1; counter <= 12; counter++ ) |
47 | monthbox->insertItem ( QString::number ( counter ) ); | 47 | monthbox->insertItem ( QString::number ( counter ) ); |
48 | monthbox->setCurrentItem ( ( date.month() ) - 1 ); | 48 | monthbox->setCurrentItem ( ( date.month() ) - 1 ); |
49 | } | 49 | } |
50 | 50 | ||
51 | void DatePicker::displayYears ( QComboBox *yearbox ) | 51 | void DatePicker::displayYears ( QComboBox *yearbox ) |
52 | { | 52 | { |
53 | int counter; | 53 | int counter; |
54 | int indexcounter = 0; | 54 | int indexcounter = 0; |
55 | int yearindex = 0; | 55 | int yearindex = 0; |
56 | int year = date.year(); | 56 | int year = date.year(); |
57 | for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ ) | 57 | for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ ) |
58 | { | 58 | { |
59 | yearbox->insertItem ( QString::number ( counter ) ); | 59 | yearbox->insertItem ( QString::number ( counter ) ); |
60 | if ( date.year() == counter ) | 60 | if ( date.year() == counter ) |
61 | yearindex = indexcounter; | 61 | yearindex = indexcounter; |
62 | indexcounter ++; | 62 | indexcounter ++; |
63 | } | 63 | } |
64 | yearbox->setCurrentItem ( yearindex ); | 64 | yearbox->setCurrentItem ( yearindex ); |
65 | } | 65 | } |
66 | 66 | ||
67 | void DatePicker::setDay ( int index ) | 67 | void DatePicker::setDay ( int index ) |
68 | { | 68 | { |
69 | day = daybox->text ( index ).toInt(); | 69 | day = daybox->text ( index ).toInt(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void DatePicker::setMonth ( int index ) | 72 | void DatePicker::setMonth ( int index ) |
73 | { | 73 | { |
74 | month = monthbox->text( index ).toInt(); | 74 | month = monthbox->text( index ).toInt(); |
75 | } | 75 | } |
76 | 76 | ||
77 | void DatePicker::setYear ( int index ) | 77 | void DatePicker::setYear ( int index ) |
78 | { | 78 | { |
79 | year = yearbox->text ( index ).toInt(); | 79 | year = yearbox->text ( index ).toInt(); |
80 | } | 80 | } |
81 | 81 | ||
82 | int DatePicker::getDay () | 82 | int DatePicker::getDay () |
83 | { return day; } | 83 | { return day; } |
84 | 84 | ||
85 | int DatePicker::getMonth () | 85 | int DatePicker::getMonth () |
86 | { return month; } | 86 | { return month; } |
87 | 87 | ||
88 | int DatePicker::getYear () | 88 | int DatePicker::getYear () |
89 | { return year; } | 89 | { return year; } |
90 | 90 | ||
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
diff --git a/noncore/apps/qashmoney/memorydialog.cpp b/noncore/apps/qashmoney/memorydialog.cpp index e9ebd54..ba11540 100755 --- a/noncore/apps/qashmoney/memorydialog.cpp +++ b/noncore/apps/qashmoney/memorydialog.cpp | |||
@@ -1,86 +1,86 @@ | |||
1 | #include "memorydialog.h" | 1 | #include "memorydialog.h" |
2 | #include "memory.h" | 2 | #include "memory.h" |
3 | #include <qmessagebox.h> | 3 | #include <qmessagebox.h> |
4 | 4 | ||
5 | extern Memory *memory; | 5 | extern Memory *memory; |
6 | 6 | ||
7 | MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE ) | 7 | MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE ) |
8 | { | 8 | { |
9 | setCaption ( tr ( "Edit Memory" ) ); | 9 | setCaption ( tr ( "Edit Memory" ) ); |
10 | 10 | ||
11 | listbox = new QListBox ( this, "listbox" ); | 11 | listbox = new QListBox ( this, "listbox" ); |
12 | memory->displayMemoryItems ( listbox ); | 12 | memory->displayMemoryItems ( listbox ); |
13 | listbox->clearSelection(); | 13 | listbox->clearSelection(); |
14 | 14 | ||
15 | secondline = new QHBox ( this ); | 15 | secondline = new QHBox ( this ); |
16 | 16 | ||
17 | newbutton = new QPushButton ( secondline ); | 17 | newbutton = new QPushButton ( secondline ); |
18 | newbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/new.png") ); | 18 | newbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/new.png") ); |
19 | connect ( newbutton, SIGNAL ( released () ), this, SLOT ( addItem () ) ); | 19 | connect ( newbutton, SIGNAL ( released() ), this, SLOT ( addItem() ) ); |
20 | 20 | ||
21 | editbutton = new QPushButton ( secondline ); | 21 | editbutton = new QPushButton ( secondline ); |
22 | editbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); | 22 | editbutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); |
23 | connect ( editbutton, SIGNAL ( released () ), this, SLOT ( editItem () ) ); | 23 | connect ( editbutton, SIGNAL ( released() ), this, SLOT ( editItem() ) ); |
24 | 24 | ||
25 | deletebutton = new QPushButton( secondline ); | 25 | deletebutton = new QPushButton( secondline ); |
26 | deletebutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/delete.png") ); | 26 | deletebutton->setPixmap( QPixmap ("/opt/QtPalmtop/pics/delete.png") ); |
27 | connect ( deletebutton, SIGNAL ( released () ), this, SLOT ( deleteItem () ) ); | 27 | connect ( deletebutton, SIGNAL ( released() ), this, SLOT ( deleteItem() ) ); |
28 | 28 | ||
29 | lineedit = new QLineEdit ( this ); | 29 | lineedit = new QLineEdit ( this ); |
30 | 30 | ||
31 | layout = new QVBoxLayout ( this, 2, 2 ); | 31 | layout = new QVBoxLayout ( this, 2, 2 ); |
32 | layout->addWidget ( listbox ); | 32 | layout->addWidget ( listbox ); |
33 | layout->addWidget ( secondline ); | 33 | layout->addWidget ( secondline ); |
34 | layout->addWidget ( lineedit ); | 34 | layout->addWidget ( lineedit ); |
35 | } | 35 | } |
36 | 36 | ||
37 | MemoryDialog::~MemoryDialog() | 37 | MemoryDialog::~MemoryDialog() |
38 | { | 38 | { |
39 | } | 39 | } |
40 | 40 | ||
41 | void MemoryDialog::addItem () | 41 | void MemoryDialog::addItem () |
42 | { | 42 | { |
43 | if ( lineedit->text().length() != 0 ) | 43 | if ( lineedit->text().length() != 0 ) |
44 | { | 44 | { |
45 | memory->addMemoryItem ( lineedit->text() ); | 45 | memory->addMemoryItem ( lineedit->text() ); |
46 | listbox->clear (); | 46 | listbox->clear (); |
47 | memory->displayMemoryItems ( listbox ); | 47 | memory->displayMemoryItems ( listbox ); |
48 | listbox->clearFocus(); | 48 | listbox->clearFocus(); |
49 | listbox->clearSelection (); | 49 | listbox->clearSelection (); |
50 | lineedit->clear(); | 50 | lineedit->clear(); |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | void MemoryDialog::editItem () | 54 | void MemoryDialog::editItem () |
55 | { | 55 | { |
56 | if ( listbox->currentItem() != -1 ) | 56 | if ( listbox->currentItem() != -1 ) |
57 | { | 57 | { |
58 | lineedit->setText ( listbox->currentText() ); | 58 | lineedit->setText ( listbox->currentText() ); |
59 | memory->deleteMemoryItem ( listbox->currentText() ); | 59 | memory->deleteMemoryItem ( listbox->currentText() ); |
60 | listbox->clear (); | 60 | listbox->clear (); |
61 | memory->displayMemoryItems ( listbox ); | 61 | memory->displayMemoryItems ( listbox ); |
62 | listbox->clearSelection(); | 62 | listbox->clearSelection(); |
63 | } | 63 | } |
64 | else | 64 | else |
65 | QMessageBox::warning ( this, "QashMoney", "Please select an item to edit." ); | 65 | QMessageBox::warning ( this, "QashMoney", "Please select an item to edit." ); |
66 | } | 66 | } |
67 | 67 | ||
68 | void MemoryDialog::deleteItem () | 68 | void MemoryDialog::deleteItem () |
69 | { | 69 | { |
70 | if ( listbox->currentItem() != -1 ) | 70 | if ( listbox->currentItem() != -1 ) |
71 | { | 71 | { |
72 | memory->deleteMemoryItem ( listbox->currentText() ); | 72 | memory->deleteMemoryItem ( listbox->currentText() ); |
73 | listbox->clear (); | 73 | listbox->clear (); |
74 | memory->displayMemoryItems ( listbox ); | 74 | memory->displayMemoryItems ( listbox ); |
75 | listbox->clearSelection(); | 75 | listbox->clearSelection(); |
76 | } | 76 | } |
77 | else | 77 | else |
78 | QMessageBox::warning ( this, "QashMoney", "Please select an item to delete." ); | 78 | QMessageBox::warning ( this, "QashMoney", "Please select an item to delete." ); |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
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 | ||
6 | extern Preferences *preferences; | 6 | extern Preferences *preferences; |
7 | 7 | ||
8 | NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDialog ( parent, name, modal ) | 8 | NewAccount::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 | ||
87 | NewAccount::~NewAccount () | 87 | NewAccount::~NewAccount () |
88 | { | 88 | { |
89 | } | 89 | } |
90 | 90 | ||
91 | void NewAccount::showChildPulldownMenu () | 91 | void 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 | ||
102 | void NewAccount::hideChildPulldownMenu () | 102 | void NewAccount::hideChildPulldownMenu () |
103 | { | 103 | { |
104 | childlabel->setEnabled ( FALSE ); | 104 | childlabel->setEnabled ( FALSE ); |
105 | childbox->setEnabled ( FALSE ); | 105 | childbox->setEnabled ( FALSE ); |
106 | } | 106 | } |
107 | 107 | ||
108 | void NewAccount::showCalculator () | 108 | void 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 | ||
116 | void NewAccount::showCreditLimitCalculator () | 116 | void 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 | ||
124 | void NewAccount::activateCreditLimit ( int index ) | 124 | void 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 | ||
135 | void NewAccount::showCalendar () | 135 | void 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 | ||
159 | bool NewAccount::getDateEdited () | 159 | bool NewAccount::getDateEdited () |
160 | { | 160 | { |
161 | return dateedited; | 161 | return dateedited; |
162 | } | 162 | } |
163 | 163 | ||
164 | int NewAccount::getDay () | 164 | int NewAccount::getDay () |
165 | { | 165 | { |
166 | return day; | 166 | return day; |
167 | } | 167 | } |
168 | 168 | ||
169 | int NewAccount::getMonth () | 169 | int NewAccount::getMonth () |
170 | { | 170 | { |
171 | return month; | 171 | return month; |
172 | } | 172 | } |
173 | 173 | ||
174 | int NewAccount::getYear () | 174 | int NewAccount::getYear () |
175 | { | 175 | { |
176 | return year; | 176 | return year; |
177 | } | 177 | } |
178 | 178 | ||
179 | QString NewAccount::getDescription () | 179 | QString NewAccount::getDescription () |
180 | { | 180 | { |
diff --git a/noncore/apps/qashmoney/newtransaction.cpp b/noncore/apps/qashmoney/newtransaction.cpp index 5c78139..87b7f7e 100755 --- a/noncore/apps/qashmoney/newtransaction.cpp +++ b/noncore/apps/qashmoney/newtransaction.cpp | |||
@@ -1,184 +1,184 @@ | |||
1 | #include "newtransaction.h" | 1 | #include "newtransaction.h" |
2 | #include "calculator.h" | 2 | #include "calculator.h" |
3 | #include "datepicker.h" | 3 | #include "datepicker.h" |
4 | #include "budget.h" | 4 | #include "budget.h" |
5 | 5 | ||
6 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | 7 | ||
8 | extern Budget *budget; | 8 | extern Budget *budget; |
9 | extern Preferences *preferences; | 9 | extern Preferences *preferences; |
10 | 10 | ||
11 | NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 11 | NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
12 | { | 12 | { |
13 | transactiondescription = ""; | 13 | transactiondescription = ""; |
14 | currentlineitem = -1; | 14 | currentlineitem = -1; |
15 | currentbudget = -1; | 15 | currentbudget = -1; |
16 | dateedited = FALSE; | 16 | dateedited = FALSE; |
17 | setCaption( tr( "Transaction" ) ); | 17 | setCaption( tr( "Transaction" ) ); |
18 | 18 | ||
19 | // START FIRST COLUMN | 19 | // START FIRST COLUMN |
20 | 20 | ||
21 | namelabel = new QLabel ( "Transaction", this ); | 21 | namelabel = new QLabel ( "Transaction", this ); |
22 | 22 | ||
23 | transactionnamebox = new QHBox ( this ); | 23 | transactionnamebox = new QHBox ( this ); |
24 | transactionname = new QComboBox ( transactionnamebox ); | 24 | transactionname = new QComboBox ( transactionnamebox ); |
25 | transactionname->setEditable ( TRUE ); | 25 | transactionname->setEditable ( TRUE ); |
26 | descriptionbutton = new QPushButton ( transactionnamebox ); | 26 | descriptionbutton = new QPushButton ( transactionnamebox ); |
27 | descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); | 27 | descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); |
28 | connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addTransactionDescription() ) ); | 28 | connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addTransactionDescription() ) ); |
29 | 29 | ||
30 | amountlabel = new QLabel ( "Amount", this ); | 30 | amountlabel = new QLabel ( "Amount", this ); |
31 | 31 | ||
32 | transactionamountbox = new QHBox ( this ); | 32 | transactionamountbox = new QHBox ( this ); |
33 | transactionamount = new QLineEdit ( transactionamountbox ); | 33 | transactionamount = new QLineEdit ( transactionamountbox ); |
34 | transactionamount->setAlignment ( Qt::AlignRight ); | 34 | transactionamount->setAlignment ( Qt::AlignRight ); |
35 | transactionamount->setText ( "0.00" ); | 35 | transactionamount->setText ( "0.00" ); |
36 | calculatorbutton = new QPushButton( transactionamountbox ); | 36 | calculatorbutton = new QPushButton( transactionamountbox ); |
37 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 37 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
38 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); | 38 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); |
39 | 39 | ||
40 | datelabel = new QLabel ( "Date", this ); | 40 | datelabel = new QLabel ( "Date", this ); |
41 | 41 | ||
42 | transactiondatebox = new QHBox ( this ); | 42 | transactiondatebox = new QHBox ( this ); |
43 | transactiondate = new QLineEdit ( transactiondatebox ); | 43 | transactiondate = new QLineEdit ( transactiondatebox ); |
44 | transactiondate->setAlignment ( Qt::AlignRight ); | 44 | transactiondate->setAlignment ( Qt::AlignRight ); |
45 | transactiondate->setDisabled ( TRUE ); | 45 | transactiondate->setDisabled ( TRUE ); |
46 | datebutton = new QPushButton( transactiondatebox ); | 46 | datebutton = new QPushButton( transactiondatebox ); |
47 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 47 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
48 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); | 48 | connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); |
49 | 49 | ||
50 | clearedcheckbox = new QCheckBox ( "Cleared", this ); | 50 | clearedcheckbox = new QCheckBox ( "Cleared", this ); |
51 | depositbox = new QCheckBox ( "Credit", this ); | 51 | depositbox = new QCheckBox ( "Credit", this ); |
52 | 52 | ||
53 | // START SECOND COLUMN | 53 | // START SECOND COLUMN |
54 | 54 | ||
55 | numberlabel = new QLabel ( "Number", this ); | 55 | numberlabel = new QLabel ( "Number", this ); |
56 | transactionnumber = new QLineEdit ( this ); | 56 | transactionnumber = new QLineEdit ( this ); |
57 | 57 | ||
58 | budgetlabel = new QLabel ( "Budget", this ); | 58 | budgetlabel = new QLabel ( "Budget", this ); |
59 | budgetbox = new QComboBox ( FALSE, this ); | 59 | budgetbox = new QComboBox ( FALSE, this ); |
60 | 60 | ||
61 | lineitemlabel = new QLabel ( "LineItem", this ); | 61 | lineitemlabel = new QLabel ( "LineItem", this ); |
62 | lineitembox = new QComboBox ( FALSE, this ); | 62 | lineitembox = new QComboBox ( FALSE, this ); |
63 | 63 | ||
64 | layout = new QGridLayout ( this, 7, 2, 2, 2 ); | 64 | layout = new QGridLayout ( this, 7, 2, 2, 2 ); |
65 | layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft ); | 65 | layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft ); |
66 | layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft ); | 66 | layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft ); |
67 | layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft ); | 67 | layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft ); |
68 | layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft ); | 68 | layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft ); |
69 | layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft ); | 69 | layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft ); |
70 | layout->addWidget ( transactiondatebox, 5, 0, Qt::AlignLeft ); | 70 | layout->addWidget ( transactiondatebox, 5, 0, Qt::AlignLeft ); |
71 | layout->addWidget ( clearedcheckbox, 6, 0, Qt::AlignLeft ); | 71 | layout->addWidget ( clearedcheckbox, 6, 0, Qt::AlignLeft ); |
72 | layout->addWidget ( numberlabel, 0, 1, Qt::AlignLeft ); | 72 | layout->addWidget ( numberlabel, 0, 1, Qt::AlignLeft ); |
73 | layout->addWidget ( transactionnumber, 1, 1, Qt::AlignLeft ); | 73 | layout->addWidget ( transactionnumber, 1, 1, Qt::AlignLeft ); |
74 | layout->addWidget ( budgetlabel, 2, 1, Qt::AlignLeft ); | 74 | layout->addWidget ( budgetlabel, 2, 1, Qt::AlignLeft ); |
75 | layout->addWidget ( budgetbox, 3, 1, Qt::AlignLeft ); | 75 | layout->addWidget ( budgetbox, 3, 1, Qt::AlignLeft ); |
76 | layout->addWidget ( lineitemlabel, 4, 1, Qt::AlignLeft ); | 76 | layout->addWidget ( lineitemlabel, 4, 1, Qt::AlignLeft ); |
77 | layout->addWidget ( lineitembox, 5, 1, Qt::AlignLeft ); | 77 | layout->addWidget ( lineitembox, 5, 1, Qt::AlignLeft ); |
78 | layout->addWidget ( depositbox, 6, 1, Qt::AlignLeft ); | 78 | layout->addWidget ( depositbox, 6, 1, Qt::AlignLeft ); |
79 | 79 | ||
80 | if ( budget->getNumberOfBudgets() != 0 ) | 80 | if ( budget->getNumberOfBudgets() != 0 ) |
81 | { | 81 | { |
82 | budgetnameslist = budget->getBudgetNames(); | 82 | budgetnameslist = budget->getBudgetNames(); |
83 | budgetidslist = budget->getBudgetIDs(); | 83 | budgetidslist = budget->getBudgetIDs(); |
84 | budgetbox->insertStringList ( *budgetnameslist ); | 84 | budgetbox->insertStringList ( *budgetnameslist ); |
85 | lineitemlabel->setEnabled ( FALSE ); | 85 | lineitemlabel->setEnabled ( FALSE ); |
86 | lineitembox->setEnabled ( FALSE ); | 86 | lineitembox->setEnabled ( FALSE ); |
87 | connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); | 87 | connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) ); |
88 | connect ( lineitembox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentLineItem ( int ) ) ); | 88 | connect ( lineitembox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentLineItem(int) ) ); |
89 | } | 89 | } |
90 | else | 90 | else |
91 | { | 91 | { |
92 | budgetlabel->setEnabled ( FALSE ); | 92 | budgetlabel->setEnabled ( FALSE ); |
93 | budgetbox->setEnabled ( FALSE ); | 93 | budgetbox->setEnabled ( FALSE ); |
94 | lineitemlabel->setEnabled ( FALSE ); | 94 | lineitemlabel->setEnabled ( FALSE ); |
95 | lineitembox->setEnabled ( FALSE ); | 95 | lineitembox->setEnabled ( FALSE ); |
96 | } | 96 | } |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | NewTransaction::~NewTransaction () | 100 | NewTransaction::~NewTransaction () |
101 | { | 101 | { |
102 | } | 102 | } |
103 | 103 | ||
104 | void NewTransaction::showCalculator () | 104 | void NewTransaction::showCalculator () |
105 | { | 105 | { |
106 | Calculator *calculator = new Calculator ( this ); | 106 | Calculator *calculator = new Calculator ( this ); |
107 | calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); | 107 | calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); |
108 | if ( calculator->exec () == QDialog::Accepted ) | 108 | if ( calculator->exec () == QDialog::Accepted ) |
109 | transactionamount->setText ( calculator->display->text() ); | 109 | transactionamount->setText ( calculator->display->text() ); |
110 | } | 110 | } |
111 | 111 | ||
112 | void NewTransaction::showCalendar () | 112 | void NewTransaction::showCalendar () |
113 | { | 113 | { |
114 | QDate newDate = QDate::currentDate (); | 114 | QDate newDate = QDate::currentDate (); |
115 | DatePicker *dp = new DatePicker ( newDate ); | 115 | DatePicker *dp = new DatePicker ( newDate ); |
116 | dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); | 116 | dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); |
117 | 117 | ||
118 | int response = dp->exec(); | 118 | int response = dp->exec(); |
119 | if ( response == QDialog::Accepted ) | 119 | if ( response == QDialog::Accepted ) |
120 | { | 120 | { |
121 | // Set date integers | 121 | // Set date integers |
122 | year = dp->getYear(); | 122 | year = dp->getYear(); |
123 | month = dp->getMonth(); | 123 | month = dp->getMonth(); |
124 | day = dp->getDay(); | 124 | day = dp->getDay(); |
125 | 125 | ||
126 | // Set dateedited to TRUE | 126 | // Set dateedited to TRUE |
127 | // This tells the transactiondisplay object that the user edited an transaction | 127 | // This tells the transactiondisplay object that the user edited an transaction |
128 | // and did change the date3 | 128 | // and did change the date3 |
129 | dateedited = TRUE; | 129 | dateedited = TRUE; |
130 | 130 | ||
131 | // Display date with our selected format | 131 | // Display date with our selected format |
132 | transactiondate->setText ( preferences->getDate ( year, month, day ) ); | 132 | transactiondate->setText ( preferences->getDate ( year, month, day ) ); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | bool NewTransaction::getDateEdited () | 136 | bool NewTransaction::getDateEdited () |
137 | { | 137 | { |
138 | return dateedited; | 138 | return dateedited; |
139 | } | 139 | } |
140 | 140 | ||
141 | int NewTransaction::getDay () | 141 | int NewTransaction::getDay () |
142 | { | 142 | { |
143 | return day; | 143 | return day; |
144 | } | 144 | } |
145 | 145 | ||
146 | int NewTransaction::getMonth () | 146 | int NewTransaction::getMonth () |
147 | { | 147 | { |
148 | return month; | 148 | return month; |
149 | } | 149 | } |
150 | 150 | ||
151 | int NewTransaction::getYear () | 151 | int NewTransaction::getYear () |
152 | { | 152 | { |
153 | return year; | 153 | return year; |
154 | } | 154 | } |
155 | 155 | ||
156 | QString NewTransaction::getDescription () | 156 | QString NewTransaction::getDescription () |
157 | { | 157 | { |
158 | return transactiondescription; | 158 | return transactiondescription; |
159 | } | 159 | } |
160 | 160 | ||
161 | void NewTransaction::setDescription ( QString description ) | 161 | void NewTransaction::setDescription ( QString description ) |
162 | { | 162 | { |
163 | transactiondescription = description; | 163 | transactiondescription = description; |
164 | } | 164 | } |
165 | 165 | ||
166 | void NewTransaction::addTransactionDescription () | 166 | void NewTransaction::addTransactionDescription () |
167 | { | 167 | { |
168 | // Function for adding or editing an transaction description. | 168 | // Function for adding or editing an transaction description. |
169 | QDialog *description = new QDialog ( this, "description", TRUE ); | 169 | QDialog *description = new QDialog ( this, "description", TRUE ); |
170 | description->setCaption ( "Notes" ); | 170 | description->setCaption ( "Notes" ); |
171 | QMultiLineEdit *enter = new QMultiLineEdit ( description ); | 171 | QMultiLineEdit *enter = new QMultiLineEdit ( description ); |
172 | enter->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) ); | 172 | enter->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) ); |
173 | enter->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) ); | 173 | enter->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) ); |
174 | enter->setWordWrap ( QMultiLineEdit::WidgetWidth ); | 174 | enter->setWordWrap ( QMultiLineEdit::WidgetWidth ); |
175 | if ( transactiondescription != "(NULL)" ) | 175 | if ( transactiondescription != "(NULL)" ) |
176 | enter->setText ( transactiondescription ); | 176 | enter->setText ( transactiondescription ); |
177 | if ( description->exec () == QDialog::Accepted ) | 177 | if ( description->exec () == QDialog::Accepted ) |
178 | transactiondescription = enter->text (); | 178 | transactiondescription = enter->text (); |
179 | } | 179 | } |
180 | 180 | ||
181 | int NewTransaction::getNameIndex ( QString name ) | 181 | int NewTransaction::getNameIndex ( QString name ) |
182 | { | 182 | { |
183 | int counter; | 183 | int counter; |
184 | int items = transactionname->count(); | 184 | int items = transactionname->count(); |
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp index 5408a5b..b83c957 100755 --- a/noncore/apps/qashmoney/preferencedialogs.cpp +++ b/noncore/apps/qashmoney/preferencedialogs.cpp | |||
@@ -1,216 +1,216 @@ | |||
1 | #include "preferencedialogs.h" | 1 | #include "preferencedialogs.h" |
2 | #include "preferences.h" | 2 | #include "preferences.h" |
3 | 3 | ||
4 | extern Preferences *preferences; | 4 | extern Preferences *preferences; |
5 | 5 | ||
6 | DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 6 | DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
7 | { | 7 | { |
8 | setCaption( tr( "Date" ) ); | 8 | setCaption( tr( "Date" ) ); |
9 | 9 | ||
10 | QLabel *datelabel = new QLabel ( "Format", this ); | 10 | QLabel *datelabel = new QLabel ( "Format", this ); |
11 | dateformat = new QComboBox ( this ); | 11 | dateformat = new QComboBox ( this ); |
12 | dateformat->setEditable ( FALSE ); | 12 | dateformat->setEditable ( FALSE ); |
13 | dateformat->insertItem ( "yyyymmdd" ); | 13 | dateformat->insertItem ( "yyyymmdd" ); |
14 | dateformat->insertItem ( "yymmdd" ); | 14 | dateformat->insertItem ( "yymmdd" ); |
15 | dateformat->insertItem ( "mmddyyyy" ); | 15 | dateformat->insertItem ( "mmddyyyy" ); |
16 | dateformat->insertItem ( "mmddyy" ); | 16 | dateformat->insertItem ( "mmddyy" ); |
17 | dateformat->insertItem ( "yyyyddmm" ); | 17 | dateformat->insertItem ( "yyyyddmm" ); |
18 | dateformat->insertItem ( "yyddmm" ); | 18 | dateformat->insertItem ( "yyddmm" ); |
19 | dateformat->insertItem ( "ddmmyyyy" ); | 19 | dateformat->insertItem ( "ddmmyyyy" ); |
20 | dateformat->insertItem ( "ddmmyy" ); | 20 | dateformat->insertItem ( "ddmmyy" ); |
21 | connect ( dateformat, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateFormat ( int ) ) ); | 21 | connect ( dateformat, SIGNAL ( activated(int) ), this, SLOT ( changeDateFormat(int) ) ); |
22 | 22 | ||
23 | QLabel *dateseparatorlabel = new QLabel ( "Separator", this ); | 23 | QLabel *dateseparatorlabel = new QLabel ( "Separator", this ); |
24 | dateseparator = new QComboBox ( this ); | 24 | dateseparator = new QComboBox ( this ); |
25 | dateseparator->insertItem ( "/" ); | 25 | dateseparator->insertItem ( "/" ); |
26 | dateseparator->insertItem ( "-" ); | 26 | dateseparator->insertItem ( "-" ); |
27 | dateseparator->insertItem ( "." ); | 27 | dateseparator->insertItem ( "." ); |
28 | connect ( dateseparator, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateSeparator ( int ) ) ); | 28 | connect ( dateseparator, SIGNAL ( activated(int) ), this, SLOT ( changeDateSeparator(int) ) ); |
29 | 29 | ||
30 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); | 30 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); |
31 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultDatePreferences () ) ); | 31 | connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultDatePreferences() ) ); |
32 | 32 | ||
33 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); | 33 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); |
34 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); | 34 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); |
35 | 35 | ||
36 | layout = new QVBoxLayout ( this, 2, 2 ); | 36 | layout = new QVBoxLayout ( this, 2, 2 ); |
37 | layout->addWidget ( datelabel ); | 37 | layout->addWidget ( datelabel ); |
38 | layout->addWidget ( dateformat ); | 38 | layout->addWidget ( dateformat ); |
39 | layout->addWidget ( dateseparatorlabel ); | 39 | layout->addWidget ( dateseparatorlabel ); |
40 | layout->addWidget ( dateseparator ); | 40 | layout->addWidget ( dateseparator ); |
41 | layout->insertSpacing ( 4, 5 ); | 41 | layout->insertSpacing ( 4, 5 ); |
42 | layout->addWidget ( defaults ); | 42 | layout->addWidget ( defaults ); |
43 | 43 | ||
44 | } | 44 | } |
45 | 45 | ||
46 | DatePreferences::~DatePreferences () | 46 | DatePreferences::~DatePreferences () |
47 | { | 47 | { |
48 | } | 48 | } |
49 | 49 | ||
50 | void DatePreferences::changeDateFormat ( int index ) | 50 | void DatePreferences::changeDateFormat ( int index ) |
51 | { | 51 | { |
52 | index ++; | 52 | index ++; |
53 | preferences->changePreference ( 1, index ); | 53 | preferences->changePreference ( 1, index ); |
54 | } | 54 | } |
55 | 55 | ||
56 | void DatePreferences::changeDateSeparator ( int index ) | 56 | void DatePreferences::changeDateSeparator ( int index ) |
57 | { | 57 | { |
58 | index ++; | 58 | index ++; |
59 | preferences->changePreference ( 2, index ); | 59 | preferences->changePreference ( 2, index ); |
60 | } | 60 | } |
61 | 61 | ||
62 | void DatePreferences::setDefaultDatePreferences () | 62 | void DatePreferences::setDefaultDatePreferences () |
63 | { | 63 | { |
64 | preferences->setDefaultDatePreferences (); | 64 | preferences->setDefaultDatePreferences (); |
65 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); | 65 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); |
66 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); | 66 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); |
67 | } | 67 | } |
68 | 68 | ||
69 | // START TRANSACTION PREFERENCES | 69 | // START TRANSACTION PREFERENCES |
70 | 70 | ||
71 | TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 71 | TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
72 | { | 72 | { |
73 | setCaption( tr ( "Transaction" ) ); | 73 | setCaption( tr ( "Transaction" ) ); |
74 | 74 | ||
75 | showclearedtransactions = new QCheckBox ( this ); | 75 | showclearedtransactions = new QCheckBox ( this ); |
76 | showclearedtransactions->setText ( "Show Cleared Transactions" ); | 76 | showclearedtransactions->setText ( "Show Cleared Transactions" ); |
77 | 77 | ||
78 | limittransactionsbox = new QHBox ( this ); | 78 | limittransactionsbox = new QHBox ( this ); |
79 | limittransactionsbox->setSpacing ( 2 ); | 79 | limittransactionsbox->setSpacing ( 2 ); |
80 | limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); | 80 | limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); |
81 | limittransactions = new QComboBox ( limittransactionsbox ); | 81 | limittransactions = new QComboBox ( limittransactionsbox ); |
82 | QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); | 82 | QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); |
83 | limittransactions->insertItem ( "14 days" ); | 83 | limittransactions->insertItem ( "14 days" ); |
84 | limittransactions->insertItem ( "30 days" ); | 84 | limittransactions->insertItem ( "30 days" ); |
85 | limittransactions->insertItem ( "90 days" ); | 85 | limittransactions->insertItem ( "90 days" ); |
86 | limittransactions->insertItem ( "180 days" ); | 86 | limittransactions->insertItem ( "180 days" ); |
87 | limittransactions->insertItem ( "365 days" ); | 87 | limittransactions->insertItem ( "365 days" ); |
88 | limittransactions->insertItem ( "All" ); | 88 | limittransactions->insertItem ( "All" ); |
89 | limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); | 89 | limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); |
90 | 90 | ||
91 | excludetransfers = new QCheckBox ( this ); | 91 | excludetransfers = new QCheckBox ( this ); |
92 | excludetransfers->setText ( "Include Transfers In Limit View" ); | 92 | excludetransfers->setText ( "Include Transfers In Limit View" ); |
93 | 93 | ||
94 | if ( preferences->getPreference ( 3 ) == 1 ) | 94 | if ( preferences->getPreference ( 3 ) == 1 ) |
95 | showclearedtransactions->setChecked ( TRUE ); | 95 | showclearedtransactions->setChecked ( TRUE ); |
96 | else | 96 | else |
97 | showclearedtransactions->setChecked ( FALSE ); | 97 | showclearedtransactions->setChecked ( FALSE ); |
98 | 98 | ||
99 | if ( preferences->getPreference ( 6 ) == 1 ) | 99 | if ( preferences->getPreference ( 6 ) == 1 ) |
100 | excludetransfers->setChecked ( TRUE ); | 100 | excludetransfers->setChecked ( TRUE ); |
101 | else | 101 | else |
102 | excludetransfers->setChecked ( FALSE ); | 102 | excludetransfers->setChecked ( FALSE ); |
103 | 103 | ||
104 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); | 104 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); |
105 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); | 105 | connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultTransactionPreferences() ) ); |
106 | 106 | ||
107 | layout = new QVBoxLayout ( this, 2, 2 ); | 107 | layout = new QVBoxLayout ( this, 2, 2 ); |
108 | layout->addWidget ( showclearedtransactions ); | 108 | layout->addWidget ( showclearedtransactions ); |
109 | layout->addWidget ( limittransactionsbox ); | 109 | layout->addWidget ( limittransactionsbox ); |
110 | layout->addWidget ( excludetransfers ); | 110 | layout->addWidget ( excludetransfers ); |
111 | layout->insertSpacing ( 3, 5 ); | 111 | layout->insertSpacing ( 3, 5 ); |
112 | layout->addWidget ( defaults ); | 112 | layout->addWidget ( defaults ); |
113 | 113 | ||
114 | connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); | 114 | connect ( showclearedtransactions, SIGNAL ( toggled(bool) ), this, SLOT ( changeShowClearedPreference(bool) ) ); |
115 | connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); | 115 | connect ( excludetransfers, SIGNAL ( toggled(bool) ), this, SLOT ( changeExcludeTranfersPreference(bool) ) ); |
116 | connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); | 116 | connect ( limittransactions, SIGNAL ( activated(int) ), this, SLOT ( changeLimitTransactionsPreference(int) ) ); |
117 | } | 117 | } |
118 | 118 | ||
119 | TransactionPreferences::~TransactionPreferences () | 119 | TransactionPreferences::~TransactionPreferences () |
120 | { | 120 | { |
121 | } | 121 | } |
122 | 122 | ||
123 | void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) | 123 | void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) |
124 | { | 124 | { |
125 | preferences->changePreference ( 7, pref ); | 125 | preferences->changePreference ( 7, pref ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void TransactionPreferences::changeShowClearedPreference ( bool state ) | 128 | void TransactionPreferences::changeShowClearedPreference ( bool state ) |
129 | { | 129 | { |
130 | if ( state == TRUE ) | 130 | if ( state == TRUE ) |
131 | preferences->changePreference ( 3, 1 ); | 131 | preferences->changePreference ( 3, 1 ); |
132 | else | 132 | else |
133 | preferences->changePreference ( 3, 0 ); | 133 | preferences->changePreference ( 3, 0 ); |
134 | } | 134 | } |
135 | 135 | ||
136 | void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) | 136 | void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) |
137 | { | 137 | { |
138 | if ( state == TRUE ) | 138 | if ( state == TRUE ) |
139 | preferences->changePreference ( 6, 1 ); | 139 | preferences->changePreference ( 6, 1 ); |
140 | else | 140 | else |
141 | preferences->changePreference ( 6, 0 ); | 141 | preferences->changePreference ( 6, 0 ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void TransactionPreferences::setDefaultTransactionPreferences () | 144 | void TransactionPreferences::setDefaultTransactionPreferences () |
145 | { | 145 | { |
146 | preferences->changePreference ( 3, 0 ); | 146 | preferences->changePreference ( 3, 0 ); |
147 | preferences->changePreference ( 6, 0 ); | 147 | preferences->changePreference ( 6, 0 ); |
148 | preferences->changePreference ( 7, 0 ); | 148 | preferences->changePreference ( 7, 0 ); |
149 | showclearedtransactions->setChecked ( FALSE ); | 149 | showclearedtransactions->setChecked ( FALSE ); |
150 | limittransactions->setCurrentItem ( 0 ); | 150 | limittransactions->setCurrentItem ( 0 ); |
151 | } | 151 | } |
152 | 152 | ||
153 | // START ACCOUNT PREFERNCES | 153 | // START ACCOUNT PREFERNCES |
154 | 154 | ||
155 | AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 155 | AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
156 | { | 156 | { |
157 | 157 | ||
158 | setCaption( tr ( "Account" ) ); | 158 | setCaption( tr ( "Account" ) ); |
159 | 159 | ||
160 | currencysupport = new QCheckBox ( this ); | 160 | currencysupport = new QCheckBox ( this ); |
161 | currencysupport->setText ( "Enable Currency Support" ); | 161 | currencysupport->setText ( "Enable Currency Support" ); |
162 | 162 | ||
163 | onetouch = new QCheckBox ( this ); | 163 | onetouch = new QCheckBox ( this ); |
164 | onetouch->setText ( "One Touch Account Viewing" ); | 164 | onetouch->setText ( "One Touch Account Viewing" ); |
165 | 165 | ||
166 | if ( preferences->getPreference ( 4 ) == 1 ) | 166 | if ( preferences->getPreference ( 4 ) == 1 ) |
167 | currencysupport->setChecked ( TRUE ); | 167 | currencysupport->setChecked ( TRUE ); |
168 | else | 168 | else |
169 | currencysupport->setChecked ( FALSE ); | 169 | currencysupport->setChecked ( FALSE ); |
170 | 170 | ||
171 | if ( preferences->getPreference ( 5 ) == 1 ) | 171 | if ( preferences->getPreference ( 5 ) == 1 ) |
172 | onetouch->setChecked ( TRUE ); | 172 | onetouch->setChecked ( TRUE ); |
173 | else | 173 | else |
174 | onetouch->setChecked ( FALSE ); | 174 | onetouch->setChecked ( FALSE ); |
175 | 175 | ||
176 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); | 176 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); |
177 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultAccountPreferences () ) ); | 177 | connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultAccountPreferences() ) ); |
178 | 178 | ||
179 | layout = new QVBoxLayout ( this, 2, 2 ); | 179 | layout = new QVBoxLayout ( this, 2, 2 ); |
180 | layout->addWidget ( currencysupport ); | 180 | layout->addWidget ( currencysupport ); |
181 | layout->addWidget ( onetouch ); | 181 | layout->addWidget ( onetouch ); |
182 | layout->insertSpacing ( 2, 5 ); | 182 | layout->insertSpacing ( 2, 5 ); |
183 | layout->addWidget ( defaults ); | 183 | layout->addWidget ( defaults ); |
184 | 184 | ||
185 | connect ( currencysupport, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeCurrencySupport ( bool ) ) ); | 185 | connect ( currencysupport, SIGNAL ( toggled(bool) ), this, SLOT ( changeCurrencySupport(bool) ) ); |
186 | connect ( onetouch, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeOneTouchViewing ( bool ) ) ); | 186 | connect ( onetouch, SIGNAL ( toggled(bool) ), this, SLOT ( changeOneTouchViewing(bool) ) ); |
187 | } | 187 | } |
188 | 188 | ||
189 | AccountPreferences::~AccountPreferences () | 189 | AccountPreferences::~AccountPreferences () |
190 | { | 190 | { |
191 | } | 191 | } |
192 | 192 | ||
193 | void AccountPreferences::changeCurrencySupport ( bool state ) | 193 | void AccountPreferences::changeCurrencySupport ( bool state ) |
194 | { | 194 | { |
195 | if ( state == TRUE ) | 195 | if ( state == TRUE ) |
196 | preferences->changePreference ( 4, 1 ); | 196 | preferences->changePreference ( 4, 1 ); |
197 | else | 197 | else |
198 | preferences->changePreference ( 4, 0 ); | 198 | preferences->changePreference ( 4, 0 ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void AccountPreferences::changeOneTouchViewing ( bool state ) | 201 | void AccountPreferences::changeOneTouchViewing ( bool state ) |
202 | { | 202 | { |
203 | if ( state == TRUE ) | 203 | if ( state == TRUE ) |
204 | preferences->changePreference ( 5, 1 ); | 204 | preferences->changePreference ( 5, 1 ); |
205 | else | 205 | else |
206 | preferences->changePreference ( 5, 0 ); | 206 | preferences->changePreference ( 5, 0 ); |
207 | } | 207 | } |
208 | 208 | ||
209 | void AccountPreferences::setDefaultAccountPreferences () | 209 | void AccountPreferences::setDefaultAccountPreferences () |
210 | { | 210 | { |
211 | preferences->changePreference ( 4, 0 ); | 211 | preferences->changePreference ( 4, 0 ); |
212 | preferences->changePreference ( 5, 0 ); | 212 | preferences->changePreference ( 5, 0 ); |
213 | currencysupport->setChecked ( FALSE ); | 213 | currencysupport->setChecked ( FALSE ); |
214 | onetouch->setChecked ( FALSE ); | 214 | onetouch->setChecked ( FALSE ); |
215 | } | 215 | } |
216 | 216 | ||
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index d4cbc14..1455eb0 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -1,166 +1,166 @@ | |||
1 | #include "qashmoney.h" | 1 | #include "qashmoney.h" |
2 | #include "preferencedialogs.h" | 2 | #include "preferencedialogs.h" |
3 | #include "memorydialog.h" | 3 | #include "memorydialog.h" |
4 | 4 | ||
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | 6 | ||
7 | Budget *budget = new Budget (); | 7 | Budget *budget = new Budget (); |
8 | Preferences *preferences = new Preferences (); | 8 | Preferences *preferences = new Preferences (); |
9 | Account *account = new Account (); | 9 | Account *account = new Account (); |
10 | Transaction *transaction = new Transaction (); | 10 | Transaction *transaction = new Transaction (); |
11 | Transfer *transfer = new Transfer (); | 11 | Transfer *transfer = new Transfer (); |
12 | Memory *memory = new Memory (); | 12 | Memory *memory = new Memory (); |
13 | 13 | ||
14 | QashMoney::QashMoney () : QWidget () | 14 | QashMoney::QashMoney () : QWidget () |
15 | { | 15 | { |
16 | preferences->addPreferences (); | 16 | preferences->addPreferences (); |
17 | preferences->initializeColumnPreferences (); | 17 | preferences->initializeColumnPreferences (); |
18 | preferences->initializeSortingPreferences (); | 18 | preferences->initializeSortingPreferences (); |
19 | 19 | ||
20 | // set the text in the upper part of the frame | 20 | // set the text in the upper part of the frame |
21 | setCaption ( tr ( "QashMoney" ) ); | 21 | setCaption ( tr ( "QashMoney" ) ); |
22 | 22 | ||
23 | // Create new menubar for our mainwindow | 23 | // Create new menubar for our mainwindow |
24 | // and add menu items | 24 | // and add menu items |
25 | mainmenu = new QMenuBar ( this ); | 25 | mainmenu = new QMenuBar ( this ); |
26 | mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 26 | mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
27 | preferencesmenu = new QPopupMenu ( this ); | 27 | preferencesmenu = new QPopupMenu ( this ); |
28 | utilitiesmenu = new QPopupMenu ( this ); | 28 | utilitiesmenu = new QPopupMenu ( this ); |
29 | mainmenu->insertItem ( "Preferences", preferencesmenu ); | 29 | mainmenu->insertItem ( "Preferences", preferencesmenu ); |
30 | mainmenu->insertItem ( "Utilities", utilitiesmenu ); | 30 | mainmenu->insertItem ( "Utilities", utilitiesmenu ); |
31 | preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) ); | 31 | preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog() ) ); |
32 | preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) ); | 32 | preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog() ) ); |
33 | preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) ); | 33 | preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog() ) ); |
34 | utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) ); | 34 | utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog() ) ); |
35 | 35 | ||
36 | // create the main tabwidget for displaying accounts and transactions | 36 | // create the main tabwidget for displaying accounts and transactions |
37 | maintabs = new QTabWidget ( this ); | 37 | maintabs = new QTabWidget ( this ); |
38 | tab = new QWidget ( this ); | 38 | tab = new QWidget ( this ); |
39 | tab_2 = new QWidget ( this ); | 39 | tab_2 = new QWidget ( this ); |
40 | tab_3 = new QWidget ( this ); | 40 | tab_3 = new QWidget ( this ); |
41 | maintabs->addTab ( tab, "Accounts" ); | 41 | maintabs->addTab ( tab, "Accounts" ); |
42 | maintabs->addTab ( tab_2, "Transactions" ); | 42 | maintabs->addTab ( tab_2, "Transactions" ); |
43 | maintabs->addTab ( tab_3, "Budgets" ); | 43 | maintabs->addTab ( tab_3, "Budgets" ); |
44 | tabheight = tab->height(); | 44 | tabheight = tab->height(); |
45 | maintabs->setTabEnabled ( tab_2, FALSE ); | 45 | maintabs->setTabEnabled ( tab_2, FALSE ); |
46 | 46 | ||
47 | // create a new account display object | 47 | // create a new account display object |
48 | accountdisplay = new AccountDisplay ( maintabs ); | 48 | accountdisplay = new AccountDisplay ( maintabs ); |
49 | accountdisplay->setTabs ( tab_2, maintabs ); | 49 | accountdisplay->setTabs ( tab_2, maintabs ); |
50 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) ); | 50 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( setTransactionTab() ) ); |
51 | 51 | ||
52 | // set the connection to disable the one touch account viewing if we are transfering money | 52 | // set the connection to disable the one touch account viewing if we are transfering money |
53 | connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) ); | 53 | connect ( accountdisplay->transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( toggleOneTouchViewing(bool) ) ); |
54 | 54 | ||
55 | // create a new transactiondisplay object | 55 | // create a new transactiondisplay object |
56 | transactiondisplay = new TransactionDisplay ( maintabs ); | 56 | transactiondisplay = new TransactionDisplay ( maintabs ); |
57 | transactiondisplay->hide(); | 57 | transactiondisplay->hide(); |
58 | 58 | ||
59 | // create new budgetdisplay object | 59 | // create new budgetdisplay object |
60 | budgetdisplay = new BudgetDisplay ( maintabs ); | 60 | budgetdisplay = new BudgetDisplay ( maintabs ); |
61 | budgetdisplay->hide(); | 61 | budgetdisplay->hide(); |
62 | 62 | ||
63 | tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); | 63 | tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); |
64 | tabslayout->addSpacing ( tabheight ); | 64 | tabslayout->addSpacing ( tabheight ); |
65 | tabslayout->addWidget ( accountdisplay ); | 65 | tabslayout->addWidget ( accountdisplay ); |
66 | tabslayout->addWidget ( transactiondisplay ); | 66 | tabslayout->addWidget ( transactiondisplay ); |
67 | tabslayout->addWidget ( budgetdisplay ); | 67 | tabslayout->addWidget ( budgetdisplay ); |
68 | 68 | ||
69 | // connect a change in the maintabs with changing the tab display | 69 | // connect a change in the maintabs with changing the tab display |
70 | connect ( maintabs, SIGNAL ( currentChanged ( QWidget * ) ), this, SLOT ( changeTabDisplay () ) ); | 70 | connect ( maintabs, SIGNAL ( currentChanged(QWidget*) ), this, SLOT ( changeTabDisplay() ) ); |
71 | 71 | ||
72 | // create layout that will contain the menubar and the maintabs | 72 | // create layout that will contain the menubar and the maintabs |
73 | layout = new QVBoxLayout ( this, 2, 2 ); | 73 | layout = new QVBoxLayout ( this, 2, 2 ); |
74 | layout->setMenuBar ( mainmenu ); | 74 | layout->setMenuBar ( mainmenu ); |
75 | layout->addWidget ( maintabs ); | 75 | layout->addWidget ( maintabs ); |
76 | } | 76 | } |
77 | 77 | ||
78 | QashMoney::~QashMoney () | 78 | QashMoney::~QashMoney () |
79 | { | 79 | { |
80 | delete budget; | 80 | delete budget; |
81 | delete preferences; | 81 | delete preferences; |
82 | delete account; | 82 | delete account; |
83 | delete transaction; | 83 | delete transaction; |
84 | delete transfer; | 84 | delete transfer; |
85 | delete memory; | 85 | delete memory; |
86 | } | 86 | } |
87 | 87 | ||
88 | void QashMoney::changeTabDisplay () | 88 | void QashMoney::changeTabDisplay () |
89 | { | 89 | { |
90 | // if the user pressed the transactions tab, hide the account display | 90 | // if the user pressed the transactions tab, hide the account display |
91 | // object and create a new transaction display | 91 | // object and create a new transaction display |
92 | if ( maintabs->currentPageIndex() == 1 ) | 92 | if ( maintabs->currentPageIndex() == 1 ) |
93 | { | 93 | { |
94 | // initialize variables | 94 | // initialize variables |
95 | bool children = FALSE; | 95 | bool children = FALSE; |
96 | 96 | ||
97 | // hide the account display and define accountid | 97 | // hide the account display and define accountid |
98 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); | 98 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); |
99 | 99 | ||
100 | //remove all the columns from the transactiondisplay | 100 | //remove all the columns from the transactiondisplay |
101 | int columns = transactiondisplay->listview->columns(); | 101 | int columns = transactiondisplay->listview->columns(); |
102 | int counter; | 102 | int counter; |
103 | for ( counter = 0; counter <= columns; counter++ ) | 103 | for ( counter = 0; counter <= columns; counter++ ) |
104 | transactiondisplay->listview->removeColumn ( 0 ); | 104 | transactiondisplay->listview->removeColumn ( 0 ); |
105 | 105 | ||
106 | // set the account name and account balance | 106 | // set the account name and account balance |
107 | QString name = account->getAccountName ( accountid ); | 107 | QString name = account->getAccountName ( accountid ); |
108 | QString balance = account->getAccountBalance ( accountid ); | 108 | QString balance = account->getAccountBalance ( accountid ); |
109 | transactiondisplay->name->setText ( name ); | 109 | transactiondisplay->name->setText ( name ); |
110 | transactiondisplay->balance->setText ( balance ); | 110 | transactiondisplay->balance->setText ( balance ); |
111 | 111 | ||
112 | // clear the limitbox | 112 | // clear the limitbox |
113 | transactiondisplay->limitbox->clear(); | 113 | transactiondisplay->limitbox->clear(); |
114 | 114 | ||
115 | // get parent account id | 115 | // get parent account id |
116 | int parentaccountid = account->getParentAccountID ( accountid ); | 116 | int parentaccountid = account->getParentAccountID ( accountid ); |
117 | 117 | ||
118 | // add columns based on which account is selected | 118 | // add columns based on which account is selected |
119 | // this first if determines if we selected a parent with no children or a child | 119 | // this first if determines if we selected a parent with no children or a child |
120 | // in these cases, we add standard three columns for date, transaction, amount | 120 | // in these cases, we add standard three columns for date, transaction, amount |
121 | transactiondisplay->listview->addColumn ( "Date", 0 ); | 121 | transactiondisplay->listview->addColumn ( "Date", 0 ); |
122 | transactiondisplay->listview->addColumn ( "Transaction", 0 ); | 122 | transactiondisplay->listview->addColumn ( "Transaction", 0 ); |
123 | transactiondisplay->listview->addColumn ( "Amt", 0); | 123 | transactiondisplay->listview->addColumn ( "Amt", 0); |
124 | transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight ); | 124 | transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight ); |
125 | transactiondisplay->listview->addColumn ( "", 0 ); | 125 | transactiondisplay->listview->addColumn ( "", 0 ); |
126 | 126 | ||
127 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children | 127 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children |
128 | { | 128 | { |
129 | // add an extra column for the account name for eac child transaction | 129 | // add an extra column for the account name for eac child transaction |
130 | transactiondisplay->listview->addColumn ( "Acct", 0 ); | 130 | transactiondisplay->listview->addColumn ( "Acct", 0 ); |
131 | children = TRUE; | 131 | children = TRUE; |
132 | 132 | ||
133 | // hide the new transaction button | 133 | // hide the new transaction button |
134 | transactiondisplay->newtransaction->setEnabled ( FALSE ); | 134 | transactiondisplay->newtransaction->setEnabled ( FALSE ); |
135 | } | 135 | } |
136 | else //we selected a parent without children or a child | 136 | else //we selected a parent without children or a child |
137 | transactiondisplay->newtransaction->setEnabled ( TRUE ); | 137 | transactiondisplay->newtransaction->setEnabled ( TRUE ); |
138 | 138 | ||
139 | // disable the transactionid column so it can't be red | 139 | // disable the transactionid column so it can't be red |
140 | transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); | 140 | transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); |
141 | 141 | ||
142 | // set the accountid and children variables | 142 | // set the accountid and children variables |
143 | transactiondisplay->setChildren ( children ); | 143 | transactiondisplay->setChildren ( children ); |
144 | transactiondisplay->setAccountID ( accountid ); | 144 | transactiondisplay->setAccountID ( accountid ); |
145 | 145 | ||
146 | setTransactionDisplayDate (); | 146 | setTransactionDisplayDate (); |
147 | 147 | ||
148 | // display transactions | 148 | // display transactions |
149 | transactiondisplay->listview->clear(); | 149 | transactiondisplay->listview->clear(); |
150 | QString displaytext = "%"; | 150 | QString displaytext = "%"; |
151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
152 | if ( transaction->getNumberOfTransactions() > 0 ) | 152 | if ( transaction->getNumberOfTransactions() > 0 ) |
153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
154 | 154 | ||
155 | // display transfers | 155 | // display transfers |
156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); | 156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
157 | 157 | ||
158 | // open a new preferences object and resize the transaction display columns | 158 | // open a new preferences object and resize the transaction display columns |
159 | // each column will have a different size based on whether we are looking at a child | 159 | // each column will have a different size based on whether we are looking at a child |
160 | // account or children through a parent | 160 | // account or children through a parent |
161 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns | 161 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns |
162 | { | 162 | { |
163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width | 163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width |
164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width | 165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width |
166 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); | 166 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); |
@@ -259,144 +259,144 @@ void QashMoney::displayDatePreferencesDialog () | |||
259 | // set children so we can let displayTransfers know if there are children for the selected account | 259 | // set children so we can let displayTransfers know if there are children for the selected account |
260 | bool children; | 260 | bool children; |
261 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 261 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
262 | children = TRUE; | 262 | children = TRUE; |
263 | else | 263 | else |
264 | children = FALSE; | 264 | children = FALSE; |
265 | 265 | ||
266 | // redisplay transactions if they are visible incorporating | 266 | // redisplay transactions if they are visible incorporating |
267 | // any changes to the date format | 267 | // any changes to the date format |
268 | transactiondisplay->listview->clear(); | 268 | transactiondisplay->listview->clear(); |
269 | QString displaytext = "%"; | 269 | QString displaytext = "%"; |
270 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 270 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
271 | 271 | ||
272 | setTransactionDisplayDate(); | 272 | setTransactionDisplayDate(); |
273 | if ( transaction->getNumberOfTransactions() > 0 ) | 273 | if ( transaction->getNumberOfTransactions() > 0 ) |
274 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 274 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
275 | 275 | ||
276 | if ( transfer->getNumberOfTransfers() != 0 ) | 276 | if ( transfer->getNumberOfTransfers() != 0 ) |
277 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); | 277 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
278 | } | 278 | } |
279 | else if ( accountdisplay->isVisible() ) | 279 | else if ( accountdisplay->isVisible() ) |
280 | { | 280 | { |
281 | accountdisplay->listview->clearSelection(); | 281 | accountdisplay->listview->clearSelection(); |
282 | maintabs->setTabEnabled ( tab_2, FALSE ); | 282 | maintabs->setTabEnabled ( tab_2, FALSE ); |
283 | } | 283 | } |
284 | else | 284 | else |
285 | budgetdisplay->updateBudgetInformation(); | 285 | budgetdisplay->updateBudgetInformation(); |
286 | } | 286 | } |
287 | 287 | ||
288 | void QashMoney::displayTransactionPreferencesDialog () | 288 | void QashMoney::displayTransactionPreferencesDialog () |
289 | { | 289 | { |
290 | // display a dialog for setting preferences for transactions | 290 | // display a dialog for setting preferences for transactions |
291 | TransactionPreferences *td = new TransactionPreferences ( this ); | 291 | TransactionPreferences *td = new TransactionPreferences ( this ); |
292 | td->exec (); | 292 | td->exec (); |
293 | if ( transactiondisplay->isVisible() ) | 293 | if ( transactiondisplay->isVisible() ) |
294 | { | 294 | { |
295 | // set the account id | 295 | // set the account id |
296 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); | 296 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); |
297 | 297 | ||
298 | // set children so we can let displayTransfers know if there are children for the selected account | 298 | // set children so we can let displayTransfers know if there are children for the selected account |
299 | bool children; | 299 | bool children; |
300 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 300 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
301 | children = TRUE; | 301 | children = TRUE; |
302 | else | 302 | else |
303 | children = FALSE; | 303 | children = FALSE; |
304 | 304 | ||
305 | // redisplay transactions incorporating any transaction preference changes | 305 | // redisplay transactions incorporating any transaction preference changes |
306 | transactiondisplay->listview->clear(); | 306 | transactiondisplay->listview->clear(); |
307 | QString displaytext = "%"; | 307 | QString displaytext = "%"; |
308 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 308 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
309 | 309 | ||
310 | setTransactionDisplayDate(); | 310 | setTransactionDisplayDate(); |
311 | if ( transaction->getNumberOfTransactions() > 0 ) | 311 | if ( transaction->getNumberOfTransactions() > 0 ) |
312 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 312 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
313 | 313 | ||
314 | if ( transfer->getNumberOfTransfers() != 0 ) | 314 | if ( transfer->getNumberOfTransfers() != 0 ) |
315 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); | 315 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
316 | } | 316 | } |
317 | else | 317 | else |
318 | { | 318 | { |
319 | accountdisplay->listview->clearSelection(); | 319 | accountdisplay->listview->clearSelection(); |
320 | maintabs->setTabEnabled ( tab_2, FALSE ); | 320 | maintabs->setTabEnabled ( tab_2, FALSE ); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | void QashMoney::displayAccountPreferencesDialog () | 324 | void QashMoney::displayAccountPreferencesDialog () |
325 | { | 325 | { |
326 | // display a dialog for setting preferences for accounts | 326 | // display a dialog for setting preferences for accounts |
327 | AccountPreferences *ap = new AccountPreferences ( this ); | 327 | AccountPreferences *ap = new AccountPreferences ( this ); |
328 | ap->exec (); | 328 | ap->exec (); |
329 | 329 | ||
330 | if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) | 330 | if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) |
331 | { | 331 | { |
332 | accountdisplay->listview->clear(); | 332 | accountdisplay->listview->clear(); |
333 | account->displayAccounts ( accountdisplay->listview ); | 333 | account->displayAccounts ( accountdisplay->listview ); |
334 | accountdisplay->listview->clearSelection(); | 334 | accountdisplay->listview->clearSelection(); |
335 | maintabs->setTabEnabled ( tab_2, FALSE ); | 335 | maintabs->setTabEnabled ( tab_2, FALSE ); |
336 | } | 336 | } |
337 | changeTabDisplay(); | 337 | changeTabDisplay(); |
338 | } | 338 | } |
339 | 339 | ||
340 | void QashMoney::displayMemoryDialog () | 340 | void QashMoney::displayMemoryDialog () |
341 | { | 341 | { |
342 | // opens a dialog to add, edit and delete memory items | 342 | // opens a dialog to add, edit and delete memory items |
343 | MemoryDialog *md = new MemoryDialog (); | 343 | MemoryDialog *md = new MemoryDialog (); |
344 | md->exec(); | 344 | md->exec(); |
345 | } | 345 | } |
346 | 346 | ||
347 | void QashMoney::showTransactions () | 347 | void QashMoney::showTransactions () |
348 | { | 348 | { |
349 | maintabs->setCurrentPage ( 1 ); | 349 | maintabs->setCurrentPage ( 1 ); |
350 | } | 350 | } |
351 | 351 | ||
352 | void QashMoney::enableOneTouchViewing () | 352 | void QashMoney::enableOneTouchViewing () |
353 | { | 353 | { |
354 | if ( preferences->getPreference ( 5 ) == 1 ) | 354 | if ( preferences->getPreference ( 5 ) == 1 ) |
355 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 355 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); |
356 | else | 356 | else |
357 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 357 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); |
358 | } | 358 | } |
359 | 359 | ||
360 | void QashMoney::disableOneTouchViewing () | 360 | void QashMoney::disableOneTouchViewing () |
361 | { | 361 | { |
362 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 362 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); |
363 | } | 363 | } |
364 | 364 | ||
365 | void QashMoney::toggleOneTouchViewing ( bool state ) | 365 | void QashMoney::toggleOneTouchViewing ( bool state ) |
366 | { | 366 | { |
367 | if ( state == TRUE ) | 367 | if ( state == TRUE ) |
368 | disableOneTouchViewing(); | 368 | disableOneTouchViewing(); |
369 | else | 369 | else |
370 | enableOneTouchViewing(); | 370 | enableOneTouchViewing(); |
371 | } | 371 | } |
372 | 372 | ||
373 | void QashMoney::setTransactionDisplayDate () | 373 | void QashMoney::setTransactionDisplayDate () |
374 | { | 374 | { |
375 | // determine how many days of transactions to show | 375 | // determine how many days of transactions to show |
376 | int limittype = preferences->getPreference ( 7 ); | 376 | int limittype = preferences->getPreference ( 7 ); |
377 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | 377 | if ( limittype != 5 ) // set today's date if we are not showing all transactions |
378 | { | 378 | { |
379 | QDate today = QDate::currentDate (); | 379 | QDate today = QDate::currentDate (); |
380 | switch ( limittype ) // if we are not showing all transactions | 380 | switch ( limittype ) // if we are not showing all transactions |
381 | { | 381 | { |
382 | case 0: // viewing two weeks | 382 | case 0: // viewing two weeks |
383 | newdate = today.addDays ( -14 ); | 383 | newdate = today.addDays ( -14 ); |
384 | break; | 384 | break; |
385 | case 1: // viewing one month | 385 | case 1: // viewing one month |
386 | newdate = today.addDays ( -30 ); | 386 | newdate = today.addDays ( -30 ); |
387 | break; | 387 | break; |
388 | case 2: // three months | 388 | case 2: // three months |
389 | newdate = today.addDays ( -90 ); | 389 | newdate = today.addDays ( -90 ); |
390 | break; | 390 | break; |
391 | case 3: // six months | 391 | case 3: // six months |
392 | newdate = today.addDays ( -180 ); | 392 | newdate = today.addDays ( -180 ); |
393 | break; | 393 | break; |
394 | case 4: // one year | 394 | case 4: // one year |
395 | newdate = today.addDays ( -365 ); | 395 | newdate = today.addDays ( -365 ); |
396 | break; | 396 | break; |
397 | } | 397 | } |
398 | } | 398 | } |
399 | else | 399 | else |
400 | newdate = QDate ( 1900, 1, 1 ); | 400 | newdate = QDate ( 1900, 1, 1 ); |
401 | } | 401 | } |
402 | 402 | ||
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index 474f11e..0b94d62 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -1,312 +1,312 @@ | |||
1 | #include "transactiondisplay.h" | 1 | #include "transactiondisplay.h" |
2 | #include "newtransaction.h" | 2 | #include "newtransaction.h" |
3 | #include "account.h" | 3 | #include "account.h" |
4 | #include "budget.h" | 4 | #include "budget.h" |
5 | #include "memory.h" | 5 | #include "memory.h" |
6 | #include "transfer.h" | 6 | #include "transfer.h" |
7 | #include "calculator.h" | 7 | #include "calculator.h" |
8 | #include "datepicker.h" | 8 | #include "datepicker.h" |
9 | 9 | ||
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include <qheader.h> | 11 | #include <qheader.h> |
12 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
13 | 13 | ||
14 | extern Transaction *transaction; | 14 | extern Transaction *transaction; |
15 | extern Budget *budget; | 15 | extern Budget *budget; |
16 | extern Account *account; | 16 | extern Account *account; |
17 | extern Preferences *preferences; | 17 | extern Preferences *preferences; |
18 | extern Memory *memory; | 18 | extern Memory *memory; |
19 | extern Transfer *transfer; | 19 | extern Transfer *transfer; |
20 | 20 | ||
21 | TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) | 21 | TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) |
22 | { | 22 | { |
23 | // set transactiondisplay variables; | 23 | // set transactiondisplay variables; |
24 | accountid = 0; | 24 | accountid = 0; |
25 | children = TRUE; | 25 | children = TRUE; |
26 | 26 | ||
27 | firstline = new QHBox ( this ); | 27 | firstline = new QHBox ( this ); |
28 | firstline->setSpacing ( 2 ); | 28 | firstline->setSpacing ( 2 ); |
29 | 29 | ||
30 | newtransaction = new QPushButton ( firstline ); | 30 | newtransaction = new QPushButton ( firstline ); |
31 | newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); | 31 | newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); |
32 | connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) ); | 32 | connect ( newtransaction, SIGNAL ( released() ), this, SLOT ( addTransaction() ) ); |
33 | 33 | ||
34 | edittransaction = new QPushButton ( firstline ); | 34 | edittransaction = new QPushButton ( firstline ); |
35 | edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); | 35 | edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); |
36 | connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) ); | 36 | connect ( edittransaction, SIGNAL ( released() ), this, SLOT ( checkListViewEdit() ) ); |
37 | 37 | ||
38 | deletetransaction = new QPushButton ( firstline ); | 38 | deletetransaction = new QPushButton ( firstline ); |
39 | deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); | 39 | deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); |
40 | connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) ); | 40 | connect ( deletetransaction, SIGNAL ( released() ), this, SLOT ( checkListViewDelete() ) ); |
41 | 41 | ||
42 | toggletransaction = new QPushButton ( firstline ); | 42 | toggletransaction = new QPushButton ( firstline ); |
43 | toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); | 43 | toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); |
44 | connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) ); | 44 | connect ( toggletransaction, SIGNAL ( released() ), this, SLOT ( checkListViewToggle() ) ); |
45 | 45 | ||
46 | viewtransactionnotes = new QPushButton ( firstline ); | 46 | viewtransactionnotes = new QPushButton ( firstline ); |
47 | viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); | 47 | viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); |
48 | connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) ); | 48 | connect ( viewtransactionnotes, SIGNAL ( released() ), this, SLOT ( showTransactionNotes() ) ); |
49 | 49 | ||
50 | secondline = new QHBox ( this ); | 50 | secondline = new QHBox ( this ); |
51 | secondline->setSpacing ( 5 ); | 51 | secondline->setSpacing ( 5 ); |
52 | 52 | ||
53 | name = new QLabel ( secondline ); | 53 | name = new QLabel ( secondline ); |
54 | balance = new QLabel ( secondline ); | 54 | balance = new QLabel ( secondline ); |
55 | 55 | ||
56 | QLabel *limit = new QLabel ( "Limit", secondline ); | 56 | QLabel *limit = new QLabel ( "Limit", secondline ); |
57 | limitbox = new QLineEdit ( secondline ); | 57 | limitbox = new QLineEdit ( secondline ); |
58 | limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); | 58 | limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); |
59 | connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); | 59 | connect ( limitbox, SIGNAL ( textChanged(const QString&) ), this, SLOT ( limitDisplay(const QString&) ) ); |
60 | 60 | ||
61 | listview = new QListView ( this ); | 61 | listview = new QListView ( this ); |
62 | listview->setAllColumnsShowFocus ( TRUE ); | 62 | listview->setAllColumnsShowFocus ( TRUE ); |
63 | listview->setShowSortIndicator ( TRUE ); | 63 | listview->setShowSortIndicator ( TRUE ); |
64 | listview->header()->setTracking ( FALSE ); | 64 | listview->header()->setTracking ( FALSE ); |
65 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 65 | connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); |
66 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | 66 | connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); |
67 | 67 | ||
68 | layout = new QVBoxLayout ( this, 2, 2 ); | 68 | layout = new QVBoxLayout ( this, 2, 2 ); |
69 | layout->addWidget ( firstline ); | 69 | layout->addWidget ( firstline ); |
70 | layout->addWidget ( secondline ); | 70 | layout->addWidget ( secondline ); |
71 | layout->addWidget ( listview ); | 71 | layout->addWidget ( listview ); |
72 | } | 72 | } |
73 | 73 | ||
74 | void TransactionDisplay::addTransaction () | 74 | void TransactionDisplay::addTransaction () |
75 | { | 75 | { |
76 | // create local variables | 76 | // create local variables |
77 | int cleared = -1; | 77 | int cleared = -1; |
78 | 78 | ||
79 | // create new transaction window | 79 | // create new transaction window |
80 | NewTransaction *newtransaction = new NewTransaction ( this ); | 80 | NewTransaction *newtransaction = new NewTransaction ( this ); |
81 | int width = this->size().width(); | 81 | int width = this->size().width(); |
82 | newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); | 82 | newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); |
83 | newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); | 83 | newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); |
84 | newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); | 84 | newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); |
85 | newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 85 | newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
86 | newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 86 | newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
87 | newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); | 87 | newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); |
88 | 88 | ||
89 | // enter today's date in the date box as defaul | 89 | // enter today's date in the date box as defaul |
90 | QDate today = QDate::currentDate (); | 90 | QDate today = QDate::currentDate (); |
91 | int defaultday = today.day(); | 91 | int defaultday = today.day(); |
92 | int defaultmonth = today.month(); | 92 | int defaultmonth = today.month(); |
93 | int defaultyear = today.year(); | 93 | int defaultyear = today.year(); |
94 | newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); | 94 | newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); |
95 | 95 | ||
96 | // add memory items to the transactionname combobox | 96 | // add memory items to the transactionname combobox |
97 | memory->displayMemoryItems ( newtransaction->transactionname ); | 97 | memory->displayMemoryItems ( newtransaction->transactionname ); |
98 | newtransaction->transactionname->insertItem ( "", 0 ); | 98 | newtransaction->transactionname->insertItem ( "", 0 ); |
99 | 99 | ||
100 | if ( newtransaction->exec () == QDialog::Accepted ) | 100 | if ( newtransaction->exec () == QDialog::Accepted ) |
101 | { | 101 | { |
102 | if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction | 102 | if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction |
103 | cleared = 1; | 103 | cleared = 1; |
104 | else | 104 | else |
105 | cleared = 0; | 105 | cleared = 0; |
106 | 106 | ||
107 | float amount = newtransaction->transactionamount->text().toFloat(); | 107 | float amount = newtransaction->transactionamount->text().toFloat(); |
108 | if ( newtransaction->depositbox->isChecked() == FALSE ) | 108 | if ( newtransaction->depositbox->isChecked() == FALSE ) |
109 | amount = amount * -1; | 109 | amount = amount * -1; |
110 | 110 | ||
111 | // add the transaction name to the memory items | 111 | // add the transaction name to the memory items |
112 | memory->addMemoryItem ( newtransaction->transactionname->currentText() ); | 112 | memory->addMemoryItem ( newtransaction->transactionname->currentText() ); |
113 | 113 | ||
114 | // add the transaction | 114 | // add the transaction |
115 | if ( newtransaction->getDateEdited () == TRUE ) | 115 | if ( newtransaction->getDateEdited () == TRUE ) |
116 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), | 116 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), |
117 | newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(), | 117 | newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(), |
118 | newtransaction->getCurrentLineItem() ); | 118 | newtransaction->getCurrentLineItem() ); |
119 | else | 119 | else |
120 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), | 120 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), |
121 | newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); | 121 | newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); |
122 | 122 | ||
123 | // redisplay transactions | 123 | // redisplay transactions |
124 | listview->clear(); | 124 | listview->clear(); |
125 | QString displaytext = "%"; | 125 | QString displaytext = "%"; |
126 | displaytext.prepend ( limitbox->text() ); | 126 | displaytext.prepend ( limitbox->text() ); |
127 | setTransactionDisplayDate (); | 127 | setTransactionDisplayDate (); |
128 | if ( transaction->getNumberOfTransactions() > 0 ) | 128 | if ( transaction->getNumberOfTransactions() > 0 ) |
129 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 129 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
130 | 130 | ||
131 | // redisplay transfers | 131 | // redisplay transfers |
132 | if ( transfer->getNumberOfTransfers() > 0 ) | 132 | if ( transfer->getNumberOfTransfers() > 0 ) |
133 | transfer->displayTransfers ( listview, accountid, children, displaydate ); | 133 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
134 | 134 | ||
135 | // add the transaction amount to the account it's associated with | 135 | // add the transaction amount to the account it's associated with |
136 | // and update its parent account balance if necessary | 136 | // and update its parent account balance if necessary |
137 | account->updateAccountBalance ( accountid ); | 137 | account->updateAccountBalance ( accountid ); |
138 | if ( account->getParentAccountID ( accountid ) != -1 ) | 138 | if ( account->getParentAccountID ( accountid ) != -1 ) |
139 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); | 139 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); |
140 | 140 | ||
141 | // format then reset the account balance | 141 | // format then reset the account balance |
142 | redisplayAccountBalance (); | 142 | redisplayAccountBalance (); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void TransactionDisplay::checkListViewEdit () | 146 | void TransactionDisplay::checkListViewEdit () |
147 | { | 147 | { |
148 | if ( listview->selectedItem() == 0 ) | 148 | if ( listview->selectedItem() == 0 ) |
149 | QMessageBox::warning ( this, "QashMoney", "Please select a transaction\nto edit."); | 149 | QMessageBox::warning ( this, "QashMoney", "Please select a transaction\nto edit."); |
150 | else if ( listview->currentItem()->text ( getIDColumn() ).toInt() < 0 ) | 150 | else if ( listview->currentItem()->text ( getIDColumn() ).toInt() < 0 ) |
151 | editTransfer (); | 151 | editTransfer (); |
152 | else | 152 | else |
153 | editTransaction(); | 153 | editTransaction(); |
154 | } | 154 | } |
155 | 155 | ||
156 | void TransactionDisplay::showCalculator () | 156 | void TransactionDisplay::showCalculator () |
157 | { | 157 | { |
158 | Calculator *calculator = new Calculator ( this ); | 158 | Calculator *calculator = new Calculator ( this ); |
159 | if ( calculator->exec () == QDialog::Accepted ) | 159 | if ( calculator->exec () == QDialog::Accepted ) |
160 | amount->setText ( calculator->display->text() ); | 160 | amount->setText ( calculator->display->text() ); |
161 | } | 161 | } |
162 | 162 | ||
163 | void TransactionDisplay::showCalendar () | 163 | void TransactionDisplay::showCalendar () |
164 | { | 164 | { |
165 | QDate newDate = QDate::currentDate (); | 165 | QDate newDate = QDate::currentDate (); |
166 | DatePicker *dp = new DatePicker ( newDate ); | 166 | DatePicker *dp = new DatePicker ( newDate ); |
167 | if ( dp->exec () == QDialog::Accepted ) | 167 | if ( dp->exec () == QDialog::Accepted ) |
168 | { | 168 | { |
169 | year = dp->getYear(); | 169 | year = dp->getYear(); |
170 | month = dp->getMonth(); | 170 | month = dp->getMonth(); |
171 | day = dp->getDay(); | 171 | day = dp->getDay(); |
172 | date->setText ( preferences->getDate ( year, month, day ) ); | 172 | date->setText ( preferences->getDate ( year, month, day ) ); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | void TransactionDisplay::editTransfer () | 176 | void TransactionDisplay::editTransfer () |
177 | { | 177 | { |
178 | transferid = listview->currentItem()->text ( getIDColumn() ).toInt(); | 178 | transferid = listview->currentItem()->text ( getIDColumn() ).toInt(); |
179 | fromaccount = transfer->getFromAccountID ( transferid ); | 179 | fromaccount = transfer->getFromAccountID ( transferid ); |
180 | toaccount = transfer->getToAccountID ( transferid ); | 180 | toaccount = transfer->getToAccountID ( transferid ); |
181 | year = transfer->getYear ( transferid ); | 181 | year = transfer->getYear ( transferid ); |
182 | month = transfer->getMonth ( transferid ); | 182 | month = transfer->getMonth ( transferid ); |
183 | day = transfer->getDay ( transferid ); | 183 | day = transfer->getDay ( transferid ); |
184 | 184 | ||
185 | QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE ); | 185 | QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE ); |
186 | editransfer->setCaption ( "Transfer" ); | 186 | editransfer->setCaption ( "Transfer" ); |
187 | 187 | ||
188 | QStringList accountnames = account->getAccountNames(); | 188 | QStringList accountnames = account->getAccountNames(); |
189 | QStringList accountids = account->getAccountIDs(); | 189 | QStringList accountids = account->getAccountIDs(); |
190 | 190 | ||
191 | QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer ); | 191 | QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer ); |
192 | QFont f = this->font(); | 192 | QFont f = this->font(); |
193 | f.setWeight ( QFont::Bold ); | 193 | f.setWeight ( QFont::Bold ); |
194 | fromaccountlabel->setFont ( f ); | 194 | fromaccountlabel->setFont ( f ); |
195 | 195 | ||
196 | QComboBox *fromaccountbox = new QComboBox ( editransfer ); | 196 | QComboBox *fromaccountbox = new QComboBox ( editransfer ); |
197 | fromaccountbox->insertStringList ( accountnames ); | 197 | fromaccountbox->insertStringList ( accountnames ); |
198 | fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) ); | 198 | fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) ); |
199 | 199 | ||
200 | QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer ); | 200 | QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer ); |
201 | toaccountlabel->setFont ( f ); | 201 | toaccountlabel->setFont ( f ); |
202 | 202 | ||
203 | QComboBox *toaccountbox = new QComboBox ( editransfer ); | 203 | QComboBox *toaccountbox = new QComboBox ( editransfer ); |
204 | toaccountbox->insertStringList ( accountnames ); | 204 | toaccountbox->insertStringList ( accountnames ); |
205 | toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) ); | 205 | toaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( toaccount ) ) ); |
206 | 206 | ||
207 | QLabel *datelabel = new QLabel ( "Date", editransfer ); | 207 | QLabel *datelabel = new QLabel ( "Date", editransfer ); |
208 | QHBox *datebox = new QHBox ( editransfer ); | 208 | QHBox *datebox = new QHBox ( editransfer ); |
209 | datebox->setSpacing ( 2 ); | 209 | datebox->setSpacing ( 2 ); |
210 | date = new QLineEdit ( datebox ); | 210 | date = new QLineEdit ( datebox ); |
211 | date->setAlignment ( Qt::AlignRight ); | 211 | date->setAlignment ( Qt::AlignRight ); |
212 | date->setDisabled ( TRUE ); | 212 | date->setDisabled ( TRUE ); |
213 | date->setText ( preferences->getDate ( year, month, day ) ); | 213 | date->setText ( preferences->getDate ( year, month, day ) ); |
214 | QPushButton *datebutton = new QPushButton ( datebox ); | 214 | QPushButton *datebutton = new QPushButton ( datebox ); |
215 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 215 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
216 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); | 216 | connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); |
217 | 217 | ||
218 | QLabel *amounttlabel = new QLabel ( "Amount", editransfer ); | 218 | QLabel *amounttlabel = new QLabel ( "Amount", editransfer ); |
219 | 219 | ||
220 | QHBox *amountbox = new QHBox ( editransfer ); | 220 | QHBox *amountbox = new QHBox ( editransfer ); |
221 | amountbox->setSpacing ( 2 ); | 221 | amountbox->setSpacing ( 2 ); |
222 | amount = new QLineEdit ( amountbox ); | 222 | amount = new QLineEdit ( amountbox ); |
223 | amount->setAlignment ( Qt::AlignRight ); | 223 | amount->setAlignment ( Qt::AlignRight ); |
224 | amount->setText ( transfer->getAmount ( transferid ) ); | 224 | amount->setText ( transfer->getAmount ( transferid ) ); |
225 | QPushButton *calculatorbutton = new QPushButton( amountbox ); | 225 | QPushButton *calculatorbutton = new QPushButton( amountbox ); |
226 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 226 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
227 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); | 227 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); |
228 | 228 | ||
229 | QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer ); | 229 | QCheckBox *clearedcheckbox = new QCheckBox ( "Cleared", editransfer ); |
230 | 230 | ||
231 | QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 ); | 231 | QBoxLayout *layout = new QVBoxLayout ( editransfer, 4, 2 ); |
232 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); | 232 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); |
233 | layout->addWidget ( fromaccountbox, Qt::AlignLeft ); | 233 | layout->addWidget ( fromaccountbox, Qt::AlignLeft ); |
234 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); | 234 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); |
235 | layout->addWidget ( toaccountbox, Qt::AlignLeft ); | 235 | layout->addWidget ( toaccountbox, Qt::AlignLeft ); |
236 | layout->addSpacing ( 5 ); | 236 | layout->addSpacing ( 5 ); |
237 | layout->addWidget ( datelabel, Qt::AlignLeft ); | 237 | layout->addWidget ( datelabel, Qt::AlignLeft ); |
238 | layout->addWidget ( datebox, Qt::AlignLeft ); | 238 | layout->addWidget ( datebox, Qt::AlignLeft ); |
239 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); | 239 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); |
240 | layout->addWidget ( amountbox, Qt::AlignLeft ); | 240 | layout->addWidget ( amountbox, Qt::AlignLeft ); |
241 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); | 241 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); |
242 | 242 | ||
243 | if ( editransfer->exec() == QDialog::Accepted ) | 243 | if ( editransfer->exec() == QDialog::Accepted ) |
244 | { | 244 | { |
245 | //get fromaccount | 245 | //get fromaccount |
246 | fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt(); | 246 | fromaccount = ( accountids.operator[] ( fromaccountbox->currentItem() ) ).toInt(); |
247 | 247 | ||
248 | //get to account | 248 | //get to account |
249 | toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt(); | 249 | toaccount = ( accountids.operator[] ( toaccountbox->currentItem() ) ).toInt(); |
250 | 250 | ||
251 | //set cleared flag | 251 | //set cleared flag |
252 | int cleared = 0; | 252 | int cleared = 0; |
253 | if ( clearedcheckbox->isChecked() == TRUE ) | 253 | if ( clearedcheckbox->isChecked() == TRUE ) |
254 | cleared = 1; | 254 | cleared = 1; |
255 | 255 | ||
256 | //update transfer | 256 | //update transfer |
257 | transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ), | 257 | transfer->updateTransfer ( fromaccount, account->getParentAccountID ( fromaccount ), toaccount, account->getParentAccountID ( toaccount ), |
258 | day, month, year, amount->text().toFloat(), cleared, transferid ); | 258 | day, month, year, amount->text().toFloat(), cleared, transferid ); |
259 | 259 | ||
260 | account->updateAccountBalance ( fromaccount ); | 260 | account->updateAccountBalance ( fromaccount ); |
261 | if ( account->getParentAccountID ( fromaccount ) != -1 ) | 261 | if ( account->getParentAccountID ( fromaccount ) != -1 ) |
262 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) ); | 262 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccount ) ); |
263 | 263 | ||
264 | updateAndDisplay ( toaccount ); | 264 | updateAndDisplay ( toaccount ); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | void TransactionDisplay::editTransaction () | 268 | void TransactionDisplay::editTransaction () |
269 | { | 269 | { |
270 | int cleared; | 270 | int cleared; |
271 | 271 | ||
272 | // set the transaction id and budgetid | 272 | // set the transaction id and budgetid |
273 | int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt(); | 273 | int transactionid = listview->currentItem()->text ( getIDColumn() ).toInt(); |
274 | int budgetid = transaction->getBudgetID ( transactionid ); | 274 | int budgetid = transaction->getBudgetID ( transactionid ); |
275 | int lineitemid = transaction->getLineItemID ( transactionid ); | 275 | int lineitemid = transaction->getLineItemID ( transactionid ); |
276 | 276 | ||
277 | // create edit transaction window | 277 | // create edit transaction window |
278 | NewTransaction *newtransaction = new NewTransaction ( this ); | 278 | NewTransaction *newtransaction = new NewTransaction ( this ); |
279 | int width = this->width(); | 279 | int width = this->width(); |
280 | newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); | 280 | newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) ); |
281 | newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); | 281 | newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) ); |
282 | newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); | 282 | newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) ); |
283 | newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 283 | newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
284 | newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); | 284 | newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) ); |
285 | newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); | 285 | newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) ); |
286 | 286 | ||
287 | // enter the date in the date box | 287 | // enter the date in the date box |
288 | newtransaction->year = transaction->getYear ( transactionid ); | 288 | newtransaction->year = transaction->getYear ( transactionid ); |
289 | newtransaction->month = transaction->getMonth ( transactionid ); | 289 | newtransaction->month = transaction->getMonth ( transactionid ); |
290 | newtransaction->day = transaction->getDay ( transactionid ); | 290 | newtransaction->day = transaction->getDay ( transactionid ); |
291 | newtransaction->transactiondate->setText ( preferences->getDate ( newtransaction->year, newtransaction->month, newtransaction->day ) ); | 291 | newtransaction->transactiondate->setText ( preferences->getDate ( newtransaction->year, newtransaction->month, newtransaction->day ) ); |
292 | 292 | ||
293 | // set the description | 293 | // set the description |
294 | newtransaction->setDescription ( transaction->getTransactionDescription ( transactionid ) ); | 294 | newtransaction->setDescription ( transaction->getTransactionDescription ( transactionid ) ); |
295 | 295 | ||
296 | // add memory items to the transactionname combobox | 296 | // add memory items to the transactionname combobox |
297 | memory->displayMemoryItems ( newtransaction->transactionname ); | 297 | memory->displayMemoryItems ( newtransaction->transactionname ); |
298 | 298 | ||
299 | // add correct transaction name | 299 | // add correct transaction name |
300 | newtransaction->transactionname->setEditText ( transaction->getPayee ( transactionid ) ); | 300 | newtransaction->transactionname->setEditText ( transaction->getPayee ( transactionid ) ); |
301 | 301 | ||
302 | // add transaction number | 302 | // add transaction number |
303 | newtransaction->transactionnumber->setText ( transaction->getNumber ( transactionid ) ); | 303 | newtransaction->transactionnumber->setText ( transaction->getNumber ( transactionid ) ); |
304 | 304 | ||
305 | // add transaction amount | 305 | // add transaction amount |
306 | newtransaction->transactionamount->setText ( transaction->getAbsoluteAmount ( transactionid ) ); | 306 | newtransaction->transactionamount->setText ( transaction->getAbsoluteAmount ( transactionid ) ); |
307 | 307 | ||
308 | // check for and set the correct budget | 308 | // check for and set the correct budget |
309 | if ( budgetid >= 1 ) // only do it if this transaction has a budget and line item | 309 | if ( budgetid >= 1 ) // only do it if this transaction has a budget and line item |
310 | { | 310 | { |
311 | newtransaction->budgetbox->setCurrentItem ( newtransaction->getBudgetIndex ( budgetid ) + 1 ); | 311 | newtransaction->budgetbox->setCurrentItem ( newtransaction->getBudgetIndex ( budgetid ) + 1 ); |
312 | if ( lineitemid >= 1 ) | 312 | if ( lineitemid >= 1 ) |
diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp index 558abec..7a12fbf 100755 --- a/noncore/apps/qashmoney/transferdialog.cpp +++ b/noncore/apps/qashmoney/transferdialog.cpp | |||
@@ -1,112 +1,112 @@ | |||
1 | #include "transferdialog.h" | 1 | #include "transferdialog.h" |
2 | #include "datepicker.h" | 2 | #include "datepicker.h" |
3 | #include "calculator.h" | 3 | #include "calculator.h" |
4 | 4 | ||
5 | 5 | ||
6 | extern Preferences *preferences; | 6 | extern Preferences *preferences; |
7 | extern Account *account; | 7 | extern Account *account; |
8 | 8 | ||
9 | TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) | 9 | TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) |
10 | { | 10 | { |
11 | dateedited = FALSE; | 11 | dateedited = FALSE; |
12 | setCaption ( "Transfer" ); | 12 | setCaption ( "Transfer" ); |
13 | 13 | ||
14 | fromaccountlabel = new QLabel ( "From account:", this ); | 14 | fromaccountlabel = new QLabel ( "From account:", this ); |
15 | QFont f = this->font(); | 15 | QFont f = this->font(); |
16 | f.setWeight ( QFont::Bold ); | 16 | f.setWeight ( QFont::Bold ); |
17 | fromaccountlabel->setFont ( f ); | 17 | fromaccountlabel->setFont ( f ); |
18 | fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this ); | 18 | fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this ); |
19 | 19 | ||
20 | toaccountlabel = new QLabel ( "To Account:", this ); | 20 | toaccountlabel = new QLabel ( "To Account:", this ); |
21 | toaccountlabel->setFont ( f ); | 21 | toaccountlabel->setFont ( f ); |
22 | toaccount = new QLabel ( account->getAccountName ( toaccountid ), this ); | 22 | toaccount = new QLabel ( account->getAccountName ( toaccountid ), this ); |
23 | 23 | ||
24 | datelabel = new QLabel ( "Date", this ); | 24 | datelabel = new QLabel ( "Date", this ); |
25 | 25 | ||
26 | datebox = new QHBox ( this ); | 26 | datebox = new QHBox ( this ); |
27 | datebox->setSpacing ( 2 ); | 27 | datebox->setSpacing ( 2 ); |
28 | date = new QLineEdit ( datebox ); | 28 | date = new QLineEdit ( datebox ); |
29 | date->setAlignment ( Qt::AlignRight ); | 29 | date->setAlignment ( Qt::AlignRight ); |
30 | date->setDisabled ( TRUE ); | 30 | date->setDisabled ( TRUE ); |
31 | datebutton = new QPushButton ( datebox ); | 31 | datebutton = new QPushButton ( datebox ); |
32 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 32 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
33 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); | 33 | connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) ); |
34 | 34 | ||
35 | amounttlabel = new QLabel ( "Amount", this ); | 35 | amounttlabel = new QLabel ( "Amount", this ); |
36 | 36 | ||
37 | amountbox = new QHBox ( this ); | 37 | amountbox = new QHBox ( this ); |
38 | amountbox->setSpacing ( 2 ); | 38 | amountbox->setSpacing ( 2 ); |
39 | amount = new QLineEdit ( amountbox ); | 39 | amount = new QLineEdit ( amountbox ); |
40 | amount->setAlignment ( Qt::AlignRight ); | 40 | amount->setAlignment ( Qt::AlignRight ); |
41 | calculatorbutton = new QPushButton( amountbox ); | 41 | calculatorbutton = new QPushButton( amountbox ); |
42 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 42 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
43 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); | 43 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); |
44 | 44 | ||
45 | clearedcheckbox = new QCheckBox ( "Cleared", this ); | 45 | clearedcheckbox = new QCheckBox ( "Cleared", this ); |
46 | 46 | ||
47 | layout = new QVBoxLayout ( this, 4, 2 ); | 47 | layout = new QVBoxLayout ( this, 4, 2 ); |
48 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); | 48 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); |
49 | layout->addWidget ( fromaccount, Qt::AlignLeft ); | 49 | layout->addWidget ( fromaccount, Qt::AlignLeft ); |
50 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); | 50 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); |
51 | layout->addWidget ( toaccount, Qt::AlignLeft ); | 51 | layout->addWidget ( toaccount, Qt::AlignLeft ); |
52 | layout->addSpacing ( 5 ); | 52 | layout->addSpacing ( 5 ); |
53 | layout->addWidget ( datelabel, Qt::AlignLeft ); | 53 | layout->addWidget ( datelabel, Qt::AlignLeft ); |
54 | layout->addWidget ( datebox, Qt::AlignLeft ); | 54 | layout->addWidget ( datebox, Qt::AlignLeft ); |
55 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); | 55 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); |
56 | layout->addWidget ( amountbox, Qt::AlignLeft ); | 56 | layout->addWidget ( amountbox, Qt::AlignLeft ); |
57 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); | 57 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool TransferDialog::getDateEdited () | 60 | bool TransferDialog::getDateEdited () |
61 | { | 61 | { |
62 | return dateedited; | 62 | return dateedited; |
63 | } | 63 | } |
64 | 64 | ||
65 | void TransferDialog::showCalendar () | 65 | void TransferDialog::showCalendar () |
66 | { | 66 | { |
67 | QDate newDate = QDate::currentDate (); | 67 | QDate newDate = QDate::currentDate (); |
68 | DatePicker *dp = new DatePicker ( newDate ); | 68 | DatePicker *dp = new DatePicker ( newDate ); |
69 | if ( dp->exec () == QDialog::Accepted ) | 69 | if ( dp->exec () == QDialog::Accepted ) |
70 | { | 70 | { |
71 | // Set date integers | 71 | // Set date integers |
72 | year = dp->getYear(); | 72 | year = dp->getYear(); |
73 | month = dp->getMonth(); | 73 | month = dp->getMonth(); |
74 | day = dp->getDay(); | 74 | day = dp->getDay(); |
75 | 75 | ||
76 | // Set dateedited to TRUE | 76 | // Set dateedited to TRUE |
77 | // This tells the accountdisplay object that the user edited an account | 77 | // This tells the accountdisplay object that the user edited an account |
78 | // and did change the date | 78 | // and did change the date |
79 | dateedited = TRUE; | 79 | dateedited = TRUE; |
80 | 80 | ||
81 | // Display date with our selected format | 81 | // Display date with our selected format |
82 | date->setText ( preferences->getDate ( year, month, day ) ); | 82 | date->setText ( preferences->getDate ( year, month, day ) ); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | int TransferDialog::getDay () | 86 | int TransferDialog::getDay () |
87 | { | 87 | { |
88 | return day; | 88 | return day; |
89 | } | 89 | } |
90 | 90 | ||
91 | int TransferDialog::getMonth () | 91 | int TransferDialog::getMonth () |
92 | { | 92 | { |
93 | return month; | 93 | return month; |
94 | } | 94 | } |
95 | 95 | ||
96 | int TransferDialog::getYear () | 96 | int TransferDialog::getYear () |
97 | { | 97 | { |
98 | return year; | 98 | return year; |
99 | } | 99 | } |
100 | 100 | ||
101 | void TransferDialog::showCalculator () | 101 | void TransferDialog::showCalculator () |
102 | { | 102 | { |
103 | Calculator *calculator = new Calculator ( this ); | 103 | Calculator *calculator = new Calculator ( this ); |
104 | if ( calculator->exec () == QDialog::Accepted ) | 104 | if ( calculator->exec () == QDialog::Accepted ) |
105 | amount->setText ( calculator->display->text() ); | 105 | amount->setText ( calculator->display->text() ); |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||