Bug 135597 Profile migrator should use prompt service instead of no_space.xul r=ccarlen sr=rbs

This commit is contained in:
neil%parkwaycc.co.uk 2003-11-18 09:16:08 +00:00
parent 2ef9e15a2d
commit 9f585b9a43
7 changed files with 35 additions and 174 deletions

View File

@ -1,75 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Don Bragg <dbragg@netscape.com
*
* 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
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var param;
function OnLoad()
{
param = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
// display the main text
var messageText = param.GetString(0);
var messageParent = document.getElementById("info.box");
// set the pressed button to cancel to handle the case where the close box is pressed
param.SetInt(0, 3);
}
function OnRetry()
{
param.SetInt(0, 0 );
window.close();
}
function OnCreateNew()
{
param.SetInt(0, 1);
window.close();
}
function OnCancel()
{
param.SetInt(0, 2);
window.close();
}

View File

@ -1,64 +0,0 @@
<?xml version="1.0"?>
<!-- The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
Don Bragg (dbragg@netscape.com)
-->
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://communicator/locale/profile/no_space.dtd">
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
onload="OnLoad()"
style="min-height: 8em; -moz-user-focus: ignore;"
class="dialog"
title="&noSpace.label;">
<script src="chrome://communicator/content/profile/no_space.js"></script>
<keyset id="keyset"/>
<hbox flex="1">
<hbox>
<text id="outOfSpace" value="&errorText1.label;"/>
<spacer flex="100%"/>
<image id="info.icon" class="message-icon"/>
</hbox>
<separator orient="vertical" class="thin"/>
</hbox>
<spacer flex="50%"/>
<hbox id="errorTextBody">
<text value="&errorText2.label;"/>
</hbox>
<spacer flex="50%"/>
<separator class="thin"/>
<hbox class="selection" id="RetryNewCancelButtons">
<button class="dialog push" id="retry" default="true" label="&buttonRetry.label;" oncommand="OnRetry();"/>
<button class="dialog push" id="createNew" label="&buttonCreateNew.label;" oncommand="OnCreateNew();" />
<button class="dialog push" id="cancel" label="&buttonCancel.label;" oncommand="OnCancel();" />
</hbox>
</window>

View File

@ -1,9 +1,6 @@
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)

View File

@ -1,8 +0,0 @@
<!-- extracted from no_space.xul -->
<!ENTITY buttonCancel.label "Cancel">
<!ENTITY buttonRetry.label "Retry">
<!ENTITY buttonCreateNew.label "Create New Profile">
<!ENTITY noSpace.label "Not enough space to migrate.">
<!ENTITY errorText1.label "There is not enough space to migrate your profile.">
<!ENTITY errorText2.label "You can free some space and retry, create a new empty profile or cancel.">

View File

@ -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<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(kStringBundleServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDialogParamBlock> 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<nsIDOMWindow> newWindow;
rv = windowWatcher->OpenWindow(mPMProgressWindow,
PREF_MIGRATION_NO_SPACE_URL,
"_blank",
"dialog,chrome,centerscreen,modal,titlebar",
ioParamBlock,
getter_AddRefs(newWindow));
nsCOMPtr<nsIStringBundle> 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<nsIPromptService> 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);
}

View File

@ -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

View File

@ -13,3 +13,11 @@ newsDirName=News
# 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?
# No Space dialog
noSpace.title=Not enough space to migrate.
# LOCALIZATION NOTE: The \n is used to indicate a new paragraph
noSpace.text=There is not enough space to migrate your profile.\nYou can free some space and retry, create a new empty profile or cancel.
# LOCALIZATION NOTE: The & is used to indicate the access key
retry.label=&Retry
createNew.label=Create &New