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:
Родитель
09c2ec21f6
Коммит
a0da660486
|
@ -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();
|
||||
break;
|
||||
case "button_goBack":
|
||||
case "cmd_goBack":
|
||||
MsgGoBack();
|
||||
GoNextMessage(nsMsgNavigationType.previousFlagged, true);
|
||||
break;
|
||||
case "button_goForward":
|
||||
case "cmd_goForward":
|
||||
MsgGoForward();
|
||||
GoNextMessage(nsMsgNavigationType.forward, true);
|
||||
break;
|
||||
case "button_goBack":
|
||||
case "cmd_goBack":
|
||||
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 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 notifyFlags = nsIFolderListener.intPropertyChanged |
|
||||
nsIFolderListener.event;
|
||||
MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
|
||||
}
|
||||
|
||||
function InitPanes()
|
||||
|
|
Загрузка…
Ссылка в новой задаче