using utf8 string to keyboard languages

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent c988c2c0a6
commit 2ab3471c25
  1. 7
      src/frameworks/UBPlatformUtils_mac.mm

@ -413,7 +413,7 @@ KEYBT* createKeyBt(const UCKeyboardLayout* keyLayout, int vkk)
UInt32 deadKeyState = 0L; UInt32 deadKeyState = 0L;
UInt32 kbdType = kKeyboardISO; UInt32 kbdType = kKeyboardISO;
UniCharCount cnt1, cnt2, cnt3; UniCharCount cnt1, cnt2;
UniChar unicodeString1[100], unicodeString2[100], unicodeString3[100]; UniChar unicodeString1[100], unicodeString2[100], unicodeString3[100];
UCKeyTranslate(keyLayout, vkk, kUCKeyActionDisplay, 0, kbdType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 100, &cnt1, unicodeString1); UCKeyTranslate(keyLayout, vkk, kUCKeyActionDisplay, 0, kbdType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 100, &cnt1, unicodeString1);
@ -426,6 +426,7 @@ KEYBT* createKeyBt(const UCKeyboardLayout* keyLayout, int vkk)
void UBPlatformUtils::initializeKeyboardLayouts() void UBPlatformUtils::initializeKeyboardLayouts()
{ {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CFStringRef keys[] = { kTISPropertyInputSourceCategory, kTISPropertyInputSourceIsEnableCapable, kTISPropertyInputSourceIsSelectCapable }; CFStringRef keys[] = { kTISPropertyInputSourceCategory, kTISPropertyInputSourceIsEnableCapable, kTISPropertyInputSourceIsSelectCapable };
const void* values[] = { kTISCategoryKeyboardInputSource, kCFBooleanTrue, kCFBooleanTrue }; const void* values[] = { kTISCategoryKeyboardInputSource, kCFBooleanTrue, kCFBooleanTrue };
CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 3, NULL, NULL); CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 3, NULL, NULL);
@ -506,7 +507,7 @@ void UBPlatformUtils::initializeKeyboardLayouts()
QString ID = QStringFromStringRef(sr); QString ID = QStringFromStringRef(sr);
sr = (CFStringRef) TISGetInputSourceProperty(keyLayoutRef, kTISPropertyLocalizedName); sr = (CFStringRef) TISGetInputSourceProperty(keyLayoutRef, kTISPropertyLocalizedName);
QString fullName = QStringFromStringRef(sr); QString fullName = QString::fromUtf8([sr UTF8String], strlen([sr UTF8String]));
CFArrayRef langs = (CFArrayRef) TISGetInputSourceProperty(keyLayoutRef, kTISPropertyInputSourceLanguages); CFArrayRef langs = (CFArrayRef) TISGetInputSourceProperty(keyLayoutRef, kTISPropertyInputSourceLanguages);
@ -539,7 +540,7 @@ void UBPlatformUtils::initializeKeyboardLayouts()
for(int i=0; i<nKeyboardLayouts; i++) for(int i=0; i<nKeyboardLayouts; i++)
keyboardLayouts[i] = result[i]; keyboardLayouts[i] = result[i];
} }
[pool drain];
} }
void UBPlatformUtils::destroyKeyboardLayouts() void UBPlatformUtils::destroyKeyboardLayouts()

Loading…
Cancel
Save