mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 16:40:27 +00:00
[SHELL32] Refresh UI on assoc change (SHOpenWithDialog) (#7076)
Fix file association UX. JIRA issue: CORE-19670 - Check the return value of shell32!SHOpenWithDialog function. - If changed, then update the UI display and internal data. - Use OAIF_FORCE_REGISTRATION flag.
This commit is contained in:
parent
edf6b805a7
commit
b41332349a
3 changed files with 32 additions and 5 deletions
|
@ -1049,8 +1049,12 @@ VOID COpenWithDialog::Accept()
|
|||
if (pApp)
|
||||
{
|
||||
/* Set programm as default handler */
|
||||
if (SendDlgItemMessage(m_hDialog, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
if (IsDlgButtonChecked(m_hDialog, 14003) == BST_CHECKED)
|
||||
{
|
||||
m_pAppList->SetDefaultHandler(pApp, m_pInfo->pcszFile);
|
||||
// FIXME: Update DefaultIcon registry
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Execute program */
|
||||
if (m_pInfo->oaifInFlags & OAIF_EXEC)
|
||||
|
|
|
@ -742,8 +742,13 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
OPENASINFO oainfo;
|
||||
oainfo.pcszFile = pFileDefExt->m_wszPath;
|
||||
oainfo.pcszClass = NULL;
|
||||
oainfo.oaifInFlags = OAIF_REGISTER_EXT|OAIF_FORCE_REGISTRATION;
|
||||
return SUCCEEDED(SHOpenWithDialog(hwndDlg, &oainfo));
|
||||
oainfo.oaifInFlags = OAIF_REGISTER_EXT | OAIF_FORCE_REGISTRATION;
|
||||
if (SHOpenWithDialog(hwndDlg, &oainfo) == S_OK)
|
||||
{
|
||||
pFileDefExt->InitGeneralPage(hwndDlg);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (LOWORD(wParam) == 14021 || LOWORD(wParam) == 14022 || LOWORD(wParam) == 14023) /* checkboxes */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
|
|
@ -1673,6 +1673,19 @@ FileTypesDlg_OnItemChanging(HWND hwndDlg, PFILE_TYPE_ENTRY pEntry)
|
|||
EnableWindow(GetDlgItem(hwndDlg, IDC_FILETYPES_DELETE), TRUE);
|
||||
}
|
||||
|
||||
static VOID
|
||||
FileTypesDlg_UpdateAppInfo(HWND hwndDlg, PFILE_TYPE_ENTRY pEntry)
|
||||
{
|
||||
pEntry->ProgramPath[0] = pEntry->AppName[0] = UNICODE_NULL;
|
||||
|
||||
DWORD cch = _countof(pEntry->ProgramPath);
|
||||
if (S_OK == AssocQueryStringW(ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_EXECUTABLE,
|
||||
pEntry->FileExtension, NULL, pEntry->ProgramPath, &cch))
|
||||
{
|
||||
QueryFileDescription(pEntry->ProgramPath, pEntry->AppName, _countof(pEntry->AppName));
|
||||
}
|
||||
}
|
||||
|
||||
// IDD_FOLDER_OPTIONS_FILETYPES
|
||||
INT_PTR CALLBACK
|
||||
FolderOptionsFileTypesDlg(
|
||||
|
@ -1719,10 +1732,15 @@ FolderOptionsFileTypesDlg(
|
|||
if (pEntry)
|
||||
{
|
||||
ZeroMemory(&Info, sizeof(Info));
|
||||
Info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT;
|
||||
Info.oaifInFlags = OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT;
|
||||
Info.pcszFile = pEntry->FileExtension;
|
||||
Info.pcszClass = NULL;
|
||||
SHOpenWithDialog(hwndDlg, &Info);
|
||||
if (SHOpenWithDialog(hwndDlg, &Info) == S_OK)
|
||||
{
|
||||
FileTypesDlg_UpdateAppInfo(hwndDlg, pEntry);
|
||||
FileTypesDlg_OnItemChanging(hwndDlg, pEntry);
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue