Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TB smartfolder interfaces?

4 views
Skip to first unread message

Axel Grude

unread,
Dec 29, 2009, 11:59:56 AM12/29/09
to
Hello,

Hi I am trying to get a UID or URI from the smartfolder after a drag and
drop operation, but the URI is not supported

the flavour.contentType seems to be "text/x-moz-folder" but there is no
URI? I looked at in the debugger and did not get _any_ data in this function

onDrop: function (evt,dropData,dragSession) {
QuickFolders.Util.logDebugOptional("dnd",
"toolbarDragObserver.onDrop " + dropData.flavour.contentType);
switch (dropData.flavour.contentType) {
case "text/x-moz-folder":
var sourceUri;
var msgFolder = evt.dataTransfer.mozGetDataAt(
"text/x-moz-folder", 0);
sourceUri = msgFolder.URI;

In Watches, msgFolder is shown as {const CPComponent} but there are no
methods/properties to expand? The only thing that seems bring up
something is the debug menu "Include ECMA Properties" but it doesn't
seem to expose any interfaces. I have tried to look at

http://mxr.mozilla.org/comm-1.9.1/ident?i=smartFolder

but I did not find any definition for smartFolders; is there a base type
for this that I can look up somewhere?

thx
Axel

Axel Grude

unread,
Dec 29, 2009, 12:01:21 PM12/29/09
to
sorry, mad a bad typo I meant {const XPComponent} how does one get more
information from there?

Philip Chee

unread,
Dec 30, 2009, 12:13:25 AM12/30/09
to
Cross-posting to m.d.a.thunderbird since you are more likely to get an
answer there.

Phil


--
-==-
Philip Chee <phi...@aleytys.pc.my>, <phili...@gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.

David Bienvenu

unread,
Dec 30, 2009, 11:25:29 AM12/30/09
to
Smart folders are nsIMsgFolders - the concrete class is always nsMsgLocalMailFolder, which implements nsIMsgFolder.

- David

Axel Grude

unread,
Jan 7, 2010, 6:39:49 AM1/7/10
to
David Bienvenu wrote:
> On 12/29/2009 9:13 PM, Philip Chee wrote:
>> On Tue, 29 Dec 2009 16:59:56 +0000, Axel Grude wrote:
>>> onDrop: function (evt,dropData,dragSession) {
>>> QuickFolders.Util.logDebugOptional("dnd",
>>> "toolbarDragObserver.onDrop " + dropData.flavour.contentType);
>>> switch (dropData.flavour.contentType) {
>>> case "text/x-moz-folder":
>>> var sourceUri;
>>> var msgFolder = evt.dataTransfer.mozGetDataAt(
>>> "text/x-moz-folder", 0);
>>> sourceUri = msgFolder.URI;
>
> Smart folders are nsIMsgFolders - the concrete class is always
> nsMsgLocalMailFolder, which implements nsIMsgFolder.
>
> - David


Okay,

So how do I retrieve the folder URI from the drop event?

1st, is "text/x-moz-folder" the correct type for dragging the smart folder:

var msgFolder = evt.dataTransfer.mozGetDataAt("text/x-moz-folder", 0);

I tried msgFolder.getURI() but that doesn't return anything.

I can not find any interfaces in the debugger, is it possible to
typecast to nsMsgLocalMailFolder or convert to a nsMsgLocalMailFolder?

I am only used to C++ style type casts, so how would I do it in
Javascript? Bear with me as I don't really know when to use a var and
when an object(?) typeless programming is always a bit of a gamble to me.

Also while we're on the topic of dragging folders, (in TB3) there
appears also a drop event on dragged newsgroup folders, any chance to
get at their folder URI? Or is this a bug and dragging won't be
supported for NG folders in the final release?

sorry for asking so many Questions, Questions...

thanks in advance
Axel

Axel Grude

unread,
Jan 7, 2010, 7:46:13 AM1/7/10
to
Axel Grude wrote:

> David Bienvenu wrote:
>> Smart folders are nsIMsgFolders - the concrete class is always
>> nsMsgLocalMailFolder, which implements nsIMsgFolder.
>>
>> - David
>
>
> Okay,
>
> So how do I retrieve the folder URI from the drop event?
>

I tried


var msgFolder = evt.dataTransfer.mozGetDataAt("text/x-moz-folder", 0);
sourceUri =

msgFolder.QueryInterface(Components.interfaces.nsIMsgFolder).URI;
- seems to do the trick - need to test with SM and Pb yet.

Last question regarding Smart Folders: when selecting a Smart Folder
there is no FOlderLoaded event - is there any other event that I could
catch? I need to highlight the select SmartFolder on my extension's toolbar.

> Also while we're on the topic of dragging folders, (in TB3) there
> appears also a drop event on dragged newsgroup folders, any chance to
> get at their folder URI? Or is this a bug and dragging won't be
> supported for NG folders in the final release?

Debugging a drop event for NG to my toolbar threw this error:
Error: transferData.first is null
Source file: chrome://global/content/nsDragAndDrop.js
Line: 459

its thrown when trying to call transferData.first.first:

var multiple =
"canHandleMultipleItems" in
aDragDropObserver && aDragDropObserver.canHandleMultipleItems;
-> var dropData = multiple ? transferData : transferData.first.first;
aDragDropObserver.onDrop(aEvent, dropData, this.mDragSession);
aEvent.stopPropagation();

thanks in advance
Axel

Axel Grude

unread,
Jan 12, 2010, 5:56:15 PM1/12/10
to
On 30/12/09 16:25, David Bienvenu wrote:
> Smart folders are nsIMsgFolders - the concrete class is always
> nsMsgLocalMailFolder, which implements nsIMsgFolder.
>
> - David
>
There is another problem with Smart Folders, in the context of the
folder tree, they are parents of the children, but by URI, the account
nodes are still the "real" parents - this leads to bugs in selectFolder
and ensureRowIsVisible. I am currently trying to deal with the fallout
of these bugs by programming a work-around in my extension.
0 new messages