You are here

The Secret Gardens of DnD

The Drag and Drop (DnD) areas of an application is like the fields in a garden. Some areas, or widgets, can deliver something, acting as a drag source, like your potato field you have in your backyard (You say you don't have any?. Strange!), while other receive something, acting as a drop source. Some areas are both sources and targets. And you can't know which role a widget has until you have actually tested.

As an example, try to drag a simple word to Firefox. If I drag the word "exit" to Firefox, it tries to open Good or bad?

In an earlier post I presented the DnD internal of the roster. This time I will give a snapshot of what other DnD you can do. Starting with the roster as a drag source, it can deliver data in two formats, text/plain and text/uri-list. The latter is just a list of URI encoded files. The text/plain supplies data in a format that an application must have any chance to understand, and I just picked a comma separated list of bare JID URIs, like:,, ...

If you drag a group, or even the online/offline folders, all users within that tree will be delivered. Also the Coccinella drop targets must understand this format.

If you drag a single contact, a group, or the online/offline folders to your desktop, you will get a file for each contact in a platform dependent way. If you open such a file, which contains an URI link, it will poke Coccinella to send a message to that person. Currently this works only on Windows.

Then there are tons of drop targets. Drag contacts to the (1-1) chat window and it will initiate an invitation to a newly created common chat room. Do the same thing with the group chat window and it will invite all dropped users. If you already have an invitation dialog, drop contacts on the Contact ID field, and the dialog will adjust to allow a field for each contact. Actually, most dialogs that accept a JID is a drop target for an XMPP URI.

To send a file to an online contact, just drag it to the roster and drop it over the contact. Cool! Change your avatar by dropping an image file to the avatar menu button in the roster window, or on your own vCard. You can also get another contact's avatar just by open its vCard and drag the image to your desktop to get an image file with the contacts bare JID as its name, but with the correct file extension. The same works from the avatar in the chat dialog.

I rely on the tkdnd extension for this and it hasn't been ported to Mac OS X. I guess I have to do it myself some sunny day...