From 70d10cab5032ed255af6bc86311eaf0202b66cea Mon Sep 17 00:00:00 2001 From: "law%netscape.com" Date: Wed, 17 Apr 2002 03:33:00 +0000 Subject: [PATCH] Bug 136940; add pref-triggered code that can disable QuickLaunch in multiple-profile case; r=morse, sr=blake git-svn-id: svn://10.0.0.236/trunk@119202 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/bootstrap/nsNativeAppSupportWin.cpp | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 2f1d6fbcd8a..2da59b1447c 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -2107,9 +2107,38 @@ nsNativeAppSupportWin::OnLastWindowClosing( nsIXULWindow *aWindow ) { nsresult rv; + + // If activated by the browser.turbo.singleProfileOnly pref, + // check for multi-profile situation and turn off turbo mode + // if there are multiple profiles. + PRBool singleProfileOnly = PR_FALSE; + nsCOMPtr prefService( do_GetService( NS_PREF_CONTRACTID, &rv ) ); + if ( NS_SUCCEEDED( rv ) ) { + prefService->GetBoolPref( "browser.turbo.singleProfileOnly", &singleProfileOnly ); + } + if ( singleProfileOnly ) { + nsCOMPtr profileMgr( do_GetService( NS_PROFILE_CONTRACTID, &rv ) ); + if ( NS_SUCCEEDED( rv ) ) { + PRInt32 profileCount = 0; + if ( NS_SUCCEEDED( profileMgr->GetProfileCount( &profileCount ) ) && + profileCount > 1 ) { + // Turn off turbo mode and quit the application. + SetIsServerMode( PR_FALSE ); + nsCOMPtr appShell = + do_GetService( "@mozilla.org/appshell/appShellService;1", &rv); + if ( NS_SUCCEEDED( rv ) ) { + appShell->Quit(); + } + return NS_OK; + } + } + } + + // Finally! If we haven't already, and the user hasn't told us not + // to bother them, inform the user that Mozilla will still be alive + // and kicking. if ( !mShownTurboDialog ) { PRBool showDialog = PR_TRUE; - nsCOMPtr prefService ( do_GetService( NS_PREF_CONTRACTID, &rv ) ); if ( NS_SUCCEEDED( rv ) ) prefService->GetBoolPref( "browser.turbo.showDialog", &showDialog ); nsCOMPtr domWindowInt ( do_GetInterface( docShell ) );