[PATCH] Fix adding global categories

Paul Eggleton <[email protected]>
Newsgroups gmane.comp.handhelds.opie.devel
Message-ID <[email protected]>
Hi there,

This patch fixes the bug that prevents setting the name properly on a new 
global category in the category editing dialog.

Cheers,
Paul

_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
[email protected]
https://handhelds.org/mailman/listinfo/opie-devel
category_add.patch (text/x-diff, 1.5 KB)
Index: categoryedit_p.cpp
===================================================================
RCS file: /cvs/opie/library/categoryedit_p.cpp,v
retrieving revision 1.4
diff -d -u -r1.4 categoryedit_p.cpp
--- categoryedit_p.cpp	1 Mar 2004 18:10:37 -0000	1.4
+++ categoryedit_p.cpp	29 Dec 2006 00:40:07 -0000
@@ -124,24 +124,27 @@
 
 void CategoryEdit::slotAdd()
 {
-    QString name = tr( "New Category" );
-    bool insertOk = FALSE;
-    int num = 0;
-    while ( !insertOk ) {
-	if ( num++ > 0 )
-	    name = tr("New Category ") + QString::number(num);
-	insertOk = 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
-	chk->setText( 1, tr("All") );
+	QString name = tr( "New Category" );
+	int num = 0;
+	int uid = 0;
+	while ( uid == 0 ) {
+		if ( num++ > 0 )
+			name = tr("New Category ") + QString::number(num);
+		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
+		chk->setText( 1, tr("All") );
 
-    lvView->setSelected( chk, TRUE );
-    txtCat->selectAll();
-    txtCat->setFocus();
+	lvView->setSelected( chk, TRUE );
+	txtCat->selectAll();
+	txtCat->setFocus();
 }
 
 void CategoryEdit::slotRemove()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.