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

List:       kde-commits
Subject:    KDE/kdepim/kalarm
From:       David Jarvie <djarvie () kde ! org>
Date:       2010-11-17 21:49:25
Message-ID: 20101117214925.E25D6AC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1198223 by djarvie:

Fix ItemModifyJob not being executed after item has been created

 M  +21 -3     akonadimodel.cpp  


--- trunk/KDE/kdepim/kalarm/akonadimodel.cpp #1198222:1198223
@@ -1445,13 +1445,17 @@
     if (it != mItemModifyJobQueue.end())
     {
         // A job is already queued for this item. Replace the queued item value with \
the new one. +        kDebug() << "Replacing previously queued job";
         it.value() = item;
     }
     else
     {
         // There is no job already queued for this item
         if (mItemsBeingCreated.contains(item.id()))
+        {
+            kDebug() << "Waiting for item initialisation";
             mItemModifyJobQueue[item.id()] = item;   // wait for item initialisation \
to complete +        }
         else
         {
             Item newItem = item;
@@ -1463,7 +1467,7 @@
             job->disableRevisionCheck();
             connect(job, SIGNAL(result(KJob*)), SLOT(itemJobDone(KJob*)));
             mPendingItemJobs[job] = item.id();
-kDebug()<<"Modify job executing for item"<<item.id()<<", \
revision="<<newItem.revision(); +            kDebug() << "Executing Modify job for \
item" << item.id() << ", revision=" << newItem.revision();  }
     }
 }
@@ -1513,7 +1517,10 @@
     {
         if (jobClass == "Akonadi::ItemCreateJob")
         {
-            // Prevent modification of the item until it is fully initialised
+            // Prevent modification of the item until it is fully initialised.
+            // Either slotMonitoredItemChanged() or slotRowsInserted(), or both,
+            // will be called when the item is done.
+            kDebug() << "item id=" << static_cast<ItemCreateJob*>(j)->item().id();
             mItemsBeingCreated << static_cast<ItemCreateJob*>(j)->item().id();
         }
         emit itemDone(itemId);
@@ -1556,6 +1563,7 @@
     if (!qitem.isValid())
     {
         // There is no further job queued for the item, so remove the item from the \
list +kDebug()<<"No more jobs queued";
         mItemModifyJobQueue.erase(it);
     }
     else
@@ -1588,7 +1596,17 @@
             attrs += CollectionAttribute::name();
             slotCollectionChanged(collection, attrs);
         }
+        else
+        {
+            const Item item = ix.data(ItemRole).value<Item>();
+            if (item.isValid())
+            {
+                kDebug() << "item id=" << item.id() << ", revision=" << \
item.revision(); +                if (mItemsBeingCreated.removeAll(item.id()))   // \
the new item has now been initialised +                    \
checkQueuedItemModifyJob(item);    // execute the next job queued for the item  }
+        }
+    }
     EventList events = eventList(parent, start, end);
     if (!events.isEmpty())
         emit eventsAdded(events);
@@ -1667,7 +1685,7 @@
 void AkonadiModel::slotMonitoredItemChanged(const Akonadi::Item& item, const \
QSet<QByteArray>&)  {
 kDebug()<<"item id="<<item.id()<<", revision="<<item.revision();
-    mItemsBeingCreated.removeAll(item.id());   // the new item has now been \
initialised +    if (mItemsBeingCreated.removeAll(item.id()))   // the new item has \
                now been initialised
     checkQueuedItemModifyJob(item);    // execute the next job queued for the item
 
     KAEvent evnt = event(item);


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

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