-rw-r--r-- | library/categoryedit_p.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/library/categoryedit_p.cpp b/library/categoryedit_p.cpp index 14ac2e1..ee0da22 100644 --- a/library/categoryedit_p.cpp +++ b/library/categoryedit_p.cpp @@ -122,18 +122,21 @@ void CategoryEdit::slotSetText( QListViewItem *selected ) chkGlobal->setChecked( false ); } void CategoryEdit::slotAdd() { QString name = tr( "New Category" ); - bool insertOk = FALSE; + int uid = 0; int num = 0; - while ( !insertOk ) { + while ( !uid ) { if ( num++ > 0 ) name = tr("New Category ") + QString::number(num); - insertOk = d->mCategories.addCategory( d->mStrApp, name ); + if ( chkGlobal->isChecked() ) + uid = d->mCategories.addGlobalCategory( name ); + else + uid = d->mCategories.addCategory( d->mStrApp, name ); } QCheckListItem *chk; chk = new QCheckListItem( lvView, name, QCheckListItem::CheckBox ); if ( !chkGlobal->isChecked() ) chk->setText( 1, tr(d->mVisible) ); else |