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

List:       kde-commits
Subject:    KDE/kdepim/mobile/lib
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2010-10-19 18:32:58
Message-ID: 20101019183258.7C684AC897 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1187536 by skelly:

Fix Tuesdays threading bug. Make sure loose ends are tied up.

 M  +16 -1     threadmodel.cpp  


--- trunk/KDE/kdepim/mobile/lib/threadmodel.cpp #1187535:1187536
@@ -207,6 +207,14 @@
   return items;
 }
 
+
+static void addToPending(QHash<QByteArray, QSet<QByteArray> > &pendingThreads, const \
QByteArray& inReplyTo, const QByteArray& identifier) +{
+  QSet<QByteArray> existingResponses = pendingThreads.take(identifier);
+  pendingThreads[inReplyTo].insert(identifier);
+  pendingThreads[inReplyTo].unite(existingResponses);
+}
+
 void ThreadGrouperModelPrivate::populateThreadGrouperModel() const
 {
   Q_Q(const ThreadGrouperModel);
@@ -234,7 +242,7 @@
       const QHash<QByteArray, QSet<QByteArray> >::const_iterator it = \
                findValue(m_threads, inReplyTo);
       const QHash<QByteArray, QSet<QByteArray> >::const_iterator end = \
m_threads.constEnd();  if (it == end) {
-        pendingThreads[inReplyTo].insert(identifier);
+        addToPending(pendingThreads, inReplyTo, identifier);
         m_threadItems[identifier] = item;
         m_allItems[identifier] = item;
         m_messageMap[item] = identifier;
@@ -253,7 +261,14 @@
       m_messageMap[item] = identifier;
     }
   }
+  QHash<QByteArray, QSet<QByteArray> >::const_iterator pendingIt = \
pendingThreads.constBegin(); +  const QHash<QByteArray, QSet<QByteArray> \
>::const_iterator pendingEnd = pendingThreads.constEnd(); +  for ( ; pendingIt != \
> pendingEnd; ++pendingIt) {
+    foreach(const QByteArray &ba, pendingIt.value())
+      m_threadItems.remove(ba);
+    m_threads[pendingIt.key()].unite(pendingIt.value());
 }
+}
 
 ThreadGrouperModel::ThreadGrouperModel(QObject* parent)
   : QSortFilterProxyModel(parent), d_ptr(new ThreadGrouperModelPrivate(this))


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

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