|
|
|
@ -74,32 +74,35 @@ void SetMacLocaleByIdentifier(const QString& id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UBKeyboardPalette::onActivated(bool activated) |
|
|
|
|
{ |
|
|
|
|
if (activated) |
|
|
|
|
{ |
|
|
|
|
TISInputSourceRef selectedLocale = TISCopyCurrentKeyboardInputSource(); |
|
|
|
|
|
|
|
|
|
CFStringRef sr = (CFStringRef) TISGetInputSourceProperty(selectedLocale, |
|
|
|
|
kTISPropertyInputSourceID);
|
|
|
|
|
|
|
|
|
|
if (sr!=NULL) |
|
|
|
|
{ |
|
|
|
|
char tmp[1024]; |
|
|
|
|
CFStringGetCString(sr, tmp, 1024, 0); |
|
|
|
|
activeLocale = tmp;
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
activeLocale = ""; |
|
|
|
|
|
|
|
|
|
void UBKeyboardPalette::checkLayout() |
|
|
|
|
{ |
|
|
|
|
TISInputSourceRef selectedLocale = TISCopyCurrentKeyboardInputSource(); |
|
|
|
|
|
|
|
|
|
CFStringRef sr = (CFStringRef) TISGetInputSourceProperty(selectedLocale, |
|
|
|
|
kTISPropertyInputSourceID); |
|
|
|
|
|
|
|
|
|
if (sr!=NULL) |
|
|
|
|
{ |
|
|
|
|
char clId[1024]; |
|
|
|
|
CFStringGetCString(sr, clId, 1024, 0); |
|
|
|
|
|
|
|
|
|
for(int i=0; i<nLocalesCount;i++) |
|
|
|
|
{ |
|
|
|
|
if (locales[i]->id == clId) |
|
|
|
|
{ |
|
|
|
|
if (nCurrentLocale!=i) |
|
|
|
|
{ |
|
|
|
|
setLocale(i); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onLocaleChanged(locales[nCurrentLocale]); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (activeLocale != "") |
|
|
|
|
SetMacLocaleByIdentifier(activeLocale); |
|
|
|
|
} |
|
|
|
|
void UBKeyboardPalette::onActivated(bool) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* locale) |
|
|
|
|