-rw-r--r-- | noncore/apps/checkbook/cbinfo.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/noncore/apps/checkbook/cbinfo.cpp b/noncore/apps/checkbook/cbinfo.cpp index 3a39317..9fdc6b2 100644 --- a/noncore/apps/checkbook/cbinfo.cpp +++ b/noncore/apps/checkbook/cbinfo.cpp @@ -71,49 +71,49 @@ CBInfo::CBInfo( const QString &name, const QString &filename ) float CBInfo::balance() { calcBalance(); return b; } void CBInfo::write() { QFile f( fn ); if ( f.exists() ) { f.remove(); } Config *config = new Config(fn, Config::File); // Save info config->setGroup( "Account" ); config->writeEntryCrypt( "Password", pw ); config->writeEntry( "Type", t ); config->writeEntry( "Bank", bn ); config->writeEntryCrypt( "Number", a ); config->writeEntryCrypt( "PINNumber", p ); - config->writeEntry( "Notes", n ); + config->writeEntry( "Notes", nt ); QString balstr; balstr.setNum( sb, 'f', 2 ); config->writeEntry( "Balance", balstr ); // Save transactions int i = 1; for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) { tran->write( config, i ); i++; } config->write(); delete config; } TranInfo *CBInfo::findTransaction( const QString &checknum, const QString &date, const QString &desc ) { TranInfo *traninfo = tl->first(); while ( traninfo ) { if ( traninfo->number() == checknum && traninfo->datestr() == date && traninfo->desc() == desc ) diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index 68c6aee..cabd231 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -183,48 +183,54 @@ void MainWindow::addCheckbook( CBInfo *cb ) lvi->setText( posName, cb->name() ); if ( showBalances ) { QString balance; balance.sprintf( "%s%.2f", currencySymbol.latin1(), cb->balance() ); lvi->setText( posName + 1, balance ); } } void MainWindow::buildFilename( const QString &name ) { tempFilename = cbDir; tempFilename.append( name ); tempFilename.append( ".qcb" ); } void MainWindow::slotNew() { CBInfo *cb = new CBInfo(); Checkbook *currcb = new Checkbook( this, cb, currencySymbol ); currcb->showMaximized(); if ( currcb->exec() == QDialog::Accepted ) { + // Save new checkbook + buildFilename( cb->name() ); + cb->setFilename( tempFilename ); + cb->write(); + + // Add to listbox checkbooks->inSort( cb ); addCheckbook( cb ); } delete currcb; } void MainWindow::slotEdit() { QListViewItem *curritem = cbList->currentItem(); if ( !curritem ) { return; } QString currname = curritem->text( posName ); CBInfo *cb = checkbooks->first(); while ( cb ) { if ( cb->name() == currname ) break; cb = checkbooks->next(); } if ( !cb ) |