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 gDataSourceSearchListener;
|
||||||
var gViewSearchListener;
|
var gViewSearchListener;
|
||||||
|
|
||||||
var gMailSession;
|
|
||||||
|
|
||||||
function GetScopeForFolder(folder)
|
function GetScopeForFolder(folder)
|
||||||
{
|
{
|
||||||
return folder.server.searchScope;
|
return folder.server.searchScope;
|
||||||
|
@ -933,9 +931,6 @@ function setupXFVirtualFolderSearch(folderUrisToSearch, searchTerms, searchOnlin
|
||||||
|
|
||||||
gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
|
gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
|
||||||
|
|
||||||
gMailSession = Cc["@mozilla.org/messenger/services/session;1"]
|
|
||||||
.getService(Ci.nsIMsgMailSession);
|
|
||||||
|
|
||||||
for (i in folderUrisToSearch)
|
for (i in folderUrisToSearch)
|
||||||
{
|
{
|
||||||
let realFolder = GetMsgFolderFromUri(folderUrisToSearch[i]);
|
let realFolder = GetMsgFolderFromUri(folderUrisToSearch[i]);
|
||||||
|
|
|
@ -538,33 +538,33 @@ var DefaultController =
|
||||||
break;
|
break;
|
||||||
case "button_next":
|
case "button_next":
|
||||||
case "cmd_nextUnreadMsg":
|
case "cmd_nextUnreadMsg":
|
||||||
MsgNextUnreadMessage();
|
GoNextMessage(nsMsgNavigationType.nextUnreadMessage, true);
|
||||||
break;
|
break;
|
||||||
case "cmd_nextUnreadThread":
|
case "cmd_nextUnreadThread":
|
||||||
MsgNextUnreadThread();
|
GoNextMessage(nsMsgNavigationType.nextUnreadThread, true);
|
||||||
break;
|
break;
|
||||||
case "cmd_nextMsg":
|
case "cmd_nextMsg":
|
||||||
MsgNextMessage();
|
GoNextMessage(nsMsgNavigationType.nextMessage, false);
|
||||||
break;
|
break;
|
||||||
case "cmd_nextFlaggedMsg":
|
case "cmd_nextFlaggedMsg":
|
||||||
MsgNextFlaggedMessage();
|
GoNextMessage(nsMsgNavigationType.nextFlagged, true);
|
||||||
break;
|
break;
|
||||||
case "cmd_previousMsg":
|
case "cmd_previousMsg":
|
||||||
MsgPreviousMessage();
|
GoNextMessage(nsMsgNavigationType.previousMessage, false);
|
||||||
break;
|
break;
|
||||||
case "cmd_previousUnreadMsg":
|
case "cmd_previousUnreadMsg":
|
||||||
MsgPreviousUnreadMessage();
|
GoNextMessage(nsMsgNavigationType.previousUnreadMessage, true);
|
||||||
break;
|
break;
|
||||||
case "cmd_previousFlaggedMsg":
|
case "cmd_previousFlaggedMsg":
|
||||||
MsgPreviousFlaggedMessage();
|
GoNextMessage(nsMsgNavigationType.previousFlagged, true);
|
||||||
|
break;
|
||||||
|
case "button_goForward":
|
||||||
|
case "cmd_goForward":
|
||||||
|
GoNextMessage(nsMsgNavigationType.forward, true);
|
||||||
break;
|
break;
|
||||||
case "button_goBack":
|
case "button_goBack":
|
||||||
case "cmd_goBack":
|
case "cmd_goBack":
|
||||||
MsgGoBack();
|
GoNextMessage(nsMsgNavigationType.back, true);
|
||||||
break;
|
|
||||||
case "button_goForward":
|
|
||||||
case "cmd_goForward":
|
|
||||||
MsgGoForward();
|
|
||||||
break;
|
break;
|
||||||
case "cmd_goStartPage":
|
case "cmd_goStartPage":
|
||||||
HideMessageHeaderPane();
|
HideMessageHeaderPane();
|
||||||
|
@ -658,7 +658,7 @@ var DefaultController =
|
||||||
MsgJunk();
|
MsgJunk();
|
||||||
return;
|
return;
|
||||||
case "cmd_stop":
|
case "cmd_stop":
|
||||||
MsgStop();
|
msgWindow.StopUrls();
|
||||||
return;
|
return;
|
||||||
case "cmd_markAsFlagged":
|
case "cmd_markAsFlagged":
|
||||||
MsgMarkAsFlagged(null);
|
MsgMarkAsFlagged(null);
|
||||||
|
@ -1003,51 +1003,6 @@ function SetFocusThreadPaneIfNotOnMessagePane()
|
||||||
SetFocusThreadPane();
|
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)
|
function SwitchPaneFocus(event)
|
||||||
{
|
{
|
||||||
var folderTree = GetFolderTree();
|
var folderTree = GetFolderTree();
|
||||||
|
|
|
@ -679,14 +679,8 @@ function CheckForMessageIdInFolder(folder, messageId)
|
||||||
dump("Failed to find message-id in folder!");
|
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;
|
const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
|
||||||
if (!gMailSession.IsFolderOpenInWindow(folder) &&
|
if (!MailServices.mailSession.IsFolderOpenInWindow(folder) &&
|
||||||
!(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
|
!(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
|
||||||
{
|
{
|
||||||
folder.msgDatabase = null;
|
folder.msgDatabase = null;
|
||||||
|
|
|
@ -15,8 +15,6 @@ var RDF;
|
||||||
var msgComposeType;
|
var msgComposeType;
|
||||||
var msgComposeFormat;
|
var msgComposeFormat;
|
||||||
|
|
||||||
var mailSession;
|
|
||||||
|
|
||||||
var gMessengerBundle;
|
var gMessengerBundle;
|
||||||
var gBrandBundle;
|
var gBrandBundle;
|
||||||
|
|
||||||
|
@ -48,11 +46,9 @@ function OnMailWindowUnload()
|
||||||
dbview.close();
|
dbview.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
|
MailServices.mailSession.RemoveFolderListener(folderListener);
|
||||||
.getService();
|
|
||||||
if (mailSession instanceof Ci.nsIMsgMailSession)
|
MailServices.mailSession.RemoveMsgWindow(msgWindow);
|
||||||
mailSession.RemoveFolderListener(folderListener);
|
|
||||||
mailSession.RemoveMsgWindow(msgWindow);
|
|
||||||
messenger.setWindow(null, null);
|
messenger.setWindow(null, null);
|
||||||
|
|
||||||
msgWindow.closeWindow();
|
msgWindow.closeWindow();
|
||||||
|
@ -186,8 +182,6 @@ function CreateMailWindowGlobals()
|
||||||
msgComposeService = Cc['@mozilla.org/messengercompose;1']
|
msgComposeService = Cc['@mozilla.org/messengercompose;1']
|
||||||
.getService(Ci.nsIMsgComposeService);
|
.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);
|
accountManager = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
|
||||||
|
|
||||||
RDF = Cc['@mozilla.org/rdf/rdf-service;1']
|
RDF = Cc['@mozilla.org/rdf/rdf-service;1']
|
||||||
|
@ -218,7 +212,7 @@ function InitMsgWindow()
|
||||||
msgWindow.domWindow = window;
|
msgWindow.domWindow = window;
|
||||||
msgWindow.statusFeedback = statusFeedback;
|
msgWindow.statusFeedback = statusFeedback;
|
||||||
msgWindow.msgHeaderSink = messageHeaderSink;
|
msgWindow.msgHeaderSink = messageHeaderSink;
|
||||||
mailSession.AddMsgWindow(msgWindow);
|
MailServices.mailSession.AddMsgWindow(msgWindow);
|
||||||
|
|
||||||
var messagepane = getMessageBrowser();
|
var messagepane = getMessageBrowser();
|
||||||
messagepane.docShell.allowAuth = false;
|
messagepane.docShell.allowAuth = false;
|
||||||
|
|
|
@ -219,13 +219,10 @@ function OnLoadMessageWindow()
|
||||||
// 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();
|
||||||
|
|
||||||
try {
|
var nsIFolderListener = Ci.nsIFolderListener;
|
||||||
var nsIFolderListener = Ci.nsIFolderListener;
|
var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event |
|
||||||
var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event | nsIFolderListener.intPropertyChanged;
|
nsIFolderListener.intPropertyChanged;
|
||||||
mailSession.AddFolderListener(folderListener, notifyFlags);
|
MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
|
||||||
} catch (ex) {
|
|
||||||
dump("Error adding to session: " +ex + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
var originalView = null;
|
var originalView = null;
|
||||||
var folder = null;
|
var folder = null;
|
||||||
|
|
|
@ -962,15 +962,10 @@ function loadStartFolder(initialUri)
|
||||||
|
|
||||||
function AddToSession()
|
function AddToSession()
|
||||||
{
|
{
|
||||||
try {
|
var nsIFolderListener = Ci.nsIFolderListener;
|
||||||
var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
|
var notifyFlags = nsIFolderListener.intPropertyChanged |
|
||||||
.getService(Ci.nsIMsgMailSession);
|
nsIFolderListener.event;
|
||||||
var nsIFolderListener = Ci.nsIFolderListener;
|
MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
|
||||||
var notifyFlags = nsIFolderListener.intPropertyChanged | nsIFolderListener.event;
|
|
||||||
mailSession.AddFolderListener(folderListener, notifyFlags);
|
|
||||||
} catch (ex) {
|
|
||||||
dump("Error adding to session\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function InitPanes()
|
function InitPanes()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче