Fix for bug #45982. Set the mode on the file picker correctly.

This allows users to back up certs successfully to new files instead
of having to over-write existing files.
This commit is contained in:
javi%netscape.com 2000-08-21 22:42:59 +00:00
Родитель 2439125f20
Коммит d67ebc94ec
1 изменённых файлов: 8 добавлений и 3 удалений

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

@ -110,7 +110,9 @@ nsPSMUIHandlerImpl::DisplayURI(PRInt32 width, PRInt32 height, PRBool modal, cons
}
NS_IMETHODIMP
nsPSMUIHandlerImpl::PromptForFile(const PRUnichar *prompt, const char *fileRegEx, PRBool shouldFileExist, char **outFile)
nsPSMUIHandlerImpl::PromptForFile(const PRUnichar *prompt,
const char *fileRegEx,
PRBool shouldFileExist, char **outFile)
{
NS_ENSURE_ARG_POINTER(outFile);
nsCOMPtr<nsIFilePicker> fp = do_CreateInstance("component://mozilla/filepicker");
@ -118,8 +120,11 @@ nsPSMUIHandlerImpl::PromptForFile(const PRUnichar *prompt, const char *fileRegEx
if (!fp)
return NS_ERROR_NULL_POINTER;
fp->Init(nsnull, prompt, nsIFilePicker::modeOpen);
if (shouldFileExist) {
fp->Init(nsnull, prompt, nsIFilePicker::modeOpen);
} else {
fp->Init(nsnull, prompt, nsIFilePicker::modeSave);
}
fp->AppendFilter(NS_ConvertASCIItoUCS2(fileRegEx).GetUnicode(), NS_ConvertASCIItoUCS2(fileRegEx).GetUnicode());
fp->AppendFilters(nsIFilePicker::filterAll);
PRInt16 mode;