Bug 1589892 - Port |Bug 440616 (part 1 v2) Clean up Thunderbird's global scope a bit more (mail session and 3pane commands)| to SeaMonkey. r=frg DONTBUILD

This commit is contained in:
Ian Neal 2019-11-11 20:45:13 +01:00
Родитель 09c2ec21f6
Коммит a0da660486
6 изменённых файлов: 26 добавлений и 96 удалений

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

@ -919,8 +919,6 @@ var gMessengerBundle = null;
var gDataSourceSearchListener;
var gViewSearchListener;
var gMailSession;
function GetScopeForFolder(folder)
{
return folder.server.searchScope;
@ -933,9 +931,6 @@ function setupXFVirtualFolderSearch(folderUrisToSearch, searchTerms, searchOnlin
gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
gMailSession = Cc["@mozilla.org/messenger/services/session;1"]
.getService(Ci.nsIMsgMailSession);
for (i in folderUrisToSearch)
{
let realFolder = GetMsgFolderFromUri(folderUrisToSearch[i]);

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

@ -538,33 +538,33 @@ var DefaultController =
break;
case "button_next":
case "cmd_nextUnreadMsg":
MsgNextUnreadMessage();
GoNextMessage(nsMsgNavigationType.nextUnreadMessage, true);
break;
case "cmd_nextUnreadThread":
MsgNextUnreadThread();
GoNextMessage(nsMsgNavigationType.nextUnreadThread, true);
break;
case "cmd_nextMsg":
MsgNextMessage();
GoNextMessage(nsMsgNavigationType.nextMessage, false);
break;
case "cmd_nextFlaggedMsg":
MsgNextFlaggedMessage();
GoNextMessage(nsMsgNavigationType.nextFlagged, true);
break;
case "cmd_previousMsg":
MsgPreviousMessage();
GoNextMessage(nsMsgNavigationType.previousMessage, false);
break;
case "cmd_previousUnreadMsg":
MsgPreviousUnreadMessage();
GoNextMessage(nsMsgNavigationType.previousUnreadMessage, true);
break;
case "cmd_previousFlaggedMsg":
MsgPreviousFlaggedMessage();
GoNextMessage(nsMsgNavigationType.previousFlagged, true);
break;
case "button_goForward":
case "cmd_goForward":
GoNextMessage(nsMsgNavigationType.forward, true);
break;
case "button_goBack":
case "cmd_goBack":
MsgGoBack();
break;
case "button_goForward":
case "cmd_goForward":
MsgGoForward();
GoNextMessage(nsMsgNavigationType.back, true);
break;
case "cmd_goStartPage":
HideMessageHeaderPane();
@ -658,7 +658,7 @@ var DefaultController =
MsgJunk();
return;
case "cmd_stop":
MsgStop();
msgWindow.StopUrls();
return;
case "cmd_markAsFlagged":
MsgMarkAsFlagged(null);
@ -1003,51 +1003,6 @@ function SetFocusThreadPaneIfNotOnMessagePane()
SetFocusThreadPane();
}
// 3pane related commands. Need to go in own file. Putting here for the moment.
function MsgNextMessage()
{
GoNextMessage(nsMsgNavigationType.nextMessage, false);
}
function MsgNextUnreadMessage()
{
GoNextMessage(nsMsgNavigationType.nextUnreadMessage, true);
}
function MsgNextFlaggedMessage()
{
GoNextMessage(nsMsgNavigationType.nextFlagged, true);
}
function MsgNextUnreadThread()
{
GoNextMessage(nsMsgNavigationType.nextUnreadThread, true);
}
function MsgPreviousMessage()
{
GoNextMessage(nsMsgNavigationType.previousMessage, false);
}
function MsgPreviousUnreadMessage()
{
GoNextMessage(nsMsgNavigationType.previousUnreadMessage, true);
}
function MsgPreviousFlaggedMessage()
{
GoNextMessage(nsMsgNavigationType.previousFlagged, true);
}
function MsgGoBack()
{
GoNextMessage(nsMsgNavigationType.back, true);
}
function MsgGoForward()
{
GoNextMessage(nsMsgNavigationType.forward, true);
}
function SwitchPaneFocus(event)
{
var folderTree = GetFolderTree();

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

@ -679,14 +679,8 @@ function CheckForMessageIdInFolder(folder, messageId)
dump("Failed to find message-id in folder!");
}
if (!gMailSession)
{
gMailSession = Cc["@mozilla.org/messenger/services/session;1"]
.getService(Ci.nsIMsgMailSession);
}
const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (!gMailSession.IsFolderOpenInWindow(folder) &&
if (!MailServices.mailSession.IsFolderOpenInWindow(folder) &&
!(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
{
folder.msgDatabase = null;

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

@ -15,8 +15,6 @@ var RDF;
var msgComposeType;
var msgComposeFormat;
var mailSession;
var gMessengerBundle;
var gBrandBundle;
@ -48,11 +46,9 @@ function OnMailWindowUnload()
dbview.close();
}
var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
.getService();
if (mailSession instanceof Ci.nsIMsgMailSession)
mailSession.RemoveFolderListener(folderListener);
mailSession.RemoveMsgWindow(msgWindow);
MailServices.mailSession.RemoveFolderListener(folderListener);
MailServices.mailSession.RemoveMsgWindow(msgWindow);
messenger.setWindow(null, null);
msgWindow.closeWindow();
@ -186,8 +182,6 @@ function CreateMailWindowGlobals()
msgComposeService = Cc['@mozilla.org/messengercompose;1']
.getService(Ci.nsIMsgComposeService);
mailSession = Cc["@mozilla.org/messenger/services/session;1"].getService(Ci.nsIMsgMailSession);
accountManager = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
RDF = Cc['@mozilla.org/rdf/rdf-service;1']
@ -218,7 +212,7 @@ function InitMsgWindow()
msgWindow.domWindow = window;
msgWindow.statusFeedback = statusFeedback;
msgWindow.msgHeaderSink = messageHeaderSink;
mailSession.AddMsgWindow(msgWindow);
MailServices.mailSession.AddMsgWindow(msgWindow);
var messagepane = getMessageBrowser();
messagepane.docShell.allowAuth = false;

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

@ -219,13 +219,10 @@ function OnLoadMessageWindow()
// FIX ME - later we will be able to use onload from the overlay
OnLoadMsgHeaderPane();
try {
var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event | nsIFolderListener.intPropertyChanged;
mailSession.AddFolderListener(folderListener, notifyFlags);
} catch (ex) {
dump("Error adding to session: " +ex + "\n");
}
var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event |
nsIFolderListener.intPropertyChanged;
MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
var originalView = null;
var folder = null;

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

@ -962,15 +962,10 @@ function loadStartFolder(initialUri)
function AddToSession()
{
try {
var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
.getService(Ci.nsIMsgMailSession);
var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.intPropertyChanged | nsIFolderListener.event;
mailSession.AddFolderListener(folderListener, notifyFlags);
} catch (ex) {
dump("Error adding to session\n");
}
var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.intPropertyChanged |
nsIFolderListener.event;
MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
}
function InitPanes()