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

List:       kde-commits
Subject:    [plasmoid-eventlist] src: fix removing id from used id list
From:       Gerd Fleischer <gerdfleischer () web ! de>
Date:       2013-10-11 16:52:11
Message-ID: E1VUfwh-0006Fc-Rn () scm ! kde ! org
[Download RAW message or body]

Git commit f515449a6b0868b4ab6ee5c2583ef0718168f20a by Gerd Fleischer.
Committed on 11/10/2013 at 16:50.
Pushed by geflei into branch 'master'.

fix removing id from used id list

M  +6    -7    src/eventmodel.cpp

http://commits.kde.org/plasmoid-eventlist/f515449a6b0868b4ab6ee5c2583ef0718168f20a

diff --git a/src/eventmodel.cpp b/src/eventmodel.cpp
index 0713e95..e64ea44 100644
--- a/src/eventmodel.cpp
+++ b/src/eventmodel.cpp
@@ -241,20 +241,19 @@ void EventModel::removeItem(const Akonadi::Item &item)
     foreach (QStandardItem *i, m_sectionItemsMap) {
         QModelIndexList l;
         if (i->hasChildren())
-            l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
+            l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id(), -1);
         while (!l.isEmpty()) {
-            i->removeRow(l[0].row());
-            if (!i->hasChildren()) break;
-            l = match(i->child(0, 0)->index(), EventModel::ItemIDRole, item.id());
+            i->removeRow(l.at(0).row());
+            l.removeFirst();
         }
         int r = i->row();
         if (r != -1 && !i->hasChildren()) {
-            takeItem(r);
-            removeRow(r);
-            itemIds.removeAll(item.id());
+            takeRow(r);
             emit modelNeedsExpanding();
         }
     }
+
+    itemIds.removeAll(item.id());
 }
 
 void EventModel::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
[prev in list] [next in list] [prev in thread] [next in thread] 

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