summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index 8d64cad..bf00102 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -49,25 +49,24 @@
49 49
50 50
51MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) 51MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl )
52 : QMainWindow( parent, name, fl || WStyle_ContextHelp ) 52 : QMainWindow( parent, name, fl || WStyle_ContextHelp )
53{ 53{
54 setCaption( tr( "Checkbook" ) ); 54 setCaption( tr( "Checkbook" ) );
55 55
56 cbDir = Global::applicationFileName( "checkbook", "" ); 56 cbDir = Global::applicationFileName( "checkbook", "" );
57 lockIcon = Resource::loadPixmap( "locked" ); 57 lockIcon = Resource::loadPixmap( "locked" );
58 58
59 // Load configuration options 59 // Load configuration options
60 Config config( "checkbook" ); 60 Config config( "checkbook" );
61qDebug( "Reading config" );
62 _cfg.readConfig( config ); 61 _cfg.readConfig( config );
63 62
64 63
65 // Build menu and tool bars 64 // Build menu and tool bars
66 setToolBarsMovable( FALSE ); 65 setToolBarsMovable( FALSE );
67 66
68 QPEToolBar *bar = new QPEToolBar( this ); 67 QPEToolBar *bar = new QPEToolBar( this );
69 bar->setHorizontalStretchable( TRUE ); 68 bar->setHorizontalStretchable( TRUE );
70 QPEMenuBar *mb = new QPEMenuBar( bar ); 69 QPEMenuBar *mb = new QPEMenuBar( bar );
71 mb->setMargin( 0 ); 70 mb->setMargin( 0 );
72 QPopupMenu *popup = new QPopupMenu( this ); 71 QPopupMenu *popup = new QPopupMenu( this );
73 72
@@ -305,24 +304,30 @@ void MainWindow::openBook(QListViewItem *curritem)
305 curritem->setPixmap( 0, lockIcon ); 304 curritem->setPixmap( 0, lockIcon );
306 else 305 else
307 curritem->setPixmap( 0, nullIcon ); 306 curritem->setPixmap( 0, nullIcon );
308 } 307 }
309 308
310 // Update balance if changed 309 // Update balance if changed
311 if ( _cfg.getShowBalances() && cb->balance() != currbalance ) 310 if ( _cfg.getShowBalances() && cb->balance() != currbalance )
312 { 311 {
313 QString tempstr; 312 QString tempstr;
314 tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); 313 tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() );
315 curritem->setText( posName + 1, tempstr ); 314 curritem->setText( posName + 1, tempstr );
316 } 315 }
316
317 // write config, if needed
318 if( _cfg.isDirty() ) {
319 Config config("checkbook");
320 _cfg.writeConfig( config );
321 }
317 } 322 }
318 delete currcb; 323 delete currcb;
319} 324}
320 325
321// --- slotDelete ------------------------------------------------------------- 326// --- slotDelete -------------------------------------------------------------
322void MainWindow::slotDelete() 327void MainWindow::slotDelete()
323{ 328{
324 QString currname = cbList->currentItem()->text( posName ); 329 QString currname = cbList->currentItem()->text( posName );
325 330
326 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) 331 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) )
327 { 332 {
328 buildFilename( currname ); 333 buildFilename( currname );