[Kde-pim] Dragging akonadi items
Robin Atwood
robin at binro.org
Wed Feb 24 10:45:26 GMT 2010
On Sunday 21 February 2010, Ingo Klöcker wrote:
> On Sunday 21 February 2010, Robin Atwood wrote:
> > On Sunday 21 February 2010, Ingo Klöcker wrote:
> > > On Sunday 21 February 2010, Robin Atwood wrote:
> > > > If I drag a kaddressbook item to kwrite, the akonadi: URL is
> > > > resolved and I can see the VCS entry in the editor. If I drag it
> > > > to my KLineEdit widget I just get the URL despite that I have
> > > > the UrlDropsEnabled property set. What am I missing? (A lot, I
> > > > suspect!)
> Nevertheless, you might not have to get in touch with Akonadi at all.
> KMail's line edit does the following:
>
> void KMLineEdit::dropEvent(QDropEvent *event)
> {
> const QMimeData *md = event->mimeData();
>
> // Case one: The user dropped a text/directory (i.e. vcard), so decode
> its
> // contents
> if ( KPIM::KVCardDrag::canDecode( md ) ) {
> KABC::Addressee::List list;
> KPIM::KVCardDrag::fromMimeData( md, list );
>
> KABC::Addressee::List::Iterator ait;
> for ( ait = list.begin(); ait != list.end(); ++ait ){
> insertEmails( (*ait).emails() );
> }
> }
>
> [...]
> }
>
> 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. In the dropEvent code "canDecode()" returns false and the
mime-data is empty. I think something more is required.
Cheers
-Robin
--
----------------------------------------------------------------------
Robin Atwood.
"Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling
----------------------------------------------------------------------
_______________________________________________
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