зеркало из https://github.com/mozilla/pjs.git
You can now select a message or folder from a msgWindow.
This commit is contained in:
Родитель
fb4c720c15
Коммит
b2e89de4f7
|
@ -47,6 +47,8 @@ interface nsIMsgWindow : nsISupports {
|
||||||
void SetDOMWindow(in nsIDOMWindow window);
|
void SetDOMWindow(in nsIDOMWindow window);
|
||||||
void StopUrls();
|
void StopUrls();
|
||||||
|
|
||||||
|
void SelectFolder(in string folderUri);
|
||||||
|
void SelectMessage(in string messageUri);
|
||||||
/* when the msg window is being unloaded from the content window,
|
/* when the msg window is being unloaded from the content window,
|
||||||
* we can use this notification to force a flush on anything the
|
* we can use this notification to force a flush on anything the
|
||||||
* msg window hangs on too. For some reason xpconnect is still hanging
|
* msg window hangs on too. For some reason xpconnect is still hanging
|
||||||
|
@ -55,3 +57,10 @@ interface nsIMsgWindow : nsISupports {
|
||||||
*/
|
*/
|
||||||
void closeWindow();
|
void closeWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[scriptable, uuid(FAD93C80-1AC6-11d4-A8F6-006097222B83)]
|
||||||
|
interface nsIMsgWindowCommands : nsISupports {
|
||||||
|
|
||||||
|
void SelectFolder(in string folderUri);
|
||||||
|
void SelectMessage(in string messageUri);
|
||||||
|
};
|
||||||
|
|
|
@ -61,6 +61,25 @@ var gMeterObserver;
|
||||||
var startTime = 0;
|
var startTime = 0;
|
||||||
//End progress and Status variables
|
//End progress and Status variables
|
||||||
|
|
||||||
|
function OnMailWindowUnload()
|
||||||
|
{
|
||||||
|
mailSession.RemoveMsgWindow(msgWindow);
|
||||||
|
messenger.SetWindow(null, null);
|
||||||
|
|
||||||
|
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
||||||
|
msgDS.window = null;
|
||||||
|
|
||||||
|
msgDS = messageDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
||||||
|
msgDS.window = null;
|
||||||
|
|
||||||
|
msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
||||||
|
msgDS.window = null;
|
||||||
|
|
||||||
|
|
||||||
|
msgWindow.closeWindow();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function CreateMailWindowGlobals()
|
function CreateMailWindowGlobals()
|
||||||
{
|
{
|
||||||
// get the messenger instance
|
// get the messenger instance
|
||||||
|
@ -75,6 +94,7 @@ function CreateMailWindowGlobals()
|
||||||
statusFeedback = Components.classes[statusFeedbackProgID].createInstance();
|
statusFeedback = Components.classes[statusFeedbackProgID].createInstance();
|
||||||
statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
|
statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
|
||||||
|
|
||||||
|
window.MsgWindowCommands = new nsMsgWindowCommands();
|
||||||
//Create message view object
|
//Create message view object
|
||||||
messageView = Components.classes[messageViewProgID].createInstance();
|
messageView = Components.classes[messageViewProgID].createInstance();
|
||||||
messageView = messageView.QueryInterface(Components.interfaces.nsIMessageView);
|
messageView = messageView.QueryInterface(Components.interfaces.nsIMessageView);
|
||||||
|
@ -111,7 +131,9 @@ function InitMsgWindow()
|
||||||
msgWindow.statusFeedback = statusFeedback;
|
msgWindow.statusFeedback = statusFeedback;
|
||||||
msgWindow.messageView = messageView;
|
msgWindow.messageView = messageView;
|
||||||
msgWindow.msgHeaderSink = messageHeaderSink;
|
msgWindow.msgHeaderSink = messageHeaderSink;
|
||||||
msgWindow.SetDOMWindow(window);
|
msgWindow.SetDOMWindow(window);
|
||||||
|
mailSession.AddMsgWindow(msgWindow);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddDataSources()
|
function AddDataSources()
|
||||||
|
@ -244,3 +266,29 @@ nsMsgStatusFeedback.prototype =
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function nsMsgWindowCommands()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nsMsgWindowCommands.prototype =
|
||||||
|
{
|
||||||
|
QueryInterface : function(iid)
|
||||||
|
{
|
||||||
|
if(iid.equals(Components.interfaces.nsIMsgWindowCommands))
|
||||||
|
return this;
|
||||||
|
throw Components.results.NS_NOINTERFACE;
|
||||||
|
},
|
||||||
|
SelectFolder: function(folderUri)
|
||||||
|
{
|
||||||
|
|
||||||
|
SelectFolder(folderUri);
|
||||||
|
|
||||||
|
},
|
||||||
|
SelectMessage: function(messageUri)
|
||||||
|
{
|
||||||
|
SelectMessage(messageUri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,7 @@ function OnLoadMessageWindow()
|
||||||
|
|
||||||
function OnUnloadMessageWindow()
|
function OnUnloadMessageWindow()
|
||||||
{
|
{
|
||||||
messenger.SetWindow(null, null);
|
OnMailWindowUnload();
|
||||||
msgWindow.closeWindow();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateMessageWindowGlobals()
|
function CreateMessageWindowGlobals()
|
||||||
|
@ -148,3 +146,14 @@ function SetNextMessageAfterDelete(messagesToCheck, useSelection)
|
||||||
{
|
{
|
||||||
gCurrentMessageIsDeleted = true;
|
gCurrentMessageIsDeleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SelectFolder(folderUri)
|
||||||
|
{
|
||||||
|
gCurrentFolderUri = folderUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectMessage(messageUri)
|
||||||
|
{
|
||||||
|
gCurrentMessageUri = messageUri;
|
||||||
|
OpenURL(gCurrentMessageUri);
|
||||||
|
}
|
||||||
|
|
|
@ -44,14 +44,20 @@ Rights Reserved.
|
||||||
windowtype="mail:messageWindow">
|
windowtype="mail:messageWindow">
|
||||||
|
|
||||||
|
|
||||||
<html:script src="chrome://global/content/strres.js"/>
|
<html:script src="chrome://global/content/strres.js"/>
|
||||||
<html:script src="chrome://messenger/content/commandglue.js"/>
|
<html:script src="chrome://messenger/content/commandglue.js"/>
|
||||||
<html:script src="chrome://messenger/content/mailWindow.js"/>
|
<html:script src="chrome://messenger/content/mailWindow.js"/>
|
||||||
<html:script src="chrome://messenger/content/messageWindow.js"/>
|
<html:script src="chrome://messenger/content/messageWindow.js"/>
|
||||||
<html:script src="chrome://messenger/content/accountUtils.js"/>
|
<html:script src="chrome://messenger/content/accountUtils.js"/>
|
||||||
|
|
||||||
<broadcasterset id="broadcasterset"/>
|
<broadcasterset id="broadcasterset"/>
|
||||||
|
|
||||||
|
<popupset>
|
||||||
|
<popup id="emailAddressPopup" oncreate="return fillEmailAddressMenu(document.popupNode);" popupanchor="bottomleft">
|
||||||
|
<menuitem value="&AddToAddressBook.label;" oncommand="AddNodeToAddressBook(document.popupNode)"/>
|
||||||
|
<menuitem value="&SendMailTo.label;" oncommand="SendMailToNode(document.popupNode)"/>
|
||||||
|
</popup>
|
||||||
|
</popupset>
|
||||||
<menubar id="mailMenubar"/>
|
<menubar id="mailMenubar"/>
|
||||||
|
|
||||||
<toolbox id="mailToolbarToolbox"/>
|
<toolbox id="mailToolbarToolbox"/>
|
||||||
|
|
|
@ -267,22 +267,10 @@ function OnUnloadMessenger()
|
||||||
if(mailSession)
|
if(mailSession)
|
||||||
{
|
{
|
||||||
mailSession.RemoveFolderListener(folderListener);
|
mailSession.RemoveFolderListener(folderListener);
|
||||||
mailSession.RemoveMsgWindow(msgWindow);
|
|
||||||
messenger.SetWindow(null, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
OnMailWindowUnload();
|
||||||
msgDS.window = null;
|
|
||||||
|
|
||||||
msgDS = messageDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
||||||
msgDS.window = null;
|
|
||||||
|
|
||||||
msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
||||||
msgDS.window = null;
|
|
||||||
|
|
||||||
|
|
||||||
msgWindow.closeWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -405,7 +393,6 @@ function AddToSession()
|
||||||
var mailSession = Components.classes[mailSessionProgID].getService(Components.interfaces.nsIMsgMailSession);
|
var mailSession = Components.classes[mailSessionProgID].getService(Components.interfaces.nsIMsgMailSession);
|
||||||
|
|
||||||
mailSession.AddFolderListener(folderListener);
|
mailSession.AddFolderListener(folderListener);
|
||||||
mailSession.AddMsgWindow(msgWindow);
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
dump("Error adding to session\n");
|
dump("Error adding to session\n");
|
||||||
}
|
}
|
||||||
|
@ -1318,6 +1305,24 @@ function SetNextMessageAfterDelete(messagesToCheck, useSelection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SelectFolder(folderUri)
|
||||||
|
{
|
||||||
|
var tree = GetFolderTree();
|
||||||
|
var treeitem = document.getElementById(folderUri);
|
||||||
|
if(tree && treeitem)
|
||||||
|
ChangeSelection(tree, treeitem);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectMessage(messageUri)
|
||||||
|
{
|
||||||
|
var tree = GetThreadTree();
|
||||||
|
var treeitem = document.getElementById(messageUri);
|
||||||
|
if(tree && treeitem)
|
||||||
|
ChangeSelection(tree, treeitem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//3pane related commands. Need to go in own file. Putting here for the moment.
|
//3pane related commands. Need to go in own file. Putting here for the moment.
|
||||||
function MsgSortByDate()
|
function MsgSortByDate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,7 +79,7 @@ Rights Reserved.
|
||||||
onclick="return top.ToggleMessageFlagged(event.target.parentNode.parentNode.parentNode)"
|
onclick="return top.ToggleMessageFlagged(event.target.parentNode.parentNode.parentNode)"
|
||||||
value="rdf:http://home.netscape.com/NC-rdf#Flagged" />
|
value="rdf:http://home.netscape.com/NC-rdf#Flagged" />
|
||||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#Status"/>
|
<treecell value="rdf:http://home.netscape.com/NC-rdf#Status"/>
|
||||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#Size"/>
|
<treecell value="rdf:http://home.netscape.com/NC-rdf#Size" align="right"/>
|
||||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalUnreadMessages"/>
|
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalUnreadMessages"/>
|
||||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalMessages"/>
|
<treecell value="rdf:http://home.netscape.com/NC-rdf#TotalMessages"/>
|
||||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#OrderReceived"/>
|
<treecell value="rdf:http://home.netscape.com/NC-rdf#OrderReceived"/>
|
||||||
|
|
|
@ -300,7 +300,7 @@ nsresult nsMsgMailSession::GetTopmostMsgWindow(nsIMsgWindow* *aMsgWindow)
|
||||||
|
|
||||||
if(count > 0)
|
if(count > 0)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISupports> windowSupports = mWindows->ElementAt(0);
|
nsCOMPtr<nsISupports> windowSupports = mWindows->ElementAt(count - 1);
|
||||||
if(windowSupports)
|
if(windowSupports)
|
||||||
rv = windowSupports->QueryInterface(NS_GET_IID(nsIMsgWindow), (void**)aMsgWindow);
|
rv = windowSupports->QueryInterface(NS_GET_IID(nsIMsgWindow), (void**)aMsgWindow);
|
||||||
if(NS_FAILED(rv))
|
if(NS_FAILED(rv))
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
#include "nsIMsgMailNewsUrl.h"
|
#include "nsIMsgMailNewsUrl.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
#include "nsPIDOMWindow.h"
|
||||||
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
|
static NS_DEFINE_CID(kTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
|
||||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||||
|
@ -76,6 +78,18 @@ nsresult nsMsgWindow::Init()
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* void SelectFolder (in string folderUri); */
|
||||||
|
NS_IMETHODIMP nsMsgWindow::SelectFolder(const char *folderUri)
|
||||||
|
{
|
||||||
|
return mMsgWindowCommands->SelectFolder(folderUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* void SelectMessage (in string messasgeUri); */
|
||||||
|
NS_IMETHODIMP nsMsgWindow::SelectMessage(const char *messageUri)
|
||||||
|
{
|
||||||
|
return mMsgWindowCommands->SelectMessage(messageUri);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsMsgWindow::CloseWindow()
|
NS_IMETHODIMP nsMsgWindow::CloseWindow()
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
@ -232,6 +246,18 @@ NS_IMETHODIMP nsMsgWindow::SetDOMWindow(nsIDOMWindow *aWindow)
|
||||||
// we don't own mMessageWindowWebShell so don't try to keep a reference to it!
|
// we don't own mMessageWindowWebShell so don't try to keep a reference to it!
|
||||||
mMessageWindowWebShell = msgWebShell;
|
mMessageWindowWebShell = msgWebShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get nsIMsgWindowCommands object
|
||||||
|
nsCOMPtr<nsISupports> xpConnectObj;
|
||||||
|
nsCOMPtr<nsPIDOMWindow> piDOMWindow(do_QueryInterface(aWindow));
|
||||||
|
if (piDOMWindow)
|
||||||
|
{
|
||||||
|
nsAutoString msgWindowCommandsWinId;
|
||||||
|
msgWindowCommandsWinId.AssignWithConversion("MsgWindowCommands");
|
||||||
|
piDOMWindow->GetObjectProperty(msgWindowCommandsWinId.GetUnicode(), getter_AddRefs(xpConnectObj));
|
||||||
|
mMsgWindowCommands = do_QueryInterface(xpConnectObj);
|
||||||
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ protected:
|
||||||
nsCOMPtr<nsITransactionManager> mTransactionManager;
|
nsCOMPtr<nsITransactionManager> mTransactionManager;
|
||||||
nsCOMPtr<nsIMessageView> mMessageView;
|
nsCOMPtr<nsIMessageView> mMessageView;
|
||||||
nsCOMPtr<nsIMsgFolder> mOpenFolder;
|
nsCOMPtr<nsIMsgFolder> mOpenFolder;
|
||||||
|
nsCOMPtr<nsIMsgWindowCommands> mMsgWindowCommands;
|
||||||
|
|
||||||
// let's not make this a strong ref - we don't own it.
|
// let's not make this a strong ref - we don't own it.
|
||||||
nsIWebShell *mRootWebShell;
|
nsIWebShell *mRootWebShell;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче