fix for #187673. when re-using the stand alone msg window, because of quick search and mail views,

we have to re-create the db view, even if it is for the same folder as the existing view.
r/sr=bienvenu.  thanks to leon.zhang@sun.com for the bug report and initial patch.
This commit is contained in:
sspitzer%netscape.com 2003-01-09 20:51:40 +00:00
Родитель ded36e68aa
Коммит dbe5b54f69
1 изменённых файлов: 21 добавлений и 16 удалений

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

@ -1105,7 +1105,7 @@ function MsgOpenExistingWindowForMessage(aMessageUri)
var msgHdr = null;
var windowID = GetWindowByWindowType("mail:messageWindow");
if(!windowID)
if (!windowID)
return false;
if (!aMessageUri) {
@ -1124,29 +1124,34 @@ function MsgOpenExistingWindowForMessage(aMessageUri)
if (!msgHdr)
return false;
if (msgHdr.folder.URI != windowID.gCurrentFolderUri) {
if ("CreateView" in windowID) {
// Reset the window's message uri and folder uri vars, and
// update the command handlers to what's going to be used.
// This has to be done before the call to CreateView().
windowID.gCurrentMessageUri = messageUri;
windowID.gCurrentFolderUri = msgHdr.folder.URI;
windowID.UpdateMailToolbar('MsgOpenExistingWindowForMessage');
windowID.CreateView(gDBView);
}
else
return false;
// even if the folder uri's match, we can't use the existing view
// (msgHdr.folder.URI == windowID.gCurrentFolderUri)
// the reason is quick search and mail views.
// see bug #187673
//
// for the sake of simplicity,
// let's always call CreateView(gDBView)
// which will clone gDBView
if ("CreateView" in windowID) {
// Reset the window's message uri and folder uri vars, and
// update the command handlers to what's going to be used.
// This has to be done before the call to CreateView().
windowID.gCurrentMessageUri = messageUri;
windowID.gCurrentFolderUri = msgHdr.folder.URI;
windowID.UpdateMailToolbar('MsgOpenExistingWindowForMessage');
windowID.CreateView(gDBView);
windowID.gDBView.loadMessageByMsgKey(msgHdr.messageKey);
}
windowID.gDBView.loadMessageByMsgKey(msgHdr.messageKey);
else
return false;
}
catch (ex) {
dump("reusing existing standalone message window failed: " + ex + "\n");
return false;
}
// bring existing window to front
windowID.focus();
return true;
}