From 95d3fb2a0575df043260eebdd3fd952e7ec1105f Mon Sep 17 00:00:00 2001 From: "ccarlen%netscape.com" Date: Fri, 9 May 2003 13:06:29 +0000 Subject: [PATCH] Make it possible for other XUL apps to hide profile switching UI. b=204908, r=/sr=/a=sspitzer git-svn-id: svn://10.0.0.236/trunk@142264 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/libpref/src/init/all.js | 2 ++ .../profile/resources/content/profileSelection.js | 12 +++++++++--- mozilla/profile/src/nsProfile.cpp | 7 ++++++- .../communicator/resources/content/tasksOverlay.xul | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mozilla/modules/libpref/src/init/all.js b/mozilla/modules/libpref/src/init/all.js index 1450d784786..90d55a69c10 100644 --- a/mozilla/modules/libpref/src/init/all.js +++ b/mozilla/modules/libpref/src/init/all.js @@ -760,6 +760,8 @@ pref("profile.confirm_automigration",true); // if -1, we never think your profile is defunct // and users will never see the remigrate UI. pref("profile.seconds_until_defunct", -1); +// We can show it anytime from menus +pref("profile.manage_only_at_launch", false); // Customizable toolbar stuff pref("custtoolbar.personal_toolbar_folder", ""); diff --git a/mozilla/profile/resources/content/profileSelection.js b/mozilla/profile/resources/content/profileSelection.js index 0de9e1adca5..8ddee7daa31 100644 --- a/mozilla/profile/resources/content/profileSelection.js +++ b/mozilla/profile/resources/content/profileSelection.js @@ -92,7 +92,12 @@ function StartUp() } var autoSelectLastProfile = document.getElementById("autoSelectLastProfile"); - autoSelectLastProfile.checked = profile.startWithLastUsedProfile; + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + if (prefs.getBoolPref("profile.manage_only_at_launch")) + autoSelectLastProfile.hidden = true; + else + autoSelectLastProfile.checked = profile.startWithLastUsedProfile; var profileList = document.getElementById("profiles"); profileList.focus(); @@ -219,9 +224,10 @@ function onStart() if (offlineState.checked != ioService.offline) ioService.offline = offlineState.checked; } - + var autoSelectLastProfile = document.getElementById("autoSelectLastProfile"); - profile.startWithLastUsedProfile = autoSelectLastProfile.checked; + if (!autoSelectLastProfile.hidden) + profile.startWithLastUsedProfile = autoSelectLastProfile.checked; try { profile.currentProfile = profilename; diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 012f046b649..c0b7525cd95 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -468,7 +468,12 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract) // multiple profiles. PRBool startWithLastUsedProfile = PR_FALSE; - GetStartWithLastUsedProfile(&startWithLastUsedProfile); + + // But first, make sure this app supports this. + PRBool cantAutoSelect; + rv = prefBranch->GetBoolPref("profile.manage_only_at_launch", &cantAutoSelect); + if (NS_SUCCEEDED(rv) && !cantAutoSelect) + GetStartWithLastUsedProfile(&startWithLastUsedProfile); // This means that there was no command-line argument to force // profile UI to come up. But we need the UI anyway if there diff --git a/mozilla/xpfe/communicator/resources/content/tasksOverlay.xul b/mozilla/xpfe/communicator/resources/content/tasksOverlay.xul index 49aa01901c8..1c56f71e115 100644 --- a/mozilla/xpfe/communicator/resources/content/tasksOverlay.xul +++ b/mozilla/xpfe/communicator/resources/content/tasksOverlay.xul @@ -33,7 +33,7 @@ - +