dropping content onto Plasma
Sebastian Kügler
sebas at kde.org
Tue Mar 24 00:11:18 CET 2009
The short version
Is there a way to offer plasma applet creation based on mimetypes of content
dropped onto Plasma also for URLS?
The Good
I think that dropping "random" content on the desktop is a very strong UI
metaphor. If we can make Plasma accept and Do The Right Thing was all kinds of
content, that'll make for a nicely self-explaining interface.
It already works nicely with files. Basically, the applet registers the
mimetypes it understands and makes sure it loads those, they're passed as args
to the constructor. Plasma creates an applet accordingly when we drop
something onto the desktop, or offers applets that "understand" and display
the mimetypes when there's more than one.
The Bad
The above procedure works nicely for local content, such as files. URL's are a
special kind of draggable content though. As far as I understand, a URL
doesn't have a mimetype attached, it's either data + mimetype (+ other
metainformation) or simply a URL.
In Lion Mail, I want to be able to drag emails from Lion Mail collections onto
the desktop, and have them created there as loose emails. I don't want to pass
the email itself around, just a reference to an email in the Akonadi database
(which is a URL such as akonadi:?item=97881&type=).
Other things that should (at some point, in the future) work, and which I
think are related:
- dropping a url to a website onto plasma should offer webbrowser
- dropping references to objects in nepomuk (contacts for example)
- dropping akonadi urls from mailody onto Plasma and load the email applet
- dropping a pdf from the web onto plasma, load previewer applet
- dropping a picture from a website, load picture frame applet
(The above, all to my knowledge, don't work right now.)
(Sidenote: For the Nepomuk and Akonadi URL case, we need either the type, or
probe those database, items can be any kind of content.)
The Ugly
I'm working around this in Lion Mail right now by lying about the mimetype of
the data the drop contains. I set the content type to the mimetype of the
email (and register X-Plasma-DropMimeTypes=message/rfc822 in the .desktop
file). I've put the URL into the data part. That obviously only works for
emails dragged from Lion Mail (since that's where I'm doing that kind of crap
in the first place) and it's the only thing in the world that assumes emails
only contain akonadi URLs). Obviously, I'm not proud of that code. ;)
I'd like to have this fine mechanism also working URLs and be a bit smarter
about that. I'm not sure about possible solutions, though. Guessing based on
the dropped content would work for most cases (akonadi: as protocol is clear),
but might be a bit tedious (impossible) to figure out for every mimetype in
the world (especially if you start doing it based on file extensions). Probing
mimetypes of remote files sounds icky to me as well. Maybe there is some code
for this problem in KDE already?
Does anybody know a good solution for this? and
Where is that code in plasma?
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
-------------- 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/20090324/112298dd/attachment.sig
More information about the Plasma-devel
mailing list