src/gui/kernel/qkeymapper_x11.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
--- a/src/gui/kernel/qkeymapper_x11.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/gui/kernel/qkeymapper_x11.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -80,22 +80,15 @@
       (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
 #endif
 
-void q_getLocaleAndDirection(QLocale *locale,
-                                  Qt::LayoutDirection *direction,
-                                  const QByteArray &layoutName,
-                                  const QByteArray &variantName)
+QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName)
 {
     int i = 0;
     while (xkbLayoutData[i].layout != 0) {
-        if (layoutName == xkbLayoutData[i].layout && variantName == xkbLayoutData[i].variant) {
-            *locale = QLocale(xkbLayoutData[i].language, xkbLayoutData[i].country);
-            *direction = xkbLayoutData[i].direction;
-            return;
-        }
+        if (layoutName == xkbLayoutData[i].layout && variantName == xkbLayoutData[i].variant)
+            return QLocale(xkbLayoutData[i].language, xkbLayoutData[i].country);
         ++i;
     }
-    *locale = QLocale::c();
-    *direction = Qt::LeftToRight;
+    return QLocale::c();
 }
 #endif // QT_NO_XKB
 
@@ -523,10 +516,8 @@
         // if (keyboardLayoutName.isEmpty())
         //     qWarning("Qt: unable to determine keyboard layout, please talk to qt-bugs@trolltech.com"); ?
 
-        q_getLocaleAndDirection(&keyboardInputLocale,
-                              &keyboardInputDirection,
-                              layoutName,
-                              variantName);
+        keyboardInputLocale = q_getKeyboardLocale(layoutName, variantName);
+        keyboardInputDirection = keyboardInputLocale.textDirection();
 
 #if 0
         qDebug() << "keyboard input locale ="