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

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/models
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2008-04-10 12:06:39
Message-ID: 1207829199.475663.11240.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 795469 by osterfeld:

remove keys from the cache if they are not in the keylist result anymore

 M  +5 -0      keycache.cpp  
 M  +3 -2      keylistmodel.cpp  


--- trunk/KDE/kdepim/kleopatra/models/keycache.cpp #795468:795469
@@ -781,6 +781,11 @@
     keys.erase( unique_by_merge( keys.begin(), keys.end(), \
_detail::ByFingerprint<std::equal_to>() ),  keys.end() );
 
+    std::vector<Key> cachedKeys = m_cache->keys();
+    std::sort( cachedKeys.begin(), cachedKeys.end(), \
_detail::ByFingerprint<std::less>() ); +    std::vector<Key> keysToRemove;
+    std::set_difference( cachedKeys.begin(), cachedKeys.end(), keys.begin(), \
keys.end(), std::back_inserter( keysToRemove ), _detail::ByFingerprint<std::less>() \
); +    m_cache->remove( keysToRemove );
     m_cache->refresh( keys );
 }
 
--- trunk/KDE/kdepim/kleopatra/models/keylistmodel.cpp #795468:795469
@@ -714,7 +714,8 @@
 
 void HierarchicalKeyListModel::doRemoveKey( const Key & key ) {
     const QModelIndex idx = index( key );
-
+    if ( !idx.isValid() )
+        return;
     //TODO: only removal of leaf nodes is implemented so far
     if ( hasChildren( idx ) )
         return;
@@ -731,7 +732,7 @@
     assert( idx.isValid() );
     assert( !parentIdx.isValid() || !parentKey.isNull() );
 
-    beginRemoveRows( parentIdx, idx.row(), idx.row() );   
+    beginRemoveRows( parentIdx, idx.row(), idx.row() );
     mKeysByFingerprint.erase( it );
 
     if ( !parentIdx.isValid() ) {


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

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