Bug 249359 Minor UI clean-up for the Roaming Profile Preferences panes

r=BenB, sr=Neil


git-svn-id: svn://10.0.0.236/trunk@163504 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Stefan.Borggraefe%gmx.de
2004-10-10 21:01:42 +00:00
parent 9205e1c30e
commit 67000e7303
6 changed files with 75 additions and 56 deletions

View File

@@ -155,8 +155,8 @@ RoamingPrefs.prototype =
/* to understand the structure of the registry,
see comment at the const defs above */
// get the Roaming reg branch
registry = Components.classes["@mozilla.org/registry;1"]
.createInstance(Components.interfaces.nsIRegistry);
var registry = Components.classes["@mozilla.org/registry;1"]
.createInstance(Components.interfaces.nsIRegistry);
registry.openWellKnownRegistry(registry.ApplicationRegistry);
this.registry = registry;
var profMan = Components.classes["@mozilla.org/profile/manager;1"]
@@ -309,7 +309,7 @@ RoamingPrefs.prototype =
verifyData : function()
{
if (!this.Enabled)
return;
return true;
var errorProp; // see showError();
var errorVal; // dito
@@ -419,15 +419,6 @@ function SwitchDeck(page, deckElement)
deckElement.setAttribute("selectedIndex", page);
}
function EnableElement(enabled, triggerElement, elementID)
{
var element = document.getElementById(elementID);
if(!enabled)
element.setAttribute("disabled", "true");
else
element.removeAttribute("disabled");
}
function EnableTree(enabled, element)
{
if (!element || !element.setAttribute)
@@ -454,3 +445,29 @@ function E(elementID)
{
return document.getElementById(elementID);
}
function Browse()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
var currentFolder = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
var currentFolderTextbox = document.getElementById("copyDir");
try {
currentFolder.initWithPath(currentFolderTextbox.value);
fp.displayDirectory = currentFolder;
}
catch (ex) {
dump("initWithPath failed. Reason: " + ex);
}
fp.init(window, E("browseButton").getAttribute("filepickertitle"),
nsIFilePicker.modeGetFolder);
if (fp.show() == nsIFilePicker.returnOK)
// convert the nsILocalFile into a nsIFileSpec
currentFolderTextbox.value = fp.file.path;
}

View File

@@ -135,7 +135,7 @@ function DataToUI()
var found = false;
for (var i2 = 0, l2 = children.length; i2 < l2; i2++)
{
var checkbox = children[i2];
checkbox = children[i2];
if ("getAttribute" in checkbox
&& checkbox.getAttribute("type") == "checkbox"
// Somebody adds unwanted nodes as children to listbox :-(

View File

@@ -59,10 +59,6 @@
<stringbundle id="bundle_roaming_filedescr" src="chrome://sroaming/locale/filedescr.properties"/>
<vbox id="roamingSettings" flex="1">
<groupbox id="files" flex="1">
<caption label="&files.label;" />
<vbox flex="1">
<!--
Defaults are set in the default pref "roaming.default.files", displayed
names in filedescr.properties.
@@ -153,9 +149,6 @@
filename="secmod.db"
label="" />
</listbox>
</vbox>
</groupbox>
</vbox>
</page>

View File

@@ -135,7 +135,7 @@ function ActivationWarning()
.getService(Components.interfaces.nsIPrefBranch);
try
{
showWarning = prefBranch.getBoolPref("roaming.showInitialWarning");
var showWarning = prefBranch.getBoolPref("roaming.showInitialWarning");
if (!showWarning)
return;
} catch(e) {}

View File

@@ -59,14 +59,16 @@
<stringbundle id="bundle_roaming_prefs" src="chrome://sroaming/locale/prefs.properties"/>
<stringbundle id="bundle_roaming_filedescr" src="chrome://sroaming/locale/filedescr.properties"/>
<checkbox id="enabled"
aoncommand="EnableTree(this.checked, E('roamingSettings'));
parent.roaming.enabled = this.checked;"
oncommand="ActivationWarning(); SwitchChanged();"
class="indent"
label="&enabled.label;"
accesskey="&enabled.accesskey;"
/>
<vbox align="start">
<checkbox id="enabled"
aoncommand="EnableTree(this.checked, E('roamingSettings'));
parent.roaming.enabled = this.checked;"
oncommand="ActivationWarning(); SwitchChanged();"
class="indent"
label="&enabled.label;"
accesskey="&enabled.accesskey;"
/>
</vbox>
<groupbox id="method">
<caption label="&method.label;" />
@@ -115,11 +117,13 @@
</row>
<row>
<hbox />
<checkbox id="streamSavePW"
oncommand="SwitchChanged();"
label="&streamSavePW.label;"
accesskey="&streamSavePW.accesskey;"
/>
<vbox align="start">
<checkbox id="streamSavePW"
oncommand="SwitchChanged();"
label="&streamSavePW.label;"
accesskey="&streamSavePW.accesskey;"
/>
</vbox>
</row>
<row>
<hbox align="center">
@@ -134,11 +138,20 @@
</grid>
</vbox>
<vbox id="copySettings">
<label control="copyDir"
value="&copyDir.label;"
accesskey="&copyDir.accesskey;"
/>
<textbox id="copyDir" />
<separator class="thin" />
<label value="&copyDir.label;" />
<hbox>
<textbox id="copyDir"
readonly="true"
flex="1"
/>
<button id="browseButton"
label="&browse.label;"
accesskey="&browse.accesskey;"
filepickertitle="&filepicker.title;"
onclick="Browse();"
/>
</hbox>
</vbox>
</deck>
</groupbox>

View File

@@ -42,26 +42,22 @@
<!ENTITY descr.label "Roaming Access allows you to retrieve and store your user profile information from/on a Roaming Access server. Your profile information will then be retrieved from the server on startup and transferred to it on shutdown.">
<!ENTITY descrFiles.label "If Roaming Access is enabled (in the Roaming User pane), the following parts of your profile will be transferred to and from the Roaming Access server.">
<!ENTITY enabled.label "Enable remote profile storage">
<!ENTITY enabled.accesskey "e">
<!ENTITY enabled.accesskey "E">
<!ENTITY method.label "Server Information">
<!ENTITY methodSelect.label "Transfer Method">
<!ENTITY methodSelect.accesskey "m">
<!ENTITY files.label "Item Selection">
<!ENTITY filesDescr.label "User profile items selected below will be transferred to/from the server.">
<!ENTITY filesList.accesskey "i">
<!ENTITY methodCopy.label "File copy">
<!ENTITY methodCopy.label "File Copy">
<!ENTITY methodStream.label "HTTP / FTP">
<!ENTITY streamURL.label "Base URL">
<!ENTITY streamURL.accesskey "u">
<!ENTITY streamUsername.label "Username">
<!ENTITY streamUsername.accesskey "Username">
<!ENTITY streamURL.label "Base URL:">
<!ENTITY streamURL.accesskey "a">
<!ENTITY streamUsername.label "Username:">
<!ENTITY streamUsername.accesskey "U">
<!ENTITY streamSavePW.label "Save password">
<!ENTITY streamSavePW.accesskey "s">
<!ENTITY streamPassword.label "Password">
<!ENTITY streamPassword.accesskey "p">
<!ENTITY streamSavePW.accesskey "S">
<!ENTITY streamPassword.label "Password:">
<!ENTITY streamPassword.accesskey "P">
<!ENTITY copyDir.label "Copy to/from directory">
<!ENTITY copyDir.accesskey "d">
<!ENTITY copyDir.label "Copy to/from directory:">
<!ENTITY browse.label "Browse...">
<!ENTITY browse.accesskey "B">
<!ENTITY filepicker.title "Select Directory">