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

List:       kde-commits
Subject:    kdepim/certmanager/lib/ui
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2004-10-27 15:03:23
Message-ID: 20041027150323.5D87E16C23 () office ! kde ! org
[Download RAW message or body]

CVS commit by mutz: 

From KDE_3_3_BRANCH: Speed up selectKeys() from O(NM) to O(MlogN+N) (M=#selectedKeys, \
N=#keys) by using itemMap once more. And simplify the code _a lot_ :)


  M +4 -14     keyselectiondialog.cpp   1.28


--- kdepim/certmanager/lib/ui/keyselectiondialog.cpp  #1.27:1.28
@@ -531,20 +531,10 @@ void Kleo::KeySelectionDialog::startKeyL
 
 static void selectKeys( Kleo::KeyListView * klv, const std::vector<GpgME::Key> & \
selectedKeys ) { +  klv->clearSelection();
   if ( selectedKeys.empty() )
     return;
-  int selectedKeysCount = selectedKeys.size();
-  for ( Kleo::KeyListViewItem * item = klv->firstChild() ; item ; item = \
                item->nextSibling() ) {
-    const char * fpr = item->key().primaryFingerprint();
-    if ( !fpr || !*fpr )
-      continue;
     for ( std::vector<GpgME::Key>::const_iterator it = selectedKeys.begin() ; it != \
                selectedKeys.end() ; ++it )
-      if ( qstrcmp( fpr, it->primaryFingerprint() ) == 0 ) {
+    if ( Kleo::KeyListViewItem * item = klv->itemByFingerprint( \
it->primaryFingerprint() ) )  item->setSelected( true );
-        if ( --selectedKeysCount <= 0 )
-          return;
-        else
-          break;
-      }
-  }
 }
 


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

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