Clean up multiple message compose appcores problem

This commit is contained in:
ducarroz%netscape.com 1999-04-27 21:23:29 +00:00
Родитель 1d90e014e3
Коммит 4a9ce66e81
1 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -13,17 +13,6 @@ function FindMsgAppCore()
return msgAppCore; return msgAppCore;
} }
function FindComposeAppCore()
{
composeAppCore = XPAppCoresManager.Find("ComposeAppCore");
if (composeAppCore == null) {
dump("FindComposeAppCore: Creating ComposeAppCore\n");
composeAppCore = new ComposeAppCore();
dump("Initializing ComposeAppCore and setting Window\n");
composeAppCore.Init("ComposeAppCore");
}
return composeAppCore;
}
function OpenURL(url) function OpenURL(url)
{ {
dump("\n\nOpenURL from XUL\n\n\n"); dump("\n\nOpenURL from XUL\n\n\n");
@ -36,13 +25,27 @@ function OpenURL(url)
function ComposeMessage(tree, nodeList, msgAppCore, type) function ComposeMessage(tree, nodeList, msgAppCore, type)
{ {
dump("\nComposeMessage from XUL\n"); dump("\nComposeMessage from XUL\n");
var appCore = FindComposeAppCore();
if (appCore != null) { // Generate a unique number, do we have a better way?
appCore.SetWindow(window); // I don't think so a user can create two message compositions
appCore.NewMessage("chrome://messengercompose/content/", tree, // in the same millisecond!!
nodeList, msgAppCore, type); var date = new Date();
} sessionID = date.getTime();
var composeAppCoreName = "ComposeAppCore:" + sessionID;
var composeAppCore = XPAppCoresManager.Find(composeAppCoreName);
if (! composeAppCore)
{
composeAppCore = new ComposeAppCore();
if (composeAppCore)
{
var args = "name=" + composeAppCoreName;
composeAppCore.Init(composeAppCoreName);
composeAppCore.NewMessage("chrome://messengercompose/content/", args, tree, nodeList, msgAppCore, type);
dump("Created a compose appcore from Messenger, " + args);
}
}
} }
function NewMessage() function NewMessage()