mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 751729 - File dialogs don't open with Visual Themes disabled in Windows 7 fix. r=jimm
This commit is contained in:
parent
d5e77f32fc
commit
5a5c7ffc39
@ -564,14 +564,26 @@ nsFilePicker::ShowXPFolderPicker(const nsString& aInitialDir)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show a folder picker post Windows XP
|
||||
*
|
||||
* @param aInitialDir The initial directory, the last used directory will be
|
||||
* used if left blank.
|
||||
* @param aWasInitError Out parameter will hold true if there was an error
|
||||
* before the folder picker is shown.
|
||||
* @return true if a file was selected successfully.
|
||||
*/
|
||||
bool
|
||||
nsFilePicker::ShowFolderPicker(const nsString& aInitialDir)
|
||||
nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
|
||||
{
|
||||
nsRefPtr<IFileOpenDialog> dialog;
|
||||
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
|
||||
IID_IFileOpenDialog,
|
||||
getter_AddRefs(dialog))))
|
||||
getter_AddRefs(dialog)))) {
|
||||
aWasInitError = true;
|
||||
return false;
|
||||
}
|
||||
aWasInitError = false;
|
||||
|
||||
// hook up event callbacks
|
||||
dialog->Advise(this, &mFDECookie);
|
||||
@ -840,21 +852,35 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show a file picker post Windows XP
|
||||
*
|
||||
* @param aInitialDir The initial directory, the last used directory will be
|
||||
* used if left blank.
|
||||
* @param aWasInitError Out parameter will hold true if there was an error
|
||||
* before the file picker is shown.
|
||||
* @return true if a file was selected successfully.
|
||||
*/
|
||||
bool
|
||||
nsFilePicker::ShowFilePicker(const nsString& aInitialDir)
|
||||
nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
|
||||
{
|
||||
nsRefPtr<IFileDialog> dialog;
|
||||
if (mMode != modeSave) {
|
||||
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
|
||||
IID_IFileOpenDialog,
|
||||
getter_AddRefs(dialog))))
|
||||
getter_AddRefs(dialog)))) {
|
||||
aWasInitError = true;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (FAILED(CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_INPROC,
|
||||
IID_IFileSaveDialog,
|
||||
getter_AddRefs(dialog))))
|
||||
getter_AddRefs(dialog)))) {
|
||||
aWasInitError = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
aWasInitError = false;
|
||||
|
||||
// hook up event callbacks
|
||||
dialog->Advise(this, &mFDECookie);
|
||||
@ -1017,18 +1043,23 @@ nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||
mUnicodeFile.Truncate();
|
||||
mFiles.Clear();
|
||||
|
||||
bool result = false;
|
||||
if (mMode == modeGetFolder) {
|
||||
// Launch the XP file/folder picker on XP and as a fallback on Vista+.
|
||||
// The CoCreateInstance call to CLSID_FileOpenDialog fails with "(0x80040111)
|
||||
// ClassFactory cannot supply requested class" when the checkbox for
|
||||
// Disable Visual Themes is on in the compatability tab within the shortcut
|
||||
// properties.
|
||||
bool result = false, wasInitError = true;
|
||||
if (mMode == modeGetFolder) {
|
||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||
result = ShowFolderPicker(initialDir);
|
||||
else
|
||||
result = ShowFolderPicker(initialDir, wasInitError);
|
||||
if (!result && wasInitError)
|
||||
result = ShowXPFolderPicker(initialDir);
|
||||
} else {
|
||||
} else {
|
||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||
result = ShowFilePicker(initialDir);
|
||||
else
|
||||
result = ShowFilePicker(initialDir, wasInitError);
|
||||
if (!result && wasInitError)
|
||||
result = ShowXPFilePicker(initialDir);
|
||||
}
|
||||
}
|
||||
|
||||
// exit, and return returnCancel in aReturnVal
|
||||
if (!result)
|
||||
|
@ -91,8 +91,8 @@ protected:
|
||||
bool FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType);
|
||||
bool ShowXPFolderPicker(const nsString& aInitialDir);
|
||||
bool ShowXPFilePicker(const nsString& aInitialDir);
|
||||
bool ShowFolderPicker(const nsString& aInitialDir);
|
||||
bool ShowFilePicker(const nsString& aInitialDir);
|
||||
bool ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError);
|
||||
bool ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError);
|
||||
void AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter);
|
||||
void RememberLastUsedDirectory();
|
||||
bool IsPrivacyModeEnabled();
|
||||
|
Loading…
Reference in New Issue
Block a user