[SHELL32][BROWSEUI] Implement ShellBrowser Apply/Reset default folder settings (#6912)

This commit is contained in:
Whindmar Saksit 2024-06-04 18:37:19 +02:00 committed by GitHub
parent ad73e17418
commit c97c1ad4c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 339 additions and 38 deletions

View file

@ -618,8 +618,18 @@ ViewDlg_CreateTreeImageList(VOID)
}
static BOOL
ViewDlg_OnInitDialog(HWND hwndDlg)
ViewDlg_OnInitDialog(HWND hwndDlg, LPPROPSHEETPAGE psp)
{
SetWindowLongPtr(hwndDlg, GWL_USERDATA, psp->lParam);
CFolderOptions *pFO = (CFolderOptions*)psp->lParam;
if (!pFO || !pFO->CanSetDefFolderSettings())
{
// The global options (started from rundll32 or control panel)
// has no browser to copy the current settings from.
EnableWindow(GetDlgItem(hwndDlg, IDC_VIEW_APPLY_TO_ALL), FALSE);
}
HWND hwndTreeView = GetDlgItem(hwndDlg, IDC_VIEW_TREEVIEW);
s_hTreeImageList = ViewDlg_CreateTreeImageList();
@ -941,7 +951,7 @@ FolderOptionsViewDlg(
switch (uMsg)
{
case WM_INITDIALOG:
return ViewDlg_OnInitDialog(hwndDlg);
return ViewDlg_OnInitDialog(hwndDlg, (LPPROPSHEETPAGE)lParam);
case WM_COMMAND:
switch (LOWORD(wParam))
@ -949,6 +959,18 @@ FolderOptionsViewDlg(
case IDC_VIEW_RESTORE_DEFAULTS: // Restore Defaults
ViewDlg_RestoreDefaults(hwndDlg);
break;
case IDC_VIEW_APPLY_TO_ALL:
case IDC_VIEW_RESET_ALL:
{
HRESULT hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
CFolderOptions *pFO = (CFolderOptions*)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
if (pFO)
hr = pFO->ApplyDefFolderSettings(LOWORD(wParam) == IDC_VIEW_RESET_ALL);
if (FAILED(hr))
SHELL_ErrorBox(hwndDlg, hr);
break;
}
}
break;