[SHELL32] Refresh 'General' tab if the folder icon is updated (#646)

CORE-11407
This commit is contained in:
Katayama Hirofumi MZ 2018-06-29 21:13:37 +09:00 committed by Hermès BÉLUSCA - MAÏTO
parent fafcd50a35
commit e353b48cb2

View file

@ -643,6 +643,7 @@ CFileDefExt::InitGeneralPage(HWND hwndDlg)
INT_PTR CALLBACK INT_PTR CALLBACK
CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -654,7 +655,7 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam); TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam);
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam); pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
pFileDefExt->InitGeneralPage(hwndDlg); pFileDefExt->InitGeneralPage(hwndDlg);
break; break;
@ -662,7 +663,6 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_COMMAND: case WM_COMMAND:
if (LOWORD(wParam) == 14024) /* Opens With - Change */ if (LOWORD(wParam) == 14024) /* Opens With - Change */
{ {
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
OPENASINFO oainfo; OPENASINFO oainfo;
oainfo.pcszFile = pFileDefExt->m_wszPath; oainfo.pcszFile = pFileDefExt->m_wszPath;
oainfo.pcszClass = NULL; oainfo.pcszClass = NULL;
@ -682,8 +682,6 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam; LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
if (lppsn->hdr.code == PSN_APPLY) if (lppsn->hdr.code == PSN_APPLY)
{ {
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
/* Update attributes first */ /* Update attributes first */
DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath); DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath);
if (dwAttr) if (dwAttr)
@ -717,6 +715,19 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
} }
break; break;
} }
case PSM_QUERYSIBLINGS:
{
// reset icon
HWND hIconCtrl = GetDlgItem(hwndDlg, 14025);
HICON hIcon = (HICON)SendMessageW(hIconCtrl, STM_GETICON, 0, 0);
DestroyIcon(hIcon);
hIcon = NULL;
SendMessageW(hIconCtrl, STM_SETICON, (WPARAM)hIcon, 0);
// refresh the page
pFileDefExt->InitGeneralPage(hwndDlg);
return FALSE; // continue
}
default: default:
break; break;
} }
@ -878,6 +889,8 @@ CFileDefExt::VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
break; break;
case WM_DESTROY: case WM_DESTROY:
break; break;
case PSM_QUERYSIBLINGS:
return FALSE; // continue
default: default:
break; break;
} }
@ -949,6 +962,9 @@ CFileDefExt::FolderCustomizePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
break; break;
} }
case PSM_QUERYSIBLINGS:
return FALSE; // continue
case WM_DESTROY: case WM_DESTROY:
pFileDefExt->OnFolderCustDestroy(hwndDlg); pFileDefExt->OnFolderCustDestroy(hwndDlg);
break; break;
@ -1116,6 +1132,9 @@ BOOL CFileDefExt::OnFolderCustApply(HWND hwndDlg)
attrs |= FILE_ATTRIBUTE_READONLY; attrs |= FILE_ATTRIBUTE_READONLY;
SetFileAttributesW(m_wszPath, attrs); SetFileAttributesW(m_wszPath, attrs);
// notify to the siblings
PropSheet_QuerySiblings(GetParent(hwndDlg), 0, 0);
// done! // done!
m_bFolderIconIsSet = FALSE; m_bFolderIconIsSet = FALSE;
} }