iconSize() == 0

David Faure dfaure at trolltech.com
Sun Jun 8 22:28:02 BST 2003


On Sunday 08 June 2003 18:42, Maks Orlovich wrote:
> > 0 means "whatever is the configuration for KIcon::Desktop icons".
> > The equality check above should probably take that into account indeed...
> 
> I see, thanks. Does something like this look OK?
> 
> 
> --- konq_iconview.cc    30 May 2003 15:45:07 -0000      1.433
> +++ konq_iconview.cc    8 Jun 2003 16:39:56 -0000
> @@ -605,7 +604,17 @@ void KonqKfmIconView::slotSortDirsFirst(
> 
>  void KonqKfmIconView::newIconSize( int size )
>  {
> -    if ( size == m_pIconView->iconSize() )
> +    //Either of the sizes can be 0 to indicate the default (Desktop) size
> icons.
> +    //check for that when checking whether the size changed
> +    int effSize = size;
> +    if (effSize == 0)
> +       effSize = IconSize(KIcon::Desktop);
> +
> +    int oldEffSize = m_pIconView->iconSize();
> +    if (oldEffSize == 0)
> +       oldEffSize = IconSize(KIcon::Desktop);
> +
> +    if ( effSize == oldEffSize )
>          return;

Looks ok - although the 0==0 case could be optimized to avoid calling
IconSize twice :)
No idea if it happens often though.

-- 
David FAURE, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
Qtella users - stability patches at http://blackie.dk/~dfaure/qtella.html




More information about the kfm-devel mailing list