author | alwin <alwin> | 2004-02-23 12:16:18 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-02-23 12:16:18 (UTC) |
commit | 2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb (patch) (side-by-side diff) | |
tree | 35694478a6b36a1e707719262b1642c42f3f7968 | |
parent | 957697a1158c9bfeae88ea35190b821fe002834a (diff) | |
download | opie-2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb.zip opie-2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb.tar.gz opie-2d37d653310da0a9d6e2e2e6c9f5bf092e54cbbb.tar.bz2 |
sorry, forgot a stdc++ reference
-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.cpp | 3 |
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,52 +1,51 @@ #include <qdatetime.h> #include <qmessagebox.h> #include <qheader.h> -#include <iostream.h> #include "accountdisplay.h" #include "newaccount.h" #include "transaction.h" #include "transferdialog.h" #include "preferences.h" #include "transfer.h" extern Account *account; extern Transaction *transaction; extern Transfer *transfer; extern Preferences *preferences; AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) { cleared = 0; firstline = new QHBox ( this ); firstline->setSpacing ( 2 ); newaccount = new QPushButton ( firstline ); newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); editaccount = new QPushButton ( firstline ); editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); deleteaccount = new QPushButton ( firstline ); deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); transferbutton = new QPushButton ( firstline ); transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); transferbutton->setToggleButton ( TRUE ); connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); listview = new QListView ( this ); listview->setAllColumnsShowFocus ( TRUE ); listview->setShowSortIndicator ( TRUE ); listview->setRootIsDecorated ( TRUE ); listview->setMultiSelection ( FALSE ); connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); listview->header()->setTracking ( FALSE ); connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); @@ -225,97 +224,97 @@ void AccountDisplay::accountTransfer ( bool state ) { firstaccountid = -1; secondaccountid = -1; listview->clearSelection (); listview->setMultiSelection ( TRUE ); disableParentsWithChildren (); connect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); } else { firstaccountid = -1; secondaccountid = -1; listview->clearSelection (); listview->setMultiSelection ( FALSE ); enableAccounts (); disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); } } void AccountDisplay::getTransferAccounts ( QListViewItem * item ) { if ( item->parent() != 0 || item->childCount() == 0 ) // only set an account for transfer if its a child or parent with no children { if ( firstaccountid == -1 ) firstaccountid = item->text ( getIDColumn() ).toInt(); // set first account if we've selected a valid account else if ( item->text ( getIDColumn() ).toInt() != firstaccountid ) // set the second account if its not equal to the first secondaccountid = item->text ( getIDColumn() ).toInt(); } // open transfer window if both accounts are set if ( firstaccountid != -1 && secondaccountid != -1 ) { // construct the transferdialog window TransferDialog *td = new TransferDialog ( this, firstaccountid, secondaccountid ); // enter today's date in the date box as default QDate today = QDate::currentDate (); int defaultday = today.day(); int defaultmonth = today.month(); int defaultyear = today.year(); td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); if ( td->exec() == QDialog::Accepted ) { // set the cleared integer if the checkbox is checked if ( td->clearedcheckbox->isChecked() == TRUE ) cleared = 1; - cout << "Year from transferdialog = " << td->getYear() << endl; + qDebug("Year from transferdialog = %i",td->getYear()); // add the transfer with a new date if its been edited or use the default date if ( td->getDateEdited () == TRUE ) transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); else transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); // update account balances of both accounts and parents if necessary account->updateAccountBalance ( firstaccountid ); if ( account->getParentAccountID ( firstaccountid ) != -1 ) account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); account->updateAccountBalance ( secondaccountid ); if ( account->getParentAccountID ( secondaccountid ) != -1 ) account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); // redisplay accounts account->displayAccounts ( listview ); } else { firstaccountid = -1; secondaccountid = -1; listview->clearSelection (); listview->setMultiSelection ( FALSE ); disconnect ( listview, SIGNAL ( clicked ( QListViewItem * ) ), this, SLOT ( getTransferAccounts ( QListViewItem * ) ) ); } // reset the accounts display window transferbutton->toggle(); // toggling this button with clear the window as well // reenable all the accounts so the transaction tab will be properly set enableAccounts (); } } void AccountDisplay::disableParentsWithChildren () { // iterate through accountdisplay listview and disable all the parents that have children QListViewItemIterator it ( listview ); for ( ; it.current(); ++it ) { if ( it.current()->parent() == 0 && it.current()->childCount() != 0 ) it.current()->setSelectable ( FALSE ); } } void AccountDisplay::enableAccounts () { // iterate through accountdisplay listview and enable all accounts |