Bug 81572: "Never provide only a text field for file/folder input (newsrc file)"

r=mscott, sr=bienvenu
This commit is contained in:
Stefan.Borggraefe%gmx.de 2004-05-04 22:28:14 +00:00
Родитель c3b1842090
Коммит cc7e3898aa
3 изменённых файлов: 35 добавлений и 1 удалений

Просмотреть файл

@ -273,3 +273,30 @@ function setupNotifyUI()
if (locked)
broadcaster.setAttribute("disabled","true");
}
function BrowseForNewsrc()
{
var newsrcTextBox = document.getElementById("nntp.newsrcFilePath");
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window,
document.getElementById("browseForNewsrc").getAttribute("filepickertitle"),
nsIFilePicker.modeSave);
var currentNewsrcFile;
try {
currentNewsrcFile = Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
currentNewsrcFile.initWithPath(newsrcTextBox.value);
} catch (e) {
dump("Failed to create nsILocalFile instance for the current newsrc file.\n");
}
if (currentNewsrcFile) {
fp.displayDirectory = currentNewsrcFile.parent;
fp.defaultString = currentNewsrcFile.leafName;
}
fp.appendFilters(nsIFilePicker.filterAll);
if (fp.show() != nsIFilePicker.returnCancel)
newsrcTextBox.value = fp.file.path;
}

Просмотреть файл

@ -269,9 +269,13 @@
<vbox hidefor="imap,pop3,movemail">
<label value="&newsrcFilePath.label;" control="nntp.newsrcFilePath"
accesskey="&newsrcFilePath.accesskey;"/>
<textbox wsm_persist="true" id="nntp.newsrcFilePath"
<hbox align="center">
<textbox readonly="true" wsm_persist="true" flex="1" id="nntp.newsrcFilePath"
datatype="nsIFileSpec"
prefstring="mail.server.%serverkey%.newsrc.file" class="uri-element"/>
<button id="browseForNewsrc" label="&browseNewsrc.label;" filepickertitle="&newsrcPicker.label;"
accesskey="&browseNewsrc.accesskey;" oncommand="BrowseForNewsrc()"/>
</hbox>
</vbox>
</vbox>

Просмотреть файл

@ -76,3 +76,6 @@
<!ENTITY localFolderPicker.label "Select Local Directory">
<!ENTITY browseFolder.label "Browse...">
<!ENTITY browseFolder.accesskey "B">
<!ENTITY newsrcPicker.label "Select newsrc File">
<!ENTITY browseNewsrc.label "Browse...">
<!ENTITY browseNewsrc.accesskey "e">