summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/checkbook/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index d9e2047..8e2e2e3 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -234,24 +234,25 @@ void MainWindow::slotEdit()
{
// get name and open it
QListViewItem *curritem = cbList->currentItem();
if ( !curritem )
return;
openBook( curritem );
}
// --- openBook ---------------------------------------------------------------
void MainWindow::openBook(QListViewItem *curritem)
{
+ if ( !curritem ) return;
// find book in List
QString currname=curritem->text(posName);
CBInfo *cb = checkbooks->first();
while ( cb ) {
if ( cb->name() == currname )
break;
cb = checkbooks->next();
}
if ( !cb ) return;
//
buildFilename( currname );
@@ -268,28 +269,26 @@ void MainWindow::openBook(QListViewItem *curritem)
}
delete pw;
}
_cfg.setLastBook( currname );
Checkbook *currcb = new Checkbook( this, cb, &_cfg );
if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted )
{
QString newname = cb->name();
if ( currname != newname )
{
// Update name if changed
- if( curritem ) {
curritem->setText( posName, newname );
cbList->sort();
- }
_cfg.setLastBook( newname );
// Remove old file
QFile f( tempFilename );
if ( f.exists() )
f.remove();
// Get new filename
buildFilename( newname );
cb->setFilename( tempFilename );
}