Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index 1ea358c..83eea01 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -98,102 +98,104 @@ void QashMoney::changeTabDisplay () | |||
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 (); | ||
147 | |||
146 | // display transactions | 148 | // display transactions |
147 | transactiondisplay->listview->clear(); | 149 | transactiondisplay->listview->clear(); |
148 | QString displaytext = "%"; | 150 | QString displaytext = "%"; |
149 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
150 | if ( transaction->getNumberOfTransactions() > 0 ) | 152 | if ( transaction->getNumberOfTransactions() > 0 ) |
151 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
152 | 154 | ||
153 | // display transfers | 155 | // display transfers |
154 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); |
155 | 157 | ||
156 | // open a new preferences object and resize the transaction display columns | 158 | // open a new preferences object and resize the transaction display columns |
157 | // 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 |
158 | // account or children through a parent | 160 | // account or children through a parent |
159 | 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 |
160 | { | 162 | { |
161 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width | 163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width |
162 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
163 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width | 165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width |
164 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); | 166 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); |
165 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 5 ) ); // normal transaction amount width | 167 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 5 ) ); // normal transaction amount width |
166 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); | 168 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); |
167 | } | 169 | } |
168 | else | 170 | else |
169 | { | 171 | { |
170 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 6 ) ); // extended transaction date width | 172 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 6 ) ); // extended transaction date width |
171 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 173 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
172 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 7 ) ); // extended transaction name width | 174 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 7 ) ); // extended transaction name width |
173 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); | 175 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); |
174 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width | 176 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width |
175 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); | 177 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); |
176 | transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width | 178 | transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width |
177 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); | 179 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); |
178 | } | 180 | } |
179 | 181 | ||
180 | // show the window | 182 | // show the window |
181 | transactiondisplay->show(); | 183 | transactiondisplay->show(); |
182 | // hide the account display and define accountid | 184 | // hide the account display and define accountid |
183 | accountdisplay->hide(); | 185 | accountdisplay->hide(); |
184 | // hide the budget display | 186 | // hide the budget display |
185 | budgetdisplay->hide(); | 187 | budgetdisplay->hide(); |
186 | } | 188 | } |
187 | else if ( maintabs->currentPageIndex() == 0 ) | 189 | else if ( maintabs->currentPageIndex() == 0 ) |
188 | { | 190 | { |
189 | disableOneTouchViewing(); | 191 | disableOneTouchViewing(); |
190 | 192 | ||
191 | // clear the account display selection | 193 | // clear the account display selection |
192 | accountdisplay->listview->clearSelection(); | 194 | accountdisplay->listview->clearSelection(); |
193 | 195 | ||
194 | // resize the account display columns | 196 | // resize the account display columns |
195 | accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) ); | 197 | accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) ); |
196 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); | 198 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); |
197 | 199 | ||
198 | // display the accounts | 200 | // display the accounts |
199 | if ( account->getNumberOfAccounts() != 0 ) | 201 | if ( account->getNumberOfAccounts() != 0 ) |
@@ -209,148 +211,180 @@ void QashMoney::changeTabDisplay () | |||
209 | // hide the transaction display | 211 | // hide the transaction display |
210 | transactiondisplay->hide(); | 212 | transactiondisplay->hide(); |
211 | 213 | ||
212 | // hide the budget display | 214 | // hide the budget display |
213 | budgetdisplay->hide(); | 215 | budgetdisplay->hide(); |
214 | 216 | ||
215 | 217 | ||
216 | enableOneTouchViewing (); | 218 | enableOneTouchViewing (); |
217 | } | 219 | } |
218 | else | 220 | else |
219 | { | 221 | { |
220 | budgetdisplay->displayLineItems(); | 222 | budgetdisplay->displayLineItems(); |
221 | budgetdisplay->show(); | 223 | budgetdisplay->show(); |
222 | transactiondisplay->hide(); | 224 | transactiondisplay->hide(); |
223 | accountdisplay->hide(); | 225 | accountdisplay->hide(); |
224 | } | 226 | } |
225 | } | 227 | } |
226 | 228 | ||
227 | void QashMoney::setTransactionTab () | 229 | void QashMoney::setTransactionTab () |
228 | { | 230 | { |
229 | if ( accountdisplay->listview->selectedItem() == 0 ) | 231 | if ( accountdisplay->listview->selectedItem() == 0 ) |
230 | maintabs->setTabEnabled ( tab_2, FALSE ); | 232 | maintabs->setTabEnabled ( tab_2, FALSE ); |
231 | else | 233 | else |
232 | maintabs->setTabEnabled ( tab_2, TRUE ); | 234 | maintabs->setTabEnabled ( tab_2, TRUE ); |
233 | } | 235 | } |
234 | 236 | ||
235 | void QashMoney::displayDatePreferencesDialog () | 237 | void QashMoney::displayDatePreferencesDialog () |
236 | { | 238 | { |
237 | // this shows a dialog to set preferences for formatting the date | 239 | // this shows a dialog to set preferences for formatting the date |
238 | DatePreferences *pd = new DatePreferences ( this ); | 240 | DatePreferences *pd = new DatePreferences ( this ); |
239 | pd->exec (); | 241 | pd->exec (); |
240 | if ( transactiondisplay->isVisible() ) | 242 | if ( transactiondisplay->isVisible() ) |
241 | { | 243 | { |
242 | // set the account id | 244 | // set the account id |
243 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); | 245 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); |
244 | 246 | ||
245 | // set children so we can let displayTransfers know if there are children for the selected account | 247 | // set children so we can let displayTransfers know if there are children for the selected account |
246 | bool children; | 248 | bool children; |
247 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 249 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
248 | children = TRUE; | 250 | children = TRUE; |
249 | else | 251 | else |
250 | children = FALSE; | 252 | children = FALSE; |
251 | 253 | ||
252 | // redisplay transactions if they are visible incorporating | 254 | // redisplay transactions if they are visible incorporating |
253 | // any changes to the date format | 255 | // any changes to the date format |
254 | transactiondisplay->listview->clear(); | 256 | transactiondisplay->listview->clear(); |
255 | QString displaytext = "%"; | 257 | QString displaytext = "%"; |
256 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 258 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
259 | |||
260 | setTransactionDisplayDate(); | ||
257 | if ( transaction->getNumberOfTransactions() > 0 ) | 261 | if ( transaction->getNumberOfTransactions() > 0 ) |
258 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 262 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
259 | 263 | ||
260 | if ( transfer->getNumberOfTransfers() != 0 ) | 264 | if ( transfer->getNumberOfTransfers() != 0 ) |
261 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 265 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); |
262 | } | 266 | } |
263 | else if ( accountdisplay->isVisible() ) | 267 | else if ( accountdisplay->isVisible() ) |
264 | { | 268 | { |
265 | accountdisplay->listview->clearSelection(); | 269 | accountdisplay->listview->clearSelection(); |
266 | maintabs->setTabEnabled ( tab_2, FALSE ); | 270 | maintabs->setTabEnabled ( tab_2, FALSE ); |
267 | } | 271 | } |
268 | else | 272 | else |
269 | budgetdisplay->updateBudgetInformation(); | 273 | budgetdisplay->updateBudgetInformation(); |
270 | } | 274 | } |
271 | 275 | ||
272 | void QashMoney::displayTransactionPreferencesDialog () | 276 | void QashMoney::displayTransactionPreferencesDialog () |
273 | { | 277 | { |
274 | // display a dialog for setting preferences for transactions | 278 | // display a dialog for setting preferences for transactions |
275 | TransactionPreferences *td = new TransactionPreferences ( this ); | 279 | TransactionPreferences *td = new TransactionPreferences ( this ); |
276 | td->exec (); | 280 | td->exec (); |
277 | if ( transactiondisplay->isVisible() ) | 281 | if ( transactiondisplay->isVisible() ) |
278 | { | 282 | { |
279 | // set the account id | 283 | // set the account id |
280 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); | 284 | int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt(); |
281 | 285 | ||
282 | // set children so we can let displayTransfers know if there are children for the selected account | 286 | // set children so we can let displayTransfers know if there are children for the selected account |
283 | bool children; | 287 | bool children; |
284 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 288 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
285 | children = TRUE; | 289 | children = TRUE; |
286 | else | 290 | else |
287 | children = FALSE; | 291 | children = FALSE; |
288 | 292 | ||
289 | // redisplay transactions incorporating any transaction preference changes | 293 | // redisplay transactions incorporating any transaction preference changes |
290 | transactiondisplay->listview->clear(); | 294 | transactiondisplay->listview->clear(); |
291 | QString displaytext = "%"; | 295 | QString displaytext = "%"; |
292 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 296 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
297 | |||
298 | setTransactionDisplayDate(); | ||
293 | if ( transaction->getNumberOfTransactions() > 0 ) | 299 | if ( transaction->getNumberOfTransactions() > 0 ) |
294 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 300 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
295 | 301 | ||
296 | if ( transfer->getNumberOfTransfers() != 0 ) | 302 | if ( transfer->getNumberOfTransfers() != 0 ) |
297 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 303 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); |
298 | } | 304 | } |
299 | else | 305 | else |
300 | { | 306 | { |
301 | accountdisplay->listview->clearSelection(); | 307 | accountdisplay->listview->clearSelection(); |
302 | maintabs->setTabEnabled ( tab_2, FALSE ); | 308 | maintabs->setTabEnabled ( tab_2, FALSE ); |
303 | } | 309 | } |
304 | } | 310 | } |
305 | 311 | ||
306 | void QashMoney::displayAccountPreferencesDialog () | 312 | void QashMoney::displayAccountPreferencesDialog () |
307 | { | 313 | { |
308 | // display a dialog for setting preferences for accounts | 314 | // display a dialog for setting preferences for accounts |
309 | AccountPreferences *ap = new AccountPreferences ( this ); | 315 | AccountPreferences *ap = new AccountPreferences ( this ); |
310 | ap->exec (); | 316 | ap->exec (); |
311 | 317 | ||
312 | if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) | 318 | if ( accountdisplay->isVisible() && account->getNumberOfAccounts() != 0 ) |
313 | { | 319 | { |
314 | accountdisplay->listview->clear(); | 320 | accountdisplay->listview->clear(); |
315 | account->displayAccounts ( accountdisplay->listview ); | 321 | account->displayAccounts ( accountdisplay->listview ); |
316 | accountdisplay->listview->clearSelection(); | 322 | accountdisplay->listview->clearSelection(); |
317 | maintabs->setTabEnabled ( tab_2, FALSE ); | 323 | maintabs->setTabEnabled ( tab_2, FALSE ); |
318 | } | 324 | } |
319 | changeTabDisplay(); | 325 | changeTabDisplay(); |
320 | } | 326 | } |
321 | 327 | ||
322 | void QashMoney::displayMemoryDialog () | 328 | void QashMoney::displayMemoryDialog () |
323 | { | 329 | { |
324 | // opens a dialog to add, edit and delete memory items | 330 | // opens a dialog to add, edit and delete memory items |
325 | MemoryDialog *md = new MemoryDialog (); | 331 | MemoryDialog *md = new MemoryDialog (); |
326 | md->exec(); | 332 | md->exec(); |
327 | } | 333 | } |
328 | 334 | ||
329 | void QashMoney::showTransactions () | 335 | void QashMoney::showTransactions () |
330 | { | 336 | { |
331 | maintabs->setCurrentPage ( 1 ); | 337 | maintabs->setCurrentPage ( 1 ); |
332 | } | 338 | } |
333 | 339 | ||
334 | void QashMoney::enableOneTouchViewing () | 340 | void QashMoney::enableOneTouchViewing () |
335 | { | 341 | { |
336 | if ( preferences->getPreference ( 5 ) == 1 ) | 342 | if ( preferences->getPreference ( 5 ) == 1 ) |
337 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 343 | connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); |
338 | else | 344 | else |
339 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 345 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); |
340 | } | 346 | } |
341 | 347 | ||
342 | void QashMoney::disableOneTouchViewing () | 348 | void QashMoney::disableOneTouchViewing () |
343 | { | 349 | { |
344 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 350 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); |
345 | } | 351 | } |
346 | 352 | ||
347 | void QashMoney::toggleOneTouchViewing ( bool state ) | 353 | void QashMoney::toggleOneTouchViewing ( bool state ) |
348 | { | 354 | { |
349 | if ( state == TRUE ) | 355 | if ( state == TRUE ) |
350 | disableOneTouchViewing(); | 356 | disableOneTouchViewing(); |
351 | else | 357 | else |
352 | enableOneTouchViewing(); | 358 | enableOneTouchViewing(); |
353 | } | 359 | } |
354 | 360 | ||
355 | 361 | void QashMoney::setTransactionDisplayDate () | |
362 | { | ||
363 | // determine how many days of transactions to show | ||
364 | int limittype = preferences->getPreference ( 7 ); | ||
365 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | ||
366 | { | ||
367 | QDate today = QDate::currentDate (); | ||
368 | switch ( limittype ) // if we are not showing all transactions | ||
369 | { | ||
370 | case 0: // viewing two weeks | ||
371 | newdate = today.addDays ( -14 ); | ||
372 | break; | ||
373 | case 1: // viewing one month | ||
374 | newdate = today.addDays ( -30 ); | ||
375 | break; | ||
376 | case 2: // three months | ||
377 | newdate = today.addDays ( -90 ); | ||
378 | break; | ||
379 | case 3: // six months | ||
380 | newdate = today.addDays ( -180 ); | ||
381 | break; | ||
382 | case 4: // one year | ||
383 | newdate = today.addDays ( -365 ); | ||
384 | break; | ||
385 | } | ||
386 | } | ||
387 | else | ||
388 | newdate = QDate ( 1, 1, 1000 ); | ||
389 | } | ||
356 | 390 | ||