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

Help request for TB3 vs SM2 -- tab mail fails

1 view
Skip to first unread message

gNeandr

unread,
Nov 1, 2009, 10:02:17 AM11/1/09
to
Help request for TB3 vs SM2

With TB3 this works :
var windowManager =
Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);

var winId = windowManager.getMostRecentWindow("mail:3pane");
winId.focus();
winId.document.getElementById('tabmail').openTab("folder",
{folder: msgHdr.folder, msgHdr:msgHdr, messagePaneVisible:true } );

.. but NOT with SM2.
Error: tabMode is undefined
Source File: chrome://messenger/content/tabmail.xml
Line: 409

Tracing with Venkman shows the error is thrown with "winId.focus();" .

Any difference here for SM2 compared with TB3??

Note:
With Postbox 1.02 this works :
var windowManager =
Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
var winId = windowManager.getMostRecentWindow("mail:3pane");
winId.focus();
winId.MsgOpenNewTabForFolder(folderUri, msgHdr.messageKey /*key*/,
false /*aBackground*/)
}

Philip Chee

unread,
Nov 1, 2009, 12:17:06 PM11/1/09
to
On Sun, 01 Nov 2009 16:02:17 +0100, gNeandr wrote:

Running your snippet of code I get "msgHdr is undefined".

> Help request for TB3 vs SM2
>
> With TB3 this works :
> var windowManager =
> Components.classes['@mozilla.org/appshell/window-mediator;1']
> .getService(Components.interfaces.nsIWindowMediator);
>
> var winId = windowManager.getMostRecentWindow("mail:3pane");
> winId.focus();
> winId.document.getElementById('tabmail').openTab("folder",
> {folder: msgHdr.folder, msgHdr:msgHdr, messagePaneVisible:true } );
>
> .. but NOT with SM2.
> Error: tabMode is undefined
> Source File: chrome://messenger/content/tabmail.xml
> Line: 409
>
> Tracing with Venkman shows the error is thrown with "winId.focus();" .

Actually the error is on the next line where you call openTab

> Any difference here for SM2 compared with TB3??

I think you can use this:

winId.document.getElementById('tabmail')
.openTab("3pane", kTabModeFolder, aFolderURI, aMsgHdr);

Where:
const kTabShowFolderPane = 1 << 0;
const kTabShowMessagePane = 1 << 1;
const kTabShowThreadPane = 1 << 2;

const kTabModeFolder = kTabShowFolderPane | kTabShowThreadPane |
kTabShowMessagePane;

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.

gNeandr

unread,
Nov 1, 2009, 1:06:55 PM11/1/09
to
[01.11.2009 18:17] �Philip Chee� wrote:
>
> winId.document.getElementById('tabmail')
> .openTab("3pane", kTabModeFolder, aFolderURI, aMsgHdr);
>
> Where:
> const kTabShowFolderPane = 1<< 0;
> const kTabShowMessagePane = 1<< 1;
> const kTabShowThreadPane = 1<< 2;
>
> const kTabModeFolder = kTabShowFolderPane | kTabShowThreadPane |
> kTabShowMessagePane;
>
>
OK, works. Only if the messenger isn't opened before it is call, it will
fail.

The specific situation here is: ReminderFox on SM works for both parts,
the browser and the messenger.
So when we are working with the browser and try to open a message from
the reminderfox list this will fail.

For FX we have a call to TB/PB with a specific cmdline handler. Think
that should not be necessary with SM. But I need to 'activate' the
messenger part of SM somehow -- open the main messenger window (similar
to user press Cltr+2).

Any thoughts??

G�nter

Philip Chee

unread,
Nov 1, 2009, 2:22:58 PM11/1/09
to
On Sun, 01 Nov 2009 19:06:55 +0100, gNeandr wrote:

> The specific situation here is: ReminderFox on SM works for both parts,
> the browser and the messenger.
> So when we are working with the browser and try to open a message from
> the reminderfox list this will fail.
>
> For FX we have a call to TB/PB with a specific cmdline handler. Think
> that should not be necessary with SM. But I need to 'activate' the
> messenger part of SM somehow -- open the main messenger window (similar
> to user press Cltr+2).

var windowManager =
Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);

var winId = windowManager.getMostRecentWindow("mail:3pane");

if (winId)
{
winId.focus();
winId.document.getElementById('tabmail').openTab("3pane",
kTabModeFolder, aFolderURI, aMsgHdr);
}
else
{
winId = window.openDialog("chrome://messenger/content/", "",
"all,dialog=no");
winId.addEventListener("load", yourListener, false);
}

// Then in your listener you can do something like:

function yourListener(event)
{
// make sure that this handler is called only once
winId.removeEventListener("unload", yourListener, false);

0 new messages