[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-18 12:22:46
Message-ID: 1208521366.765266.29779.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 798485 by osterfeld:

emit dataChanged() for parents. This forces KeyListSortFilterProxyModel to show \
parents which have now matching certificates in their subtree but were hidden before.

 M  +17 -1     keylistmodel.cpp  


--- trunk/KDE/kdepim/kleopatra/models/keylistmodel.cpp #798484:798485
@@ -61,6 +61,7 @@
 #include <algorithm>
 #include <vector>
 #include <map>
+#include <set>
 #include <iterator>
 #include <cassert>
 
@@ -654,6 +655,8 @@
     
     mKeysByFingerprint = merged;
 
+    std::set<Key, ByFingerprint<std::less> > changedParents;
+
     Q_FOREACH( const Key & key, topological_sort( keys ) ) {
 
         // check to see whether this key is a parent for a previously parent-less \
group: @@ -703,6 +706,13 @@
             // parent does't exist yet...
             addKeyWithoutParent( issuer_fpr, key );
 
+        const QModelIndex key_idx = index( key );
+        QModelIndex key_parent = key_idx.parent();
+        while ( key_parent.isValid() ) {
+            changedParents.insert( doMapToKey( key_parent ) );
+            key_parent = key_parent.parent();
+        }
+
         // Step 3: Add children to new parent ( == key )
 
         if ( !keyAlreadyExisted && !children.empty() ) {
@@ -728,7 +738,13 @@
                 emit rowMoved( new_parent, i );
         }
     }
-
+    //emit dataChanged for all parents with new children. This triggers \
KeyListSortFilterProxyModel to +    //show a parent node if it just got children \
matching the proxy's filter  +    Q_FOREACH( const Key & i, changedParents ) {
+        const QModelIndex idx = index( i );
+        if ( idx.isValid() )
+            emit dataChanged( idx.sibling( idx.row(), 0 ), idx.sibling( idx.row(), \
NumColumns - 1 ) ); +    }
     return indexes( keys );
 }
 


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

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