[Kde-pim] Dragging akonadi items

Tobias Koenig tokoe at kde.org
Wed Feb 24 11:58:25 GMT 2010


On Wed, Feb 24, 2010 at 05:45:26PM +0700, Robin Atwood wrote:
> On Sunday 21 February 2010, Ingo Klöcker wrote:
Hej Robin,

> > The only problem is that KPIM::KVCardDrag lives in kdepim/libkdepim,
> > i.e. it's not public API. If you want to use it outside or kdepim you
> > might have to copy it.
> 
> I have been playing around with this and I think just copying over KVcardDrag 
> doesn't cut it.
No, KVCardDrag is not supposed to work with Akonadi out-of-the-box.

When you drag an item from an Akonadi based view (e.g. from new KAddressBook or
the ported KMail/KOrganizer), then the url inside the drag object looks like

 akonadi:?item=123&mimetype=text/directory

So it does not contain any real data, only a reference to the Akonadi item
you refer to. To get the actual data, you have to start a Akonadi::ItemFetchJob.

  KUrl url = ... // extract url from drag object

  Akonadi::Item item = Akonadi::Item::fromUrl( url );

  Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item );
  job->fetchScope()->fullPayload();
  connect( job, SIGNAL( result( KJob* ) ), SLOT( fetchedItem( KJob* ) ) );

  ...

Ciao,
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100224/8c4273be/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