Commit 4fb6c014 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

msctf: Use ITfCategoryMgr::FindClosestCategory to set catid when enuming language profiles.

parent d2647356
...@@ -72,6 +72,7 @@ typedef struct tagEnumTfLanguageProfiles { ...@@ -72,6 +72,7 @@ typedef struct tagEnumTfLanguageProfiles {
DWORD lang_index; DWORD lang_index;
LANGID langid; LANGID langid;
ITfCategoryMgr *catmgr;
} EnumTfLanguageProfiles; } EnumTfLanguageProfiles;
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut);
...@@ -670,6 +671,7 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This) ...@@ -670,6 +671,7 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This)
RegCloseKey(This->tipkey); RegCloseKey(This->tipkey);
if (This->langkey) if (This->langkey)
RegCloseKey(This->langkey); RegCloseKey(This->langkey);
ITfCategoryMgr_Release(This->catmgr);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
} }
...@@ -746,6 +748,9 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA ...@@ -746,6 +748,9 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
if (tflp) if (tflp)
{ {
static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
&GUID_TFCAT_TIP_SPEECH,
&GUID_TFCAT_TIP_HANDWRITING };
res = CLSIDFromString(profileid, &profile); res = CLSIDFromString(profileid, &profile);
if (FAILED(res)) return 0; if (FAILED(res)) return 0;
...@@ -754,7 +759,10 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA ...@@ -754,7 +759,10 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
/* FIXME */ /* FIXME */
tflp->fActive = FALSE; tflp->fActive = FALSE;
tflp->guidProfile = profile; tflp->guidProfile = profile;
/* FIXME set catid */ if (ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
&tflp->catid, tipcats, 3) != S_OK)
ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
&tflp->catid, NULL, 0);
} }
return 1; return 1;
...@@ -865,6 +873,7 @@ static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={ ...@@ -865,6 +873,7 @@ static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut) static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut)
{ {
HRESULT hr;
EnumTfLanguageProfiles *This; EnumTfLanguageProfiles *This;
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(EnumTfLanguageProfiles)); This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(EnumTfLanguageProfiles));
...@@ -875,6 +884,13 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage ...@@ -875,6 +884,13 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage
This->refCount = 1; This->refCount = 1;
This->langid = langid; This->langid = langid;
hr = CategoryMgr_Constructor(NULL,(IUnknown**)&This->catmgr);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(),0,This);
return hr;
}
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0, if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS) KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS)
return E_FAIL; return E_FAIL;
......
...@@ -115,7 +115,7 @@ static void test_EnumLanguageProfiles(void) ...@@ -115,7 +115,7 @@ static void test_EnumLanguageProfiles(void)
{ {
found = TRUE; found = TRUE;
ok(profile.langid == gLangid, "LangId Incorrect\n"); ok(profile.langid == gLangid, "LangId Incorrect\n");
todo_wine ok(IsEqualGUID(&profile.catid,&GUID_TFCAT_TIP_KEYBOARD), "CatId Incorrect\n"); ok(IsEqualGUID(&profile.catid,&GUID_TFCAT_TIP_KEYBOARD), "CatId Incorrect\n");
ok(IsEqualGUID(&profile.guidProfile,&CLSID_FakeService), "guidProfile Incorrect\n"); ok(IsEqualGUID(&profile.guidProfile,&CLSID_FakeService), "guidProfile Incorrect\n");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment