[Kde-pim] Dragging akonadi items
Ingo Klöcker
kloecker at kde.org
Sun Feb 21 10:39:24 GMT 2010
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!)
I think you misunderstand the UrlDropsEnabled property. The API
documentation [1] says:
=====
void KLineEdit::setUrlDropsEnabled( bool enable )
Enables/Disables handling of URL drops.
If enabled and the user drops an URL, the decoded URL will be inserted.
Otherwise the default behavior of QLineEdit is used, which inserts the
encoded URL.
=====
So, URLs will not be resolved, but just decoded, i.e. %-encoded
characters will be converted to the corresponding Unicode character.
IMO resolving of URLs cannot be handled by a plain vanilla KLineEdit
because what the URL should be resolved to depends on the context. An
akonadi-URL representing a contact could be resolved to the contact's
name, the contact's email address, the contact's phone number, etc.,
depending on the context (i.e. does the line edit expect a name, an
email address, a phone number, etc.).
The line edit used in KMail's composer for the email addresses is a
subclass of KLineEdit which (among other features like address book
completion) provides special handling of mailto:-URLs and akonadi:-URLs.
IMO a better approach than subclassing (which IMNSHO is almost always
the wrong approach) would be making KLineEdit extensible with URL
resolvers. Then the user of KLineEdit could add the correct resolvers
depending on the context.
Regards,
Ingo
[1] http://api.kde.org/4.x-api/kdelibs-
apidocs/kdeui/html/classKLineEdit.html#aaa093c035a4cb233bb99da6cf78ac48f
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100221/0e892527/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