Diffstat (limited to 'noncore/apps/checkbook/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index ead17b4..2eb8396 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -92,72 +92,77 @@ MainWindow::MainWindow() // Load Checkbook selection list QDir checkdir( cbDir ); if (checkdir.exists() == true) { QStringList checkbooks = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time ); for ( QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++ ) { (*it) = (*it).remove( (*it).find('.'), (*it).length() ); } cbList->insertStringList( checkbooks ); } cbList->sort(); cbList->setSelected( 0, TRUE ); currencySymbol = '$'; } MainWindow::~MainWindow() { } void MainWindow::slotNew() { Checkbook *currcb = new Checkbook( this, "", cbDir, currencySymbol ); currcb->showMaximized(); if ( currcb->exec() == QDialog::Accepted ) { cbList->insertItem( currcb->getName() ); cbList->sort(); delete currcb; } } void MainWindow::slotEdit() { QString currname = cbList->currentText(); Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); currcb->showMaximized(); if ( currcb->exec() == QDialog::Accepted ) { QString newname = currcb->getName(); if ( currname != newname ) { cbList->changeItem( newname, cbList->currentItem() ); cbList->sort(); - QFile f( cbDir + currname + ".qcb" ); + QString tempstr = cbDir; + tempstr.append( currname ); + tempstr.append( ".qcb" ); + QFile f( tempstr ); if ( f.exists() ) { f.remove(); } } delete currcb; } } void MainWindow::slotDelete() { if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) ) { - QString name = cbDir + cbList->currentText() + ".qcb"; - QFile f( name ); + QString tempstr = cbDir; + tempstr.append( cbList->currentText() ); + tempstr.append( ".qcb" ); + QFile f( tempstr ); if ( f.exists() ) { f.remove(); } cbList->removeItem( cbList->currentItem() ); } } |