summaryrefslogtreecommitdiff
authorerik <erik>2007-01-10 16:52:08 (UTC)
committer erik <erik>2007-01-10 16:52:08 (UTC)
commit51bd5e8d542372ad54898ce642fe9b82b8ba83f3 (patch) (unidiff)
treef2d6649a26347239e992082b22deca343939fc33
parent3c4c894bcdb1e49ce4d3e8167c8a21b1c617037d (diff)
downloadopie-51bd5e8d542372ad54898ce642fe9b82b8ba83f3.zip
opie-51bd5e8d542372ad54898ce642fe9b82b8ba83f3.tar.gz
opie-51bd5e8d542372ad54898ce642fe9b82b8ba83f3.tar.bz2
BUG: If the global category is checked in the category dialog the
'New Category' entry is still in local application scope. This means that the 'New Category' entry is in the wrong scope and all hell breaks loose. Actually the user will probably get confused that the category they are wanting to change is not in the right scope. FIX: Check to see that the global checkbox is checked before trying to add the new category. NOTE: This patch was originally submitted by Paul Eggleton (Blue Lightning). Thanks for the fix!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/categoryedit_p.cpp9
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
@@ -116,30 +116,33 @@ void CategoryEdit::slotSetText( QListViewItem *selected )
116 return; 116 return;
117 txtCat->setText( d->editItem->text(0) ); 117 txtCat->setText( d->editItem->text(0) );
118 txtCat->setEnabled( true ); 118 txtCat->setEnabled( true );
119 if ( d->editItem->text(1) == tr("All") ) 119 if ( d->editItem->text(1) == tr("All") )
120 chkGlobal->setChecked( true ); 120 chkGlobal->setChecked( true );
121 else 121 else
122 chkGlobal->setChecked( false ); 122 chkGlobal->setChecked( false );
123} 123}
124 124
125void CategoryEdit::slotAdd() 125void CategoryEdit::slotAdd()
126{ 126{
127 QString name = tr( "New Category" ); 127 QString name = tr( "New Category" );
128 bool insertOk = FALSE; 128 int uid = 0;
129 int num = 0; 129 int num = 0;
130 while ( !insertOk ) { 130 while ( !uid ) {
131 if ( num++ > 0 ) 131 if ( num++ > 0 )
132 name = tr("New Category ") + QString::number(num); 132 name = tr("New Category ") + QString::number(num);
133 insertOk = d->mCategories.addCategory( d->mStrApp, name ); 133 if ( chkGlobal->isChecked() )
134 uid = d->mCategories.addGlobalCategory( name );
135 else
136 uid = d->mCategories.addCategory( d->mStrApp, name );
134 } 137 }
135 QCheckListItem *chk; 138 QCheckListItem *chk;
136 chk = new QCheckListItem( lvView, name, QCheckListItem::CheckBox ); 139 chk = new QCheckListItem( lvView, name, QCheckListItem::CheckBox );
137 if ( !chkGlobal->isChecked() ) 140 if ( !chkGlobal->isChecked() )
138 chk->setText( 1, tr(d->mVisible) ); 141 chk->setText( 1, tr(d->mVisible) );
139 else 142 else
140 chk->setText( 1, tr("All") ); 143 chk->setText( 1, tr("All") );
141 144
142 lvView->setSelected( chk, TRUE ); 145 lvView->setSelected( chk, TRUE );
143 txtCat->selectAll(); 146 txtCat->selectAll();
144 txtCat->setFocus(); 147 txtCat->setFocus();
145} 148}