[PATCH] Re: dropping content onto Plasma
Sebastian Kügler
sebas at kde.org
Sat Mar 28 15:53:47 CET 2009
Here's a first try:
Use KIO::TransferJob to retrieve the mimetype of dropped remote content
This is a rough proof-of-concept to enable dropping remote urls onto Plasma.
Currently they're simply added as an icon. The goal is to be able to
transparantly add remote content to the plasma desktop by dropping urls to
websites, pictures or references to database such as akonadi or nepomuk.
With this patch, Containment retrieves the mimetype for URLs through KIO, and
offers a qmenu popup after retrieving the applet's mimedata.
There are a couple of interesting things s mimetype retrieved signal of the
TransferJob triggers the popupmenu (since only then we can get a list of
possible applets).
- Applets need to actually support loading content through URLs. That means
checking the args passed when loading the applet, and loading for example an
image through KIO. The Picture Frame applet only does the arg part right now,
the webbrowser does both.
- The akonadi: url is currently hard-coded to the emailmessage applet. I'll
need to find a more elegant way, since it technically doesn't have emaildata,
probably a mimetype for an akonadi object.
- The algorithm in there is a bit wacky. In current trunk, containment tries
to find an applet suitable for the mimetype, if it doesn't it just puts a URL
there. I guess a change to isLocalFile: handle it sync, else do the
KIO::TransferJob async popup should make more sense, semantically. And it
wouldn't stop working when someone registers an applet for application/octet-
stream (which is what you get in the default case).
- Since we don't have the pointer to the event in the slotMimetype() method, I
had to cache the dropped location. I've put that QRectF into the d-pointer.
The slot is in Containment. Should that slot also go into the d-pointer? It's
private.
- This QRectF makes the menu pop up in the wrong location (usually way to much
top right. I guess the cached location needs to be mapped to the scene here?
- What if the user wants to save the document? KIO will probably do caching
for us, but I wonder if it makes sense to save the dropped URL to the
~/Desktop directory.
So as you see there are some rough edges about this patch right now. I'd like
some conceptual feedback, and a bit of input on the above items.
Thanks,
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-drop-remote-urls1.diff
Type: text/x-patch
Size: 9607 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090328/b1dd8081/attachment.diff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090328/b1dd8081/attachment.sig
More information about the Plasma-devel
mailing list