Trunk version of latest 88844 stuff, look for "Mozilla Quick Launch" instead of

trying to construct a string based on the app name, which is not working.
r=ssu, sr=brendan, a=asa
This commit is contained in:
syd%netscape.com 2001-09-13 09:09:06 +00:00
Родитель bf2b8bc2be
Коммит ac233ca8d6
3 изменённых файлов: 17 добавлений и 43 удалений

Просмотреть файл

@ -51,7 +51,6 @@
#include "nsIWindowsHooks.h"
#include "nsIPromptService.h"
#include "nsNetCID.h"
#include "nsIHttpProtocolHandler.h"
// These are needed to load a URL in a browser window.
#include "nsIDOMLocation.h"
@ -74,7 +73,6 @@
#define TURBO_EXIT 6
static HWND hwndForDOMWindow( nsISupports * );
static NS_DEFINE_CID(kHttpHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
static
nsresult
@ -925,29 +923,24 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) {
PRBool serverMode = PR_FALSE;
GetIsServerMode( &serverMode );
#if 0
/* temporarily disabling to clear smoketest blocker 99286
don't create an http protocol handler service before XPCOM is initialized
(danm for dp) */
// This code CANNOT be enabled here. This happens before XPCOM is initialized.
// SetIsServerMode() requires string bundle which requires XPCOM
// We should have this happen on a callback on first page load complete
// or some such thing.
if ( !serverMode ) { // okay, so it's not -turbo
HKEY key;
LONG result = ::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_QUERY_VALUE, &key );
if ( result == ERROR_SUCCESS ) {
nsresult res;
nsCOMPtr<nsIHttpProtocolHandler> http ( do_GetService( kHttpHandlerCID, &res ) );
if ( NS_FAILED( res ) ) return rv;
nsXPIDLCString appName;
http->GetAppName( getter_Copies( appName ) );
nsCString fullValue; fullValue.Assign( appName );
fullValue.Append( " Quick Launch" );
result = ::RegQueryValueEx( key, fullValue, NULL, NULL, NULL, NULL );
result = ::RegQueryValueEx( key, NS_QUICKLAUNCH_RUN_KEY, NULL, NULL, NULL, NULL );
::RegCloseKey( key );
if ( result == ERROR_SUCCESS )
SetIsServerMode( PR_TRUE );
if ( result == ERROR_SUCCESS ) {
// XXX To make absolutely sure, we should check the value to see if this is
// XXX us or one of our predecessors - bascially distinguish betn mozilla and
// XXX mozilla based browsers
SetIsServerMode( PR_TRUE );
}
}
}
#endif
return rv;
}

Просмотреть файл

@ -174,4 +174,7 @@ interface nsIWindowsHooks : nsISupports {
%{C++
#define NS_IWINDOWSHOOKS_CONTRACTID "@mozilla.org/winhooks;1"
#define NS_IWINDOWSHOOKS_CLASSNAME "Mozilla Windows Integration Hooks"
// The key that is used to write the quick launch appname in the windows registry
#define NS_QUICKLAUNCH_RUN_KEY "Mozilla Quick Launch"
%}

Просмотреть файл

@ -36,7 +36,6 @@
#include "nsXPIDLString.h"
#include "nsString.h"
#include "nsMemory.h"
#include "nsIHttpProtocolHandler.h"
#include "nsNetCID.h"
// The order of these headers is important on Win2K because CreateDirectory
// is |#undef|-ed in nsFileSpec.h, so we need to pull in windows.h for the
@ -54,7 +53,6 @@ static ProtocolRegistryEntry
ftp( "ftp" ),
chrome( "chrome" ),
gopher( "gopher" );
static NS_DEFINE_CID(kHttpHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
const char *jpgExts[] = { ".jpg", ".jpeg", 0 };
const char *gifExts[] = { ".gif", 0 };
const char *pngExts[] = { ".png", 0 };
@ -528,14 +526,7 @@ NS_IMETHODIMP nsWindowsHooks::IsStartupTurboEnabled(PRBool *_retval)
HKEY key;
LONG result = ::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_QUERY_VALUE, &key );
if ( result == ERROR_SUCCESS ) {
nsresult rv;
nsCOMPtr<nsIHttpProtocolHandler> http ( do_GetService( kHttpHandlerCID, &rv ) );
if ( NS_FAILED( rv ) ) return rv;
nsXPIDLCString appName;
http->GetAppName( getter_Copies( appName ) );
nsCString fullValue; fullValue.Assign( appName );
fullValue.Append( " Quick Launch" );
result = ::RegQueryValueEx( key, fullValue, NULL, NULL, NULL, NULL );
result = ::RegQueryValueEx( key, NS_QUICKLAUNCH_RUN_KEY, NULL, NULL, NULL, NULL );
::RegCloseKey( key );
if ( result == ERROR_SUCCESS )
*_retval = PR_TRUE;
@ -560,13 +551,7 @@ NS_IMETHODIMP nsWindowsHooks::StartupTurboEnable()
if ( rv ) {
strcat( fileName, " -turbo" );
nsresult rv;
nsCOMPtr<nsIHttpProtocolHandler> http ( do_GetService( kHttpHandlerCID, &rv ) );
if ( NS_FAILED( rv ) ) return rv;
nsXPIDLCString appName;
http->GetAppName( getter_Copies( appName ) );
nsCString fullValue; fullValue.Assign( appName );
fullValue.Append( " Quick Launch" );
::RegSetValueEx( hKey, fullValue, 0, REG_SZ, ( LPBYTE )fileName, strlen( fileName ) );
::RegSetValueEx( hKey, NS_QUICKLAUNCH_RUN_KEY, 0, REG_SZ, ( LPBYTE )fileName, strlen( fileName ) );
}
::RegCloseKey( hKey );
return NS_OK;
@ -583,14 +568,7 @@ NS_IMETHODIMP nsWindowsHooks::StartupTurboDisable()
LONG res = ::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_SET_VALUE, &hKey );
if ( res != ERROR_SUCCESS )
return NS_OK;
nsresult rv;
nsCOMPtr<nsIHttpProtocolHandler> http ( do_GetService( kHttpHandlerCID, &rv ) );
if ( NS_FAILED( rv ) ) return rv;
nsXPIDLCString appName;
http->GetAppName( getter_Copies( appName ) );
nsCString fullValue; fullValue.Assign( appName );
fullValue.Append( " Quick Launch" );
res = ::RegDeleteValue( hKey, fullValue );
res = ::RegDeleteValue( hKey, NS_QUICKLAUNCH_RUN_KEY );
::RegCloseKey( hKey );
return NS_OK;
}