- Fix bug with addition of keyboard layouts

svn path=/trunk/; revision=38883
This commit is contained in:
Dmitry Chapyshev 2009-01-18 11:20:32 +00:00
parent 667636f08a
commit 88cd4628a0
2 changed files with 34 additions and 6 deletions

View file

@ -106,15 +106,40 @@ AddNewLayout(HWND hwndDlg)
return;
}
if (GetLayoutName(LangID, Layout))
if (_tcscmp(LangID, pts) != 0)
{
if ((SendMessage(hLayoutList, CB_SELECTSTRING, (WPARAM) -1, (LPARAM)Layout) != CB_ERR)&&
(GetLayoutCount(Lang) >= 1))
if (!GetLayoutName(pts, Layout))
{
wsprintf(SubPath, _T("d%03d%s"), GetLayoutCount(Lang)-1, Lang);
RegCloseKey(hKey);
return;
}
}
else
{
if (!GetLayoutName(LangID, Layout))
{
RegCloseKey(hKey);
return;
}
}
if (SendMessage(hLayoutList, CB_SELECTSTRING, (WPARAM) -1, (LPARAM)Layout) != CB_ERR)
{
if (GetLayoutCount(Lang) >= 1)
{
wsprintf(SubPath, _T("d%03d%s"), GetLayoutCount(Lang), Lang);
}
else if ((_tcscmp(LangID, pts) != 0) && (GetLayoutCount(Lang) == 0))
{
wsprintf(SubPath, _T("d%03d%s"), 0, Lang);
}
else SubPath[0] = '\0';
}
else
{
RegCloseKey(hKey);
return;
}
if (_tcslen(SubPath) != 0)
{

View file

@ -64,7 +64,10 @@ IsLayoutExists(LPTSTR szLayoutID, LPTSTR szLangID)
GetLocaleInfo(langid, LOCALE_ILANGUAGE, szTmp, sizeof(szTmp) / sizeof(TCHAR));
wsprintf(szOldLangID, _T("0000%s"), szTmp);
if (_tcscmp(szOldLangID, szLangID) == 0) IsLangExists = TRUE;
if (_tcscmp(szOldLangID, szLangID) == 0)
IsLangExists = TRUE;
else
IsLangExists = FALSE;
if (szPreload[0] == 'd')
{
@ -84,7 +87,7 @@ IsLayoutExists(LPTSTR szLayoutID, LPTSTR szLangID)
}
else
{
if (_tcscmp(szPreload, szLayoutID) == 0)
if ((_tcscmp(szPreload, szLayoutID) == 0) && (IsLangExists))
{
RegCloseKey(hKey);
return TRUE;