From 5ecf903f0adedebabd6926425f9fc6c6ada25559 Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Mon, 16 Feb 2004 03:54:56 +0000 Subject: [PATCH] Rip out some turbo garbage. --- .../components/winhooks/nsIWindowsHooks.idl | 20 --- .../components/winhooks/nsWindowsHooks.cpp | 155 +----------------- 2 files changed, 1 insertion(+), 174 deletions(-) diff --git a/browser/components/winhooks/nsIWindowsHooks.idl b/browser/components/winhooks/nsIWindowsHooks.idl index 480571c1eb15..db533bbd0af0 100755 --- a/browser/components/winhooks/nsIWindowsHooks.idl +++ b/browser/components/winhooks/nsIWindowsHooks.idl @@ -180,26 +180,6 @@ interface nsIWindowsHooks : nsISupports { // Returns true if the windows integration dialog was shown boolean checkSettings( in nsIDOMWindowInternal aParent ); - /** - * Returns true if command is in the "(appname) QuickLaunch" value in the - * HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run - * key. - */ - boolean isOptionEnabled(in string option); - - /** - * Adds the option to the "(appname) QuickLaunch" value to the key mentioned above, - * with data "(path\to\app.exe) option", if not done already. - */ - void startupAddOption(in string option); - - /** - * Removes the commnand from the "(appname) QuickLaunch" value from - * the key mentioned above, if not done already. And deletes the - * "(appname) QuickLaunch" value entirely if there are no options left - */ - void startupRemoveOption(in string option); - const PRInt32 WALLPAPER_TILE = 0; const PRInt32 WALLPAPER_STRETCH = 1; const PRInt32 WALLPAPER_CENTER = 2; diff --git a/browser/components/winhooks/nsWindowsHooks.cpp b/browser/components/winhooks/nsWindowsHooks.cpp index 993d4df72a6d..82a35f63057a 100755 --- a/browser/components/winhooks/nsWindowsHooks.cpp +++ b/browser/components/winhooks/nsWindowsHooks.cpp @@ -25,6 +25,7 @@ * Joe Elwell * Håkan Waara * Aaron Kaluszka + * Blake Ross * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -708,160 +709,6 @@ NS_IMETHODIMP nsWindowsHooks::GetRegistryEntry( PRInt32 aHKEYConstant, const cha return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } -// nsIWindowsHooks.idl for documentation - -/* - * Name: IsOptionEnabled - * Arguments: - * PRUnichar* option - the option line switch we check to see if it is in the registry key - * - * Return Value: - * PRBool* _retval - PR_TRUE if option is already in the registry key, otherwise PR_FALSE - * - * Description: - * This function merely checks if the passed in string exists in the (appname) Quick Launch Key or not. - * - * Author: - * Joseph Elwell 3/1/2002 -*/ -NS_IMETHODIMP nsWindowsHooks::IsOptionEnabled(const char* option, PRBool *_retval) { - NS_ASSERTION(option, "nsWindowsHooks::IsOptionEnabled requires something like \"-turbo\""); - *_retval = PR_FALSE; - RegistryEntry startup ( HKEY_CURRENT_USER, RUNKEY, NS_QUICKLAUNCH_RUN_KEY, NULL ); - nsCString cargs = startup.currentSetting(); - if (cargs.Find(option, PR_TRUE) != kNotFound) - *_retval = PR_TRUE; - return NS_OK; -} - -/* - * Name: grabArgs - * Arguments: - * char* optionline - the full optionline as read from the (appname) Quick Launch registry key - * - * Return Value: - * char** args - A pointer to the arguments (string in optionline) - * passed to the executable in the (appname) Quick Launch registry key - * - * Description: - * This function separates out the arguments from the optinline string - * Returning a pointer into the first arguments buffer. - * This function is used only locally, and is meant to reduce code size and readability. - * - * Author: - * Joseph Elwell 3/1/2002 -*/ -void grabArgs(char* optionline, char** args) { - nsCRT::strtok(optionline, "\"", &optionline); - if (optionline != NULL) - *args = nsCRT::strtok(optionline, "\"", &optionline); -} - -/* - * Name: StartupAddOption - * Arguments: - * PRUnichar* option - the option line switch we want to add to the registry key - * - * Return Value: none - * - * Description: - * This function adds the given option line argument to the (appname) Quick Launch registry key - * - * Author: - * Joseph Elwell 3/1/2002 -*/ -NS_IMETHODIMP nsWindowsHooks::StartupAddOption(const char* option) { - NS_ASSERTION(option, "nsWindowsHooks::StartupAddOption requires something like \"-turbo\""); - PRBool retval; - IsOptionEnabled(option, &retval); - if (retval) return NS_OK; //already in there - - RegistryEntry startup ( HKEY_CURRENT_USER, RUNKEY, NS_QUICKLAUNCH_RUN_KEY, NULL ); - nsCString cargs = startup.currentSetting(); - nsCAutoString newsetting; - newsetting.Assign('\"'); - newsetting.Append(thisApplication()); - newsetting.Append('\"'); - if (!cargs.IsEmpty()) - { - char* args; - // exploiting the fact that nsString's storage is also a char* buffer. - // NS_CONST_CAST is safe here because nsCRT::strtok will only modify - // the existing buffer - grabArgs(NS_CONST_CAST(char *, cargs.get()), &args); - if (args != NULL) - newsetting.Append(args); - else - { - // check for the old style registry key that doesnot quote its executable - IsOptionEnabled("-turbo", &retval); - if (retval) - newsetting.Append(" -turbo"); - } - } - newsetting.Append(' '); - newsetting.Append(option); - startup.setting = newsetting; - startup.set(); - return NS_OK; -} - -/* - * Name: StartupRemoveOption - * Arguments: - * PRUnichar* option - the option line switch we want to remove from the registry key - * - * Return Value: none. - * - * Description: - * This function removes the given option from the (appname) Quick Launch Key. - * And deletes the key entirely if no options are left. - * - * Author: - * Joseph Elwell 3/1/2002 -*/ -NS_IMETHODIMP nsWindowsHooks::StartupRemoveOption(const char* option) { - NS_ASSERTION(option, "nsWindowsHooks::StartupRemoveOption requires something like \"-turbo\""); - PRBool startupFound; - IsOptionEnabled(option, &startupFound ); - if ( !startupFound ) - return NS_OK; // already disabled, no need to do anything - - RegistryEntry startup ( HKEY_CURRENT_USER, RUNKEY, NS_QUICKLAUNCH_RUN_KEY, NULL ); - nsCString cargs = startup.currentSetting(); - char* args; - // exploiting the fact that nsString's storage is also a char* buffer. - // NS_CONST_CAST is safe here because nsCRT::strtok will only modify - // the existing buffer - grabArgs(NS_CONST_CAST(char *, cargs.get()), &args); - - nsCAutoString launchcommand; - if (args) - { - launchcommand.Assign(args); - PRInt32 optionlocation = launchcommand.Find(option, PR_TRUE); - // modify by one to get rid of the space we prepended in StartupAddOption - if (optionlocation != kNotFound) - launchcommand.Cut(optionlocation - 1, strlen(option) + 1); - } - - if (launchcommand.IsEmpty()) - { - startup.set(); - } - else - { - nsCAutoString ufileName; - ufileName.Assign('\"'); - ufileName.Append(thisApplication()); - ufileName.Append('\"'); - ufileName.Append(launchcommand); - startup.setting = ufileName; - startup.set(); - } - return NS_OK; -} - nsresult WriteBitmap(nsString& aPath, gfxIImageFrame* aImage) {