--- a/src/hbcore/inputfw/hbinputmodecache.cpp Wed Jun 23 18:33:25 2010 +0300
+++ b/src/hbcore/inputfw/hbinputmodecache.cpp Tue Jul 06 14:36:53 2010 +0300
@@ -33,6 +33,7 @@
#include "hbinpututils.h"
#include "hbinputmethod.h"
+#include "hbinputcontextplugin.h"
#include "hbinputsettingproxy.h"
#include "hbinputmodeproperties.h"
#include "hbinputkeymapfactory.h"
@@ -151,6 +152,13 @@
listItem.descriptor.setKey(key);
listItem.descriptor.setDisplayName(inputContextPlugin->displayName(key));
+ HbInputContextPlugin *extension = qobject_cast<HbInputContextPlugin *>(inputContextPlugin);
+ if (extension) {
+ listItem.descriptor.setDisplayNames(extension->displayNames(key));
+ listItem.descriptor.setIcon(extension->icon(key));
+ listItem.descriptor.setIcons(extension->icons(key));
+ }
+
int index = mMethods.indexOf(listItem);
if (index >= 0) {
// The method is already in the list, the situation hasn't changed.
@@ -364,7 +372,7 @@
/*!
\internal
-Lists custom input methods.
+Lists all custom input methods.
*/
QList<HbInputMethodDescriptor> HbInputModeCache::listCustomInputMethods()
{
@@ -387,6 +395,61 @@
/*!
\internal
+Lists custom input methods for given parameters.
+*/
+QList<HbInputMethodDescriptor> HbInputModeCache::listCustomInputMethods(Qt::Orientation orientation, const HbInputLanguage &language)
+{
+ Q_D(HbInputModeCache);
+
+ QList<HbInputMethodDescriptor> result;
+
+ foreach (const HbInputMethodListItem &item, d->mMethods) {
+ foreach (const QString &lang, item.languages) {
+ HbInputModeProperties properties = d->propertiesFromString(lang);
+
+ // Find custom methods that supports given language or any language and
+ // supports given orientation
+ if (properties.inputMode() == HbInputModeCustom &&
+ (properties.language() == language || properties.language() == HbInputLanguage()) &&
+ ((orientation == Qt::Vertical && properties.keyboard() == HbKeyboardTouchPortrait) ||
+ (orientation == Qt::Horizontal && properties.keyboard() == HbKeyboardTouchLandscape))) {
+ result.append(item.descriptor);
+ break;
+ }
+ }
+ }
+
+ return result;
+}
+
+/*!
+\internal
+Returns default input method for given orientation.
+*/
+HbInputMethodDescriptor HbInputModeCache::defaultInputMethod(Qt::Orientation orientation)
+{
+ Q_D(HbInputModeCache);
+
+ HbInputMethodDescriptor result;
+ foreach (const HbInputMethodListItem &item, d->mMethods) {
+ foreach (const QString &language, item.languages) {
+ HbInputModeProperties properties = d->propertiesFromString(language);
+
+ // Find default method that supports given orientation
+ if (properties.inputMode() == HbInputModeDefault &&
+ ((orientation == Qt::Vertical && properties.keyboard() == HbKeyboardTouchPortrait) ||
+ (orientation == Qt::Horizontal && properties.keyboard() == HbKeyboardTouchLandscape))) {
+ result = item.descriptor;
+ break;
+ }
+ }
+ }
+
+ return result;
+}
+
+/*!
+\internal
Find correct handler for given input state.
*/
HbInputMethod *HbInputModeCache::findStateHandler(const HbInputState &state)