Merge pull request #1139 from ONLYOFFICE/patch/hotfix/v8.0.1

Fix bug 65991
This commit is contained in:
Maxim Kadushkin
2024-02-01 15:04:21 +03:00
committed by GitHub
4 changed files with 16 additions and 0 deletions

View File

@ -36,6 +36,7 @@
# include <Shobjidl.h>
#endif
#include "filechooser.h"
#include "utils.h"
using std::wstring;
#ifndef __OS_WIN_XP
@ -248,6 +249,7 @@ QStringList Win::openWinFileChooser(QWidget *parent,
QStringList filenames;
HWND parent_hwnd = (parent) ? (HWND)parent->winId() : nullptr;
WindowHelper::toggleLayoutDirection(parent_hwnd);
nativeFileDialog(parent_hwnd,
mode,
filenames,
@ -258,5 +260,6 @@ QStringList Win::openWinFileChooser(QWidget *parent,
sel_filter,
sel_multiple);
WindowHelper::toggleLayoutDirection(parent_hwnd);
return filenames;
}

View File

@ -397,6 +397,7 @@ QDialog::DialogCode PrintDialog::exec()
PrintDialogCallback clb(&dialog_was_changed);
dlg.lpCallback = static_cast<IPrintDialogCallback*>(&clb);
WindowHelper::toggleLayoutDirection(parent_hwnd);
QDialog::DialogCode exit_code = QDialog::DialogCode::Rejected;
HRESULT hr = PrintDlgEx(&dlg);
if (hr == S_OK) {
@ -485,6 +486,7 @@ QDialog::DialogCode PrintDialog::exec()
}
GlobalFree(page_ranges);
WindowHelper::toggleLayoutDirection(parent_hwnd);
return exit_code;
}

View File

@ -1004,6 +1004,16 @@ namespace WindowHelper {
::SetActiveWindow(hwnd);
::AttachThreadInput(frgID, appID, FALSE);
}
auto toggleLayoutDirection(HWND hwnd) -> void
{
LONG exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
if (exstyle & WS_EX_LAYOUTRTL)
SetWindowLong(hwnd, GWL_EXSTYLE, exstyle & ~WS_EX_LAYOUTRTL);
else
if (AscAppManager::isRtlEnabled())
SetWindowLong(hwnd, GWL_EXSTYLE, exstyle | WS_EX_LAYOUTRTL);
}
#endif
auto correctWindowMinimumSize(const QRect& windowrect, const QSize& minsize) -> QSize

View File

@ -159,6 +159,7 @@ namespace WindowHelper {
auto correctModalOrder(HWND windowhandle, HWND modalhandle) -> void;
auto adjustWindowRect(HWND, double, LPRECT) -> void;
auto bringToTop(HWND) -> void;
auto toggleLayoutDirection(HWND hwnd) -> void;
#endif
auto correctWindowMinimumSize(const QRect&, const QSize&) -> QSize;