diff -r 7516d6d86cf5 -r ed14f46c0e55 src/hbcore/inputfw/hbinputmodeproperties.h --- a/src/hbcore/inputfw/hbinputmodeproperties.h Mon Oct 04 17:49:30 2010 +0300 +++ b/src/hbcore/inputfw/hbinputmodeproperties.h Mon Oct 18 18:23:13 2010 +0300 @@ -26,8 +26,11 @@ #ifndef HB_INPUT_MODE_PROPERTIES_H #define HB_INPUT_MODE_PROPERTIES_H +#include + #include #include +#include /*! @alpha @@ -54,6 +57,10 @@ : mMode(mode), mLanguage(language), mKeyboard(keyboard) { } + HbInputModeProperties(const HbInputState &state) + : mMode(state.inputMode()), mLanguage(state.language()), mKeyboard(state.keyboard()) { + } + HbInputModeProperties &operator=(const HbInputModeProperties &other) { mMode = other.mMode; mLanguage = other.mLanguage; @@ -126,7 +133,27 @@ only needed by input method developers. */ QString asString() const { - return mLanguage.asString() + QString(" ") + QString::number(mMode) + QString(" ") + QString::number(mKeyboard); + return mLanguage.asString() + QString(' ') + QString::number(mMode) + QString(' ') + QString::number(mKeyboard); + } + + /*! + Creates property object from a string generated with asString. + */ + static HbInputModeProperties fromString(const QString& string) { + HbInputModeProperties result; + + // See asString() for order, amount and type of string parts + QStringList parts = string.split(' '); + if (parts.count() == 4) { + QString languageStr = parts[0] + QString(' ') + parts[1]; + HbInputLanguage language; + language.fromString(languageStr); + result.setLanguage(language); + result.setInputMode((HbInputModeType)parts[2].toLong()); + result.setKeyboard((HbKeyboardType)parts[3].toLong()); + } + + return result; } private: