[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/kfile
From:       Aurélien Gâteau <aurelien.gateau () free ! fr>
Date:       2008-09-29 13:13:17
Message-ID: 1222693997.424197.3376.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 865924 by gateau:

Fix broken selection of current filter:
'i' could sometimes be set to an incorrect value if the code reached the
"continue;" line earlier in the loop. It's simpler and safer to use
count().
BUG:171430
Backported https://svn.kde.org/home/kde/trunk/KDE/kdelibs@865771


 M  +3 -4      kfilefiltercombo.cpp  


--- branches/KDE/4.1/kdelibs/kfile/kfilefiltercombo.cpp #865923:865924
@@ -145,8 +145,7 @@
     d->m_allTypes = defaultType.isEmpty() && (types.count() > 1);
 
     QString allComments, allTypes;
-    int i = 0;
-    for(QStringList::ConstIterator it = types.begin(); it != types.end(); ++it,  ++i)
+    for(QStringList::ConstIterator it = types.begin(); it != types.end(); ++it)
     {
         if ( d->m_allTypes && it != types.begin() ) {
             allComments += delim;
@@ -170,12 +169,12 @@
         }
         addItem( type->comment() );
         if ( type->name() == defaultType )
-            setCurrentIndex( i );
+            setCurrentIndex( count() - 1 );
     }
 
     if ( d->m_allTypes )
     {
-        if ( i < 3 ) // show the mime-comments of at max 3 types
+        if ( count() <= 3 ) // show the mime-comments of at max 3 types
             insertItem(0, allComments);
         else {
             insertItem(0, i18n("All Supported Files"));
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic