equal
deleted
inserted
replaced
24 ****************************************************************************/ |
24 ****************************************************************************/ |
25 |
25 |
26 #ifndef HB_INPUT_MODE_PROPERTIES_H |
26 #ifndef HB_INPUT_MODE_PROPERTIES_H |
27 #define HB_INPUT_MODE_PROPERTIES_H |
27 #define HB_INPUT_MODE_PROPERTIES_H |
28 |
28 |
|
29 #include <QStringList> |
|
30 |
29 #include <hbinputdef.h> |
31 #include <hbinputdef.h> |
30 #include <hbinputlanguage.h> |
32 #include <hbinputlanguage.h> |
|
33 #include <hbinputstate.h> |
31 |
34 |
32 /*! |
35 /*! |
33 @alpha |
36 @alpha |
34 @hbcore |
37 @hbcore |
35 \class HbInputModeProperties |
38 \class HbInputModeProperties |
50 HbInputModeProperties() { |
53 HbInputModeProperties() { |
51 } |
54 } |
52 |
55 |
53 HbInputModeProperties(HbInputModeType mode, const HbInputLanguage &language, HbKeyboardType keyboard) |
56 HbInputModeProperties(HbInputModeType mode, const HbInputLanguage &language, HbKeyboardType keyboard) |
54 : mMode(mode), mLanguage(language), mKeyboard(keyboard) { |
57 : mMode(mode), mLanguage(language), mKeyboard(keyboard) { |
|
58 } |
|
59 |
|
60 HbInputModeProperties(const HbInputState &state) |
|
61 : mMode(state.inputMode()), mLanguage(state.language()), mKeyboard(state.keyboard()) { |
55 } |
62 } |
56 |
63 |
57 HbInputModeProperties &operator=(const HbInputModeProperties &other) { |
64 HbInputModeProperties &operator=(const HbInputModeProperties &other) { |
58 mMode = other.mMode; |
65 mMode = other.mMode; |
59 mLanguage = other.mLanguage; |
66 mLanguage = other.mLanguage; |
124 /*! |
131 /*! |
125 Returns mode properties in string format. This is used for input method resolving and |
132 Returns mode properties in string format. This is used for input method resolving and |
126 only needed by input method developers. |
133 only needed by input method developers. |
127 */ |
134 */ |
128 QString asString() const { |
135 QString asString() const { |
129 return mLanguage.asString() + QString(" ") + QString::number(mMode) + QString(" ") + QString::number(mKeyboard); |
136 return mLanguage.asString() + QString(' ') + QString::number(mMode) + QString(' ') + QString::number(mKeyboard); |
|
137 } |
|
138 |
|
139 /*! |
|
140 Creates property object from a string generated with asString. |
|
141 */ |
|
142 static HbInputModeProperties fromString(const QString& string) { |
|
143 HbInputModeProperties result; |
|
144 |
|
145 // See asString() for order, amount and type of string parts |
|
146 QStringList parts = string.split(' '); |
|
147 if (parts.count() == 4) { |
|
148 QString languageStr = parts[0] + QString(' ') + parts[1]; |
|
149 HbInputLanguage language; |
|
150 language.fromString(languageStr); |
|
151 result.setLanguage(language); |
|
152 result.setInputMode((HbInputModeType)parts[2].toLong()); |
|
153 result.setKeyboard((HbKeyboardType)parts[3].toLong()); |
|
154 } |
|
155 |
|
156 return result; |
130 } |
157 } |
131 |
158 |
132 private: |
159 private: |
133 HbInputModeType mMode; |
160 HbInputModeType mMode; |
134 HbInputLanguage mLanguage; |
161 HbInputLanguage mLanguage; |