Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index 83eea01..20e8d32 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -13,12 +13,13 @@ Transfer *transfer = new Transfer (); | |||
13 | Memory *memory = new Memory (); | 13 | Memory *memory = new Memory (); |
14 | 14 | ||
15 | QashMoney::QashMoney () : QWidget () | 15 | QashMoney::QashMoney () : QWidget () |
16 | { | 16 | { |
17 | preferences->addPreferences(); | 17 | preferences->addPreferences(); |
18 | preferences->initializeColumnPreferences (); | 18 | preferences->initializeColumnPreferences (); |
19 | preferences->initializeSortingPreferences (); | ||
19 | 20 | ||
20 | // set the text in the upper part of the frame | 21 | // set the text in the upper part of the frame |
21 | setCaption ( tr ( "QashMoney" ) ); | 22 | setCaption ( tr ( "QashMoney" ) ); |
22 | 23 | ||
23 | // Create new menubar for our mainwindow | 24 | // Create new menubar for our mainwindow |
24 | // and add menu items | 25 | // and add menu items |
@@ -150,13 +151,13 @@ void QashMoney::changeTabDisplay () | |||
150 | QString displaytext = "%"; | 151 | QString displaytext = "%"; |
151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 152 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
152 | if ( transaction->getNumberOfTransactions() > 0 ) | 153 | if ( transaction->getNumberOfTransactions() > 0 ) |
153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 154 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
154 | 155 | ||
155 | // display transfers | 156 | // display transfers |
156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 157 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
157 | 158 | ||
158 | // open a new preferences object and resize the transaction display columns | 159 | // 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 | 160 | // each column will have a different size based on whether we are looking at a child |
160 | // account or children through a parent | 161 | // 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 | 162 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns |
162 | { | 163 | { |
@@ -176,12 +177,18 @@ void QashMoney::changeTabDisplay () | |||
176 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width | 177 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width |
177 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); | 178 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); |
178 | transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width | 179 | transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width |
179 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); | 180 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); |
180 | } | 181 | } |
181 | 182 | ||
183 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | ||
184 | int column = 0; | ||
185 | int direction = 0; | ||
186 | preferences->getSortingPreference ( 2, &column, &direction ); | ||
187 | transactiondisplay->listview->setSorting ( column, direction ); | ||
188 | |||
182 | // show the window | 189 | // show the window |
183 | transactiondisplay->show(); | 190 | transactiondisplay->show(); |
184 | // hide the account display and define accountid | 191 | // hide the account display and define accountid |
185 | accountdisplay->hide(); | 192 | accountdisplay->hide(); |
186 | // hide the budget display | 193 | // hide the budget display |
187 | budgetdisplay->hide(); | 194 | budgetdisplay->hide(); |
@@ -194,12 +201,18 @@ void QashMoney::changeTabDisplay () | |||
194 | accountdisplay->listview->clearSelection(); | 201 | accountdisplay->listview->clearSelection(); |
195 | 202 | ||
196 | // resize the account display columns | 203 | // resize the account display columns |
197 | accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) ); | 204 | accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) ); |
198 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); | 205 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); |
199 | 206 | ||
207 | // set sorting preference on account display columns | ||
208 | int column = 0; | ||
209 | int direction = 0; | ||
210 | preferences->getSortingPreference ( 1, &column, &direction ); | ||
211 | accountdisplay->listview->setSorting ( column, direction ); | ||
212 | |||
200 | // display the accounts | 213 | // display the accounts |
201 | if ( account->getNumberOfAccounts() != 0 ) | 214 | if ( account->getNumberOfAccounts() != 0 ) |
202 | account->displayAccounts ( accountdisplay->listview ); | 215 | account->displayAccounts ( accountdisplay->listview ); |
203 | maintabs->setTabEnabled ( tab_2, FALSE ); | 216 | maintabs->setTabEnabled ( tab_2, FALSE ); |
204 | 217 | ||
205 | // set the toggle button | 218 | // set the toggle button |
@@ -259,13 +272,13 @@ void QashMoney::displayDatePreferencesDialog () | |||
259 | 272 | ||
260 | setTransactionDisplayDate(); | 273 | setTransactionDisplayDate(); |
261 | if ( transaction->getNumberOfTransactions() > 0 ) | 274 | if ( transaction->getNumberOfTransactions() > 0 ) |
262 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 275 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
263 | 276 | ||
264 | if ( transfer->getNumberOfTransfers() != 0 ) | 277 | if ( transfer->getNumberOfTransfers() != 0 ) |
265 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 278 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
266 | } | 279 | } |
267 | else if ( accountdisplay->isVisible() ) | 280 | else if ( accountdisplay->isVisible() ) |
268 | { | 281 | { |
269 | accountdisplay->listview->clearSelection(); | 282 | accountdisplay->listview->clearSelection(); |
270 | maintabs->setTabEnabled ( tab_2, FALSE ); | 283 | maintabs->setTabEnabled ( tab_2, FALSE ); |
271 | } | 284 | } |
@@ -297,13 +310,13 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
297 | 310 | ||
298 | setTransactionDisplayDate(); | 311 | setTransactionDisplayDate(); |
299 | if ( transaction->getNumberOfTransactions() > 0 ) | 312 | if ( transaction->getNumberOfTransactions() > 0 ) |
300 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 313 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
301 | 314 | ||
302 | if ( transfer->getNumberOfTransfers() != 0 ) | 315 | if ( transfer->getNumberOfTransfers() != 0 ) |
303 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 316 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
304 | } | 317 | } |
305 | else | 318 | else |
306 | { | 319 | { |
307 | accountdisplay->listview->clearSelection(); | 320 | accountdisplay->listview->clearSelection(); |
308 | maintabs->setTabEnabled ( tab_2, FALSE ); | 321 | maintabs->setTabEnabled ( tab_2, FALSE ); |
309 | } | 322 | } |
@@ -382,9 +395,9 @@ void QashMoney::setTransactionDisplayDate () | |||
382 | case 4: // one year | 395 | case 4: // one year |
383 | newdate = today.addDays ( -365 ); | 396 | newdate = today.addDays ( -365 ); |
384 | break; | 397 | break; |
385 | } | 398 | } |
386 | } | 399 | } |
387 | else | 400 | else |
388 | newdate = QDate ( 1, 1, 1000 ); | 401 | newdate = QDate ( 1900, 1, 1 ); |
389 | } | 402 | } |
390 | 403 | ||