SVN commit 1202449 by krake: Use hashes for storing pending items instead of lists to avoid double entries. Having the same item twice in the added/modified list will cause the resource's transaction to fail M +4 -4 birthdaysresource.cpp M +4 -2 birthdaysresource.h --- trunk/KDE/kdepim/runtime/resources/birthdays/birthdaysresource.cpp #1202448:1202449 @@ -97,7 +97,7 @@ void BirthdaysResource::retrieveItems(const Akonadi::Collection& collection) { Q_UNUSED( collection ); - itemsRetrievedIncremental( mPendingItems, mDeletedItems ); + itemsRetrievedIncremental( mPendingItems.values(), mDeletedItems.values() ); mPendingItems.clear(); mDeletedItems.clear(); } @@ -172,7 +172,7 @@ Item i( "application/x-vnd.akonadi.calendar.event" ); i.setRemoteId( remoteId ); i.setPayload( evptr ); - mPendingItems << i; // TODO check if we have that item already + mPendingItems[ remoteId ] = i; synchronize(); } @@ -181,9 +181,9 @@ { Item i( "application/x-vnd.akonadi.calendar.event" ); i.setRemoteId( QString::fromLatin1( "b%1" ).arg( item.id() ) ); - mDeletedItems << i; + mDeletedItems[ i.remoteId() ] = i; i.setRemoteId( QString::fromLatin1( "a%1" ).arg( item.id() ) ); - mDeletedItems << i; + mDeletedItems[ i.remoteId() ] = i; synchronize(); } --- trunk/KDE/kdepim/runtime/resources/birthdays/birthdaysresource.h #1202448:1202449 @@ -25,6 +25,8 @@ #include +#include + class QDate; class BirthdaysResource : public Akonadi::ResourceBase, public Akonadi::AgentBase::Observer @@ -60,8 +62,8 @@ void contactRetrieved( KJob *job ); private: - Akonadi::Item::List mPendingItems; - Akonadi::Item::List mDeletedItems; + QHash mPendingItems; + QHash mDeletedItems; }; #endif