[Kde-pim] [RFC] Contact specific Akonadi API

Kevin Krammer kevin.krammer at gmx.at
Sun Aug 9 13:23:48 BST 2009


On Sunday, 2009-08-09, Tobias Koenig wrote:
> On Sat, Aug 08, 2009 at 03:51:34PM +0200, Kevin Krammer wrote:
> > On Friday, 2009-08-07, Tobias Koenig wrote:
>
> Hej,
>
> > Unless we really want to do GUI inside jobs, I am not sure special
> > subclass jobs are really worth the effort.
>
> Yes, I want user interaction inside the jobs to make them as easy to use as
> possible. Settings up a collection selection dialog is a boring work that
> could be encapsulated by the job.

While I agree that it looks more convenient, it creates artificial 
restrictions such no longer being capable to run the job in a thread, getting 
a nested event loop the application developer no control over, etc.

IMHO job APIs are too low level to include high level stuff like UI.
Especially if the same class is going to provide both options (get collection 
in constructor, get it from user selection), because a new developer might 
unknowingly introduce UI requirements in a common data structure or code path.

KIO might have other limitations which lead to the separation of concerns 
there, but I don't see any developers complaining that they have to use 
KFileDialog to get a save location and not having the "store" jobs do it 
internally.

> > I am more inclined towards an approach similar to KIO, where a high level
> > API creates low level jobs behind the scenes, e.g. similar to
> >
> > KJob *job = KIO::copy( source, destination );
> >
> > we could have
> >
> > Akonadi::Job *job = KABC::createContact( addressee, addressbook );
> > or maybe more specific
> > Akonadi::ItemCreateJob* job ...
>
> But that would imply that inside the slot the user has to do the conversion
> of the results (item -> addressee object) manually again. That's what I
> want to avoid.

I am still not convinced that this is a suffiently big gain.

job->payload<Addressee>();

is not significantly more difficult then

job->addressee();

Templated getters are quite common in C++ APIs, including Qt (e.g. 
QVariant::value())

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20090809/9ec7b1ce/attachment.sig>
-------------- 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