mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[RAPPS] Must apply settings changes when a new download folder is created (#7792)
This commit is contained in:
parent
dba4efbcae
commit
d769f5675d
4 changed files with 29 additions and 23 deletions
|
@ -173,17 +173,10 @@ struct InstallInfo : CommonInfo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT
|
static inline UINT
|
||||||
ErrorBox(UINT Error = GetLastError())
|
ErrorBox(UINT Error = GetLastError())
|
||||||
{
|
{
|
||||||
if (!Error)
|
return g_pInfo->Error = ErrorBox(g_pInfo->GetGuiOwner(), Error);
|
||||||
Error = ERROR_INTERNAL_ERROR;
|
|
||||||
WCHAR buf[400];
|
|
||||||
UINT fmf = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM;
|
|
||||||
FormatMessageW(fmf, NULL, Error, 0, buf, _countof(buf), NULL);
|
|
||||||
MessageBoxW(g_pInfo->GetGuiOwner(), buf, 0, MB_OK | MB_ICONSTOP);
|
|
||||||
g_pInfo->Error = Error;
|
|
||||||
return Error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static LPCWSTR
|
static LPCWSTR
|
||||||
|
|
|
@ -26,6 +26,9 @@ ErrorFromHResult(HRESULT hr)
|
||||||
return hr >= 0 ? ERROR_SUCCESS : hr;
|
return hr >= 0 ? ERROR_SUCCESS : hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT
|
||||||
|
ErrorBox(HWND hOwner, UINT Error = GetLastError());
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CopyTextToClipboard(LPCWSTR lpszText);
|
CopyTextToClipboard(LPCWSTR lpszText);
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -12,6 +12,18 @@
|
||||||
|
|
||||||
static HANDLE hLog = NULL;
|
static HANDLE hLog = NULL;
|
||||||
|
|
||||||
|
UINT
|
||||||
|
ErrorBox(HWND hOwner, UINT Error)
|
||||||
|
{
|
||||||
|
if (!Error)
|
||||||
|
Error = ERROR_INTERNAL_ERROR; // Note: geninst.cpp depends on this
|
||||||
|
WCHAR buf[400];
|
||||||
|
UINT fmf = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM;
|
||||||
|
FormatMessageW(fmf, NULL, Error, 0, buf, _countof(buf), NULL);
|
||||||
|
MessageBoxW(hOwner, buf, 0, MB_OK | MB_ICONSTOP);
|
||||||
|
return Error;
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CopyTextToClipboard(LPCWSTR lpszText)
|
CopyTextToClipboard(LPCWSTR lpszText)
|
||||||
{
|
{
|
||||||
|
|
|
@ -256,11 +256,6 @@ SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
case IDOK:
|
case IDOK:
|
||||||
{
|
{
|
||||||
HandleGeneralListItems(GetDlgItem(hDlg, IDC_GENERALLIST), NULL, &NewSettingsInfo);
|
HandleGeneralListItems(GetDlgItem(hDlg, IDC_GENERALLIST), NULL, &NewSettingsInfo);
|
||||||
if (SettingsInfo.bSmallIcons != NewSettingsInfo.bSmallIcons)
|
|
||||||
{
|
|
||||||
SendMessageW(hMainWnd, WM_SETTINGCHANGE, SPI_SETICONMETRICS, 0); // Note: WM_SETTINGCHANGE cannot be posted
|
|
||||||
PostMessageW(hMainWnd, WM_COMMAND, ID_REFRESH, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
CStringW szDir;
|
CStringW szDir;
|
||||||
CStringW szSource;
|
CStringW szSource;
|
||||||
|
@ -288,23 +283,21 @@ SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
NewSettingsInfo.szNoProxyFor, _countof(NewSettingsInfo.szNoProxyFor), szNoProxy,
|
NewSettingsInfo.szNoProxyFor, _countof(NewSettingsInfo.szNoProxyFor), szNoProxy,
|
||||||
szNoProxy.GetLength() + 1);
|
szNoProxy.GetLength() + 1);
|
||||||
|
|
||||||
|
CStringW::CopyChars(
|
||||||
|
NewSettingsInfo.szDownloadDir, _countof(NewSettingsInfo.szDownloadDir), szDir,
|
||||||
|
szDir.GetLength() + 1);
|
||||||
dwAttr = GetFileAttributesW(szDir);
|
dwAttr = GetFileAttributesW(szDir);
|
||||||
if (dwAttr != INVALID_FILE_ATTRIBUTES && (dwAttr & FILE_ATTRIBUTE_DIRECTORY))
|
if (dwAttr == INVALID_FILE_ATTRIBUTES || !(dwAttr & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
|
||||||
CStringW::CopyChars(
|
|
||||||
NewSettingsInfo.szDownloadDir, _countof(NewSettingsInfo.szDownloadDir), szDir,
|
|
||||||
szDir.GetLength() + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
CStringW szMsgText;
|
CStringW szMsgText;
|
||||||
szMsgText.LoadStringW(IDS_CHOOSE_FOLDER_ERROR);
|
szMsgText.LoadStringW(IDS_CHOOSE_FOLDER_ERROR);
|
||||||
|
|
||||||
if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
|
if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
|
||||||
{
|
{
|
||||||
if (CreateDirectoryW(szDir, NULL))
|
if (!CreateDirectoryW(szDir, NULL))
|
||||||
{
|
{
|
||||||
EndDialog(hDlg, LOWORD(wParam));
|
ErrorBox(hDlg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -330,6 +323,11 @@ SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
szSource.GetLength() + 1);
|
szSource.GetLength() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SettingsInfo.bSmallIcons != NewSettingsInfo.bSmallIcons)
|
||||||
|
{
|
||||||
|
SendMessageW(hMainWnd, WM_SETTINGCHANGE, SPI_SETICONMETRICS, 0); // Note: WM_SETTINGCHANGE cannot be posted
|
||||||
|
PostMessageW(hMainWnd, WM_COMMAND, ID_REFRESH, 0);
|
||||||
|
}
|
||||||
SettingsInfo = NewSettingsInfo;
|
SettingsInfo = NewSettingsInfo;
|
||||||
SaveSettings(GetParent(hDlg), &SettingsInfo);
|
SaveSettings(GetParent(hDlg), &SettingsInfo);
|
||||||
EndDialog(hDlg, LOWORD(wParam));
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
|
Loading…
Reference in a new issue