summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2010-03-26 12:53:30 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2010-03-26 12:54:31 (GMT)
commit0d5c68c7e4f31300ac6736203cea4f67e8b825b5 (patch)
tree496b2c95a52051dfb7bfce1b0a81be188480ee13 /src/gui/inputmethod
parentea0f3f7db1d62b2ee94addbeb991061bc2811745 (diff)
downloadQt-0d5c68c7e4f31300ac6736203cea4f67e8b825b5.zip
Qt-0d5c68c7e4f31300ac6736203cea4f67e8b825b5.tar.gz
Qt-0d5c68c7e4f31300ac6736203cea4f67e8b825b5.tar.bz2
QInputContextFactory::languages implementation for Symbian.
Task-number: QTBUG-6851 Reviewed-by: Sami Merila
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r--src/gui/inputmethod/inputmethod.pri2
-rw-r--r--src/gui/inputmethod/qinputcontextfactory.cpp47
2 files changed, 47 insertions, 2 deletions
diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri
index 6d9f748..02e3e57 100644
--- a/src/gui/inputmethod/inputmethod.pri
+++ b/src/gui/inputmethod/inputmethod.pri
@@ -26,6 +26,6 @@ mac:!embedded {
symbian:contains(QT_CONFIG, s60) {
HEADERS += inputmethod/qcoefepinputcontext_p.h
SOURCES += inputmethod/qcoefepinputcontext_s60.cpp
- LIBS += -lfepbase
+ LIBS += -lfepbase -lakninputlanguage
}
diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp
index 501a36e..d47e343 100644
--- a/src/gui/inputmethod/qinputcontextfactory.cpp
+++ b/src/gui/inputmethod/qinputcontextfactory.cpp
@@ -73,6 +73,7 @@
#endif
#ifdef Q_WS_S60
#include "qcoefepinputcontext_p.h"
+#include "akninputlanguageinfo.h"
#endif
#include "private/qfactoryloader_p.h"
@@ -198,6 +199,42 @@ QStringList QInputContextFactory::keys()
return result;
}
+#if defined(Q_WS_S60)
+/*!
+ \internal
+
+ This function contains pure Symbian exception handling code for
+ getting S60 language list.
+ Returned object ownership is transfered to caller.
+*/
+static CAknInputLanguageList* s60LangListL()
+{
+ CAknInputLanguageInfo *langInfo = AknInputLanguageInfoFactory::CreateInputLanguageInfoL();
+ CleanupStack::PushL(langInfo);
+ // In rare phone there is more than 7 languages installed -> use 7 as an array granularity
+ CAknInputLanguageList *langList = new (ELeave) CAknInputLanguageList(7);
+ CleanupStack::PushL(langList);
+ langInfo->AppendAvailableLanguagesL(langList);
+ CleanupStack::Pop(langList);
+ CleanupStack::PopAndDestroy(langInfo);
+ return langList;
+}
+
+/*!
+ \internal
+
+ This function utility function return S60 language list.
+ Returned object ownership is transfered to caller.
+*/
+static CAknInputLanguageList* s60LangList()
+{
+ CAknInputLanguageList *langList = NULL;
+ TRAP_IGNORE(langList = s60LangListL());
+ q_check_ptr(langList);
+ return langList;
+}
+#endif
+
/*!
Returns the languages supported by the QInputContext object
specified by \a key.
@@ -229,7 +266,15 @@ QStringList QInputContextFactory::languages( const QString &key )
#endif
#if defined(Q_WS_S60)
if (key == QLatin1String("coefep"))
- return QStringList(QString());
+ {
+ CAknInputLanguageList *langList = s60LangList();
+ int count = langList->Count();
+ for (int i = 0; i < count; ++i)
+ {
+ result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode())));
+ }
+ delete langList;
+ }
#endif
#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
Q_UNUSED(key);