Bug 787808 - Create common base class for Win32 and WinRT filepickers. r=jimm

This commit is contained in:
Brian R. Bondy 2012-09-03 11:25:08 -04:00
Родитель 6589977592
Коммит 462a60f579
2 изменённых файлов: 22 добавлений и 14 удалений

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

@ -1130,7 +1130,7 @@ nsFilePicker::GetFiles(nsISimpleEnumerator **aFiles)
// Get the file + path
NS_IMETHODIMP
nsFilePicker::SetDefaultString(const nsAString& aString)
nsBaseWinFilePicker::SetDefaultString(const nsAString& aString)
{
mDefaultFilePath = aString;
@ -1164,21 +1164,21 @@ nsFilePicker::SetDefaultString(const nsAString& aString)
}
NS_IMETHODIMP
nsFilePicker::GetDefaultString(nsAString& aString)
nsBaseWinFilePicker::GetDefaultString(nsAString& aString)
{
return NS_ERROR_FAILURE;
}
// The default extension to use for files
NS_IMETHODIMP
nsFilePicker::GetDefaultExtension(nsAString& aExtension)
nsBaseWinFilePicker::GetDefaultExtension(nsAString& aExtension)
{
aExtension = mDefaultExtension;
return NS_OK;
}
NS_IMETHODIMP
nsFilePicker::SetDefaultExtension(const nsAString& aExtension)
nsBaseWinFilePicker::SetDefaultExtension(const nsAString& aExtension)
{
mDefaultExtension = aExtension;
return NS_OK;

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

@ -34,13 +34,28 @@
class nsILoadContext;
class nsBaseWinFilePicker :
public nsBaseFilePicker
{
public:
NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
protected:
nsString mDefaultFilePath;
nsString mDefaultFilename;
nsString mDefaultExtension;
};
/**
* Native Windows FileSelector wrapper
*/
class nsFilePicker :
public nsBaseFilePicker,
public IFileDialogEvents
public IFileDialogEvents,
public nsBaseWinFilePicker
{
public:
nsFilePicker();
@ -53,11 +68,7 @@ public:
// IUnknown's QueryInterface
STDMETHODIMP QueryInterface(REFIID refiid, void** ppvResult);
// nsIFilePicker (less what's in nsBaseFilePicker)
NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
// nsIFilePicker (less what's in nsBaseFilePicker and nsBaseWinFilePicker)
NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex);
NS_IMETHOD SetFilterIndex(int32_t aFilterIndex);
NS_IMETHOD GetFile(nsIFile * *aFile);
@ -109,9 +120,6 @@ protected:
nsString mTitle;
int16_t mMode;
nsCString mFile;
nsString mDefaultFilePath;
nsString mDefaultFilename;
nsString mDefaultExtension;
nsString mFilterList;
int16_t mSelectedType;
nsCOMArray<nsIFile> mFiles;