diff --git a/widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp b/widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp index 9a6122f203fb..0e206516cf93 100644 --- a/widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp +++ b/widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp @@ -24,7 +24,33 @@ #undef NS_FILE_FAILURE #define NS_FILE_FAILURE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES,(0xFFFF)) -NS_IMPL_ISUPPORTS(nsFileSpecWithUIImpl, nsCOMTypeInfo::GetIID()) +NS_IMPL_ADDREF(nsFileSpecWithUIImpl) +NS_IMPL_RELEASE(nsFileSpecWithUIImpl) + +NS_IMETHODIMP nsFileSpecWithUIImpl::QueryInterface(REFNSIID aIID, + void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + static NS_DEFINE_IID(kClassIID, nsCOMTypeInfo::GetIID()); + if (aIID.Equals(kClassIID)) + *aInstancePtr = (void*) this; + else if (aIID.Equals(nsCOMTypeInfo::GetIID())) + *aInstancePtr = (void*) this; + else if (aIID.Equals(nsCOMTypeInfo::GetIID())) + *aInstancePtr = (void*) ((nsISupports*)this); + + if (*aInstancePtr) + { + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID); @@ -76,9 +102,10 @@ NS_IMETHODIMP nsFileSpecWithUIImpl::ChooseOutputFile( nsFileDlgResults result = fileWidget->PutFile(nsnull, winTitle, spec); if (result != nsFileDlgResults_OK) - return NS_FILE_FAILURE; - if (spec.Exists() && result != nsFileDlgResults_Replace) - return NS_FILE_FAILURE; + { + if (spec.Exists() && result != nsFileDlgResults_Replace) + return NS_FILE_FAILURE; + } return mBaseFileSpec->SetFromFileSpec(spec); } // nsFileSpecImpl::ChooseOutputFile @@ -115,31 +142,31 @@ void nsFileSpecWithUIImpl::SetFileWidgetFilterList( if (mask & eAllReadable) { *nextTitle++ = "All Readable Files"; - *nextFilter++ = "*.htm; *.html; *.xml; *.gif; *.jpg; *.jpeg; *.png"; + *nextFilter++ = "*.eml; *.txt; *.htm; *.html; *.xml; *.gif; *.jpg; *.jpeg; *.png"; } + if (mask & eMailFiles) + { + *nextTitle++ = "Mail Files (*.eml)"; + *nextFilter++ = "*.eml"; + } if (mask & eHTMLFiles) { - *nextTitle++ = "HTML Files"; + *nextTitle++ = "HTML Files (*.hml; *.html)"; *nextFilter++ = "*.htm; *.html"; } if (mask & eXMLFiles) { - *nextTitle++ = "XML Files"; + *nextTitle++ = "XML Files (*.xml)"; *nextFilter++ = "*.xml"; } if (mask & eImageFiles) { - *nextTitle++ = "Image Files"; + *nextTitle++ = "Image Files (*.gif; *.jpg; *.jpeg; *.png)"; *nextFilter++ = "*.gif; *.jpg; *.jpeg; *.png"; } - if (mask & eMailFiles) - { - *nextTitle++ = "Mail Files"; - *nextFilter++ = "*.eml"; - } if (mask & eTextFiles) { - *nextTitle++ = "Text Files"; + *nextTitle++ = "Text Files (*.txt)"; *nextFilter++ = "*.txt"; } if (mask & eExtraFilter)