fix for 16349 - shift delete works. Also more work on multiple windows by removing GetTemporaryMsgWindow.

various reviewers = mscott, hangas, rhp, and jefft.
This commit is contained in:
putterman%netscape.com 2000-03-25 00:58:20 +00:00
parent a3bf30070f
commit 02e52d2580
40 changed files with 341 additions and 132 deletions

View File

@ -53,7 +53,8 @@ interface nsIMessenger : nsISupports {
void DoPrintPreview();
void DeleteMessages(in nsIRDFCompositeDataSource database,
in nsIRDFResource srcFolderResource,
in nsISupportsArray messages);
in nsISupportsArray messages,
in boolean reallyDelete);
void DeleteFolders(in nsIRDFCompositeDataSource db,
in nsIRDFResource parentFolder,
in nsIRDFResource folder);
@ -101,7 +102,7 @@ interface nsIMessenger : nsISupports {
void Redo(in nsIMsgWindow msgWindow);
void SendUnsentMessages(in nsIMsgIdentity aIdentity);
void SetDocumentCharset(in wstring characterSet);
void saveAs(in string url, in boolean asFile, in nsIMsgIdentity identity);
void saveAs(in string url, in boolean asFile, in nsIMsgIdentity identity, in nsIMsgWindow aMsgWindow);
void openAttachment(in string url, in string displayName, in string messageUri);
void find();
void findAgain();

View File

@ -42,7 +42,6 @@ interface nsIMsgWindow;
[scriptable, uuid(D5124440-D59E-11d2-806A-006008128C4E)]
interface nsIMsgMailSession : nsISupports {
attribute nsIMsgWindow temporaryMsgWindow;
void Shutdown();
void AddFolderListener(in nsIFolderListener listener);
@ -73,11 +72,12 @@ interface nsIMsgMailSession : nsISupports {
void NotifyFolderLoaded(in nsIFolder folder);
void NotifyDeleteOrMoveMessagesCompleted(in nsIFolder folder);
readonly attribute nsIMsgWindow topmostMsgWindow;
void AddMsgWindow(in nsIMsgWindow msgWindow);
void RemoveMsgWindow(in nsIMsgWindow msgWindow);
readonly attribute nsISupportsArray msgWindowsArray;
boolean IsFolderOpenInWindow(in nsIMsgFolder folder);
string ConvertMsgURIToMsgURL(in string aURI);
string ConvertMsgURIToMsgURL(in string aURI, in nsIMsgWindow aMsgWindow);
};

View File

@ -90,7 +90,7 @@ interface nsIMsgMessageService : nsISupports {
void SaveMessageToDisk(in string aMessageURI, in nsIFileSpec aFile,
in boolean aGenerateDummyEnvelope,
in nsIUrlListener aUrlListener, out nsIURI aURL,
in boolean canonicalLineEnding);
in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow);
/////////////////////////////////////////////////////////////////////
// GetUrlForUri: when you have a uri and you would like to convert that
@ -98,7 +98,7 @@ interface nsIMsgMessageService : nsISupports {
// the Uri MUST refer to a message and not a folder!
/////////////////////////////////////////////////////////////////////
void GetUrlForUri(in string aMessageURI, out nsIURI aURL);
void GetUrlForUri(in string aMessageURI, out nsIURI aURL, in nsIMsgWindow aMsgWindow);
// tells if the message service can download mime parts directly, like IMAP
readonly attribute boolean canFetchMimeParts;

View File

@ -24,6 +24,7 @@
#include "nsIDocumentLoaderObserver.idl"
#include "nsrootidl.idl"
#include "domstubs.idl"
#include "nsIMsgStatusFeedback.idl"
%{C++
#include "nsIDOMWindow.h"
@ -33,7 +34,7 @@
interface nsIMsgPrintEngine : nsIDocumentLoaderObserver {
void SetWindow(in nsIDOMWindow ptr);
void SetStatusFeedback(in nsIMsgStatusFeedback feedback);
void SetPrintURICount(in PRInt32 aCount);
void AddPrintURI(in wstring aURI);
void StartPrintOperation();

View File

@ -26,6 +26,8 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = unix
SAMPLES_DIR = $(DIST)/bin/chrome/messenger/content/default
EXPORT_RESOURCE_SAMPLES = \

View File

@ -897,6 +897,6 @@ function PrintEnginePrint()
printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
"",
"chrome,dialog=no,all",
numSelected, selectionArray);
numSelected, selectionArray, statusFeedback);
return true;
}

View File

@ -0,0 +1,23 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# This is a list of local files which get copied to the chrome\messenger\content\default directory
#
platformMailnewsOverlay.xul

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- mac version of platformMailnewsOverlay.xul -->
<overlay id="platformMailnewsOverlay"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- Delete Key -->
<key id="cmd_shiftDelete" keycode="VK_BACK" shift="true" xulkey="false"/>
</overlay>

View File

@ -21,6 +21,8 @@
DEPTH=..\..\..\..
DIRS=win
include <$(DEPTH)\config\rules.mak>
install::

View File

@ -21,6 +21,7 @@ Rights Reserved.
<?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/platformMailnewsOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/threadPane.xul"?>
<?xul-overlay href="chrome://messenger/content/folderPane.xul"?>
<?xul-overlay href="chrome://messenger/content/msgHdrViewOverlay.xul"?>
@ -97,7 +98,8 @@ Rights Reserved.
<broadcaster id="Messenger:Status"/>
<broadcaster id="Messenger:LoadingProgress"/>
<broadcaster id="cmd_nextUnreadMsg" oncommand="MsgNextUnreadMessage();"/>
<broadcaster id="cmd_nextUnreadMsg" oncommand="goDoCommand('cmd_nextUnreadMsg')" disabled="true"/>
<broadcaster id="cmd_nextUnreadThread" oncommand="goDoCommand('cmd_nextUnreadThread')" disabled="true"/>
</broadcasterset>
<keyset id="keyset">
@ -112,11 +114,13 @@ Rights Reserved.
<key id="key_cut"/>
<key id="key_copy"/>
<key id="key_paste"/>
<key id="key_delete"/>
<key id="key_delete" shift="false"/>
<key id="cmd_shiftDelete" oncommand="goDoCommand('cmd_shiftDelete')"/>
<key id="key_selectAll"/>
<key id="key_preferences"/>
<key id="key_nextUnreadMsg" key="&nextUnreadMsgCmd.key;" observes="cmd_NextUnreadMsg"/>
<key id="key_nextUnreadMsg" key="&nextUnreadMsgCmd.key;" control="false" shift="false" observes="cmd_nextUnreadMsg"/>
<key id="key_nextUnreadThread" key="&nextUnreadThreadCmd.key;" control="false" shift="false" observes="cmd_nextUnreadThread"/>
</keyset>
<popupset>
@ -257,7 +261,7 @@ Rights Reserved.
<menuitem id="threadPaneContext-delete"
value="&contextDelete.label;"
accesskey=""
oncommand="MsgDeleteMessage(false);"/>
oncommand="MsgDeleteMessage(false, false);"/>
<menuseparator id="threadPaneContext-sep-edit"/>
<menuitem id="threadPaneContext-addSenderToAddressBook"
value="&contextAddSenderToAddressBook.label;"
@ -595,10 +599,10 @@ Rights Reserved.
<menu value="&nextMenu.label;">
<menupopup>
<menuitem value="&nextMsgCmd.label;" oncommand="MsgNextMessage();"/>
<menuitem value="&nextUnreadMsgCmd.label;" observes="cmd_nextUnreadMsg"/>
<menuitem value="&nextUnreadMsgCmd.label;" key="key_nextUnreadMsg" accesskey="&nextUnreadMsgCmd.key;" observes="cmd_nextUnreadMsg"/>
<menuitem value="&nextFlaggedMsgCmd.label;" oncommand="MsgNextFlaggedMessage();"/>
<menuseparator/>
<menuitem value="&nextUnreadThread.label;" oncommand="MsgNextUnreadThread();"/>
<menuitem value="&nextUnreadThread.label;" observes="cmd_nextUnreadThread"/>
</menupopup>
</menu>
<menu value="&prevMenu.label;">

View File

@ -56,6 +56,9 @@ function InitPrintEngineWindow()
{
var numSelected = window.arguments[0];
var uriArray = window.arguments[1];
var statusFeedback = window.arguments[2];
printEngine.SetStatusFeedback(statusFeedback);
if (numSelected > 0)
{

View File

@ -128,7 +128,7 @@ function GoNextThread(type, startFromBeginning, gotoNextInThread)
else
{
//currentTopmessage is the first one in the tree and we want it to be checked for criteria.
currentTopMessage = FindFirstMessage(tree);
currentTopMessage = msgNavigationService.FindFirstMessage(tree);
checkCurrentTopMessage = true;
}

View File

@ -0,0 +1,38 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORT_RESOURCE_CONTENT = \
$(srcdir)/platformMailnewsOverlay.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk
install::
$(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/messenger/content/default

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- unix version of platformMailnewsOverlay.xul -->
<overlay id="platformMailnewsOverlay"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- Delete Key -->
<key id="cmd_shiftDelete" keycode="VK_DELETE" shift="true" xulkey="false"/>
</overlay>

View File

@ -186,10 +186,14 @@ var DefaultController =
{
supportsCommand: function(command)
{
switch ( command )
{
case "cmd_delete":
case "button_delete":
case "cmd_shiftDelete":
case "cmd_nextUnreadMsg":
case "cmd_nextUnreadThread":
return true;
default:
@ -199,16 +203,16 @@ var DefaultController =
isCommandEnabled: function(command)
{
// dump("ThreadPaneController.isCommandEnabled(" + command + ")\n");
switch ( command )
{
case "cmd_delete":
case "button_delete":
case "cmd_shiftDelete":
var threadTree = GetThreadTree();
var numSelected = 0;
if ( threadTree && threadTree.selectedItems )
numSelected = threadTree.selectedItems.length;
if ( command == "cmd_delete" )
if ( command == "cmd_delete")
{
if ( numSelected < 2 )
goSetMenuValue(command, 'valueMessage');
@ -216,7 +220,22 @@ var DefaultController =
goSetMenuValue(command, 'valueMessages');
}
return ( numSelected > 0 );
case "cmd_nextUnreadMsg":
case "cmd_nextUnreadThread":
//Input and TextAreas should get access to the keys that cause these commands.
//Currently if we don't do this then we will steal the key away and you can't type them
//in these controls. This is a bug that should be fixed and when it is we can get rid of
//this.
var focusedElement = top.document.commandDispatcher.focusedElement;
if(focusedElement)
{
var name = focusedElement.nodeName;
return ((name != "INPUT") && (name != "TEXTAREA"));
}
else
{
return true;
}
default:
return false;
}
@ -224,14 +243,24 @@ var DefaultController =
doCommand: function(command)
{
//dump("ThreadPaneController.doCommand(" + command + ")\n");
switch ( command )
{
case "cmd_delete":
MsgDeleteMessage(false);
MsgDeleteMessage(false, false);
break;
case "cmd_shiftDelete":
MsgDeleteMessage(true, false);
break;
case "button_delete":
MsgDeleteMessage(true);
MsgDeleteMessage(false, true);
break;
case "cmd_nextUnreadMsg":
MsgNextUnreadMessage();
break;
case "cmd_nextUnreadThread":
MsgNextUnreadThread();
break;
}
},
@ -265,6 +294,9 @@ function CommandUpdate_Mail()
goUpdateCommand('cmd_delete');
goUpdateCommand('button_delete');
goUpdateCommand('cmd_shiftDelete');
goUpdateCommand('cmd_nextUnreadMsg');
goUpdateCommand('cmd_nextUnreadThread');
}
function SetupUndoRedoCommand(command)
@ -380,11 +412,13 @@ function MsgGetMessage()
GetNewMessages();
}
function MsgDeleteMessage(fromToolbar)
function MsgDeleteMessage(reallyDelete, fromToolbar)
{
//dump("\nMsgDeleteMessage from XUL\n");
//dump("from toolbar? " + fromToolbar + "\n");
if(reallyDelete)
dump("reallyDelete\n");
var tree = GetThreadTree();
if(tree) {
var srcFolder = GetThreadTreeFolder();
@ -402,14 +436,13 @@ function MsgDeleteMessage(fromToolbar)
//get the selected elements
var messageList = ConvertDOMListToResourceArray(tree.selectedItems);
var nextMessage = GetNextMessageAfterDelete(tree.selectedItems);
//get the current folder
messenger.DeleteMessages(tree.database, srcFolder.resource, messageList);
var nextMessage = GetNextMessageAfterDelete(tree.selectedItems);
if(nextMessage)
gNextMessageAfterDelete = nextMessage.getAttribute('id');
else
gNextMessageAfterDelete = null;
messenger.DeleteMessages(tree.database, srcFolder.resource, messageList, reallyDelete);
}
}
@ -1026,7 +1059,7 @@ function MsgViewPageSource()
uri = selectedItems[i].getAttribute("id");
// Now, we need to get a URL from a URI
url = mailSession.ConvertMsgURIToMsgURL(uri);
url = mailSession.ConvertMsgURIToMsgURL(uri, msgWindow);
if (url)
url += "?header=src";
@ -1063,6 +1096,8 @@ function MsgNextFlaggedMessage()
function MsgNextUnreadThread()
{
//First mark the current thread as read. Then go to the next one.
MsgMarkThreadAsRead();
GoNextThread(navigateUnread, true, true);
}

View File

@ -0,0 +1,33 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2000 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..\..
include <$(DEPTH)\config\rules.mak>
DISTBROWSER=$(DIST)\bin\chrome\global\content\default
install::
$(MAKE_INSTALL) platformMailnewsOverlay.xul $(DIST)\bin\chrome\messenger\content\default
clobber::
rm -f $(DIST)\chrome\messenger\content\default\platformMailnewsOverlay.xul

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- win version of platformMailnewsOverlay.xul -->
<overlay id="platformMailnewsOverlay"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- Delete Key -->
<key id="cmd_shiftDelete" keycode="VK_DELETE" shift="true" xulkey="false"/>
</overlay>

View File

@ -212,6 +212,7 @@ Rights Reserved.
<!ENTITY nextFlaggedMsgCmd.label "Flagged Message">
<!ENTITY nextUnflaggedMsgCmd.label "Unflagged Message">
<!ENTITY nextUnreadThread.label "Unread Thread">
<!ENTITY nextUnreadThreadCmd.key "t">
<!ENTITY prevMenu.label "Previous">
<!ENTITY prevMsgCmd.label "Message">
<!ENTITY prevUnreadMsgCmd.label "Unread Message">

View File

@ -333,9 +333,6 @@ nsMessenger::SetWindow(nsIDOMWindow *aWin, nsIMsgWindow *aMsgWindow)
aStatusFeedback->SetWebShell(mWebShell, mWindow);
nsCOMPtr<nsIDocShell> childDocShell(do_QueryInterface(mWebShell));
childDocShell->SetDocLoaderObserver(m_docLoaderObserver);
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
mailSession->SetTemporaryMsgWindow(aMsgWindow);
aMsgWindow->GetTransactionManager(getter_AddRefs(mTxnMgr));
}
}
@ -610,7 +607,7 @@ done:
NS_IMETHODIMP
nsMessenger::SaveAs(const char* url, PRBool asFile, nsIMsgIdentity* identity)
nsMessenger::SaveAs(const char* url, PRBool asFile, nsIMsgIdentity* identity, nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_ERROR_FAILURE;
nsIMsgMessageService* messageService = nsnull;
@ -771,7 +768,7 @@ nsMessenger::SaveAs(const char* url, PRBool asFile, nsIMsgIdentity* identity)
default:
rv = messageService->SaveMessageToDisk(url, aSpec, PR_TRUE,
urlListener, nsnull,
PR_FALSE);
PR_FALSE, mMsgWindow);
break;
case 1:
case 2:
@ -860,7 +857,7 @@ nsMessenger::SaveAs(const char* url, PRBool asFile, nsIMsgIdentity* identity)
rv = messageService->SaveMessageToDisk(url, aSpec,
needDummyHeader,
urlListener, nsnull,
canonicalLineEnding);
canonicalLineEnding, mMsgWindow);
}
done:
if (messageService)
@ -915,7 +912,8 @@ nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, char *command,
NS_IMETHODIMP
nsMessenger::DeleteMessages(nsIRDFCompositeDataSource *database,
nsIRDFResource *srcFolderResource,
nsISupportsArray *resourceArray)
nsISupportsArray *resourceArray,
PRBool reallyDelete)
{
nsresult rv;
@ -932,7 +930,11 @@ nsMessenger::DeleteMessages(nsIRDFCompositeDataSource *database,
folderArray->AppendElement(srcFolderResource);
rv = DoCommand(database, NC_RDF_DELETE, folderArray, resourceArray);
if(reallyDelete)
rv = DoCommand(database, NC_RDF_REALLY_DELETE, folderArray, resourceArray);
else
rv = DoCommand(database, NC_RDF_DELETE, folderArray, resourceArray);
return rv;
}

View File

@ -78,6 +78,7 @@ nsIRDFResource* nsMsgFolderDataSource::kNC_NoSelect = nsnull;
// commands
nsIRDFResource* nsMsgFolderDataSource::kNC_Delete= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_ReallyDelete= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_NewFolder= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_GetNewMessages= nsnull;
nsIRDFResource* nsMsgFolderDataSource::kNC_Copy= nsnull;
@ -137,6 +138,7 @@ nsMsgFolderDataSource::~nsMsgFolderDataSource (void)
NS_RELEASE2(kNC_NoSelect, refcnt);
NS_RELEASE2(kNC_Delete, refcnt);
NS_RELEASE2(kNC_ReallyDelete, refcnt);
NS_RELEASE2(kNC_NewFolder, refcnt);
NS_RELEASE2(kNC_GetNewMessages, refcnt);
NS_RELEASE2(kNC_Copy, refcnt);
@ -194,6 +196,7 @@ nsresult nsMsgFolderDataSource::Init()
rdf->GetResource(NC_RDF_NOSELECT, &kNC_NoSelect);
rdf->GetResource(NC_RDF_DELETE, &kNC_Delete);
rdf->GetResource(NC_RDF_REALLY_DELETE, &kNC_ReallyDelete);
rdf->GetResource(NC_RDF_NEWFOLDER, &kNC_NewFolder);
rdf->GetResource(NC_RDF_GETNEWMESSAGES, &kNC_GetNewMessages);
rdf->GetResource(NC_RDF_COPY, &kNC_Copy);
@ -573,6 +576,7 @@ nsMsgFolderDataSource::GetAllCommands(nsIRDFResource* source,
rv = NS_NewISupportsArray(getter_AddRefs(cmds));
if (NS_FAILED(rv)) return rv;
cmds->AppendElement(kNC_Delete);
cmds->AppendElement(kNC_ReallyDelete);
cmds->AppendElement(kNC_NewFolder);
cmds->AppendElement(kNC_GetNewMessages);
cmds->AppendElement(kNC_Copy);
@ -615,6 +619,7 @@ nsMsgFolderDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aS
if (NS_SUCCEEDED(rv)) {
// we don't care about the arguments -- folder commands are always enabled
if (!((aCommand == kNC_Delete) ||
(aCommand == kNC_ReallyDelete) ||
(aCommand == kNC_NewFolder) ||
(aCommand == kNC_Copy) ||
(aCommand == kNC_Move) ||
@ -656,7 +661,11 @@ nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
{
if ((aCommand == kNC_Delete))
{
rv = DoDeleteFromFolder(folder, aArguments, mWindow);
rv = DoDeleteFromFolder(folder, aArguments, mWindow, PR_FALSE);
}
if ((aCommand == kNC_ReallyDelete))
{
rv = DoDeleteFromFolder(folder, aArguments, mWindow, PR_TRUE);
}
else if((aCommand == kNC_NewFolder))
{
@ -1500,7 +1509,7 @@ nsresult nsMsgFolderDataSource::DoCopyToFolder(nsIMsgFolder *dstFolder, nsISuppo
nsresult nsMsgFolderDataSource::DoDeleteFromFolder(
nsIMsgFolder *folder, nsISupportsArray *arguments,
nsIMsgWindow *msgWindow)
nsIMsgWindow *msgWindow, PRBool reallyDelete)
{
nsresult rv = NS_OK;
PRUint32 itemCount;
@ -1531,7 +1540,7 @@ nsresult nsMsgFolderDataSource::DoDeleteFromFolder(
rv = messageArray->Count(&cnt);
if (NS_FAILED(rv)) return rv;
if (cnt > 0)
rv = folder->DeleteMessages(messageArray, msgWindow, PR_FALSE, PR_FALSE);
rv = folder->DeleteMessages(messageArray, msgWindow, reallyDelete, PR_FALSE);
rv = folderArray->Count(&cnt);
if (NS_FAILED(rv)) return rv;

View File

@ -148,7 +148,7 @@ protected:
nsresult getFolderArcLabelsOut(nsISupportsArray **arcs);
nsresult DoDeleteFromFolder(nsIMsgFolder *folder,
nsISupportsArray *arguments, nsIMsgWindow *msgWindow);
nsISupportsArray *arguments, nsIMsgWindow *msgWindow, PRBool reallyDelete);
nsresult DoCopyToFolder(nsIMsgFolder *dstFolder, nsISupportsArray *arguments,
nsIMsgWindow *msgWindow, PRBool isMove);
@ -209,6 +209,7 @@ protected:
// commands
static nsIRDFResource* kNC_Delete;
static nsIRDFResource* kNC_ReallyDelete;
static nsIRDFResource* kNC_NewFolder;
static nsIRDFResource* kNC_GetNewMessages;
static nsIRDFResource* kNC_Copy;

View File

@ -69,22 +69,6 @@ nsresult nsMsgMailSession::Shutdown()
return NS_OK;
}
nsresult nsMsgMailSession::GetTemporaryMsgWindow(nsIMsgWindow* *aMsgWindow)
{
if (!aMsgWindow) return NS_ERROR_NULL_POINTER;
*aMsgWindow = m_temporaryMsgWindow;
NS_IF_ADDREF(*aMsgWindow);
return NS_OK;
}
nsresult nsMsgMailSession::SetTemporaryMsgWindow(nsIMsgWindow* aMsgWindow)
{
m_temporaryMsgWindow = do_QueryInterface(aMsgWindow);
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::AddFolderListener(nsIFolderListener * listener)
{
@ -282,6 +266,38 @@ NS_IMETHODIMP nsMsgMailSession::NotifyDeleteOrMoveMessagesCompleted(nsIFolder *
}
nsresult nsMsgMailSession::GetTopmostMsgWindow(nsIMsgWindow* *aMsgWindow)
{
//for right now just return the first msg window. Eventually have to figure out which is topmost.
nsresult rv;
if (!aMsgWindow) return NS_ERROR_NULL_POINTER;
*aMsgWindow = nsnull;
if(mWindows)
{
PRUint32 count;
rv = mWindows->Count(&count);
if(NS_FAILED(rv))
return rv;
if(count > 0)
{
nsCOMPtr<nsISupports> windowSupports = mWindows->ElementAt(0);
if(windowSupports)
rv = windowSupports->QueryInterface(NS_GET_IID(nsIMsgWindow), (void**)aMsgWindow);
if(NS_FAILED(rv))
return rv;
}
}
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::AddMsgWindow(nsIMsgWindow *msgWindow)
{
mWindows->AppendElement(msgWindow);
@ -334,7 +350,7 @@ NS_IMETHODIMP nsMsgMailSession::IsFolderOpenInWindow(nsIMsgFolder *folder, PRBoo
}
NS_IMETHODIMP
nsMsgMailSession::ConvertMsgURIToMsgURL(const char *aURI, char **aURL)
nsMsgMailSession::ConvertMsgURIToMsgURL(const char *aURI, nsIMsgWindow *aMsgWindow, char **aURL)
{
if ((!aURI) || (!aURL))
return NS_ERROR_NULL_POINTER;
@ -346,7 +362,7 @@ nsMsgMailSession::ConvertMsgURIToMsgURL(const char *aURI, char **aURL)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIURI> tURI;
rv = msgService->GetUrlForUri(aURI, getter_AddRefs(tURI));
rv = msgService->GetUrlForUri(aURI, getter_AddRefs(tURI), aMsgWindow);
if (NS_FAILED(rv))
return NS_ERROR_NULL_POINTER;

View File

@ -61,19 +61,6 @@ nsMsgPrintEngine::nsMsgPrintEngine() :
{
mCurrentlyPrintingURI = -1;
// note: it is okay to return a null status feedback and not return an error
// it's possible the url really doesn't have status feedback
nsresult rv;
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgWindow> msgWindow;
mailSession->GetTemporaryMsgWindow(getter_AddRefs(msgWindow));
if (msgWindow)
msgWindow->GetStatusFeedback(getter_AddRefs(mFeedback));
}
NS_INIT_REFCNT();
}
@ -280,6 +267,13 @@ nsMsgPrintEngine::StartNextPrintOperation()
return rv;
}
NS_IMETHODIMP
nsMsgPrintEngine::SetStatusFeedback(nsIMsgStatusFeedback *aFeedback)
{
mFeedback = aFeedback;
return NS_OK;
}
NS_IMETHODIMP
nsMsgPrintEngine::FireThatLoadOperation(nsString *uri)
{

View File

@ -77,6 +77,7 @@ typedef struct _nsMsgRDFNotification {
//Folder Commands
#define NC_RDF_DELETE NC_NAMESPACE_URI "Delete"
#define NC_RDF_REALLY_DELETE NC_NAMESPACE_URI "ReallyDelete"
#define NC_RDF_NEWFOLDER NC_NAMESPACE_URI "NewFolder"
#define NC_RDF_GETNEWMESSAGES NC_NAMESPACE_URI "GetNewMessages"
#define NC_RDF_COPY NC_NAMESPACE_URI "Copy"

View File

@ -208,14 +208,10 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetStatusFeedback(nsIMsgStatusFeedback **aMsgFee
// it's possible the url really doesn't have status feedback
if (!m_statusFeedback)
{
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
if(NS_SUCCEEDED(rv))
if(m_msgWindow)
{
nsCOMPtr<nsIMsgWindow> msgWindow;
mailSession->GetTemporaryMsgWindow(getter_AddRefs(msgWindow));
if (msgWindow)
msgWindow->GetStatusFeedback(getter_AddRefs(m_statusFeedback));
m_msgWindow->GetStatusFeedback(getter_AddRefs(m_statusFeedback));
}
}
if (aMsgFeedback)

View File

@ -161,7 +161,7 @@ nsMsgQuote::QuoteMessage(const PRUnichar *msgURI, PRBool quoteHeaders, nsIStream
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIURI> aURL;
rv = msgService->GetUrlForUri(aMsgUri, getter_AddRefs(aURL));
rv = msgService->GetUrlForUri(aMsgUri, getter_AddRefs(aURL), nsnull);
if (NS_FAILED(rv)) return rv;
// now we want to append some quote specific information to the

View File

@ -206,19 +206,6 @@ nsMsgComposeAndSend::nsMsgComposeAndSend() :
mMessageWarningSize = 0;
mWebShell = nsnull;
// note: it is okay to return a null status feedback and not return an error
// it's possible the url really doesn't have status feedback
nsresult rv;
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgWindow> msgWindow;
mailSession->GetTemporaryMsgWindow(getter_AddRefs(msgWindow));
if (msgWindow)
msgWindow->GetStatusFeedback(getter_AddRefs(mFeedback));
}
NS_INIT_REFCNT();
}
@ -2876,8 +2863,10 @@ nsMsgComposeAndSend::DeliverFileAsNews()
if (!mailSession) return NS_ERROR_FAILURE;
nsCOMPtr<nsIMsgWindow> msgWindow;
rv = mailSession->GetTemporaryMsgWindow(getter_AddRefs(msgWindow));
if (NS_FAILED(rv)) return rv;
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if(NS_FAILED(rv))
return rv;
if (!msgWindow) return NS_ERROR_FAILURE;
@ -4088,16 +4077,35 @@ nsMsgComposeAndSend::StartMessageCopyOperation(nsIFileSpec *aFileSpec,
return rv;
}
//I'm getting this each time without holding onto the feedback so that 3 pane windows can be closed
//without any chance of crashing due to holding onto a deleted feedback.
nsresult
nsMsgComposeAndSend::SetStatusMessage(PRUnichar *aMsgString)
{
PRUnichar *progressMsg;
if ( (!mFeedback) || (!aMsgString) || (!mGUINotificationEnabled) )
nsresult rv;
if ( (!aMsgString) || (!mGUINotificationEnabled) )
return NS_OK;
progressMsg = nsCRT::strdup(aMsgString);
mFeedback->ShowStatusString(progressMsg);
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(kMsgMailSessionCID, &rv);
if (NS_FAILED(rv)) return rv;
if (!mailSession) return NS_ERROR_FAILURE;
nsCOMPtr<nsIMsgWindow> msgWindow;
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if(NS_FAILED(rv))
return rv;
if (!msgWindow) return NS_OK;
nsCOMPtr<nsIMsgStatusFeedback> feedback;
rv = msgWindow->GetStatusFeedback(getter_AddRefs(feedback));
if(NS_FAILED(rv)) return NS_OK;
feedback->ShowStatusString(progressMsg);
return NS_OK;
}

View File

@ -408,8 +408,6 @@ public:
PRUint32 mCompFieldLocalAttachments; // the number of file:// attachments in the comp fields
PRUint32 mCompFieldRemoteAttachments; // the number of remote attachments in the comp fields
nsCOMPtr <nsIMsgStatusFeedback> mFeedback; // Tell the user something why don't ya'
//
// attachment states and other info...
//

View File

@ -1390,7 +1390,7 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
imapServer = do_QueryInterface(server);
if (imapServer)
imapServer->GetDeleteModel(&deleteModel);
if (deleteModel != nsMsgImapDeleteModels::MoveToTrash)
if (deleteModel != nsMsgImapDeleteModels::MoveToTrash || deleteStorage)
deleteImmediatelyNoTrash = PR_TRUE;
}

View File

@ -246,7 +246,7 @@ nsImapService::LiteSelectFolder(nsIEventQueue * aClientEventQueue,
return rv;
}
NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL)
NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL, nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_OK;
@ -500,7 +500,8 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
PRBool aAddDummyEnvelope,
nsIUrlListener *aUrlListener,
nsIURI **aURL,
PRBool canonicalLineEnding)
PRBool canonicalLineEnding,
nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMsgFolder> folder;

View File

@ -56,7 +56,7 @@ interface nsIPop3Service : nsISupports {
nsIURI GetNewMail(in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener,
in nsIPop3IncomingServer popServer);
nsIURI CheckForNewMail(in nsIUrlListener aUrlListener,
nsIURI CheckForNewMail(in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener,
in nsIMsgFolder inbox,
in nsIPop3IncomingServer popServer);

View File

@ -121,7 +121,7 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
nsresult rv = NS_OK;
nsCOMPtr<nsIMailboxUrl> mailboxurl;
rv = PrepareMessageUrl(aMessageURI, aUrlListener, mailboxAction, getter_AddRefs(mailboxurl));
rv = PrepareMessageUrl(aMessageURI, aUrlListener, mailboxAction, getter_AddRefs(mailboxurl), aMsgWindow);
if (NS_SUCCEEDED(rv))
{
@ -160,12 +160,13 @@ nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
PRBool aAddDummyEnvelope,
nsIUrlListener *aUrlListener,
nsIURI **aURL,
PRBool canonicalLineEnding)
PRBool canonicalLineEnding,
nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMailboxUrl> mailboxurl;
rv = PrepareMessageUrl(aMessageURI, aUrlListener, nsIMailboxUrl::ActionSaveMessageToDisk, getter_AddRefs(mailboxurl));
rv = PrepareMessageUrl(aMessageURI, aUrlListener, nsIMailboxUrl::ActionSaveMessageToDisk, getter_AddRefs(mailboxurl), aMsgWindow);
if (NS_SUCCEEDED(rv))
{
@ -186,11 +187,11 @@ nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
return rv;
}
NS_IMETHODIMP nsMailboxService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL)
NS_IMETHODIMP nsMailboxService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL, nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMailboxUrl> mailboxurl;
rv = PrepareMessageUrl(aMessageURI, nsnull, nsIMailboxUrl::ActionDisplayMessage, getter_AddRefs(mailboxurl));
rv = PrepareMessageUrl(aMessageURI, nsnull, nsIMailboxUrl::ActionDisplayMessage, getter_AddRefs(mailboxurl), aMsgWindow);
if (NS_SUCCEEDED(rv) && mailboxurl)
rv = mailboxurl->QueryInterface(NS_GET_IID(nsIURI), (void **) aURL);
return rv;
@ -239,7 +240,8 @@ nsresult nsMailboxService::RunMailboxUrl(nsIURI * aMailboxUrl, nsISupports * aDi
// listener if appropriate. AND it can take in a mailbox action and set that field
// on the returned url as well.
nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsIUrlListener * aUrlListener,
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl)
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
nsIMsgWindow *msgWindow)
{
nsresult rv = NS_OK;
rv = nsComponentManager::CreateInstance(kCMailboxUrl,
@ -279,13 +281,7 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
if (aUrlListener)
rv = url->RegisterListener(aUrlListener);
// set progress feedback...eventually, we'll need to pass this into all methods in
// the mailbox service...this is just a temp work around to get things going...
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgWindow> window;
session->GetTemporaryMsgWindow(getter_AddRefs(window));
url->SetMsgWindow(window);
url->SetMsgWindow(msgWindow);
} // if we got a url
} // if we got a url

View File

@ -53,7 +53,8 @@ protected:
// helper functions used by the service
nsresult PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsIUrlListener * aUrlListener,
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl);
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
nsIMsgWindow *msgWindow);
nsresult RunMailboxUrl(nsIURI * aMailboxUrl, nsISupports * aDisplayConsumer = nsnull);

View File

@ -37,8 +37,10 @@
#include "nsMsgFolderFlags.h"
#include "nsIFileSpec.h"
#include "nsPop3Protocol.h"
#include "nsIMsgMailSession.h"
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
NS_IMPL_ISUPPORTS_INHERITED(nsPop3IncomingServer,nsMsgIncomingServer,
@ -128,7 +130,16 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
}
}
rv = pop3Service->CheckForNewMail(nsnull, inbox, this, nsnull);
//Biff just needs to give status in one of the windows. so do it in topmost window.
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgWindow> msgWindow;
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if(NS_SUCCEEDED(rv))
rv = pop3Service->CheckForNewMail(msgWindow, nsnull, inbox, this, nsnull);
return NS_OK;
}

View File

@ -65,7 +65,8 @@ NS_IMPL_ISUPPORTS3(nsPop3Service,
nsIProtocolHandler,
nsIMsgProtocolInfo)
NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIUrlListener * aUrlListener,
NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIMsgWindow* aMsgWindow,
nsIUrlListener * aUrlListener,
nsIMsgFolder *inbox,
nsIPop3IncomingServer *popServer,
nsIURI ** aURL)
@ -84,7 +85,7 @@ NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIUrlListener * aUrlListener,
{
// now construct a pop3 url...
char * urlSpec = PR_smprintf("pop3://%s:%d?check", hostname, POP3_PORT);
rv = BuildPop3Url(urlSpec, inbox, popServer, aUrlListener, getter_AddRefs(url));
rv = BuildPop3Url(urlSpec, inbox, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
PR_FREEIF(urlSpec);
if (hostname) PL_strfree(hostname);
}
@ -123,7 +124,7 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
{
// now construct a pop3 url...
char * urlSpec = PR_smprintf("pop3://%s:%d", popHost, POP3_PORT);
rv = BuildPop3Url(urlSpec, nsnull, popServer, aUrlListener, getter_AddRefs(url));
rv = BuildPop3Url(urlSpec, nsnull, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
PR_FREEIF(urlSpec);
}
@ -149,7 +150,8 @@ nsresult nsPop3Service::BuildPop3Url(char * urlSpec,
nsIMsgFolder *inbox,
nsIPop3IncomingServer *server,
nsIUrlListener * aUrlListener,
nsIURI ** aUrl)
nsIURI ** aUrl,
nsIMsgWindow *aMsgWindow)
{
nsPop3Sink * pop3Sink = new nsPop3Sink();
if (pop3Sink)
@ -180,13 +182,7 @@ nsresult nsPop3Service::BuildPop3Url(char * urlSpec,
{
mailnewsurl->RegisterListener(aUrlListener);
// set progress feedback...eventually, we'll need to pass this into all methods in
// the mailbox service...this is just a temp work around to get things going...
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgWindow> window;
session->GetTemporaryMsgWindow(getter_AddRefs(window));
mailnewsurl->SetMsgWindow(window);
mailnewsurl->SetMsgWindow(aMsgWindow);
}
}

View File

@ -52,7 +52,7 @@ protected:
// convience function to make constructing of the pop3 url easier...
nsresult BuildPop3Url(char * urlSpec, nsIMsgFolder *inbox,
nsIPop3IncomingServer *, nsIUrlListener * aUrlListener,
nsIURI ** aUrl);
nsIURI ** aUrl, nsIMsgWindow *aMsgWindow);
nsresult RunPopUrl(nsIMsgIncomingServer * aServer, nsIURI * aUrlToRun);
};

View File

@ -381,7 +381,7 @@ nsresult nsPop3TestDriver::OnCheck()
if (pop3Service)
{
pop3Service->CheckForNewMail(this, nsnull, popServer, nsnull);
pop3Service->CheckForNewMail(nsnull, this, nsnull, popServer, nsnull);
m_runningURL = PR_TRUE;
}

View File

@ -30,6 +30,7 @@ mailnews/base/tests/accountmanager/Makefile
mailnews/base/tests/identity/Makefile
mailnews/base/resources/Makefile
mailnews/base/resources/content/Makefile
mailnews/base/resources/content/unix/Makefile
mailnews/base/resources/skin/Makefile
mailnews/base/resources/locale/Makefile
mailnews/base/resources/locale/en-US/Makefile

View File

@ -1818,7 +1818,7 @@ mime_bridge_create_draft_stream(
return nsnull;
nsCOMPtr<nsIURI> aURL;
rv = msgService->GetUrlForUri(turl, getter_AddRefs(aURL));
rv = msgService->GetUrlForUri(turl, getter_AddRefs(aURL), nsnull);
if (NS_FAILED(rv))
return nsnull;

View File

@ -101,7 +101,8 @@ nsNntpService::SaveMessageToDisk(const char *aMessageURI,
PRBool aAddDummyEnvelope,
nsIUrlListener *aUrlListener,
nsIURI **aURL,
PRBool canonicalLineEnding)
PRBool canonicalLineEnding,
nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_OK;
if (!aMessageURI)
@ -213,7 +214,7 @@ NS_IMETHODIMP nsNntpService::GetCanFetchMimeParts(PRBool *canFetchMimeParts)
}
NS_IMETHODIMP nsNntpService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL)
NS_IMETHODIMP nsNntpService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL, nsIMsgWindow *aMsgWindow)
{
nsresult rv = NS_OK;
nsCAutoString uri(aMessageURI);