зеркало из https://github.com/mozilla/gecko-dev.git
r=mscott. Fix for 31805. can now have multiple mail windows open.
This commit is contained in:
Родитель
3700a0f38f
Коммит
cc31405197
|
@ -38,7 +38,8 @@
|
||||||
onblur="goOnEvent(this,'blur')"
|
onblur="goOnEvent(this,'blur')"
|
||||||
ondragover="return DragOverTree(event);"
|
ondragover="return DragOverTree(event);"
|
||||||
ondraggesture="return BeginDragFolderTree(event);"
|
ondraggesture="return BeginDragFolderTree(event);"
|
||||||
ondragdrop="return DropOnFolderTree(event);">
|
ondragdrop="return DropOnFolderTree(event);"
|
||||||
|
onclick="FolderPaneOnClick(event);">
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<rule>
|
<rule>
|
||||||
|
|
|
@ -93,7 +93,7 @@ function fillFolderPaneContextMenu()
|
||||||
EnableMenuItem("folderPaneContext-getMessages", true);
|
EnableMenuItem("folderPaneContext-getMessages", true);
|
||||||
|
|
||||||
ShowMenuItem("folderPaneContext-openNewWindow", (numSelected <= 1) && !isServer);
|
ShowMenuItem("folderPaneContext-openNewWindow", (numSelected <= 1) && !isServer);
|
||||||
EnableMenuItem("folderPaneContext-openNewWindow", (false));
|
EnableMenuItem("folderPaneContext-openNewWindow", (true));
|
||||||
|
|
||||||
SetupRenameMenuItem(targetFolder, numSelected, isServer, serverType, specialFolder);
|
SetupRenameMenuItem(targetFolder, numSelected, isServer, serverType, specialFolder);
|
||||||
SetupRemoveMenuItem(targetFolder, numSelected, isServer, serverType, specialFolder);
|
SetupRemoveMenuItem(targetFolder, numSelected, isServer, serverType, specialFolder);
|
||||||
|
|
|
@ -276,7 +276,7 @@ Rights Reserved.
|
||||||
<menuitem id="folderPaneContext-openNewWindow"
|
<menuitem id="folderPaneContext-openNewWindow"
|
||||||
value="&folderContextOpenNewWindow.label;"
|
value="&folderContextOpenNewWindow.label;"
|
||||||
accesskey=""
|
accesskey=""
|
||||||
oncommand="MsgOpenNewWindowForFolder();"/>
|
oncommand="MsgOpenNewWindowForFolder(null);"/>
|
||||||
<menuitem id="folderPaneContext-rename"
|
<menuitem id="folderPaneContext-rename"
|
||||||
value="&folderContextRename.label;"
|
value="&folderContextRename.label;"
|
||||||
accesskey=""
|
accesskey=""
|
||||||
|
|
|
@ -73,6 +73,8 @@ var gNextMessageAfterDelete = null;
|
||||||
|
|
||||||
var gActiveThreadPaneSortColumn = "";
|
var gActiveThreadPaneSortColumn = "";
|
||||||
|
|
||||||
|
var gStartFolderUri = null;
|
||||||
|
|
||||||
// the folderListener object
|
// the folderListener object
|
||||||
var folderListener = {
|
var folderListener = {
|
||||||
OnItemAdded: function(parentItem, item, view) {},
|
OnItemAdded: function(parentItem, item, view) {},
|
||||||
|
@ -126,8 +128,7 @@ var folderListener = {
|
||||||
if(resource)
|
if(resource)
|
||||||
{
|
{
|
||||||
var uri = resource.Value;
|
var uri = resource.Value;
|
||||||
dump('In OnFolderLoaded for ' + uri);
|
dump("In OnFolderLoaded for " + uri +"\n");
|
||||||
dump('\n');
|
|
||||||
if(uri == gCurrentFolderToReroot)
|
if(uri == gCurrentFolderToReroot)
|
||||||
{
|
{
|
||||||
gCurrentFolderToReroot="";
|
gCurrentFolderToReroot="";
|
||||||
|
@ -135,7 +136,6 @@ var folderListener = {
|
||||||
if(msgFolder)
|
if(msgFolder)
|
||||||
{
|
{
|
||||||
msgFolder.endFolderLoading();
|
msgFolder.endFolderLoading();
|
||||||
dump("before reroot in OnFolderLoaded\n");
|
|
||||||
RerootFolder(uri, msgFolder, gCurrentLoadingFolderIsThreaded, gCurrentLoadingFolderSortID, gCurrentLoadingFolderSortDirection);
|
RerootFolder(uri, msgFolder, gCurrentLoadingFolderIsThreaded, gCurrentLoadingFolderSortID, gCurrentLoadingFolderSortDirection);
|
||||||
gCurrentLoadingFolderIsThreaded = false;
|
gCurrentLoadingFolderIsThreaded = false;
|
||||||
gCurrentLoadingFolderSortID = "";
|
gCurrentLoadingFolderSortID = "";
|
||||||
|
@ -168,23 +168,17 @@ var folderListener = {
|
||||||
},
|
},
|
||||||
OnDeleteOrMoveMessagesCompleted :function(folder)
|
OnDeleteOrMoveMessagesCompleted :function(folder)
|
||||||
{
|
{
|
||||||
dump("In OnDeleteOrMoveMessagesCompleted\n");
|
|
||||||
if(IsCurrentLoadedFolder(folder))
|
if(IsCurrentLoadedFolder(folder))
|
||||||
{
|
{
|
||||||
msgNavigationService.EnsureDocumentIsLoaded(document);
|
msgNavigationService.EnsureDocumentIsLoaded(document);
|
||||||
|
|
||||||
dump("next message uri is " + gNextMessageAfterDelete + "\n");
|
|
||||||
if(gNextMessageAfterDelete)
|
if(gNextMessageAfterDelete)
|
||||||
{
|
{
|
||||||
var nextMessage = document.getElementById(gNextMessageAfterDelete);
|
var nextMessage = document.getElementById(gNextMessageAfterDelete);
|
||||||
if(!nextMessage)
|
|
||||||
dump("No next message after delete\n");
|
|
||||||
SelectNextMessage(nextMessage);
|
SelectNextMessage(nextMessage);
|
||||||
var threadTree = GetThreadTree();
|
var threadTree = GetThreadTree();
|
||||||
if(threadTree)
|
if(threadTree)
|
||||||
threadTree.ensureElementIsVisible(nextMessage);
|
threadTree.ensureElementIsVisible(nextMessage);
|
||||||
else
|
|
||||||
dump("No thread tree\n");
|
|
||||||
gNextMessageAfterDelete = null;
|
gNextMessageAfterDelete = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,16 +190,12 @@ function IsCurrentLoadedFolder(folder)
|
||||||
msgfolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
msgfolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||||
if(msgfolder)
|
if(msgfolder)
|
||||||
{
|
{
|
||||||
dump("IsCurrentLoadedFolder: has msgFolder\n");
|
|
||||||
var folderResource = msgfolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
var folderResource = msgfolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||||
if(folderResource)
|
if(folderResource)
|
||||||
{
|
{
|
||||||
dump("IsCurrentLoadedFolder: has folderResource\n");
|
|
||||||
var folderURI = folderResource.Value;
|
var folderURI = folderResource.Value;
|
||||||
var currentLoadedFolder = GetThreadTreeFolder();
|
var currentLoadedFolder = GetThreadTreeFolder();
|
||||||
var currentURI = currentLoadedFolder.getAttribute('ref');
|
var currentURI = currentLoadedFolder.getAttribute('ref');
|
||||||
dump("IsCurrentLoadedFolder: folderURI = " + folderURI + "\n");
|
|
||||||
dump("IsCurrentLoadedFolder: currentURI = " + currentURI + "\n");
|
|
||||||
return(currentURI == folderURI);
|
return(currentURI == folderURI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,8 +223,16 @@ function OnLoadMessenger()
|
||||||
AddToSession();
|
AddToSession();
|
||||||
//need to add to session before trying to load start folder otherwise listeners aren't
|
//need to add to session before trying to load start folder otherwise listeners aren't
|
||||||
//set up correctly.
|
//set up correctly.
|
||||||
dump('Before load start folder\n');
|
if(window.arguments && window.arguments[0])
|
||||||
setTimeout("loadStartFolder();", 0);
|
{
|
||||||
|
gStartFolderUri = window.arguments[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gStartFolderUri = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout("loadStartFolder(gStartFolderUri);", 0);
|
||||||
|
|
||||||
// FIX ME - later we will be able to use onload from the overlay
|
// FIX ME - later we will be able to use onload from the overlay
|
||||||
OnLoadMsgHeaderPane();
|
OnLoadMsgHeaderPane();
|
||||||
|
@ -416,10 +414,12 @@ function loadStartPage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadStartFolder()
|
function loadStartFolder(startFolderUri)
|
||||||
{
|
{
|
||||||
//First get default account
|
//First get default account
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if(!startFolderUri)
|
||||||
{
|
{
|
||||||
var defaultAccount = accountManager.defaultAccount;
|
var defaultAccount = accountManager.defaultAccount;
|
||||||
|
|
||||||
|
@ -429,30 +429,27 @@ function loadStartFolder()
|
||||||
|
|
||||||
//now find Inbox
|
//now find Inbox
|
||||||
var outNumFolders = new Object();
|
var outNumFolders = new Object();
|
||||||
dump('Before getting inbox\n');
|
|
||||||
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders);
|
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders);
|
||||||
if(!inboxFolder) return;
|
if(!inboxFolder) return;
|
||||||
dump('We have an inbox\n');
|
|
||||||
|
|
||||||
var resource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
var resource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||||
var inboxURI = resource.Value;
|
var startFolderUri = resource.Value;
|
||||||
|
|
||||||
dump('InboxURI = ' + inboxURI + '\n');
|
|
||||||
//first, let's see if it's already in the dom. This will make life easier.
|
//first, let's see if it's already in the dom. This will make life easier.
|
||||||
//We need to make sure content is built by this time
|
//We need to make sure content is built by this time
|
||||||
|
}
|
||||||
msgNavigationService.EnsureDocumentIsLoaded(document);
|
msgNavigationService.EnsureDocumentIsLoaded(document);
|
||||||
|
|
||||||
var inbox = document.getElementById(inboxURI);
|
var startFolder = document.getElementById(startFolderUri);
|
||||||
|
|
||||||
//if it's not here we will have to make sure it's open.
|
//if it's not here we will have to make sure it's open.
|
||||||
if(!inbox)
|
if(!startFolder)
|
||||||
{
|
{
|
||||||
dump('There isnt an inbox in the tree yet\n');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var folderTree= GetFolderTree();
|
var folderTree= GetFolderTree();
|
||||||
ChangeSelection(folderTree, inbox);
|
ChangeSelection(folderTree, startFolder);
|
||||||
}
|
}
|
||||||
catch(ex)
|
catch(ex)
|
||||||
{
|
{
|
||||||
|
@ -516,7 +513,6 @@ function AddDataSources()
|
||||||
|
|
||||||
function SetupMoveCopyMenus(menuid, accountManagerDataSource, folderDataSource)
|
function SetupMoveCopyMenus(menuid, accountManagerDataSource, folderDataSource)
|
||||||
{
|
{
|
||||||
dump("SetupMoveCopyMenus for " + menuid + "\n");
|
|
||||||
var menu = document.getElementById(menuid);
|
var menu = document.getElementById(menuid);
|
||||||
if(menu)
|
if(menu)
|
||||||
{
|
{
|
||||||
|
@ -541,7 +537,6 @@ function InitPanes()
|
||||||
|
|
||||||
function OnLoadFolderPane(folderTree)
|
function OnLoadFolderPane(folderTree)
|
||||||
{
|
{
|
||||||
dump('In onLoadfolderPane\n');
|
|
||||||
gFolderTree = folderTree;
|
gFolderTree = folderTree;
|
||||||
SortFolderPane('FolderColumn', 'http://home.netscape.com/NC-rdf#FolderTreeName');
|
SortFolderPane('FolderColumn', 'http://home.netscape.com/NC-rdf#FolderTreeName');
|
||||||
|
|
||||||
|
@ -600,8 +595,6 @@ function GetThreadTree()
|
||||||
{
|
{
|
||||||
if (gThreadTree) return gThreadTree;
|
if (gThreadTree) return gThreadTree;
|
||||||
var threadTree = document.getElementById('threadTree');
|
var threadTree = document.getElementById('threadTree');
|
||||||
if(!threadTree)
|
|
||||||
dump('thread tree is null\n');
|
|
||||||
gThreadTree = threadTree;
|
gThreadTree = threadTree;
|
||||||
return threadTree;
|
return threadTree;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +709,6 @@ function ThreadPaneOnClick(event)
|
||||||
//open all of the children of the treeitem
|
//open all of the children of the treeitem
|
||||||
msgNavigationService.OpenTreeitemAndDescendants(treeitem);
|
msgNavigationService.OpenTreeitemAndDescendants(treeitem);
|
||||||
}
|
}
|
||||||
dump('clicked on a twisty\n');
|
|
||||||
}
|
}
|
||||||
else if(event.clickCount == 2)
|
else if(event.clickCount == 2)
|
||||||
{
|
{
|
||||||
|
@ -736,6 +728,21 @@ function ThreadPaneDoubleClick(treeitem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function FolderPaneOnClick(event)
|
||||||
|
{
|
||||||
|
if(event.clickCount == 2)
|
||||||
|
{
|
||||||
|
var item = event.target.parentNode.parentNode;
|
||||||
|
if (item.nodeName == "treeitem")
|
||||||
|
FolderPaneDoubleClick(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function FolderPaneDoubleClick(treeitem)
|
||||||
|
{
|
||||||
|
MsgOpenNewWindowForFolder(treeitem);
|
||||||
|
}
|
||||||
|
|
||||||
function ChangeSelection(tree, newSelection)
|
function ChangeSelection(tree, newSelection)
|
||||||
{
|
{
|
||||||
if(newSelection)
|
if(newSelection)
|
||||||
|
|
|
@ -1205,3 +1205,21 @@ function GetResourceFromUri(uri)
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MsgOpenNewWindowForFolder(folder)
|
||||||
|
{
|
||||||
|
if(!folder)
|
||||||
|
{
|
||||||
|
folder = GetSelectedFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(folder)
|
||||||
|
{
|
||||||
|
var uri = folder.getAttribute("id");
|
||||||
|
if(uri)
|
||||||
|
{
|
||||||
|
window.openDialog( "chrome://messenger/content/", "_blank", "chrome,all,dialog=no", uri );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче