summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/accountdisplay.cpp
Unidiff
Diffstat (limited to 'noncore/apps/qashmoney/accountdisplay.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp22
1 files changed, 11 insertions, 11 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
@@ -12,50 +12,50 @@ extern 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
@@ -216,34 +216,34 @@ void AccountDisplay::setToggleButton ()
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();
@@ -282,25 +282,25 @@ void AccountDisplay::getTransferAccounts ( QListViewItem * item )
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 {