mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[CPL][INTL] Realize automatic Japanese IME installation (#4705)
In intl.cpl, realize semi-automatic Japanese IME installation by checkbox "Install files for East Asian languages" by using rapps.exe. CORE-11700
This commit is contained in:
parent
32c20ab112
commit
34635e1585
1 changed files with 65 additions and 0 deletions
|
@ -1,6 +1,16 @@
|
|||
#include "intl.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
/* Is there any Japanese input method? */
|
||||
BOOL HasJapaneseIME(VOID)
|
||||
{
|
||||
WCHAR szImePath[MAX_PATH];
|
||||
GetSystemDirectoryW(szImePath, _countof(szImePath));
|
||||
StringCchCatW(szImePath, _countof(szImePath), L"\\mzimeja.ime");
|
||||
return GetFileAttributesW(szImePath) != INVALID_FILE_ATTRIBUTES;
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
|
@ -25,6 +35,24 @@ LanguagesPageProc(HWND hwndDlg,
|
|||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_RTOL_LANG), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
|
||||
}
|
||||
|
||||
/* EAST ASIAN specific */
|
||||
switch (PRIMARYLANGID(GetUserDefaultLangID()))
|
||||
{
|
||||
case LANG_JAPANESE:
|
||||
if (HasJapaneseIME())
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
|
||||
CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN, BST_CHECKED);
|
||||
}
|
||||
break;
|
||||
|
||||
case LANG_CHINESE: /* Not supported yet */
|
||||
case LANG_KOREAN: /* Not supported yet */
|
||||
default:
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -46,6 +74,43 @@ LanguagesPageProc(HWND hwndDlg,
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_INST_FILES_FOR_ASIAN:
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
||||
{
|
||||
/* Apply changes */
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_INST_FILES_FOR_ASIAN) == BST_CHECKED)
|
||||
{
|
||||
/* EAST ASIAN specific */
|
||||
switch (PRIMARYLANGID(GetUserDefaultLangID()))
|
||||
{
|
||||
case LANG_JAPANESE:
|
||||
if (HasJapaneseIME())
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
|
||||
CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN, BST_CHECKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShellExecuteW(hwndDlg, NULL, L"rapps.exe", L"/INSTALL mzimeja",
|
||||
NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
break;
|
||||
|
||||
case LANG_CHINESE: /* Not supported yet */
|
||||
case LANG_KOREAN: /* Not supported yet */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue