summaryrefslogtreecommitdiff
authoralwin <alwin>2004-02-23 12:16:18 (UTC)
committer alwin <alwin>2004-02-23 12:16:18 (UTC)
commit2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb (patch) (unidiff)
tree35694478a6b36a1e707719262b1642c42f3f7968
parent957697a1158c9bfeae88ea35190b821fe002834a (diff)
downloadopie-2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb.zip
opie-2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb.tar.gz
opie-2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb.tar.bz2
sorry, forgot a stdc++ reference
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp
index 64f4ea8..d0ba82a 100755
--- a/noncore/apps/qashmoney/accountdisplay.cpp
+++ b/noncore/apps/qashmoney/accountdisplay.cpp
@@ -1,36 +1,35 @@
1#include <qdatetime.h> 1#include <qdatetime.h>
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <iostream.h>
5 4
6#include "accountdisplay.h" 5#include "accountdisplay.h"
7#include "newaccount.h" 6#include "newaccount.h"
8#include "transaction.h" 7#include "transaction.h"
9#include "transferdialog.h" 8#include "transferdialog.h"
10#include "preferences.h" 9#include "preferences.h"
11#include "transfer.h" 10#include "transfer.h"
12 11
13extern Account *account; 12extern Account *account;
14extern Transaction *transaction; 13extern Transaction *transaction;
15extern Transfer *transfer; 14extern Transfer *transfer;
16extern Preferences *preferences; 15extern Preferences *preferences;
17 16
18AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) 17AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent )
19 { 18 {
20 cleared = 0; 19 cleared = 0;
21 20
22 firstline = new QHBox ( this ); 21 firstline = new QHBox ( this );
23 firstline->setSpacing ( 2 ); 22 firstline->setSpacing ( 2 );
24 23
25 newaccount = new QPushButton ( firstline ); 24 newaccount = new QPushButton ( firstline );
26 newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); 25 newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
27 connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); 26 connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) );
28 27
29 editaccount = new QPushButton ( firstline ); 28 editaccount = new QPushButton ( firstline );
30 editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); 29 editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
31 connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); 30 connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) );
32 31
33 deleteaccount = new QPushButton ( firstline ); 32 deleteaccount = new QPushButton ( firstline );
34 deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); 33 deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
35 connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); 34 connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) );
36 35
@@ -241,65 +240,65 @@ void AccountDisplay::accountTransfer ( bool state )
241 } 240 }
242 } 241 }
243 242
244void AccountDisplay::getTransferAccounts ( QListViewItem * item ) 243void AccountDisplay::getTransferAccounts ( QListViewItem * item )
245 { 244 {
246 if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children 245 if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children
247 { 246 {
248 if ( firstaccountid == -1 ) 247 if ( firstaccountid == -1 )
249 firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account 248 firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account
250 else 249 else
251 if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first 250 if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first
252 secondaccountid = item->text ( getIDColumn() ).toInt(); 251 secondaccountid = item->text ( getIDColumn() ).toInt();
253 } 252 }
254 253
255 // open transfer window if both accounts are set 254 // open transfer window if both accounts are set
256 if ( firstaccountid != -1 && secondaccountid != -1 ) 255 if ( firstaccountid != -1 && secondaccountid != -1 )
257 { 256 {
258 // construct the transferdialog window 257 // construct the transferdialog window
259 TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid ); 258 TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid );
260 259
261 // enter today's date in the date box as default 260 // enter today's date in the date box as default
262 QDate today = QDate::currentDate (); 261 QDate today = QDate::currentDate ();
263 int defaultday = today.day(); 262 int defaultday = today.day();
264 int defaultmonth = today.month(); 263 int defaultmonth = today.month();
265 int defaultyear = today.year(); 264 int defaultyear = today.year();
266 td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); 265 td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
267 266
268 if ( td->exec() == QDialog::Accepted ) 267 if ( td->exec() == QDialog::Accepted )
269 { 268 {
270 // set the cleared integer if the checkbox is checked 269 // set the cleared integer if the checkbox is checked
271 if ( td->clearedcheckbox->isChecked() == TRUE ) 270 if ( td->clearedcheckbox->isChecked() == TRUE )
272 cleared = 1; 271 cleared = 1;
273 cout << "Year from transferdialog = " << td->getYear() << endl; 272 qDebug("Year from transferdialog = %i",td->getYear());
274 // add the transfer with a new date if its been edited or use the default date 273 // add the transfer with a new date if its been edited or use the default date
275 if ( td->getDateEdited () == TRUE ) 274 if ( td->getDateEdited () == TRUE )
276 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); 275 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared );
277 else 276 else
278 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); 277 transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared );
279 278
280 // update account balances of both accounts and parents if necessary 279 // update account balances of both accounts and parents if necessary
281 account->updateAccountBalance ( firstaccountid ); 280 account->updateAccountBalance ( firstaccountid );
282 if ( account->getParentAccountID ( firstaccountid ) != -1 ) 281 if ( account->getParentAccountID ( firstaccountid ) != -1 )
283 account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); 282 account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) );
284 account->updateAccountBalance ( secondaccountid ); 283 account->updateAccountBalance ( secondaccountid );
285 if ( account->getParentAccountID ( secondaccountid ) != -1 ) 284 if ( account->getParentAccountID ( secondaccountid ) != -1 )
286 account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); 285 account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) );
287 286
288 // redisplay accounts 287 // redisplay accounts
289 account->displayAccounts ( listview ); 288 account->displayAccounts ( listview );
290 } 289 }
291 else 290 else
292 { 291 {
293 firstaccountid = -1; 292 firstaccountid = -1;
294 secondaccountid = -1; 293 secondaccountid = -1;
295 listview->clearSelection (); 294 listview->clearSelection ();
296 listview->setMultiSelection ( FALSE ); 295 listview->setMultiSelection ( FALSE );
297 disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); 296 disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) );
298 } 297 }
299 298
300 // reset the accounts display window 299 // reset the accounts display window
301 transferbutton->toggle(); // toggling this button with clear the window as well 300 transferbutton->toggle(); // toggling this button with clear the window as well
302 301
303 // reenable all the accounts so the transaction tab will be properly set 302 // reenable all the accounts so the transaction tab will be properly set
304 enableAccounts (); 303 enableAccounts ();
305 } 304 }