[Kde-pim] synchronizing a collection

Stephen Kelly steveire at gmail.com
Tue Apr 14 05:02:46 BST 2009


Sebastian Kügler wrote:

> Hi,
> 
> I'm trying to write the implementation for a refresh button in Lion Mail
> collections. I'm running into two problems, though;

> - Akonadi::Collection(id).resource() returns an empty string

This is because Akonadi::Collection(id) doesn't come from the server, so it 
doesn't know its resource. Agent manager knows all the resources in Akonadi 
though as you noticed. It caches those for convenience. You would need to do 
something like 

Collection wantedCol = Akonadi::Collection(id);
Job *job = new CollectionFetchJob(wantedCol, BaseCollection);

and get the collection out of the result of the job.

That's just FYI. You don't really want to do that. You don't need a refresh 
button at all. Instead, you should be using a Monitor on the selected 
resource and reacting to it's itemLinked and unlinked signals.

Presumably when lion mail is finished, that will be a virtual resource of 
some kind and linking a new item means a new mail has arrived and should be 
shown. I think lionmail should not react to itemunlinked though. When the 
user reads a new email, you should be starting a itemModifed job with the 
'unread' flag removed, so that other applications can react to it being read. 
That would cause an itemunlinked signal to come through your monitor which, 
if lionmail reacted to it, would make it impossible to read mail. I guess 
you should clean up mails that have been read periodically, and maybe 
provide a i18n('Clears emails that have been read from the email list', 
'Clear read emails' ) action.

If lionmail should also be able to display mails from any arbitrary 
collection, I guess you'd have to implement slots for 
item{Moved,Removed,Added} too. You also need to implement a slot for 
itemChanged either way.

> 
> Can someone enlighten me? :)

HTH.

All the best,

Steve


-------------- next part --------------
_______________________________________________
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