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
b8d40b05f7
commit
45f24fb0bf
@ -564,14 +564,26 @@ nsFilePicker::ShowXPFolderPicker(const nsString& aInitialDir)
|
|||||||
return result;
|
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
|
bool
|
||||||
nsFilePicker::ShowFolderPicker(const nsString& aInitialDir)
|
nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
|
||||||
{
|
{
|
||||||
nsRefPtr<IFileOpenDialog> dialog;
|
nsRefPtr<IFileOpenDialog> dialog;
|
||||||
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
|
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
|
||||||
IID_IFileOpenDialog,
|
IID_IFileOpenDialog,
|
||||||
getter_AddRefs(dialog))))
|
getter_AddRefs(dialog)))) {
|
||||||
|
aWasInitError = true;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
aWasInitError = false;
|
||||||
|
|
||||||
// hook up event callbacks
|
// hook up event callbacks
|
||||||
dialog->Advise(this, &mFDECookie);
|
dialog->Advise(this, &mFDECookie);
|
||||||
@ -840,21 +852,35 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
|
|||||||
return true;
|
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
|
bool
|
||||||
nsFilePicker::ShowFilePicker(const nsString& aInitialDir)
|
nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
|
||||||
{
|
{
|
||||||
nsRefPtr<IFileDialog> dialog;
|
nsRefPtr<IFileDialog> dialog;
|
||||||
if (mMode != modeSave) {
|
if (mMode != modeSave) {
|
||||||
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
|
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
|
||||||
IID_IFileOpenDialog,
|
IID_IFileOpenDialog,
|
||||||
getter_AddRefs(dialog))))
|
getter_AddRefs(dialog)))) {
|
||||||
|
aWasInitError = true;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (FAILED(CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_INPROC,
|
if (FAILED(CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_INPROC,
|
||||||
IID_IFileSaveDialog,
|
IID_IFileSaveDialog,
|
||||||
getter_AddRefs(dialog))))
|
getter_AddRefs(dialog)))) {
|
||||||
|
aWasInitError = true;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
aWasInitError = false;
|
||||||
|
|
||||||
// hook up event callbacks
|
// hook up event callbacks
|
||||||
dialog->Advise(this, &mFDECookie);
|
dialog->Advise(this, &mFDECookie);
|
||||||
@ -1017,18 +1043,23 @@ nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
|||||||
mUnicodeFile.Truncate();
|
mUnicodeFile.Truncate();
|
||||||
mFiles.Clear();
|
mFiles.Clear();
|
||||||
|
|
||||||
bool result = false;
|
// Launch the XP file/folder picker on XP and as a fallback on Vista+.
|
||||||
if (mMode == modeGetFolder) {
|
// 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)
|
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||||
result = ShowFolderPicker(initialDir);
|
result = ShowFolderPicker(initialDir, wasInitError);
|
||||||
else
|
if (!result && wasInitError)
|
||||||
result = ShowXPFolderPicker(initialDir);
|
result = ShowXPFolderPicker(initialDir);
|
||||||
} else {
|
} else {
|
||||||
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION)
|
||||||
result = ShowFilePicker(initialDir);
|
result = ShowFilePicker(initialDir, wasInitError);
|
||||||
else
|
if (!result && wasInitError)
|
||||||
result = ShowXPFilePicker(initialDir);
|
result = ShowXPFilePicker(initialDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// exit, and return returnCancel in aReturnVal
|
// exit, and return returnCancel in aReturnVal
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -91,8 +91,8 @@ protected:
|
|||||||
bool FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType);
|
bool FilePickerWrapper(OPENFILENAMEW* ofn, PickerType aType);
|
||||||
bool ShowXPFolderPicker(const nsString& aInitialDir);
|
bool ShowXPFolderPicker(const nsString& aInitialDir);
|
||||||
bool ShowXPFilePicker(const nsString& aInitialDir);
|
bool ShowXPFilePicker(const nsString& aInitialDir);
|
||||||
bool ShowFolderPicker(const nsString& aInitialDir);
|
bool ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError);
|
||||||
bool ShowFilePicker(const nsString& aInitialDir);
|
bool ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError);
|
||||||
void AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter);
|
void AppendXPFilter(const nsAString& aTitle, const nsAString& aFilter);
|
||||||
void RememberLastUsedDirectory();
|
void RememberLastUsedDirectory();
|
||||||
bool IsPrivacyModeEnabled();
|
bool IsPrivacyModeEnabled();
|
||||||
|
Loading…
Reference in New Issue
Block a user