don't allow user to pick local directory that's used by another account, sr=mscott 233265

git-svn-id: svn://10.0.0.236/trunk@160367 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bienvenu%nventure.com 2004-08-04 19:21:19 +00:00
parent 69f1b0d846
commit dc39737bd2
2 changed files with 25 additions and 3 deletions

View File

@ -54,10 +54,31 @@ function BrowseForLocalFolders()
var ret = fp.show();
if (ret == nsIFilePicker.returnOK) {
// convert the nsILocalFile into a nsIFileSpec
currentFolderTextBox.value = fp.file.path;
if (ret == nsIFilePicker.returnOK)
{
// check that no other account/server has this same local directory
var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
var allServers = accountManager.allServers;
for (var i=0; i < allServers.Count(); i++)
{
var currentServer = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
var localPath = currentServer.localPath;
if (currentServer.key != gServer.key && fp.file.path == localPath.nativePath)
{
var directoryAlreadyUsed =
top.gPrefsBundle.getString("directoryUsedByOtherServer");
var promptService =
Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
getService(Components.interfaces.nsIPromptService);
promptService.alert(window, null, directoryAlreadyUsed);
return;
}
}
}
// convert the nsILocalFile into a nsIFileSpec
currentFolderTextBox.value = fp.file.path;
}
function hostnameIsIllegal(hostname)

View File

@ -68,6 +68,7 @@ accountName=%1$S - %2$S
confirmDeferAccount=If you store this account's new mail in a different account's Inbox, you will no longer be able to access already downloaded e-mail for this account. If you have mail in this account, please copy it to another account first. If you have filters that filter mail into this account, you should disable them or change the destination folder. If any accounts have special folders in this account (Sent, Drafts, Templates), you should change them to be in another account. Do you still want to store this account's e-mail in a different account?
confirmDeferAccountTitle=Defer Account?
directoryUsedByOtherServer=This directory is already used by another server. Please pick a different directory.
#Provide default example values for sample email address
exampleEmailUserName=user
exampleEmailDomain=example.net