From 30037f6c30f700312c3c8836e1b08c622201b99b Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Wed, 6 Sep 2000 22:21:06 +0000 Subject: [PATCH] Bug #47799 --> push prompt for file name over to ucth handler code so we don't bring UI up from the uriloader. This allows us to properly use a string bundle for text in the dialog. this is prep work for the real fix for this bug. r=law --- .../exthandler/nsExternalHelperAppService.cpp | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 03b0e323c3fd..e0fdf317ed7b 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -43,7 +43,6 @@ #include "nsDirectoryServiceDefs.h" #include "nsIHelperAppLauncherDialog.h" -#include "nsIFilePicker.h" #include "nsCExternalHandlerService.h" // contains progids for the helper app service @@ -514,10 +513,6 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIChannel * aChannel, nsISup else mReceivedDispostionInfo = PR_TRUE; // no need to wait for a response from the user - // be sure to release our reference on the context now that we are done with it to avoid any circular reference - // chains... - mWindowContext = nsnull; - return NS_OK; } @@ -607,26 +602,11 @@ NS_IMETHODIMP nsExternalAppHandler::GetMIMEInfo(nsIMIMEInfo ** aMIMEInfo) nsresult nsExternalAppHandler::PromptForSaveToFile(nsILocalFile ** aNewFile, const PRUnichar * aDefaultFile) { - // I'm thinking the best thing to do here is to pass this call through to - // someone else and let them bring up the dialog. This keeps dialog dependencies out - // of the uriloader... + // invoke the dialog!!!!! use mWindowContext as the window context parameter for the dialog service + nsCOMPtr dlgService( do_GetService( NS_IHELPERAPPLAUNCHERDLG_PROGID ) ); nsresult rv = NS_OK; - nsCOMPtr filePicker = do_CreateInstance("component://mozilla/filepicker", &rv); - if (filePicker) - { - // HACK!! Find a string bundle to extract this string from. - filePicker->Init(nsnull, NS_LITERAL_STRING("Enter name of file to save to"), nsIFilePicker::modeSave); - filePicker->SetDefaultString(aDefaultFile); - filePicker->AppendFilter(NS_ConvertASCIItoUCS2(mTempFileExtension), NS_ConvertASCIItoUCS2(mTempFileExtension)); - filePicker->AppendFilters(nsIFilePicker::filterAll); - - PRInt16 dialogResult; - filePicker->Show(&dialogResult); - if (dialogResult == nsIFilePicker::returnCancel) - rv = NS_ERROR_FAILURE; - else - rv = filePicker->GetFile(aNewFile); - } + if ( dlgService ) + rv = dlgService->PromptForSaveToFile(mWindowContext, aDefaultFile, NS_ConvertASCIItoUCS2(mTempFileExtension), aNewFile); return rv; }