Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 23 |
1 files changed, 18 insertions, 5 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,10 +13,11 @@ 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 | ||
@@ -152,9 +153,9 @@ void QashMoney::changeTabDisplay () | |||
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 |
@@ -177,8 +178,14 @@ void QashMoney::changeTabDisplay () | |||
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 | } |
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 ); | ||
181 | 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 |
@@ -196,8 +203,14 @@ void QashMoney::changeTabDisplay () | |||
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 ); |
@@ -261,9 +274,9 @@ void QashMoney::displayDatePreferencesDialog () | |||
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(); |
@@ -299,9 +312,9 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
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(); |
@@ -384,7 +397,7 @@ void QashMoney::setTransactionDisplayDate () | |||
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 | ||