pref for turning off confirm dialog

This commit is contained in:
mkaply%us.ibm.com 2006-01-03 22:22:10 +00:00
parent 8350195d1e
commit 1184762348
6 changed files with 83 additions and 16 deletions

View File

@ -5,11 +5,10 @@ cckwizard.jar:
content/cckwizard/cckwizard.js (resources/content/cckwizard/cckwizard.js)
content/cckwizard/cckwizard.png (resources/content/cckwizard/cckwizard.png)
content/cckwizard/cckwizard.xul (resources/content/cckwizard/cckwizard.xul)
content/cckwizard/cckwizard.properties (resources/content/cckwizard/cckwizard.properties)
content/cckwizard/config.xul (resources/content/cckwizard/config.xul)
content/cckwizard/pref.xul (resources/content/cckwizard/pref.xul)
content/cckwizard/reg.xul (resources/content/cckwizard/reg.xul)
content/cckwizard/searchplugin.xul (resources/content/cckwizard/searchplugin.xul)
content/cckwizard/searchplugin.xul (resources/content/cckwizard/searchplugin.xul)
content/cckwizard/showconfig.xul (resources/content/cckwizard/showconfig.xul)
content/cckwizard/srcfiles/cck-browser-overlay.xul.in (resources/content/cckwizard/srcfiles/cck-browser-overlay.xul.in)
content/cckwizard/srcfiles/cck.dtd.in (resources/content/cckwizard/srcfiles/cck.dtd.in)

View File

@ -22,6 +22,8 @@
<!ENTITY configName.label "Name of configuration">
<!ENTITY configLocation.label "Location of configuration">
<!ENTITY saveOnExit.label "Save settings automatically on exit">
<!ENTITY zipLocation.label "Path to ZIP executable">

View File

@ -0,0 +1,5 @@
windowTitle=Firefox CCK
deleteConfirm=Are you sure you want to delete this configuration?
outputLocation=Firefox CCK Wizard is completed. XPI is available at:\n
cancelConfirm=Do you want to save your changes?

View File

@ -3,3 +3,4 @@
cckwizard.jar:
% locale cckwizard @AB_CD@ %locale/@AB_CD@/cckwizard/
locale/@AB_CD@/cckwizard/cckWizard.dtd (@AB_CD@/chrome/cckWizard.dtd)
locale/@AB_CD@/cckwizard/cckwizard.properties (@AB_CD@/chrome/cckwizard.properties)

View File

@ -137,19 +137,34 @@ function DeleteConfig()
{
var bundle = document.getElementById("bundle_cckwizard");
var rv = gPromptService.confirmEx(window, "WizardMachine", bundle.getString("deleteConfirm"),
gPromptService.BUTTON_TITLE_YES * gPromptService.BUTTON_POS_0 +
gPromptService.BUTTON_TITLE_NO * gPromptService.BUTTON_POS_1,
null, null, null, null, {});
if (rv == false) {
var button = gPromptService.confirmEx(window, "WizardMachine", bundle.getString("deleteConfirm"),
gPromptService.BUTTON_TITLE_YES * gPromptService.BUTTON_POS_0 +
gPromptService.BUTTON_TITLE_NO * gPromptService.BUTTON_POS_1,
null, null, null, null, {});
if (button == 0) {
gPrefBranch.deleteBranch("cck.config."+currentconfigname);
updateconfiglist();
}
}
function SetSaveOnExitPref()
{
gPrefBranch.setBoolPref("cck.save_on_exit", document.getElementById("saveOnExit").checked);
}
function OpenCCKWizard()
{
try {
document.getElementById("saveOnExit").checked = gPrefBranch.getBoolPref("cck.save_on_exit");
} catch (ex) {
}
try {
document.getElementById("zipLocation").value = gPrefBranch.getCharPref("cck.path_to_zip");
} catch (ex) {
}
}
function ShowMain()
{
@ -225,6 +240,34 @@ function saveconfig()
}
function CloseCCKWizard()
{
var saveOnExit;
try {
saveOnExit = gPrefBranch.getBoolPref("cck.save_on_exit");
} catch (ex) {
saveOnExit = false;
}
var button;
if (!saveOnExit) {
var bundle = document.getElementById("bundle_cckwizard");
var button = gPromptService.confirmEx(window, "WizardMachine", bundle.getString("cancelConfirm"),
gPromptService.BUTTON_TITLE_YES * gPromptService.BUTTON_POS_0 +
gPromptService.BUTTON_TITLE_NO * gPromptService.BUTTON_POS_1,
null, null, null, null, {});
} else {
button = 0;
}
if (button == 0) {
saveconfig();
}
gPrefBranch.setCharPref("cck.path_to_zip", document.getElementById("zipLocation").value);
}
function OnConfigLoad()
{
configCheckOKButton();
@ -724,6 +767,11 @@ function CCKZip(zipfile, location)
}
return;
}
var zipLocation = document.getElementById("zipLocation").value;
if (zipLocation.length == 0) {
zipLocation = "zip";
}
platform = navigator.platform;
var file = location.clone();
@ -739,9 +787,9 @@ function CCKZip(zipfile, location)
line = "cd \"" + location.path + "\"\n";
fos.write(line, line.length);
if (navigator.platform == "Win32")
line = "zip -r \"" + location.path + "\\" + zipfile + "\"";
line = zipLocation + " -r \"" + location.path + "\\" + zipfile + "\"";
else
line = "zip -r \"" + location.path + "/" + zipfile + "\"";
line = zipLocation + " -r \"" + location.path + "/" + zipfile + "\"";
for (var i=2; i < arguments.length; i++) {
line += " " + arguments[i];
}
@ -769,7 +817,7 @@ function CCKZip(zipfile, location)
var args = [file.path];
process.run(true, args, args.length);
file.remove(false);
// file.remove(false);
}
function CCKWriteXULOverlay(destdir)
@ -1361,8 +1409,10 @@ function CCKWriteConfigFile(destdir)
(elements[i].nodeName == "checkbox") ||
(elements[i].id == "RootKey1") ||
(elements[i].id == "Type1")) {
var line = elements[i].getAttribute("id") + "=" + elements[i].value + "\n";
fos.write(line, line.length);
if ((elements[i].id != "saveOnExit") && (elements[i].id != "zipLocation")) {
var line = elements[i].getAttribute("id") + "=" + elements[i].value + "\n";
fos.write(line, line.length);
}
} else if (elements[i].id == "prefList") {
listbox = document.getElementById('prefList');
for (var j=0; j < listbox.getRowCount(); j++) {

View File

@ -45,8 +45,9 @@
<wizard id="example-window" title="&cckWizard.title;"
height="480"
width="640"
onwizardcancel="alert('&cckWizard.oncancel;');saveconfig();"
onwizardcancel="CloseCCKWizard();"
onwizardfinish="CreateCCK();"
onload="OpenCCKWizard();"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://cckwizard/content/cckwizard.js"/>
@ -59,7 +60,7 @@
</groupbox>
</wizardpage>
<wizardpage label="&configurePage.label;" onpageshow="ShowMain();">
<wizardpage label="&configurePage.label;" onpageshow="ShowMain();" onpageadvanced="return ValidateFile('zipLocation');">
<groupbox>
<caption label="&selectConfig.label;"/>
<description>&selectConfig.description;</description>
@ -76,6 +77,15 @@
<button label="&deleteConfig.label;" id="deleteconfig" oncommand="DeleteConfig();"/>
</hbox>
</groupbox>
<vbox>
<checkbox id="saveOnExit" label="&saveOnExit.label;" oncommand="SetSaveOnExitPref();"/>
<description>&zipLocation.label;</description>
<hbox align="center">
<textbox flex="1" id="zipLocation"/>
<button label="&chooseFile.label;" oncommand="choosefile('zipLocation');"/>
</hbox>
</vbox>
</wizardpage>
<wizardpage label="&customizeExt.label;" description="&customizeExt.description;"
@ -646,7 +656,7 @@
</wizardpage>
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_cckwizard" src="chrome://cckwizard/content/cckwizard.properties"/>
<stringbundle id="bundle_cckwizard" src="chrome://cckwizard/locale/cckwizard.properties"/>
</stringbundleset>
</wizard>