author | ar <ar> | 2004-02-08 19:14:56 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-08 19:14:56 (UTC) |
commit | 5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0 (patch) (unidiff) | |
tree | 525f35c4937c9f4ae99538289c5d1f96c53d7fa7 /noncore/apps/checkbook | |
parent | 2dc8add65c44b3dd240cf2bd3c276c3c0155f46b (diff) | |
download | opie-5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0.zip opie-5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0.tar.gz opie-5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0.tar.bz2 |
improve support for BigScreen
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 11 |
2 files changed, 6 insertions, 11 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index a42c824..a5492e4 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -474,26 +474,25 @@ void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) | |||
474 | 474 | ||
475 | 475 | ||
476 | // --- slotNewTran ------------------------------------------------------------ | 476 | // --- slotNewTran ------------------------------------------------------------ |
477 | void Checkbook::slotNewTran() | 477 | void Checkbook::slotNewTran() |
478 | { | 478 | { |
479 | TranInfo *traninfo = new TranInfo( info->getNextNumber() ); | 479 | TranInfo *traninfo = new TranInfo( info->getNextNumber() ); |
480 | if( !_dLastNew.isNull() ) | 480 | if( !_dLastNew.isNull() ) |
481 | traninfo->setDate(_dLastNew); | 481 | traninfo->setDate(_dLastNew); |
482 | 482 | ||
483 | Transaction *currtran = new Transaction( this, true, info->name(), | 483 | Transaction *currtran = new Transaction( this, true, info->name(), |
484 | traninfo, | 484 | traninfo, |
485 | _pCfg ); | 485 | _pCfg ); |
486 | currtran->showMaximized(); | 486 | if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted ) |
487 | if ( currtran->exec() == QDialog::Accepted ) | ||
488 | { | 487 | { |
489 | // Add to transaction list | 488 | // Add to transaction list |
490 | info->addTransaction( traninfo ); | 489 | info->addTransaction( traninfo ); |
491 | 490 | ||
492 | // Add to transaction table | 491 | // Add to transaction table |
493 | float amount; | 492 | float amount; |
494 | QString stramount; | 493 | QString stramount; |
495 | amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount(); | 494 | amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount(); |
496 | stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); | 495 | stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); |
497 | ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), traninfo->datestr(false), | 496 | ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), traninfo->datestr(false), |
498 | traninfo->number(), traninfo->datestr(true), traninfo->desc(), | 497 | traninfo->number(), traninfo->datestr(true), traninfo->desc(), |
499 | stramount ); | 498 | stramount ); |
@@ -521,26 +520,25 @@ void Checkbook::slotNewTran() | |||
521 | // --- slotEditTran ----------------------------------------------------------- | 520 | // --- slotEditTran ----------------------------------------------------------- |
522 | void Checkbook::slotEditTran() | 521 | void Checkbook::slotEditTran() |
523 | { | 522 | { |
524 | QListViewItem *curritem = tranTable->currentItem(); | 523 | QListViewItem *curritem = tranTable->currentItem(); |
525 | if ( !curritem ) | 524 | if ( !curritem ) |
526 | return; | 525 | return; |
527 | 526 | ||
528 | TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) ); | 527 | TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) ); |
529 | 528 | ||
530 | Transaction *currtran = new Transaction( this, false, info->name(), | 529 | Transaction *currtran = new Transaction( this, false, info->name(), |
531 | traninfo, | 530 | traninfo, |
532 | _pCfg ); | 531 | _pCfg ); |
533 | currtran->showMaximized(); | 532 | if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted ) |
534 | if ( currtran->exec() == QDialog::Accepted ) | ||
535 | { | 533 | { |
536 | curritem->setText( COL_NUM, traninfo->number() ); | 534 | curritem->setText( COL_NUM, traninfo->number() ); |
537 | curritem->setText( COL_SORTDATE, traninfo->datestr(false) ); | 535 | curritem->setText( COL_SORTDATE, traninfo->datestr(false) ); |
538 | curritem->setText( COL_DATE, traninfo->datestr(true) ); | 536 | curritem->setText( COL_DATE, traninfo->datestr(true) ); |
539 | curritem->setText( COL_DESC, traninfo->desc() ); | 537 | curritem->setText( COL_DESC, traninfo->desc() ); |
540 | 538 | ||
541 | float amount = traninfo->amount(); | 539 | float amount = traninfo->amount(); |
542 | if ( traninfo->withdrawal() ) | 540 | if ( traninfo->withdrawal() ) |
543 | { | 541 | { |
544 | amount *= -1; | 542 | amount *= -1; |
545 | } | 543 | } |
546 | QString stramount; | 544 | QString stramount; |
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index f29001a..60aea42 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -27,29 +27,29 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
30 | #include "cbinfo.h" | 30 | #include "cbinfo.h" |
31 | #include "configuration.h" | 31 | #include "configuration.h" |
32 | #include "password.h" | 32 | #include "password.h" |
33 | #include "checkbook.h" | 33 | #include "checkbook.h" |
34 | #include "listedit.h" | 34 | #include "listedit.h" |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include <qmenubar.h> | ||
40 | #include <qpe/qpemessagebox.h> | 39 | #include <qpe/qpemessagebox.h> |
41 | #include <qpe/qpetoolbar.h> | 40 | #include <qpe/qpetoolbar.h> |
42 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
43 | 42 | ||
43 | #include <qmenubar.h> | ||
44 | #include <qaction.h> | 44 | #include <qaction.h> |
45 | #include <qcheckbox.h> | 45 | #include <qcheckbox.h> |
46 | #include <qdir.h> | 46 | #include <qdir.h> |
47 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
48 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
49 | 49 | ||
50 | 50 | ||
51 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) | 51 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) |
52 | : QMainWindow( parent, name, WStyle_ContextHelp ) | 52 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
53 | { | 53 | { |
54 | setCaption( tr( "Checkbook" ) ); | 54 | setCaption( tr( "Checkbook" ) ); |
55 | 55 | ||
@@ -205,26 +205,25 @@ void MainWindow::addCheckbook( CBInfo *cb ) | |||
205 | void MainWindow::buildFilename( const QString &name ) | 205 | void MainWindow::buildFilename( const QString &name ) |
206 | { | 206 | { |
207 | tempFilename = cbDir; | 207 | tempFilename = cbDir; |
208 | tempFilename.append( name ); | 208 | tempFilename.append( name ); |
209 | tempFilename.append( ".qcb" ); | 209 | tempFilename.append( ".qcb" ); |
210 | } | 210 | } |
211 | 211 | ||
212 | void MainWindow::slotNew() | 212 | void MainWindow::slotNew() |
213 | { | 213 | { |
214 | CBInfo *cb = new CBInfo(); | 214 | CBInfo *cb = new CBInfo(); |
215 | 215 | ||
216 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 216 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
217 | currcb->showMaximized(); | 217 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
218 | if ( currcb->exec() == QDialog::Accepted ) | ||
219 | { | 218 | { |
220 | // Save new checkbook | 219 | // Save new checkbook |
221 | buildFilename( cb->name() ); | 220 | buildFilename( cb->name() ); |
222 | _cfg.setLastBook( cb->name() ); | 221 | _cfg.setLastBook( cb->name() ); |
223 | cb->setFilename( tempFilename ); | 222 | cb->setFilename( tempFilename ); |
224 | cb->write(); | 223 | cb->write(); |
225 | 224 | ||
226 | // Add to listbox | 225 | // Add to listbox |
227 | checkbooks->inSort( cb ); | 226 | checkbooks->inSort( cb ); |
228 | addCheckbook( cb ); | 227 | addCheckbook( cb ); |
229 | } | 228 | } |
230 | delete currcb; | 229 | delete currcb; |
@@ -263,26 +262,25 @@ void MainWindow::openBook(QListViewItem *curritem) | |||
263 | { | 262 | { |
264 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 263 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
265 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) | 264 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) |
266 | { | 265 | { |
267 | delete pw; | 266 | delete pw; |
268 | return; | 267 | return; |
269 | } | 268 | } |
270 | delete pw; | 269 | delete pw; |
271 | } | 270 | } |
272 | 271 | ||
273 | _cfg.setLastBook( currname ); | 272 | _cfg.setLastBook( currname ); |
274 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 273 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
275 | currcb->showMaximized(); | 274 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
276 | if ( currcb->exec() == QDialog::Accepted ) | ||
277 | { | 275 | { |
278 | QString newname = cb->name(); | 276 | QString newname = cb->name(); |
279 | if ( currname != newname ) | 277 | if ( currname != newname ) |
280 | { | 278 | { |
281 | // Update name if changed | 279 | // Update name if changed |
282 | if( curritem ) { | 280 | if( curritem ) { |
283 | curritem->setText( posName, newname ); | 281 | curritem->setText( posName, newname ); |
284 | cbList->sort(); | 282 | cbList->sort(); |
285 | } | 283 | } |
286 | _cfg.setLastBook( newname ); | 284 | _cfg.setLastBook( newname ); |
287 | 285 | ||
288 | // Remove old file | 286 | // Remove old file |
@@ -336,26 +334,25 @@ void MainWindow::slotDelete() | |||
336 | { | 334 | { |
337 | f.remove(); | 335 | f.remove(); |
338 | } | 336 | } |
339 | 337 | ||
340 | delete cbList->currentItem(); | 338 | delete cbList->currentItem(); |
341 | } | 339 | } |
342 | } | 340 | } |
343 | 341 | ||
344 | // --- slotConfigure ---------------------------------------------------------- | 342 | // --- slotConfigure ---------------------------------------------------------- |
345 | void MainWindow::slotConfigure() | 343 | void MainWindow::slotConfigure() |
346 | { | 344 | { |
347 | Configuration *cfgdlg = new Configuration( this, _cfg ); | 345 | Configuration *cfgdlg = new Configuration( this, _cfg ); |
348 | cfgdlg->showMaximized(); | 346 | if ( QPEApplication::execDialog( cfgdlg ) == QDialog::Accepted ) |
349 | if ( cfgdlg->exec() == QDialog::Accepted ) | ||
350 | { | 347 | { |
351 | // read data from config dialog & save it | 348 | // read data from config dialog & save it |
352 | cfgdlg->saveConfig( _cfg ); | 349 | cfgdlg->saveConfig( _cfg ); |
353 | writeConfig(); | 350 | writeConfig(); |
354 | buildList(); | 351 | buildList(); |
355 | } | 352 | } |
356 | delete cfgdlg; | 353 | delete cfgdlg; |
357 | } | 354 | } |
358 | 355 | ||
359 | 356 | ||
360 | // --- writeConfig -------------------------------------------------------------- | 357 | // --- writeConfig -------------------------------------------------------------- |
361 | void MainWindow::writeConfig() | 358 | void MainWindow::writeConfig() |