-rw-r--r-- | library/categoryedit_p.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/categoryedit_p.cpp b/library/categoryedit_p.cpp index 06e5fec..07e707e 100644 --- a/library/categoryedit_p.cpp +++ b/library/categoryedit_p.cpp @@ -54,51 +54,53 @@ public: }; CategoryEdit::CategoryEdit( QWidget *parent, const char *name ) : CategoryEditBase( parent, name ) { d = 0; } CategoryEdit::CategoryEdit( const QArray<int> &recCats, const QString &appName, const QString &visibleName, QWidget *parent, const char *name ) : CategoryEditBase( parent, name ) { d = 0; setCategories( recCats, appName, visibleName ); } void CategoryEdit::setCategories( const QArray<int> &recCats, const QString &appName, const QString &visibleName ) { if ( !d ) d = new CategoryEditPrivate( (QWidget*)parent(), name() ); d->mStrApp = appName; d->mVisible = visibleName; - QArray<int> cats = d->mCategories.ids( d->mStrApp ); - lvView->clear(); + QStringList appCats = d->mCategories.labels( d->mStrApp ); + QArray<int> cats = d->mCategories.ids(d->mStrApp, appCats); + lvView->clear(); + QStringList::ConstIterator it; int i, j; for ( i = 0, it = appCats.begin(); it != appCats.end(); i++, ++it ) { QCheckListItem *chk; chk = new QCheckListItem( lvView, (*it), QCheckListItem::CheckBox ); if ( !d->mCategories.isGlobal((*it)) ) chk->setText( 1, tr(d->mVisible) ); else chk->setText( 1, tr("All") ); // Is this record using this category, then we should check it for ( j = 0; j < int(recCats.count()); j++ ) { if ( cats[i] == recCats[j] ) { chk->setOn( true ); break; } } } lvView->setSorting( 0, TRUE ); lvView->sort(); if ( lvView->childCount() < 1 ) txtCat->setEnabled( FALSE ); else { lvView->setSelected( lvView->firstChild(), true ); } |