69 qreal HbInputSettingListPrivate::languageNameWidth() |
69 qreal HbInputSettingListPrivate::languageNameWidth() |
70 { |
70 { |
71 qreal nameWidth(0); |
71 qreal nameWidth(0); |
72 QList<HbInputLanguage> languages; |
72 QList<HbInputLanguage> languages; |
73 HbInputUtils::listSupportedInputLanguages(languages); |
73 HbInputUtils::listSupportedInputLanguages(languages); |
74 QFontMetrics fontMetrics(HbFontSpec(HbFontSpec::Primary).font()); |
74 QFontMetrics fontMetrics(mLanguageButton->font()); |
75 |
75 |
76 foreach (HbInputLanguage language, languages) { |
76 foreach (HbInputLanguage language, languages) { |
77 qreal width = fontMetrics.width(language.localisedName()); |
77 qreal width = fontMetrics.width(language.localisedName()); |
78 if (width > nameWidth) { |
78 if (width > nameWidth) { |
79 nameWidth = width; |
79 nameWidth = width; |
111 d->mOptionList = new HbListWidget(this); |
111 d->mOptionList = new HbListWidget(this); |
112 d->mOptionList->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
112 d->mOptionList->setFontSpec(HbFontSpec(HbFontSpec::Primary)); |
113 d->mOptionList->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); |
113 d->mOptionList->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); |
114 d->mOptionList->setObjectName("Input options list"); |
114 d->mOptionList->setObjectName("Input options list"); |
115 d->mOptionList->addItem(HbIcon(settingsIcon), tr("Input settings")); |
115 d->mOptionList->addItem(HbIcon(settingsIcon), tr("Input settings")); |
|
116 d->mOptionList->setPreferredWidth(300); |
116 |
117 |
117 gridLayout->addItem(languageLabel, 0, 0); |
118 gridLayout->addItem(languageLabel, 0, 0); |
118 gridLayout->addItem(d->mLanguageButton, 0, 1); |
119 gridLayout->addItem(d->mLanguageButton, 0, 1); |
119 gridLayout->addItem(predictionLabel, 1, 0); |
120 gridLayout->addItem(predictionLabel, 1, 0); |
120 gridLayout->addItem(d->mPredictionButton, 1, 1); |
121 gridLayout->addItem(d->mPredictionButton, 1, 1); |
168 HbInputSettingList::~HbInputSettingList() |
169 HbInputSettingList::~HbInputSettingList() |
169 { |
170 { |
170 } |
171 } |
171 |
172 |
172 /*! |
173 /*! |
173 \deprecated HbInputSettingList::showSettingList() |
|
174 is deprecated. Use updateSettingList and open functions instead. |
|
175 */ |
|
176 void HbInputSettingList::showSettingList() |
|
177 { |
|
178 } |
|
179 |
|
180 /*! |
|
181 Updates settings list with current values |
174 Updates settings list with current values |
182 */ |
175 */ |
183 void HbInputSettingList::updateSettingList() |
176 void HbInputSettingList::updateSettingList() |
184 { |
177 { |
185 Q_D(HbInputSettingList); |
178 Q_D(HbInputSettingList); |
229 */ |
222 */ |
230 void HbInputSettingList::languageButtonClicked() |
223 void HbInputSettingList::languageButtonClicked() |
231 { |
224 { |
232 Q_D(HbInputSettingList); |
225 Q_D(HbInputSettingList); |
233 |
226 |
|
227 HbInputSettingProxy *settings = HbInputSettingProxy::instance(); |
|
228 HbPredictionFactory *predFactory = HbPredictionFactory::instance(); |
234 if (d->mSecondaryLanguage == HbInputLanguage()) { |
229 if (d->mSecondaryLanguage == HbInputLanguage()) { |
235 emit inputSettingsButtonClicked(); |
230 emit inputSettingsButtonClicked(); |
236 } else { |
231 } else { |
237 HbInputLanguage language = d->mPrimaryLanguage; |
232 HbInputLanguage language = d->mPrimaryLanguage; |
|
233 bool oldPLangSupportsPrediction = (predFactory->predictionEngineForLanguage(language) != NULL); |
238 d->mPrimaryLanguage = d->mSecondaryLanguage; |
234 d->mPrimaryLanguage = d->mSecondaryLanguage; |
239 d->mSecondaryLanguage = language; |
235 d->mSecondaryLanguage = language; |
240 |
236 |
241 HbInputSettingProxy::instance()->setGlobalInputLanguage(d->mPrimaryLanguage); |
237 HbInputSettingProxy::instance()->setGlobalInputLanguage(d->mPrimaryLanguage); |
|
238 bool langSupportsPrediction = (predFactory->predictionEngineForLanguage(d->mPrimaryLanguage) != NULL); |
242 HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(d->mSecondaryLanguage); |
239 HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(d->mSecondaryLanguage); |
243 |
240 |
244 if (!HbPredictionFactory::instance()->predictionEngineForLanguage(d->mPrimaryLanguage)) { |
241 if( oldPLangSupportsPrediction != langSupportsPrediction) { |
245 HbInputSettingProxy::instance()->setPredictiveInputStatus(false); |
242 settings->setPredictiveInputStatusForActiveKeyboard(langSupportsPrediction); |
246 } |
243 } |
247 } |
244 } |
248 |
245 |
249 close(); |
246 close(); |
250 } |
247 } |
251 |
248 |
295 |
292 |
296 d->mSecondaryLanguage = HbInputLanguage(newLanguage); |
293 d->mSecondaryLanguage = HbInputLanguage(newLanguage); |
297 } |
294 } |
298 |
295 |
299 /*! |
296 /*! |
300 \deprecated HbInputSettingList::predictionStatusChanged(int) |
|
301 is deprecated. Use predictionStatusChanged(bool) instead. |
|
302 |
|
303 Updates prediction button text |
|
304 */ |
|
305 void HbInputSettingList::predictionStatusChanged(int newStatus) |
|
306 { |
|
307 Q_UNUSED(newStatus); |
|
308 } |
|
309 |
|
310 /*! |
|
311 Updates prediction button text |
297 Updates prediction button text |
312 */ |
298 */ |
313 void HbInputSettingList::predictionStatusChanged(HbKeyboardSettingFlags keyboardType, bool newStatus) |
299 void HbInputSettingList::predictionStatusChanged(HbKeyboardSettingFlags keyboardType, bool newStatus) |
314 { |
300 { |
315 Q_D(HbInputSettingList); |
301 Q_D(HbInputSettingList); |