Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index d4cbc14..1455eb0 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -1,166 +1,166 @@ | |||
1 | #include "qashmoney.h" | 1 | #include "qashmoney.h" |
2 | #include "preferencedialogs.h" | 2 | #include "preferencedialogs.h" |
3 | #include "memorydialog.h" | 3 | #include "memorydialog.h" |
4 | 4 | ||
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | 6 | ||
7 | Budget *budget = new Budget (); | 7 | Budget *budget = new Budget (); |
8 | Preferences *preferences = new Preferences (); | 8 | Preferences *preferences = new Preferences (); |
9 | Account *account = new Account (); | 9 | Account *account = new Account (); |
10 | Transaction *transaction = new Transaction (); | 10 | Transaction *transaction = new Transaction (); |
11 | Transfer *transfer = new Transfer (); | 11 | Transfer *transfer = new Transfer (); |
12 | Memory *memory = new Memory (); | 12 | Memory *memory = new Memory (); |
13 | 13 | ||
14 | QashMoney::QashMoney () : QWidget () | 14 | QashMoney::QashMoney () : QWidget () |
15 | { | 15 | { |
16 | preferences->addPreferences (); | 16 | preferences->addPreferences (); |
17 | preferences->initializeColumnPreferences (); | 17 | preferences->initializeColumnPreferences (); |
18 | preferences->initializeSortingPreferences (); | 18 | preferences->initializeSortingPreferences (); |
19 | 19 | ||
20 | // set the text in the upper part of the frame | 20 | // set the text in the upper part of the frame |
21 | setCaption ( tr ( "QashMoney" ) ); | 21 | setCaption ( tr ( "QashMoney" ) ); |
22 | 22 | ||
23 | // Create new menubar for our mainwindow | 23 | // Create new menubar for our mainwindow |
24 | // and add menu items | 24 | // and add menu items |
25 | mainmenu = new QMenuBar ( this ); | 25 | mainmenu = new QMenuBar ( this ); |
26 | mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 26 | mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
27 | preferencesmenu = new QPopupMenu ( this ); | 27 | preferencesmenu = new QPopupMenu ( this ); |
28 | utilitiesmenu = new QPopupMenu ( this ); | 28 | utilitiesmenu = new QPopupMenu ( this ); |
29 | mainmenu->insertItem ( "Preferences", preferencesmenu ); | 29 | mainmenu->insertItem ( "Preferences", preferencesmenu ); |
30 | mainmenu->insertItem ( "Utilities", utilitiesmenu ); | 30 | mainmenu->insertItem ( "Utilities", utilitiesmenu ); |
31 | preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) ); | 31 | preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog() ) ); |
32 | preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) ); | 32 | preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog() ) ); |
33 | preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) ); | 33 | preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog() ) ); |
34 | utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) ); | 34 | utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog() ) ); |
35 | 35 | ||
36 | // create the main tabwidget for displaying accounts and transactions | 36 | // create the main tabwidget for displaying accounts and transactions |
37 | maintabs = new QTabWidget ( this ); | 37 | maintabs = new QTabWidget ( this ); |
38 | tab = new QWidget ( this ); | 38 | tab = new QWidget ( this ); |
39 | tab_2 = new QWidget ( this ); | 39 | tab_2 = new QWidget ( this ); |
40 | tab_3 = new QWidget ( this ); | 40 | tab_3 = new QWidget ( this ); |
41 | maintabs->addTab ( tab, "Accounts" ); | 41 | maintabs->addTab ( tab, "Accounts" ); |
42 | maintabs->addTab ( tab_2, "Transactions" ); | 42 | maintabs->addTab ( tab_2, "Transactions" ); |
43 | maintabs->addTab ( tab_3, "Budgets" ); | 43 | maintabs->addTab ( tab_3, "Budgets" ); |
44 | tabheight = tab->height(); | 44 | tabheight = tab->height(); |
45 | maintabs->setTabEnabled ( tab_2, FALSE ); | 45 | maintabs->setTabEnabled ( tab_2, FALSE ); |
46 | 46 | ||
47 | // create a new account display object | 47 | // create a new account display object |
48 | accountdisplay = new AccountDisplay ( maintabs ); | 48 | accountdisplay = new AccountDisplay ( maintabs ); |
49 | accountdisplay->setTabs ( tab_2, maintabs ); | 49 | accountdisplay->setTabs ( tab_2, maintabs ); |
50 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) ); | 50 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( setTransactionTab() ) ); |
51 | 51 | ||
52 | // set the connection to disable the one touch account viewing if we are transfering money | 52 | // set the connection to disable the one touch account viewing if we are transfering money |
53 | connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) ); | 53 | connect ( accountdisplay->transferbutton, SIGNAL ( toggled(bool) ), this, SLOT ( toggleOneTouchViewing(bool) ) ); |
54 | 54 | ||
55 | // create a new transactiondisplay object | 55 | // create a new transactiondisplay object |
56 | transactiondisplay = new TransactionDisplay ( maintabs ); | 56 | transactiondisplay = new TransactionDisplay ( maintabs ); |
57 | transactiondisplay->hide(); | 57 | transactiondisplay->hide(); |
58 | 58 | ||
59 | // create new budgetdisplay object | 59 | // create new budgetdisplay object |
60 | budgetdisplay = new BudgetDisplay ( maintabs ); | 60 | budgetdisplay = new BudgetDisplay ( maintabs ); |
61 | budgetdisplay->hide(); | 61 | budgetdisplay->hide(); |
62 | 62 | ||
63 | tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); | 63 | tabslayout = new QVBoxLayout ( maintabs, 4, 2 ); |
64 | tabslayout->addSpacing ( tabheight ); | 64 | tabslayout->addSpacing ( tabheight ); |
65 | tabslayout->addWidget ( accountdisplay ); | 65 | tabslayout->addWidget ( accountdisplay ); |
66 | tabslayout->addWidget ( transactiondisplay ); | 66 | tabslayout->addWidget ( transactiondisplay ); |
67 | tabslayout->addWidget ( budgetdisplay ); | 67 | tabslayout->addWidget ( budgetdisplay ); |
68 | 68 | ||
69 | // connect a change in the maintabs with changing the tab display | 69 | // connect a change in the maintabs with changing the tab display |
70 | connect ( maintabs, SIGNAL ( currentChanged ( QWidget * ) ), this, SLOT ( changeTabDisplay () ) ); | 70 | connect ( maintabs, SIGNAL ( currentChanged(QWidget*) ), this, SLOT ( changeTabDisplay() ) ); |
71 | 71 | ||
72 | // create layout that will contain the menubar and the maintabs | 72 | // create layout that will contain the menubar and the maintabs |
73 | layout = new QVBoxLayout ( this, 2, 2 ); | 73 | layout = new QVBoxLayout ( this, 2, 2 ); |
74 | layout->setMenuBar ( mainmenu ); | 74 | layout->setMenuBar ( mainmenu ); |
75 | layout->addWidget ( maintabs ); | 75 | layout->addWidget ( maintabs ); |
76 | } | 76 | } |
77 | 77 | ||
78 | QashMoney::~QashMoney () | 78 | QashMoney::~QashMoney () |
79 | { | 79 | { |
80 | delete budget; | 80 | delete budget; |
81 | delete preferences; | 81 | delete preferences; |
82 | delete account; | 82 | delete account; |
83 | delete transaction; | 83 | delete transaction; |
84 | delete transfer; | 84 | delete transfer; |
85 | delete memory; | 85 | delete memory; |
86 | } | 86 | } |
87 | 87 | ||
88 | void QashMoney::changeTabDisplay () | 88 | void QashMoney::changeTabDisplay () |
89 | { | 89 | { |
90 | // if the user pressed the transactions tab, hide the account display | 90 | // if the user pressed the transactions tab, hide the account display |
91 | // object and create a new transaction display | 91 | // object and create a new transaction display |
92 | if ( maintabs->currentPageIndex() == 1 ) | 92 | if ( maintabs->currentPageIndex() == 1 ) |
93 | { | 93 | { |
94 | // initialize variables | 94 | // initialize variables |
95 | bool children = FALSE; | 95 | bool children = FALSE; |
96 | 96 | ||
97 | // hide the account display and define accountid | 97 | // hide the account display and define accountid |
98 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); | 98 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); |
99 | 99 | ||
100 | //remove all the columns from the transactiondisplay | 100 | //remove all the columns from the transactiondisplay |
101 | int columns = transactiondisplay->listview->columns(); | 101 | int columns = transactiondisplay->listview->columns(); |
102 | int counter; | 102 | int counter; |
103 | for ( counter = 0; counter <= columns; counter++ ) | 103 | for ( counter = 0; counter <= columns; counter++ ) |
104 | transactiondisplay->listview->removeColumn ( 0 ); | 104 | transactiondisplay->listview->removeColumn ( 0 ); |
105 | 105 | ||
106 | // set the account name and account balance | 106 | // set the account name and account balance |
107 | QString name = account->getAccountName ( accountid ); | 107 | QString name = account->getAccountName ( accountid ); |
108 | QString balance = account->getAccountBalance ( accountid ); | 108 | QString balance = account->getAccountBalance ( accountid ); |
109 | transactiondisplay->name->setText ( name ); | 109 | transactiondisplay->name->setText ( name ); |
110 | transactiondisplay->balance->setText ( balance ); | 110 | transactiondisplay->balance->setText ( balance ); |
111 | 111 | ||
112 | // clear the limitbox | 112 | // clear the limitbox |
113 | transactiondisplay->limitbox->clear(); | 113 | transactiondisplay->limitbox->clear(); |
114 | 114 | ||
115 | // get parent account id | 115 | // get parent account id |
116 | int parentaccountid = account->getParentAccountID ( accountid ); | 116 | int parentaccountid = account->getParentAccountID ( accountid ); |
117 | 117 | ||
118 | // add columns based on which account is selected | 118 | // add columns based on which account is selected |
119 | // this first if determines if we selected a parent with no children or a child | 119 | // this first if determines if we selected a parent with no children or a child |
120 | // in these cases, we add standard three columns for date, transaction, amount | 120 | // in these cases, we add standard three columns for date, transaction, amount |
121 | transactiondisplay->listview->addColumn ( "Date", 0 ); | 121 | transactiondisplay->listview->addColumn ( "Date", 0 ); |
122 | transactiondisplay->listview->addColumn ( "Transaction", 0 ); | 122 | transactiondisplay->listview->addColumn ( "Transaction", 0 ); |
123 | transactiondisplay->listview->addColumn ( "Amt", 0); | 123 | transactiondisplay->listview->addColumn ( "Amt", 0); |
124 | transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight ); | 124 | transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight ); |
125 | transactiondisplay->listview->addColumn ( "", 0 ); | 125 | transactiondisplay->listview->addColumn ( "", 0 ); |
126 | 126 | ||
127 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children | 127 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children |
128 | { | 128 | { |
129 | // add an extra column for the account name for eac child transaction | 129 | // add an extra column for the account name for eac child transaction |
130 | transactiondisplay->listview->addColumn ( "Acct", 0 ); | 130 | transactiondisplay->listview->addColumn ( "Acct", 0 ); |
131 | children = TRUE; | 131 | children = TRUE; |
132 | 132 | ||
133 | // hide the new transaction button | 133 | // hide the new transaction button |
134 | transactiondisplay->newtransaction->setEnabled ( FALSE ); | 134 | transactiondisplay->newtransaction->setEnabled ( FALSE ); |
135 | } | 135 | } |
136 | else //we selected a parent without children or a child | 136 | else //we selected a parent without children or a child |
137 | transactiondisplay->newtransaction->setEnabled ( TRUE ); | 137 | transactiondisplay->newtransaction->setEnabled ( TRUE ); |
138 | 138 | ||
139 | // disable the transactionid column so it can't be red | 139 | // disable the transactionid column so it can't be red |
140 | transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); | 140 | transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); |
141 | 141 | ||
142 | // set the accountid and children variables | 142 | // set the accountid and children variables |
143 | transactiondisplay->setChildren ( children ); | 143 | transactiondisplay->setChildren ( children ); |
144 | transactiondisplay->setAccountID ( accountid ); | 144 | transactiondisplay->setAccountID ( accountid ); |
145 | 145 | ||
146 | setTransactionDisplayDate (); | 146 | setTransactionDisplayDate (); |
147 | 147 | ||
148 | // display transactions | 148 | // display transactions |
149 | transactiondisplay->listview->clear(); | 149 | transactiondisplay->listview->clear(); |
150 | QString displaytext = "%"; | 150 | QString displaytext = "%"; |
151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
152 | if ( transaction->getNumberOfTransactions() > 0 ) | 152 | if ( transaction->getNumberOfTransactions() > 0 ) |
153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
154 | 154 | ||
155 | // display transfers | 155 | // display transfers |
156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); | 156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
157 | 157 | ||
158 | // open a new preferences object and resize the transaction display columns | 158 | // open a new preferences object and resize the transaction display columns |
159 | // each column will have a different size based on whether we are looking at a child | 159 | // each column will have a different size based on whether we are looking at a child |
160 | // account or children through a parent | 160 | // account or children through a parent |
161 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns | 161 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns |
162 | { | 162 | { |
163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width | 163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width |
164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width | 165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width |
166 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); | 166 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); |
@@ -259,144 +259,144 @@ void QashMoney::displayDatePreferencesDialog () | |||
259 | // set children so we can let displayTransfers know if there are children for the selected account | 259 | // set children so we can let displayTransfers know if there are children for the selected account |
260 | bool children; | 260 | bool children; |
261 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 261 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
262 | children = TRUE; | 262 | children = TRUE; |
263 | else | 263 | else |
264 | children = FALSE; | 264 | children = FALSE; |
265 | 265 | ||
266 | // redisplay transactions if they are visible incorporating | 266 | // redisplay transactions if they are visible incorporating |
267 | // any changes to the date format | 267 | // any changes to the date format |
268 | transactiondisplay->listview->clear(); | 268 | transactiondisplay->listview->clear(); |
269 | QString displaytext = "%"; | 269 | QString displaytext = "%"; |
270 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 270 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
271 | 271 | ||
272 | setTransactionDisplayDate(); | 272 | setTransactionDisplayDate(); |
273 | if ( transaction->getNumberOfTransactions() > 0 ) | 273 | if ( transaction->getNumberOfTransactions() > 0 ) |
274 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 274 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
275 | 275 | ||
276 | if ( transfer->getNumberOfTransfers() != 0 ) | 276 | if ( transfer->getNumberOfTransfers() != 0 ) |
277 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); | 277 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
278 | } | 278 | } |
279 | else if ( accountdisplay->isVisible() ) | 279 | else if ( accountdisplay->isVisible() ) |
280 | { | 280 | { |
281 | accountdisplay->listview->clearSelection(); | 281 | accountdisplay->listview->clearSelection(); |
282 | maintabs->setTabEnabled ( tab_2, FALSE ); | 282 | maintabs->setTabEnabled ( tab_2, FALSE ); |
283 | } | 283 | } |
284 | else | 284 | else |
285 | budgetdisplay->updateBudgetInformation(); | 285 | budgetdisplay->updateBudgetInformation(); |
286 | } | 286 | } |
287 | 287 | ||
288 | void QashMoney::displayTransactionPreferencesDialog () | 288 | void QashMoney::displayTransactionPreferencesDialog () |
289 | { | 289 | { |
290 | // display a dialog for setting preferences for transactions | 290 | // display a dialog for setting preferences for transactions |
291 | TransactionPreferences *td = new TransactionPreferences ( this ); | 291 | TransactionPreferences *td = new TransactionPreferences ( this ); |
292 | td->exec (); | 292 | td->exec (); |
293 | if ( transactiondisplay->isVisible() ) | 293 | if ( transactiondisplay->isVisible() ) |
294 | { | 294 | { |
295 | // set the account id | 295 | // set the account id |
296 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); | 296 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); |
297 | 297 | ||
298 | // set children so we can let displayTransfers know if there are children for the selected account | 298 | // set children so we can let displayTransfers know if there are children for the selected account |
299 | bool children; | 299 | bool children; |
300 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 300 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
301 | children = TRUE; | 301 | children = TRUE; |
302 | else | 302 | else |
303 | children = FALSE; | 303 | children = FALSE; |
304 | 304 | ||
305 | // redisplay transactions incorporating any transaction preference changes | 305 | // redisplay transactions incorporating any transaction preference changes |
306 | transactiondisplay->listview->clear(); | 306 | transactiondisplay->listview->clear(); |
307 | QString displaytext = "%"; | 307 | QString displaytext = "%"; |
308 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 308 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
309 | 309 | ||
310 | setTransactionDisplayDate(); | 310 | setTransactionDisplayDate(); |
311 | if ( transaction->getNumberOfTransactions() > 0 ) | 311 | if ( transaction->getNumberOfTransactions() > 0 ) |
312 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 312 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
313 | 313 | ||
314 | if ( transfer->getNumberOfTransfers() != 0 ) | 314 | if ( transfer->getNumberOfTransfers() != 0 ) |
315 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); | 315 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
316 | } | 316 | } |
317 | else | 317 | else |
318 | { | 318 | { |
319 | accountdisplay->listview->clearSelection(); | 319 | accountdisplay->listview->clearSelection(); |
320 | maintabs->setTabEnabled ( tab_2, FALSE ); | 320 | maintabs->setTabEnabled ( tab_2, FALSE ); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | void QashMoney::displayAccountPreferencesDialog () | 324 | void QashMoney::displayAccountPreferencesDialog () |
325 | { | 325 | { |
326 | // display a dialog for setting preferences for accounts | 326 | // display a dialog for setting preferences for accounts |
327 | AccountPreferences *ap = new AccountPreferences ( this ); | 327 | AccountPreferences *ap = new AccountPreferences ( this ); |
328 | ap->exec (); | 328 | ap->exec (); |
329 | 329 | ||
330 | if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) | 330 | if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) |
331 | { | 331 | { |
332 | accountdisplay->listview->clear(); | 332 | accountdisplay->listview->clear(); |
333 | account->displayAccounts ( accountdisplay->listview ); | 333 | account->displayAccounts ( accountdisplay->listview ); |
334 | accountdisplay->listview->clearSelection(); | 334 | accountdisplay->listview->clearSelection(); |
335 | maintabs->setTabEnabled ( tab_2, FALSE ); | 335 | maintabs->setTabEnabled ( tab_2, FALSE ); |
336 | } | 336 | } |
337 | changeTabDisplay(); | 337 | changeTabDisplay(); |
338 | } | 338 | } |
339 | 339 | ||
340 | void QashMoney::displayMemoryDialog () | 340 | void QashMoney::displayMemoryDialog () |
341 | { | 341 | { |
342 | // opens a dialog to add, edit and delete memory items | 342 | // opens a dialog to add, edit and delete memory items |
343 | MemoryDialog *md = new MemoryDialog (); | 343 | MemoryDialog *md = new MemoryDialog (); |
344 | md->exec(); | 344 | md->exec(); |
345 | } | 345 | } |
346 | 346 | ||
347 | void QashMoney::showTransactions () | 347 | void QashMoney::showTransactions () |
348 | { | 348 | { |
349 | maintabs->setCurrentPage ( 1 ); | 349 | maintabs->setCurrentPage ( 1 ); |
350 | } | 350 | } |
351 | 351 | ||
352 | void QashMoney::enableOneTouchViewing () | 352 | void QashMoney::enableOneTouchViewing () |
353 | { | 353 | { |
354 | if ( preferences->getPreference ( 5 ) == 1 ) | 354 | if ( preferences->getPreference ( 5 ) == 1 ) |
355 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 355 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); |
356 | else | 356 | else |
357 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 357 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); |
358 | } | 358 | } |
359 | 359 | ||
360 | void QashMoney::disableOneTouchViewing () | 360 | void QashMoney::disableOneTouchViewing () |
361 | { | 361 | { |
362 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 362 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged() ), this, SLOT ( showTransactions() ) ); |
363 | } | 363 | } |
364 | 364 | ||
365 | void QashMoney::toggleOneTouchViewing ( bool state ) | 365 | void QashMoney::toggleOneTouchViewing ( bool state ) |
366 | { | 366 | { |
367 | if ( state == TRUE ) | 367 | if ( state == TRUE ) |
368 | disableOneTouchViewing(); | 368 | disableOneTouchViewing(); |
369 | else | 369 | else |
370 | enableOneTouchViewing(); | 370 | enableOneTouchViewing(); |
371 | } | 371 | } |
372 | 372 | ||
373 | void QashMoney::setTransactionDisplayDate () | 373 | void QashMoney::setTransactionDisplayDate () |
374 | { | 374 | { |
375 | // determine how many days of transactions to show | 375 | // determine how many days of transactions to show |
376 | int limittype = preferences->getPreference ( 7 ); | 376 | int limittype = preferences->getPreference ( 7 ); |
377 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | 377 | if ( limittype != 5 ) // set today's date if we are not showing all transactions |
378 | { | 378 | { |
379 | QDate today = QDate::currentDate (); | 379 | QDate today = QDate::currentDate (); |
380 | switch ( limittype ) // if we are not showing all transactions | 380 | switch ( limittype ) // if we are not showing all transactions |
381 | { | 381 | { |
382 | case 0: // viewing two weeks | 382 | case 0: // viewing two weeks |
383 | newdate = today.addDays ( -14 ); | 383 | newdate = today.addDays ( -14 ); |
384 | break; | 384 | break; |
385 | case 1: // viewing one month | 385 | case 1: // viewing one month |
386 | newdate = today.addDays ( -30 ); | 386 | newdate = today.addDays ( -30 ); |
387 | break; | 387 | break; |
388 | case 2: // three months | 388 | case 2: // three months |
389 | newdate = today.addDays ( -90 ); | 389 | newdate = today.addDays ( -90 ); |
390 | break; | 390 | break; |
391 | case 3: // six months | 391 | case 3: // six months |
392 | newdate = today.addDays ( -180 ); | 392 | newdate = today.addDays ( -180 ); |
393 | break; | 393 | break; |
394 | case 4: // one year | 394 | case 4: // one year |
395 | newdate = today.addDays ( -365 ); | 395 | newdate = today.addDays ( -365 ); |
396 | break; | 396 | break; |
397 | } | 397 | } |
398 | } | 398 | } |
399 | else | 399 | else |
400 | newdate = QDate ( 1900, 1, 1 ); | 400 | newdate = QDate ( 1900, 1, 1 ); |
401 | } | 401 | } |
402 | 402 | ||