[Kde-pim] Akonadi resources and collection IDs

Dmitry Ivanov vonami at gmail.com
Mon Jun 16 22:09:45 BST 2008


Hi there,

While trying to add a D-Bus interface to the RSS resource I ran into a 
problem I'd like to discuss.

The D-Bus interface has a method to synchronize a feed:

synchronizeFeed( XmlUrl ) // actually this might another id

To trigger the collection synchronization the resource should call

synchronizeCollection( quint64 id ) // id is Akonadi::Collection::Id

The problem is, given how the resource is implemented now, it doesn't
store IDs for collections. Then the user launches resource configuration 
dialog, he can import existing feeds from an OPML file. The resource loads 
the feeds, converts them to collections, and then calls 
ResourceBase::synchronize(). The current collection tree eventually 
reaches Akonadi::CollectionSync which commits the collections to the 
database. This way the resource ends up with collections without valid IDs.

And I bet I'll have to have collection IDs while implementing other 
operations in the future.

The proposed solution is as follows:

1. The resource doesn't rely on Akonadi::CollectionSync anymore, it 
creates and commits collections itself, receiving IDs from 
Akonadi::CollectionCreateJob. 

2. The clients shouldn't add new feeds via Akonadi::CollectionCreateJob, 
instead they use the D-Bus interface. The resource receives XmlUrl, 
creates a new collection, and commits it.
 
Why add new feeds via the D-Bus interface? Why shouldn't clients create 
collections themselves and commit them to Akonadi (via a standard 
action)? Because of remoteId. I believe only the resource should assign 
remoteId to a newly added feed/collection. remoteId may point to 
something in a storage of feeds/items if the resource have such a storage 
(like metakit in Akregator), or may point to a feed in online feed reader in 
case of a dedicated RSS resource for this online feed reader.

Although a client can create/commit a collection on its own, then the 
resource gets a notification via collectionAdded() and assigns a proper 
remoteId. Sounds a bit "kludgy".

3. Upon (re)start, the resource reloads the collection tree from Akonadi.

Any better approaches? Do you foresee any problems with the proposed 
solution?

Thanks in advance.

-- 
Dmitry


_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list