summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney
Unidiff
Diffstat (limited to 'noncore/apps/qashmoney') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp22
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/calculator.cpp24
-rwxr-xr-xnoncore/apps/qashmoney/datepicker.cpp6
-rwxr-xr-xnoncore/apps/qashmoney/memorydialog.cpp6
-rwxr-xr-xnoncore/apps/qashmoney/newaccount.cpp8
-rwxr-xr-xnoncore/apps/qashmoney/newtransaction.cpp8
-rwxr-xr-xnoncore/apps/qashmoney/preferencedialogs.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp20
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp18
-rwxr-xr-xnoncore/apps/qashmoney/transferdialog.cpp2
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,97 +1,97 @@
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
10extern Account *account; 10extern Account *account;
11extern Transaction *transaction; 11extern Transaction *transaction;
12extern Transfer *transfer; 12extern Transfer *transfer;
13extern Preferences *preferences; 13extern Preferences *preferences;
14 14
15AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) 15AccountDisplay::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
56void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) 56void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs )
57 { 57 {
58 tab2 = newtab2; 58 tab2 = newtab2;
59 maintabs = newtabs; 59 maintabs = newtabs;
60 } 60 }
61 61
62void AccountDisplay::addAccount () 62void 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() );
@@ -180,163 +180,163 @@ void AccountDisplay::deleteAccount ()
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
201void AccountDisplay::setToggleButton () 201void 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
219void AccountDisplay::accountTransfer ( bool state ) 219void 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
241void AccountDisplay::getTransferAccounts ( QListViewItem * item ) 241void 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
305void AccountDisplay::disableParentsWithChildren () 305void 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
316void AccountDisplay::enableAccounts () 316void 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
324void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) 324void 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;
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,130 +1,130 @@
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
10extern Preferences *preferences; 10extern Preferences *preferences;
11extern Budget *budget; 11extern Budget *budget;
12extern Transaction *transaction; 12extern Transaction *transaction;
13 13
14BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) 14BudgetDisplay::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
99void BudgetDisplay::deleteBudget () 99void 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
109void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) 109void 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
125void BudgetDisplay::saveSortingPreference ( int column ) 125void BudgetDisplay::saveSortingPreference ( int column )
126 { 126 {
127 preferences->changeSortingPreference ( 3, column ); 127 preferences->changeSortingPreference ( 3, column );
128 } 128 }
129 129
130int BudgetDisplay::getIDColumn () 130int BudgetDisplay::getIDColumn ()
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,106 +1,106 @@
1#include "calculator.h" 1#include "calculator.h"
2 2
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4 4
5Calculator::Calculator ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 5Calculator::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
77void Calculator::displayOne () 77void Calculator::displayOne ()
78 { display->insert ( "1" ); } 78 { display->insert ( "1" ); }
79 79
80void Calculator::displayTwo () 80void Calculator::displayTwo ()
81 { display->insert ( "2" ); } 81 { display->insert ( "2" ); }
82 82
83void Calculator::displayThree () 83void Calculator::displayThree ()
84 { display->insert ( "3" ); } 84 { display->insert ( "3" ); }
85 85
86void Calculator::displayFour () 86void Calculator::displayFour ()
87 { display->insert ( "4" ); } 87 { display->insert ( "4" ); }
88 88
89void Calculator::displayFive () 89void Calculator::displayFive ()
90 { display->insert ( "5" ); } 90 { display->insert ( "5" ); }
91 91
92void Calculator::displaySix () 92void Calculator::displaySix ()
93 { display->insert ( "6" ); } 93 { display->insert ( "6" ); }
94 94
95void Calculator::displaySeven () 95void Calculator::displaySeven ()
96 { display->insert ( "7" ); } 96 { display->insert ( "7" ); }
97 97
98void Calculator::displayEight () 98void Calculator::displayEight ()
99 { display->insert ( "8" ); } 99 { display->insert ( "8" ); }
100 100
101void Calculator::displayNine () 101void Calculator::displayNine ()
102 { display->insert ( "9" ); } 102 { display->insert ( "9" ); }
103 103
104void Calculator::displayZero () 104void Calculator::displayZero ()
105 { display->insert ( "0" ); } 105 { display->insert ( "0" ); }
106 106
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,70 +1,70 @@
1#include "datepicker.h" 1#include "datepicker.h"
2 2
3DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) 3DatePicker::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
34void DatePicker::displayDays ( QComboBox *daybox ) 34void 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
43void DatePicker::displayMonths ( QComboBox *monthbox ) 43void 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
51void DatePicker::displayYears ( QComboBox *yearbox ) 51void 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
67void DatePicker::setDay ( int index ) 67void DatePicker::setDay ( int index )
68 { 68 {
69 day = daybox->text ( index ).toInt(); 69 day = daybox->text ( index ).toInt();
70 } 70 }
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,75 +1,75 @@
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
5extern Memory *memory; 5extern Memory *memory;
6 6
7MemoryDialog::MemoryDialog () : QDialog ( 0, 0, TRUE ) 7MemoryDialog::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
37MemoryDialog::~MemoryDialog() 37MemoryDialog::~MemoryDialog()
38 { 38 {
39 } 39 }
40 40
41void MemoryDialog::addItem () 41void 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
54void MemoryDialog::editItem () 54void 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
68void MemoryDialog::deleteItem () 68void 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();
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
@@ -31,102 +31,102 @@ NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDial
31 31
32 childlabel = new QLabel ( "Child of", this ); 32 childlabel = new QLabel ( "Child of", this );
33 childbox = new QComboBox ( FALSE, this ); 33 childbox = new QComboBox ( FALSE, this );
34 hideChildPulldownMenu (); 34 hideChildPulldownMenu ();
35 35
36 balancelabel = new QLabel ( "Balance", this ); 36 balancelabel = new QLabel ( "Balance", this );
37 37
38 balancebox = new QHBox ( this ); 38 balancebox = new QHBox ( this );
39 accountbalance = new QLineEdit ( balancebox ); 39 accountbalance = new QLineEdit ( balancebox );
40 accountbalance->setText ( "0.00" ); 40 accountbalance->setText ( "0.00" );
41 balancecalculator = new QPushButton( balancebox ); 41 balancecalculator = new QPushButton( balancebox );
42 balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 42 balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
43 43
44 creditlimitlabel = new QLabel ( "Credit Limit", this ); 44 creditlimitlabel = new QLabel ( "Credit Limit", this );
45 45
46 creditlimitbox = new QHBox ( this ); 46 creditlimitbox = new QHBox ( this );
47 creditlimit = new QLineEdit ( creditlimitbox ); 47 creditlimit = new QLineEdit ( creditlimitbox );
48 creditlimitbox->setEnabled ( FALSE ); 48 creditlimitbox->setEnabled ( FALSE );
49 creditlimitcalculator = new QPushButton( creditlimitbox ); 49 creditlimitcalculator = new QPushButton( creditlimitbox );
50 creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); 50 creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
51 51
52 currencybox = new Currency ( this ); 52 currencybox = new Currency ( this );
53 53
54 typelabel = new QLabel ( "Type", this ); 54 typelabel = new QLabel ( "Type", this );
55 accounttype = new QComboBox ( FALSE, this ); 55 accounttype = new QComboBox ( FALSE, this );
56 accounttype->insertItem( tr( "Bank" ) ); 56 accounttype->insertItem( tr( "Bank" ) );
57 accounttype->insertItem( tr( "Cash" ) ); 57 accounttype->insertItem( tr( "Cash" ) );
58 accounttype->insertItem( tr( "Credit Card" ) ); 58 accounttype->insertItem( tr( "Credit Card" ) );
59 accounttype->insertItem( tr( "Equity" ) ); 59 accounttype->insertItem( tr( "Equity" ) );
60 accounttype->insertItem( tr( "Asset" ) ); 60 accounttype->insertItem( tr( "Asset" ) );
61 accounttype->insertItem( tr( "Liability" ) ); 61 accounttype->insertItem( tr( "Liability" ) );
62 62
63 layout = new QGridLayout ( this, 7, 2, 4, 2 ); 63 layout = new QGridLayout ( this, 7, 2, 4, 2 );
64 layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft ); 64 layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft );
65 layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft ); 65 layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft );
66 layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft ); 66 layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft );
67 layout->addWidget ( datebox, 3, 0, Qt::AlignLeft ); 67 layout->addWidget ( datebox, 3, 0, Qt::AlignLeft );
68 layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft ); 68 layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft );
69 layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft ); 69 layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft );
70 layout->addWidget ( childbox, 6, 0, Qt::AlignLeft ); 70 layout->addWidget ( childbox, 6, 0, Qt::AlignLeft );
71 layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft ); 71 layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft );
72 layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft ); 72 layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft );
73 layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft ); 73 layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft );
74 layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft ); 74 layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft );
75 layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft ); 75 layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft );
76 layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft ); 76 layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft );
77 layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft ); 77 layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft );
78 78
79 connect ( childcheckbox, SIGNAL ( clicked () ), this, SLOT ( showChildPulldownMenu() ) ); 79 connect ( childcheckbox, SIGNAL ( clicked() ), this, SLOT ( showChildPulldownMenu() ) );
80 connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); 80 connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
81 connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) ); 81 connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) );
82 connect ( accounttype, SIGNAL ( activated ( int ) ), this, SLOT ( activateCreditLimit ( int ) ) ); 82 connect ( accounttype, SIGNAL ( activated(int) ), this, SLOT ( activateCreditLimit(int) ) );
83 connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); 83 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
84 connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addAccountDescription() ) ); 84 connect ( descriptionbutton, SIGNAL ( released() ), this, SLOT ( addAccountDescription() ) );
85} 85}
86 86
87NewAccount::~NewAccount () 87NewAccount::~NewAccount ()
88 { 88 {
89 } 89 }
90 90
91void NewAccount::showChildPulldownMenu () 91void NewAccount::showChildPulldownMenu ()
92 { 92 {
93 if ( childcheckbox->isChecked() == TRUE ) 93 if ( childcheckbox->isChecked() == TRUE )
94 { 94 {
95 childlabel->setEnabled ( TRUE ); 95 childlabel->setEnabled ( TRUE );
96 childbox->setEnabled ( TRUE ); 96 childbox->setEnabled ( TRUE );
97 } 97 }
98 else 98 else
99 hideChildPulldownMenu(); 99 hideChildPulldownMenu();
100 } 100 }
101 101
102void NewAccount::hideChildPulldownMenu () 102void NewAccount::hideChildPulldownMenu ()
103 { 103 {
104 childlabel->setEnabled ( FALSE ); 104 childlabel->setEnabled ( FALSE );
105 childbox->setEnabled ( FALSE ); 105 childbox->setEnabled ( FALSE );
106 } 106 }
107 107
108void NewAccount::showCalculator () 108void NewAccount::showCalculator ()
109 { 109 {
110 Calculator *calculator = new Calculator ( this ); 110 Calculator *calculator = new Calculator ( this );
111 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 111 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
112 if ( calculator->exec () == QDialog::Accepted ) 112 if ( calculator->exec () == QDialog::Accepted )
113 accountbalance->setText ( calculator->display->text() ); 113 accountbalance->setText ( calculator->display->text() );
114 } 114 }
115 115
116void NewAccount::showCreditLimitCalculator () 116void NewAccount::showCreditLimitCalculator ()
117 { 117 {
118 Calculator *calculator = new Calculator ( this ); 118 Calculator *calculator = new Calculator ( this );
119 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) ); 119 calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
120 if ( calculator->exec () == QDialog::Accepted ) 120 if ( calculator->exec () == QDialog::Accepted )
121 creditlimit->setText ( calculator->display->text() ); 121 creditlimit->setText ( calculator->display->text() );
122 } 122 }
123 123
124void NewAccount::activateCreditLimit ( int index ) 124void NewAccount::activateCreditLimit ( int index )
125 { 125 {
126 if ( index == 2 || index == 5 ) 126 if ( index == 2 || index == 5 )
127 creditlimitbox->setEnabled ( TRUE ); 127 creditlimitbox->setEnabled ( TRUE );
128 else 128 else
129 { 129 {
130 creditlimit->clear (); 130 creditlimit->clear ();
131 creditlimitbox->setEnabled ( FALSE ); 131 creditlimitbox->setEnabled ( FALSE );
132 } 132 }
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,136 +1,136 @@
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
8extern Budget *budget; 8extern Budget *budget;
9extern Preferences *preferences; 9extern Preferences *preferences;
10 10
11NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 11NewTransaction::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
100NewTransaction::~NewTransaction () 100NewTransaction::~NewTransaction ()
101 { 101 {
102 } 102 }
103 103
104void NewTransaction::showCalculator () 104void 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
112void NewTransaction::showCalendar () 112void 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
136bool NewTransaction::getDateEdited () 136bool NewTransaction::getDateEdited ()
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
4extern Preferences *preferences; 4extern Preferences *preferences;
5 5
6DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 6DatePreferences::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
46DatePreferences::~DatePreferences () 46DatePreferences::~DatePreferences ()
47 { 47 {
48 } 48 }
49 49
50void DatePreferences::changeDateFormat ( int index ) 50void DatePreferences::changeDateFormat ( int index )
51 { 51 {
52 index ++; 52 index ++;
53 preferences->changePreference ( 1, index ); 53 preferences->changePreference ( 1, index );
54 } 54 }
55 55
56void DatePreferences::changeDateSeparator ( int index ) 56void DatePreferences::changeDateSeparator ( int index )
57 { 57 {
58 index ++; 58 index ++;
59 preferences->changePreference ( 2, index ); 59 preferences->changePreference ( 2, index );
60 } 60 }
61 61
62void DatePreferences::setDefaultDatePreferences () 62void 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
71TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 71TransactionPreferences::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
119TransactionPreferences::~TransactionPreferences () 119TransactionPreferences::~TransactionPreferences ()
120 { 120 {
121 } 121 }
122 122
123void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) 123void TransactionPreferences::changeLimitTransactionsPreference ( int pref )
124 { 124 {
125 preferences->changePreference ( 7, pref ); 125 preferences->changePreference ( 7, pref );
126 } 126 }
127 127
128void TransactionPreferences::changeShowClearedPreference ( bool state ) 128void 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
136void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) 136void 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
144void TransactionPreferences::setDefaultTransactionPreferences () 144void 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
155AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 155AccountPreferences::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
189AccountPreferences::~AccountPreferences () 189AccountPreferences::~AccountPreferences ()
190 { 190 {
191 } 191 }
192 192
193void AccountPreferences::changeCurrencySupport ( bool state ) 193void 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
201void AccountPreferences::changeOneTouchViewing ( bool state ) 201void 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
209void AccountPreferences::setDefaultAccountPreferences () 209void 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,118 +1,118 @@
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
7Budget *budget = new Budget (); 7Budget *budget = new Budget ();
8Preferences *preferences = new Preferences (); 8Preferences *preferences = new Preferences ();
9Account *account = new Account (); 9Account *account = new Account ();
10Transaction *transaction = new Transaction (); 10Transaction *transaction = new Transaction ();
11Transfer *transfer = new Transfer (); 11Transfer *transfer = new Transfer ();
12Memory *memory = new Memory (); 12Memory *memory = new Memory ();
13 13
14QashMoney::QashMoney () : QWidget () 14QashMoney::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
78QashMoney::~QashMoney () 78QashMoney::~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
88void QashMoney::changeTabDisplay () 88void 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
@@ -307,96 +307,96 @@ void QashMoney::displayTransactionPreferencesDialog ()
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
324void QashMoney::displayAccountPreferencesDialog () 324void 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
340void QashMoney::displayMemoryDialog () 340void 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
347void QashMoney::showTransactions () 347void QashMoney::showTransactions ()
348 { 348 {
349 maintabs->setCurrentPage ( 1 ); 349 maintabs->setCurrentPage ( 1 );
350 } 350 }
351 351
352void QashMoney::enableOneTouchViewing () 352void 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
360void QashMoney::disableOneTouchViewing () 360void 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
365void QashMoney::toggleOneTouchViewing ( bool state ) 365void 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
373void QashMoney::setTransactionDisplayDate () 373void 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,114 +1,114 @@
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
14extern Transaction *transaction; 14extern Transaction *transaction;
15extern Budget *budget; 15extern Budget *budget;
16extern Account *account; 16extern Account *account;
17extern Preferences *preferences; 17extern Preferences *preferences;
18extern Memory *memory; 18extern Memory *memory;
19extern Transfer *transfer; 19extern Transfer *transfer;
20 20
21TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) 21TransactionDisplay::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
74void TransactionDisplay::addTransaction () 74void 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
@@ -168,97 +168,97 @@ void TransactionDisplay::showCalendar ()
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
176void TransactionDisplay::editTransfer () 176void 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 );
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,81 +1,81 @@
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
6extern Preferences *preferences; 6extern Preferences *preferences;
7extern Account *account; 7extern Account *account;
8 8
9TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) 9TransferDialog::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
60bool TransferDialog::getDateEdited () 60bool TransferDialog::getDateEdited ()
61 { 61 {
62 return dateedited; 62 return dateedited;
63 } 63 }
64 64
65void TransferDialog::showCalendar () 65void 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