Bug #151688 --> Allow a browse button to set email storage directory in the account settings

Patch by Stefan Borggraefe

r=mscott
sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2004-02-20 19:40:20 +00:00
parent 55c69981f6
commit 94e61650a2
6 changed files with 37 additions and 30 deletions

View File

@ -36,6 +36,7 @@ Contributors:
<script type="application/x-javascript" src="chrome://messenger/content/AccountManager.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-server.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-prefs.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/amUtils.js"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<broadcaster id="broadcaster_doBiff"/>
@ -262,9 +263,11 @@ Contributors:
<vbox>
<label value="&localPath.label;" control="server.localPath"
accesskey="&localPath.accesskey;"/>
<textbox wsm_persist="true" id="server.localPath"
datatype="nsIFileSpec"
class="uri-element"
prefstring="mail.server.%serverkey%.directory"/>
<hbox align="center">
<textbox readonly="true" wsm_persist="true" flex="1" id="server.localPath" datatype="nsIFileSpec"
prefstring="mail.server.%serverkey%.directory" class="uri-element"/>
<button id="browseForLocalFolder" label="&browseFolder.label;" filepickertitle="&localFolderPicker.label;"
accesskey="&browseFolder.accesskey;" oncommand="BrowseForLocalFolders()"/>
</hbox>
</vbox>
</page>

View File

@ -20,27 +20,3 @@
function onInit() {
}
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsILocalFile = Components.interfaces.nsILocalFile;
const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
function BrowseForLocalFolders()
{
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
var currentFolder = Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
var currentFolderTextBox = document.getElementById("server.localPath");
currentFolder.initWithPath(currentFolderTextBox.value);
fp.init(window, document.getElementById("browseForLocalFolder").getAttribute("filepickertitle"), nsIFilePicker.modeGetFolder);
fp.displayDirectory = currentFolder;
var ret = fp.show();
if (ret == nsIFilePicker.returnOK) {
// convert the nsILocalFile into a nsIFileSpec
currentFolderTextBox.value = fp.file.path;
}
}

View File

@ -7,7 +7,8 @@
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="parent.onPanelLoaded('am-serverwithnoidentities.xul');">
<script src="chrome://messenger/content/am-serverwithnoidentities.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-serverwithnoidentities.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/amUtils.js"/>
<dialogheader title="&accountTitle.label;"/>

View File

@ -36,6 +36,30 @@
*
* ***** END LICENSE BLOCK ***** */
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsILocalFile = Components.interfaces.nsILocalFile;
const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
function BrowseForLocalFolders()
{
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
var currentFolder = Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
var currentFolderTextBox = document.getElementById("server.localPath");
currentFolder.initWithPath(currentFolderTextBox.value);
fp.init(window, document.getElementById("browseForLocalFolder").getAttribute("filepickertitle"), nsIFilePicker.modeGetFolder);
fp.displayDirectory = currentFolder;
var ret = fp.show();
if (ret == nsIFilePicker.returnOK) {
// convert the nsILocalFile into a nsIFileSpec
currentFolderTextBox.value = fp.file.path;
}
}
function hostnameIsIllegal(hostname)
{
// XXX TODO do a complete check.

View File

@ -73,3 +73,6 @@
<!ENTITY abbreviateOff.label "Abbreviate names (For example, 'n.p.m.mail-news')">
<!ENTITY advancedButton.label "Advanced...">
<!ENTITY advancedButton.accesskey "v">
<!ENTITY localFolderPicker.label "Select Local Directory">
<!ENTITY browseFolder.label "Browse...">
<!ENTITY browseFolder.accesskey "B">

View File

@ -4,6 +4,6 @@
<!ENTITY accountName.accesskey "N">
<!ENTITY localPath.label "Local directory:">
<!ENTITY localPath.accesskey "L">
<!ENTITY localFolderPicker.label "Location of Local Folders:">
<!ENTITY localFolderPicker.label "Select Local Directory">
<!ENTITY browseFolder.label "Browse...">
<!ENTITY browseFolder.accesskey "B">