我已经创建了一个执行以下操作的扩展:
当我使用命令行thunderbird -MyCustomParam1 "12345"运行Thinderbird时,我的扩展将打开一个撰写窗口,并将参数"12345"添加到该窗口。
下面是我使用的一些代码:
// In the calling code
var args = {
param1: 12345,
};
args.wrappedJSObject = args;
var watcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
watcher.openWindow(null, url, windowName, features, args);
// In the window code
var args = window.arguments[0].wrappedJSObject;当然,使用正确的url和功能。
现在我想做同样的事情,但对于消息窗口和eml文件是选择的。
您可以像下面这样从命令行打开一个eml文件:Thunderbird test.eml (这将在一个新窗口中打开邮件)。
我想要的是:
Thunderbird test.eml -MycustomParam1 "1234"应该打开邮件,并将参数"1234"添加到屏幕,这样我就可以在文档窗口中访问它,就像示例1一样。
所以基本上我想要一些类似watcher.openWindow的东西,但是带有给定的eml文件。
有什么想法吗?
发布于 2012-06-12 16:21:45
您可以在MsgOpenFromFile function中看到这是如何完成的,它是为文件/打开保存的邮件菜单项调用的。基本上,您必须获取eml文件(get an nsIFile instance from file path) turn it into a URI,然后在打开消息窗口之前更改查询字符串:
uri.QueryInterface(Components.interfaces.nsIURL);
uri.query = "type=application/x-message-display";
watcher.openWindow(null, "chrome://messenger/content/messageWindow.xul", "_blank",
"all,chrome,dialog=no,status,toolbar", uri);https://stackoverflow.com/questions/10984796
复制相似问题