Re: [PATCH] Fix adding global categories

Dmitriy Korovkin <[email protected]> Wed, 03 Jan 2007 14:50:09 +0300
Newsgroups gmane.comp.handhelds.opie.devel
Message-ID <[email protected]>
Dear Colleagues,
Will someone from the core team review this patch?
Thanks in advance,

Dmitriy



Paul Eggleton wrote:
> 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
>   
> ------------------------------------------------------------------------
>
> 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()
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
>
> http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex
>
> Opie-devel mailing list
> [email protected]
> https://handhelds.org/mailman/listinfo/opie-devel
>   
_______________________________________________

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

Opie-devel mailing list
[email protected]
https://handhelds.org/mailman/listinfo/opie-devel