From 6e75191930e175009f633fd72b36f46d7cc0732a Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Tue, 18 Nov 2003 09:16:08 +0000 Subject: [PATCH] Bug 135597 Profile migrator should use prompt service instead of no_space.xul r=ccarlen sr=rbs --- .../resources/content/no_space.js | 0 .../resources/content/no_space.xul | 0 profile/pref-migrator/resources/jar.mn | 9 ---- .../resources/locale/en-US/no_space.dtd | 0 profile/pref-migrator/src/nsPrefMigration.cpp | 47 ++++++++++--------- profile/pref-migrator/src/nsPrefMigration.h | 4 +- .../locale/en-US/migration.properties | 15 ------ 7 files changed, 27 insertions(+), 48 deletions(-) delete mode 100644 profile/pref-migrator/resources/content/no_space.js delete mode 100644 profile/pref-migrator/resources/content/no_space.xul delete mode 100644 profile/pref-migrator/resources/locale/en-US/no_space.dtd diff --git a/profile/pref-migrator/resources/content/no_space.js b/profile/pref-migrator/resources/content/no_space.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/profile/pref-migrator/resources/content/no_space.xul b/profile/pref-migrator/resources/content/no_space.xul deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/profile/pref-migrator/resources/jar.mn b/profile/pref-migrator/resources/jar.mn index f574c0447ae..e69de29bb2d 100644 --- a/profile/pref-migrator/resources/jar.mn +++ b/profile/pref-migrator/resources/jar.mn @@ -1,9 +0,0 @@ -comm.jar: - content/communicator/profile/no_space.js (content/no_space.js) - content/communicator/profile/no_space.xul (content/no_space.xul) - content/communicator/profile/profileMigrationProgress.js (content/profileMigrationProgress.js) - content/communicator/profile/profileMigrationProgress.xul (content/profileMigrationProgress.xul) - -en-US.jar: - locale/en-US/communicator/profile/no_space.dtd (locale/en-US/no_space.dtd) - locale/en-US/communicator/profile/profileMigrationProgress.dtd (locale/en-US/profileMigrationProgress.dtd) diff --git a/profile/pref-migrator/resources/locale/en-US/no_space.dtd b/profile/pref-migrator/resources/locale/en-US/no_space.dtd deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/profile/pref-migrator/src/nsPrefMigration.cpp b/profile/pref-migrator/src/nsPrefMigration.cpp index b1d34be46f4..22850838b94 100644 --- a/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/profile/pref-migrator/src/nsPrefMigration.cpp @@ -41,7 +41,7 @@ #include "pratom.h" #include "nsIComponentManager.h" #include "nsIComponentManager.h" -#include "nsIDialogParamBlock.h" +#include "nsIPromptService.h" #include "nsIServiceManager.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptContext.h" @@ -212,7 +212,6 @@ #define PREF_FILE_NAME_IN_5x "prefs.js" #define PREF_MIGRATION_PROGRESS_URL "chrome://communicator/content/profile/profileMigrationProgress.xul" -#define PREF_MIGRATION_NO_SPACE_URL "chrome://communicator/content/profile/no_space.xul" typedef struct { @@ -425,7 +424,7 @@ extern "C" void ProfileMigrationController(void *data) migrator->mErrorCode = rv; return; } - choice++;// Increment choice to match the RETRY=1, CREATE_NEW=2 and CANCEL=3 format + choice++;// Increment choice to match the RETRY=1, CANCEL=2 and CREATE_NEW=3 format } } @@ -466,29 +465,33 @@ NS_IMETHODIMP nsPrefMigration::ShowSpaceDialog(PRInt32 *choice) { nsresult rv; - nsCOMPtr windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv)); + nsCOMPtr bundleService = do_GetService(kStringBundleServiceCID, &rv); if (NS_FAILED(rv)) return rv; - nsCOMPtr ioParamBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &rv)); - if (NS_FAILED(rv)) return rv; - - ioParamBlock->SetInt(0,3); //set the Retry, CreateNew and Cancel buttons - - // WindowWatcher can work with or without parent window - nsCOMPtr newWindow; - rv = windowWatcher->OpenWindow(mPMProgressWindow, - PREF_MIGRATION_NO_SPACE_URL, - "_blank", - "dialog,chrome,centerscreen,modal,titlebar", - ioParamBlock, - getter_AddRefs(newWindow)); + nsCOMPtr bundle; + rv = bundleService->CreateBundle(MIGRATION_PROPERTIES_URL, getter_AddRefs(bundle)); if (NS_FAILED(rv)) return rv; - // Now get which button was pressed from the ParamBlock - if (NS_SUCCEEDED(rv)) - ioParamBlock->GetInt( 0, choice ); - - return NS_OK; + nsXPIDLString noSpaceTitle, noSpaceText, retryLabel, createNewLabel; + rv = bundle->GetStringFromName(NS_LITERAL_STRING("noSpace.title").get(), getter_Copies(noSpaceTitle)); + if (NS_FAILED(rv)) return rv; + rv = bundle->GetStringFromName(NS_LITERAL_STRING("noSpace.text").get(), getter_Copies(noSpaceText)); + if (NS_FAILED(rv)) return rv; + rv = bundle->GetStringFromName(NS_LITERAL_STRING("retry.label").get(), getter_Copies(retryLabel)); + if (NS_FAILED(rv)) return rv; + rv = bundle->GetStringFromName(NS_LITERAL_STRING("createNew.label").get(), getter_Copies(createNewLabel)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv); + if (NS_FAILED(rv)) return rv; + + const PRUint32 buttons = + (nsIPromptService::BUTTON_TITLE_IS_STRING * nsIPromptService::BUTTON_POS_0)+ + (nsIPromptService::BUTTON_TITLE_CANCEL * nsIPromptService::BUTTON_POS_1)+ + (nsIPromptService::BUTTON_TITLE_IS_STRING * nsIPromptService::BUTTON_POS_2); + return promptService->ConfirmEx(mPMProgressWindow, noSpaceTitle, noSpaceText, + buttons, retryLabel, nsnull, createNewLabel, + nsnull, nsnull, choice); } diff --git a/profile/pref-migrator/src/nsPrefMigration.h b/profile/pref-migrator/src/nsPrefMigration.h index b3c26dd2fd8..43243abff75 100644 --- a/profile/pref-migrator/src/nsPrefMigration.h +++ b/profile/pref-migrator/src/nsPrefMigration.h @@ -55,8 +55,8 @@ #define MIGRATION_SUCCESS 0 #define MIGRATION_RETRY 1 -#define MIGRATION_CREATE_NEW 2 -#define MIGRATION_CANCEL 3 +#define MIGRATION_CANCEL 2 +#define MIGRATION_CREATE_NEW 3 #define MAX_DRIVES 4 diff --git a/profile/resources/locale/en-US/migration.properties b/profile/resources/locale/en-US/migration.properties index 99b4b5a01f1..e69de29bb2d 100644 --- a/profile/resources/locale/en-US/migration.properties +++ b/profile/resources/locale/en-US/migration.properties @@ -1,15 +0,0 @@ -# LOCALIZATION NOTE: Do not translate Unicode characters such as \u00a9 -dialogTitle=Confirm Migration -confirmMigration=You are about to create a %S profile based on your Netscape 4 profile.\u000a\u000aThis will copy and convert some of your Netscape 4 files to work with %S. Your Netscape 4 profile data will not be modified. -migrate=Convert Profile -manage=Manage Profiles... -# mailDirName needs to be set to the same value as in 4.x -# see bug #55449 -mailDirName=Mail -# newsDirName needs to be set to the same value as in 4.x -# see bug #55449 -newsDirName=News -# see nsAppShellService::CheckAndRemigrateDefunctProfile() -# for where the confirmRemigration entries are used -# LOCALIZATION NOTE: Do not translate Unicode characters such as \u00a9 -confirmRemigration=A more recent Netscape 4.5+ version of this profile (which contains your bookmarks, email settings, address books and preferences) was found.\u000aWould you like to use the more recent profile?