From e2fb93af2caa71ae6a44f392046c1abdc4bca3aa Mon Sep 17 00:00:00 2001 From: "silver%warwickcompsoc.co.uk" Date: Wed, 28 Dec 2005 21:48:33 +0000 Subject: [PATCH] Bug 317435 - Add DnD hook to userlist tree to make dragging a user from it drag their nickname. ChatZilla only. r=silver p=gijskruitbosch+bugs@gmail.com (Gijs Kruitbosch) --- extensions/irc/xul/content/static.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/extensions/irc/xul/content/static.js b/extensions/irc/xul/content/static.js index 1738fc4772f..f1889de2b88 100644 --- a/extensions/irc/xul/content/static.js +++ b/extensions/irc/xul/content/static.js @@ -279,6 +279,11 @@ function initStatic() setListMode("symbol"); else setListMode("graphic"); + + var tree = document.getElementById('user-list'); + tree.setAttribute("ondraggesture", + "nsDragAndDrop.startDrag(event, userlistDNDObserver);"); + setDebugMode(client.prefs["debugMode"]); var ver = __cz_version + (__cz_suffix ? "-" + __cz_suffix : ""); @@ -3223,6 +3228,20 @@ function tabdnd_dstart (aEvent, aXferData, aDragAction) name + ""); } +var userlistDNDObserver = new Object(); + +userlistDNDObserver.onDragStart = +function userlistdnd_dstart(event, transferdata, dragAction) +{ + var tree = document.getElementById('user-list'); + var index = tree.treeBoxObject.getRowAt(event.clientX, event.clientY); + var user = tree.contentView.getItemAtIndex(index).firstChild.firstChild; + var nickname = user.getAttribute("unicodeName"); + + transferdata.data = new TransferData(); + transferdata.data.addDataForFlavour("text/unicode", nickname); +} + function deleteTab (tb) { if (!ASSERT(tb.hasAttribute("viewKey"),