зеркало из https://github.com/mozilla/gecko-dev.git
Bug 113936; tailor WinXP start menu so Mozilla's Preferences are used instead of opening IE's; r=ben, sr=hyatt
This commit is contained in:
Родитель
482b92845c
Коммит
3fe5966524
|
@ -31,6 +31,19 @@
|
|||
**/
|
||||
function Startup()
|
||||
{
|
||||
// Check for an existing pref window.
|
||||
const kWindowMediatorContractID = "@mozilla.org/rdf/datasource;1?name=window-mediator";
|
||||
const kWindowMediatorIID = Components.interfaces.nsIWindowMediator;
|
||||
const kWindowMediator = Components.classes[kWindowMediatorContractID].getService(kWindowMediatorIID);
|
||||
var windows = kWindowMediator.getEnumerator("mozilla:preferences");
|
||||
var prefWindow;
|
||||
while ((prefWindow = windows.getNext().QueryInterface(Components.interfaces.nsIDOMWindow)) &&
|
||||
prefWindow != window) {
|
||||
// Prefs already open, activate it and close this one.
|
||||
prefWindow.focus();
|
||||
window.close();
|
||||
}
|
||||
|
||||
hPrefWindow = new nsPrefWindow('panelFrame');
|
||||
|
||||
if( !hPrefWindow )
|
||||
|
|
|
@ -3,3 +3,4 @@ noButtonLabel=No
|
|||
cancelButtonLabel=Cancel
|
||||
checkBoxLabel=Check at startup next time, too.
|
||||
promptText=%S is not currently set as your default browser. Would you like to make it your default browser?
|
||||
prefsLabel=Pr&eferences
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "nsString.h"
|
||||
#include "nsINativeAppSupportWin.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
// Where Mozilla stores its own registry values.
|
||||
const char * const mozillaKeyName = "Software\\Mozilla\\Desktop";
|
||||
|
@ -364,6 +365,26 @@ static void setWindowsXP() {
|
|||
nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\open\\command" ) ).get(),
|
||||
"",
|
||||
thisApplication().get() ).set();
|
||||
// "Properties" verb. The default value is the text that will appear in the menu.
|
||||
// The default value under the command subkey is the name of this application, with
|
||||
// arguments to cause the Preferences window to appear.
|
||||
nsCOMPtr<nsIStringBundleService> bundleService( do_GetService( "@mozilla.org/intl/stringbundle;1" ) );
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsXPIDLString label;
|
||||
if ( bundleService &&
|
||||
NS_SUCCEEDED( bundleService->CreateBundle( "chrome://global-platform/locale/nsWindowsHooks.properties",
|
||||
getter_AddRefs( bundle ) ) ) &&
|
||||
NS_SUCCEEDED( bundle->GetStringFromName( NS_LITERAL_STRING( "prefsLabel" ).get(), getter_Copies( label ) ) ) ) {
|
||||
// Set the label that will appear in the start menu context menu.
|
||||
RegistryEntry( HKEY_LOCAL_MACHINE,
|
||||
nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\properties" ) ).get(),
|
||||
"",
|
||||
NS_ConvertUCS2toUTF8( label ).get() ).set();
|
||||
}
|
||||
RegistryEntry( HKEY_LOCAL_MACHINE,
|
||||
nsCAutoString( subkey + NS_LITERAL_CSTRING( "\\shell\\properties\\command" ) ).get(),
|
||||
"",
|
||||
nsCAutoString( thisApplication() + NS_LITERAL_CSTRING( "-chrome \"chrome://communicator/content/pref/pref.xul\"" ) ).get() ).set();
|
||||
|
||||
// Now we need to select our application as the default start menu internet application.
|
||||
// This is accomplished by first trying to store our subkey name in
|
||||
|
@ -412,7 +433,7 @@ nsresult RegistryEntry::reset() {
|
|||
if ( rc == ERROR_SUCCESS ) {
|
||||
rc = ::RegDeleteValue( key, valueNameArg() );
|
||||
#ifdef DEBUG_law
|
||||
if ( rc == ERROR_SUCCESS ) printf( "Deleting key=%s\n", (const char*)fullName() );
|
||||
if ( rc == ERROR_SUCCESS ) printf( "Deleting key=%s\n", (const char*)fullName().get() );
|
||||
#endif
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче