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

List:       kde-commits
Subject:    KDE/kdepimlibs/akonadi
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2010-12-23 13:03:43
Message-ID: 20101223130343.0502B3E1F4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208845 by skelly:

Call collection.id() and item.id() only once.

 M  +12 -8     entitytreemodel_p.cpp  


--- trunk/KDE/kdepimlibs/akonadi/entitytreemodel_p.cpp #1208844:1208845
@@ -1000,24 +1000,28 @@
 
   if ( isHidden( item ) )
     return;
-  Q_ASSERT( m_collections.contains( collection.id() ) );
 
+  const Collection::Id collectionId = collection.id();
+  const Item::Id itemId = item.id();
+
+  Q_ASSERT( m_collections.contains( collectionId ) );
+
   if ( !m_mimeChecker.wantedMimeTypes().isEmpty() && !m_mimeChecker.isWantedItem( item ) )
     return;
 
-  const int row = m_childEntities.value( collection.id() ).size();
+  const int row = m_childEntities.value( collectionId ).size();
 
-  const QModelIndex parentIndex = indexForCollection( m_collections.value( collection.id() ) );
+  const QModelIndex parentIndex = indexForCollection( m_collections.value( collectionId ) );
 
   q->beginInsertRows( parentIndex, row, row );
-  if ( !m_items.contains( item.id() ) ) {
-      m_items.insert( item.id(), item );
+  if ( !m_items.contains( itemId ) ) {
+      m_items.insert( itemId, item );
   }
   Node *node = new Node;
-  node->id = item.id();
-  node->parent = collection.id();
+  node->id = itemId;
+  node->parent = collectionId;
   node->type = Node::Item;
-  m_childEntities[ collection.id() ].append( node );
+  m_childEntities[ collectionId ].append( node );
   q->endInsertRows();
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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