Bug 149764: changes to quit-application observer topic. r=danm, sr=jst

This commit is contained in:
rjesup%wgate.com 2002-11-07 20:25:45 +00:00
parent 201f9528cf
commit 16b4006118
4 changed files with 5 additions and 40 deletions

View File

@ -216,41 +216,6 @@ function MsgToggleSplitter(id)
splitter.setAttribute("state", "collapsed")
}
function NotifyQuitApplication()
{
var ObserverService = Components.classes["@mozilla.org/observer-service;1"].getService();
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
if (ObserverService)
{
try
{
ObserverService.notifyObservers(null, "quit-application", null);
}
catch (ex)
{
// dump("no observer found \n");
}
}
}
function LastToClose()
{
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
var enumerator = windowManagerInterface.getEnumerator( null );
var count = 0;
while ( enumerator.hasMoreElements() && count < 2 )
{
var windowToClose = enumerator.getNext();
count++;
}
if (count == 1)
return true;
else
return false;
}
function MsgSetFolderCharset()
{
MsgFolderProperties()

View File

@ -2140,8 +2140,6 @@ function ComposeCanClose()
switch (result)
{
case 0: //Save
if (LastToClose())
NotifyQuitApplication();
gCloseWindowAfterSave = true;
SaveAsDraft();
return false;

View File

@ -583,10 +583,10 @@ nsAppShellService::Quit(PRUint32 aFerocity)
if (aFerocity == eForceQuit) {
// do it!
#ifdef MOZ_PHOENIX
// No chance of the shutdown being cancelled from here on; tell people
// we're shutting down for sure while all services are still available.
nsCOMPtr<nsIObserverService> obsService = do_GetService("@mozilla.org/observer-service;1", &rv);
obsService->NotifyObservers(nsnull, "quit-application", nsnull);
#endif
// first shutdown native app support; doing this first will prevent new
// requests to open additional windows coming in.

View File

@ -6,7 +6,9 @@ function goQuitApplication()
{
try
{
ObserverService.notifyObservers(null, "quit-application", null);
// XXX FIX! we should have a way to cancel a requested quit; see
// bugzilla bug 149764
ObserverService.notifyObservers(null, "quit-application-requested", null);
}
catch (ex)
{