changeset 34 | ed14f46c0e55 |
parent 6 | c3690ec91ef8 |
31:7516d6d86cf5 | 34:ed14f46c0e55 |
---|---|
33 #include <QSharedMemory> |
33 #include <QSharedMemory> |
34 #include <QVector> |
34 #include <QVector> |
35 #include <QDir> |
35 #include <QDir> |
36 |
36 |
37 #include "hbinputmodecache_p.h" |
37 #include "hbinputmodecache_p.h" |
38 #include "hbinputmethod.h" |
|
38 #include "hbinputfilter.h" |
39 #include "hbinputfilter.h" |
39 |
40 |
40 #ifdef Q_OS_SYMBIAN |
41 #ifdef Q_OS_SYMBIAN |
41 |
42 |
42 #define HBI_BASE_PATH QString("\\resource\\plugins") |
43 #define HBI_BASE_PATH QString("\\resource\\plugins") |
44 |
45 |
45 #else |
46 #else |
46 |
47 |
47 #ifndef Q_OS_UNIX |
48 #ifndef Q_OS_UNIX |
48 #define HBI_BASE_WRITABLE_PATH QString("c:\\Hb\\lib") |
49 #define HBI_BASE_WRITABLE_PATH QString("c:\\Hb\\lib") |
49 #endif |
50 #endif // Q_OS_UNIX |
50 |
51 |
51 #endif |
52 #endif //Q_OS_SYMBIAN |
52 |
53 |
53 /*! |
54 /*! |
54 @alpha |
55 @stable |
55 @hbcore |
56 @hbcore |
56 \class HbInputSettingProxy |
57 \class HbInputSettingProxy |
57 \brief A singleton class providing access to system wide input related settings. |
58 \brief A singleton class providing access to system wide input related settings. |
58 |
59 |
59 HbInputSettingProxy provides access to all system wide input settings. It is implemented |
60 HbInputSettingProxy provides access to all system wide input settings. It is implemented |
138 memcpy(customData, data.data(), data.size()); |
139 memcpy(customData, data.data(), data.size()); |
139 customDataSize = data.size(); |
140 customDataSize = data.size(); |
140 } |
141 } |
141 } |
142 } |
142 |
143 |
143 // Special character classifier class for bookkeeping |
|
144 // of how popular a SC is. |
|
145 class HbScClassifier |
|
146 { |
|
147 public: |
|
148 HbScClassifier(QChar aChar = 0, int aCount = 0) |
|
149 : mChar(aChar), mCount(aCount) { |
|
150 } |
|
151 |
|
152 void operator=(const HbScClassifier &aOther) { |
|
153 mChar = aOther.mChar; |
|
154 mCount = aOther.mCount; |
|
155 } |
|
156 |
|
157 public: |
|
158 QChar mChar; |
|
159 int mCount; |
|
160 }; |
|
161 |
|
162 HbInputSettingProxyPrivate::HbInputSettingProxyPrivate() |
144 HbInputSettingProxyPrivate::HbInputSettingProxyPrivate() |
163 { |
145 { |
164 iSharedMemory = new QSharedMemory(KInputSettingProxyKey); |
146 mSharedMemory = new QSharedMemory(HbInputSettingsSharedMemoryKey); |
165 |
147 |
166 if (!iSharedMemory->attach()) { |
148 if (!mSharedMemory->attach()) { |
167 if (iSharedMemory->error() != QSharedMemory::NotFound) { |
149 if (mSharedMemory->error() != QSharedMemory::NotFound) { |
168 qDebug("HbInputSettingProxy: QSharedMemory::attached returned error %d", iSharedMemory->error()); |
150 qDebug("HbInputSettingProxy: QSharedMemory::attach returned error %d", mSharedMemory->error()); |
169 return; |
151 return; |
170 } |
152 } |
171 |
153 |
172 if (!iSharedMemory->create(sizeof(HbSettingProxyInternalData))) { |
154 if (!mSharedMemory->create(sizeof(HbSettingProxyInternalData))) { |
173 qDebug("HbInputSettingProxy : Unable to create shared memory block!"); |
155 qDebug("HbInputSettingProxy : Unable to create shared memory block!"); |
174 return; |
156 return; |
175 } |
157 } |
176 |
158 |
177 initializeDataArea(); |
159 initializeDataArea(); |
178 } |
160 } |
179 |
161 #ifdef Q_OS_UNIX |
162 #ifndef Q_OS_SYMBIAN |
|
163 else if (proxyData()->version != HbProxyDataRequiredVersion) { |
|
164 // In unix systems, the shared memory may be left dangling with an outdated version |
|
165 // In that case, update all the values with defaults to make sure |
|
166 initializeDataArea(); |
|
167 } |
|
168 #endif // Q_OS_SYMBIAN |
|
169 #endif // Q_OS_UNIX |
|
170 } |
|
171 |
|
172 HbInputSettingProxyPrivate::~HbInputSettingProxyPrivate() |
|
173 { |
|
174 // NOTE: mSharedMemory is not deleted on purpose. See HbInputSettingProxy::shutdown. |
|
175 } |
|
176 |
|
177 void HbInputSettingProxyPrivate::shutdownDataArea() |
|
178 { |
|
180 lock(); |
179 lock(); |
181 |
180 save(proxyData()); |
182 HbSettingProxyInternalData *prData = proxyData(); |
|
183 if (prData) { |
|
184 ++prData->iReferences; |
|
185 } |
|
186 |
|
187 unlock(); |
181 unlock(); |
188 |
182 } |
189 // This is needed because qApp doesn't not exist anymore when singleton destructs. |
183 |
190 iSaveFile = dataFileNameAndPath(); |
184 QString HbInputSettingProxyPrivate::dataFilePath() |
191 } |
185 { |
192 |
186 return HbInputSettingProxy::writablePath() + QDir::separator() + QString("settings"); |
193 HbInputSettingProxyPrivate::~HbInputSettingProxyPrivate() |
187 } |
194 { |
188 |
195 // NOTE: iSharedMemory is not deleted on purpose. See HbInputSettingProxy::shutdown. |
189 QString HbInputSettingProxyPrivate::dataFileNameAndPath() |
196 } |
190 { |
197 |
191 return dataFilePath() + QDir::separator() + QString("proxy.dat"); |
198 void HbInputSettingProxyPrivate::shutdownDataArea() |
192 } |
193 |
|
194 void HbInputSettingProxyPrivate::initializeDataArea() |
|
199 { |
195 { |
200 lock(); |
196 lock(); |
201 HbSettingProxyInternalData *prData = proxyData(); |
197 bool wasLoaded = load(proxyData()); |
202 if (prData) { |
198 if (!wasLoaded) { |
203 prData->iReferences--; |
199 HbSettingProxyInternalData *prData = proxyData(); |
204 if (prData->iReferences <= 0) { |
200 if (prData) { |
205 save(); |
201 writeDefaultValuesToData(prData); |
206 } |
202 } |
207 } |
203 } |
208 unlock(); |
204 unlock(); |
209 } |
205 } |
210 |
206 |
211 QString HbInputSettingProxyPrivate::dataFilePath() |
207 void HbInputSettingProxyPrivate::writeDefaultValuesToData(HbSettingProxyInternalData* data) |
212 { |
208 { |
213 return HbInputSettingProxy::writablePath() + QDir::separator() + QString("settings"); |
209 data->version = HbProxyDataRequiredVersion; |
214 } |
210 data->globalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom); |
215 |
211 data->globalSecondaryInputLanguage = QLocale::Language(0); |
216 QString HbInputSettingProxyPrivate::dataFileNameAndPath() |
212 data->predictiveInputState = (HbKeyboardSettingFlags)HbKeyboardSetting12key | HbKeyboardSettingQwerty; |
217 { |
213 data->digitType = HbDigitTypeLatin; |
218 return dataFilePath() + QDir::separator() + QString("proxy.dat"); |
214 data->qwertyTextCasing = true; |
219 } |
215 data->qwertyCharacterPreview = true; |
220 |
216 data->regionalCorrectionStatus = true; |
221 void HbInputSettingProxyPrivate::initializeDataArea() |
217 data->flipStatus = false; |
222 { |
218 data->keypressTimeout = 1000; |
223 lock(); |
219 data->autocompletion = (HbKeyboardSettingFlags)(HbKeyboardSetting12key | HbKeyboardSettingQwerty); |
224 bool wasLoaded = load(); |
220 data->typingCorrectionLevel = HbTypingCorrectionLevelHigh; |
225 |
221 data->primaryCandidateMode = HbPrimaryCandidateModeBestPrediction; |
226 HbSettingProxyInternalData *prData = proxyData(); |
222 data->preferredMethodHorizontal = HbInputMethodDescriptor(); |
227 if (prData) { |
223 data->preferredMethodHorizontal.setData(QByteArray()); |
228 prData->iReferences = 0; |
224 data->preferredMethodVertical = HbInputMethodDescriptor(); |
229 prData->iOrientationChangeCompleted = true; |
225 data->preferredMethodVertical.setData(QByteArray()); |
230 // Default values, real ones should be set by calling initializeOrientation() |
226 data->hwrSpeed = HbHwrSpeedNormal; |
231 prData->iScreenOrientation = Qt::Vertical; |
227 data->cangjieMode = HbCangjieNormal; |
232 |
228 } |
233 if (!wasLoaded) { |
229 |
234 // There was no permanent storage version, so initialize to defaults. |
230 bool HbInputSettingProxyPrivate::load(HbSettingProxyInternalData *data) |
235 prData->iVersion = HbProxyDataRequiredVersion; |
231 { |
236 prData->iGlobalPrimaryInputLanguage = HbInputLanguage(QLocale::English, QLocale::UnitedKingdom); |
232 if (!data) { |
237 prData->iGlobalSecondaryInputLanguage = QLocale::Language(0); |
233 return false; |
238 prData->iActiveKeyboard = HbKeyboardVirtual12Key; |
234 } |
239 prData->iTouchKeyboard = HbKeyboardVirtual12Key; |
|
240 prData->iHwKeyboard = HbKeyboardQwerty; |
|
241 prData->iPredictiveInputState = (HbKeyboardSettingFlags)HbKeyboardSetting12key | HbKeyboardSettingQwerty; |
|
242 prData->iDigitType = HbDigitTypeLatin; |
|
243 prData->iQwertyTextCasing = true; |
|
244 prData->iQwertyCharacterPreview = true; |
|
245 prData->iRegionalCorrectionStatus = true; |
|
246 prData->iKeypressTimeout = 1000; |
|
247 prData->iAutocompletion = (HbKeyboardSettingFlags)(HbKeyboardSetting12key | HbKeyboardSettingQwerty); |
|
248 prData->iTypingCorrectionLevel = HbTypingCorrectionLevelHigh; |
|
249 prData->iPrimaryCandidateMode = HbPrimaryCandidateModeBestPrediction; |
|
250 prData->iPreferredMethodHorizontal = HbInputMethodDescriptor(); |
|
251 prData->iPreferredMethodHorizontal.setData(QByteArray()); |
|
252 prData->iPreferredMethodVertical = HbInputMethodDescriptor(); |
|
253 prData->iPreferredMethodVertical.setData(QByteArray()); |
|
254 } |
|
255 } |
|
256 unlock(); |
|
257 } |
|
258 |
|
259 bool HbInputSettingProxyPrivate::load() |
|
260 { |
|
261 QFile file(dataFileNameAndPath()); |
235 QFile file(dataFileNameAndPath()); |
262 if (!file.open(QIODevice::ReadOnly)) { |
236 if (!file.open(QIODevice::ReadOnly)) { |
263 return false; |
237 return false; |
264 } |
238 } |
265 |
239 |
266 QByteArray rawData = file.read(sizeof(HbSettingProxyInternalData)); |
240 QByteArray rawData = file.read(sizeof(HbSettingProxyInternalData)); |
241 file.close(); |
|
242 |
|
267 if (rawData.size() == sizeof(HbSettingProxyInternalData)) { |
243 if (rawData.size() == sizeof(HbSettingProxyInternalData)) { |
268 HbSettingProxyInternalData *ldData = (HbSettingProxyInternalData *)rawData.constData(); |
244 HbSettingProxyInternalData *ldData = (HbSettingProxyInternalData *)rawData.constData(); |
269 if (ldData) { |
245 if (ldData) { |
270 if (ldData->iVersion == HbProxyDataRequiredVersion) { |
246 if (ldData->version == HbProxyDataRequiredVersion) { |
271 |
247 memcpy((void *)data, (void *)ldData, sizeof(HbSettingProxyInternalData)); |
272 HbSettingProxyInternalData *prData = proxyData(); |
|
273 memcpy((void *)prData, (void *)ldData, sizeof(HbSettingProxyInternalData)); |
|
274 prData->iActiveKeyboard = ldData->iActiveKeyboard; |
|
275 |
|
276 // Temporarily like this, will be moved as part of shared data later... |
|
277 int numItems = 0; |
|
278 file.read((char *)&numItems, sizeof(int)); |
|
279 iTopScs.clear(); |
|
280 for (int jj = 0; jj < numItems; jj++) { |
|
281 HbScClassifier tmpItem; |
|
282 file.read((char *)&tmpItem, sizeof(HbScClassifier)); |
|
283 iTopScs.append(tmpItem); |
|
284 } |
|
285 |
|
286 file.close(); |
|
287 return true; |
248 return true; |
288 } |
249 } |
289 } |
250 } |
290 } |
251 } |
291 |
252 // The data size was incorrect or the version number was wrong |
292 file.close(); |
|
293 return false; |
253 return false; |
294 } |
254 } |
295 |
255 |
296 void HbInputSettingProxyPrivate::save() |
256 void HbInputSettingProxyPrivate::save(HbSettingProxyInternalData *data) |
297 { |
257 { |
298 // Make sure that the path exists |
258 if (data) { |
299 QDir settingDir; |
259 // Make sure that the path exists |
300 settingDir.mkpath(dataFilePath()); |
260 QDir settingDir; |
301 |
261 settingDir.mkpath(dataFilePath()); |
302 HbSettingProxyInternalData *prData = proxyData(); |
262 |
303 if (prData) { |
263 QFile file(dataFileNameAndPath()); |
304 QFile file(iSaveFile); |
|
305 if (!file.open(QIODevice::WriteOnly)) { |
264 if (!file.open(QIODevice::WriteOnly)) { |
306 return; |
265 return; |
307 } |
266 } |
308 |
267 |
309 file.write((const char *)prData, sizeof(HbSettingProxyInternalData)); |
268 file.write((const char *)data, sizeof(HbSettingProxyInternalData)); |
310 |
|
311 // Temporarily like this, will be moved to shared data later... |
|
312 int numItems = iTopScs.count(); |
|
313 file.write((const char *)&numItems, sizeof(int)); |
|
314 file.write((const char *)iTopScs.constData(), numItems * sizeof(HbScClassifier)); |
|
315 file.close(); |
269 file.close(); |
316 } |
270 } |
317 } |
271 } |
318 |
272 |
319 QString HbInputSettingProxyPrivate::stringFromProxyDataElement(QChar *string) const |
273 QString HbInputSettingProxyPrivate::stringFromProxyDataElement(QChar *string) const |
335 string[i] = 0; |
289 string[i] = 0; |
336 } |
290 } |
337 |
291 |
338 HbSettingProxyInternalData *HbInputSettingProxyPrivate::proxyData() const |
292 HbSettingProxyInternalData *HbInputSettingProxyPrivate::proxyData() const |
339 { |
293 { |
340 return static_cast<HbSettingProxyInternalData *>(iSharedMemory->data()); |
294 return static_cast<HbSettingProxyInternalData *>(mSharedMemory->data()); |
341 } |
|
342 |
|
343 void HbInputSettingProxyPrivate::flipToggle() |
|
344 { |
|
345 setFlipStatus(!flipStatus()); |
|
346 } |
|
347 |
|
348 bool HbInputSettingProxyPrivate::flipStatus() |
|
349 { |
|
350 HbSettingProxyInternalData *prData = proxyData(); |
|
351 return prData->iFlipStatus; |
|
352 } |
|
353 |
|
354 void HbInputSettingProxyPrivate::setFlipStatus(bool flipStatus) |
|
355 { |
|
356 HbSettingProxyInternalData *prData = proxyData(); |
|
357 prData->iFlipStatus = flipStatus; |
|
358 |
|
359 handleDeviceSpecificOriantationAndFlipChange(); |
|
360 } |
|
361 |
|
362 void HbInputSettingProxyPrivate::handleDeviceSpecificOriantationAndFlipChange() |
|
363 { |
|
364 HbKeyboardType keyboard = HbKeyboardNone; |
|
365 |
|
366 if (HbInputSettingProxy::instance()->screenOrientation() == Qt::Vertical) { |
|
367 keyboard = HbKeyboardVirtual12Key; |
|
368 } else { |
|
369 if (flipStatus()) { |
|
370 keyboard = HbKeyboardQwerty; |
|
371 } else { |
|
372 keyboard = HbKeyboardVirtualQwerty; |
|
373 } |
|
374 } |
|
375 |
|
376 HbInputSettingProxy::instance()->setActiveKeyboard(keyboard); |
|
377 } |
295 } |
378 |
296 |
379 /// @endcond |
297 /// @endcond |
380 |
298 |
381 /*! |
299 /*! |
411 void HbInputSettingProxy::shutdown() |
329 void HbInputSettingProxy::shutdown() |
412 { |
330 { |
413 Q_D(HbInputSettingProxy); |
331 Q_D(HbInputSettingProxy); |
414 |
332 |
415 d->shutdownDataArea(); |
333 d->shutdownDataArea(); |
416 delete d->iSharedMemory; |
334 delete d->mSharedMemory; |
417 d->iSharedMemory = 0; |
335 d->mSharedMemory = 0; |
418 } |
336 } |
419 |
337 |
420 /*! |
338 /*! |
421 Toggles prediction mode |
339 Toggles prediction mode |
422 */ |
340 */ |
423 void HbInputSettingProxy::togglePrediction() |
341 void HbInputSettingProxy::togglePrediction() |
424 { |
342 { |
425 if (activeKeyboard() & HbQwertyKeyboardMask) { |
343 HbInputMethod *im = HbInputMethod::activeInputMethod(); |
426 setPredictiveInputStatus(HbKeyboardSettingQwerty, !predictiveInputStatus(HbKeyboardSettingQwerty)); |
344 if (im) { |
427 } else { |
345 HbInputState state = im->inputState(); |
428 setPredictiveInputStatus(HbKeyboardSetting12key, !predictiveInputStatus(HbKeyboardSetting12key)); |
346 if (state.keyboard() & HbQwertyKeyboardMask) { |
347 setPredictiveInputStatus(HbKeyboardSettingQwerty, !predictiveInputStatus(HbKeyboardSettingQwerty)); |
|
348 } else { |
|
349 setPredictiveInputStatus(HbKeyboardSetting12key, !predictiveInputStatus(HbKeyboardSetting12key)); |
|
350 } |
|
429 } |
351 } |
430 } |
352 } |
431 |
353 |
432 /*! |
354 /*! |
433 Setting proxy emits a signal when any of the monitored settings changes. This |
355 Setting proxy emits a signal when any of the monitored settings changes. This |
447 void HbInputSettingProxy::connectObservingObject(QObject *aObserver) |
369 void HbInputSettingProxy::connectObservingObject(QObject *aObserver) |
448 { |
370 { |
449 if (aObserver) { |
371 if (aObserver) { |
450 connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &))); |
372 connect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &))); |
451 connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &))); |
373 connect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &))); |
452 connect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType))); |
|
453 connect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange())); |
|
454 connect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation))); |
|
455 } |
374 } |
456 } |
375 } |
457 |
376 |
458 /*! |
377 /*! |
459 Disconnects given object from the setting proxy. |
378 Disconnects given object from the setting proxy. |
463 void HbInputSettingProxy::disconnectObservingObject(QObject *aObserver) |
382 void HbInputSettingProxy::disconnectObservingObject(QObject *aObserver) |
464 { |
383 { |
465 if (aObserver) { |
384 if (aObserver) { |
466 disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &))); |
385 disconnect(this, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalInputLanguageChanged(const HbInputLanguage &))); |
467 disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &))); |
386 disconnect(this, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), aObserver, SLOT(globalSecondaryInputLanguageChanged(const HbInputLanguage &))); |
468 disconnect(this, SIGNAL(activeKeyboardChanged(HbKeyboardType)), aObserver, SLOT(activeKeyboardChanged(HbKeyboardType))); |
|
469 disconnect(this, SIGNAL(orientationAboutToChange()), aObserver, SLOT(orientationAboutToChange())); |
|
470 disconnect(this, SIGNAL(orientationChanged(Qt::Orientation)), aObserver, SLOT(orientationChanged(Qt::Orientation))); |
|
471 } |
387 } |
472 } |
388 } |
473 |
389 |
474 /*! |
390 /*! |
475 Returns active input language. This is system wide value, an editor and input state machine may override this by defining |
391 Returns active input language. This is system wide value, an editor and input state machine may override this by defining |
484 HbInputLanguage res; |
400 HbInputLanguage res; |
485 |
401 |
486 d->lock(); |
402 d->lock(); |
487 HbSettingProxyInternalData *prData = d->proxyData(); |
403 HbSettingProxyInternalData *prData = d->proxyData(); |
488 if (prData) { |
404 if (prData) { |
489 res = prData->iGlobalPrimaryInputLanguage; |
405 res = prData->globalPrimaryInputLanguage; |
490 } |
406 } |
491 d->unlock(); |
407 d->unlock(); |
492 |
408 |
493 return HbInputLanguage(res); |
409 return HbInputLanguage(res); |
494 } |
410 } |
505 HbInputLanguage res; |
421 HbInputLanguage res; |
506 |
422 |
507 d->lock(); |
423 d->lock(); |
508 HbSettingProxyInternalData *prData = d->proxyData(); |
424 HbSettingProxyInternalData *prData = d->proxyData(); |
509 if (prData) { |
425 if (prData) { |
510 res = prData->iGlobalSecondaryInputLanguage; |
426 res = prData->globalSecondaryInputLanguage; |
511 } |
427 } |
512 d->unlock(); |
428 d->unlock(); |
513 |
429 |
514 return HbInputLanguage(res); |
430 return HbInputLanguage(res); |
515 } |
431 } |
522 aListOfAvailableKeyboards.append(HbKeyboard12Key); |
438 aListOfAvailableKeyboards.append(HbKeyboard12Key); |
523 aListOfAvailableKeyboards.append(HbKeyboardQwerty); |
439 aListOfAvailableKeyboards.append(HbKeyboardQwerty); |
524 } |
440 } |
525 |
441 |
526 /*! |
442 /*! |
527 Returns active hardware keyboard type. |
443 Stores speed attribute for handwriting recognition. |
528 |
444 */ |
529 \sa setActiveHwKeyboard |
445 void HbInputSettingProxy::setHwrWritingSpeed(HbHwrWritingSpeed speed) |
530 \sa activeTouchKeyboard |
446 { |
531 */ |
447 Q_D(HbInputSettingProxy); |
532 HbKeyboardType HbInputSettingProxy::activeHwKeyboard() const |
448 HbSettingProxyInternalData *prData = d->proxyData(); |
533 { |
449 if (prData) { |
534 Q_D(const HbInputSettingProxy); |
450 bool notify = false; |
535 HbKeyboardType res = HbKeyboardNone; |
451 d->lock(); |
536 |
452 if (prData->hwrSpeed != speed) { |
537 HbSettingProxyInternalData *prData = d->proxyData(); |
453 prData->hwrSpeed = speed; |
538 if (prData) { |
454 notify = true; |
539 res = prData->iHwKeyboard; |
455 } |
456 d->unlock(); |
|
457 if (notify) { |
|
458 emit hwrWritingSpeedChanged(speed); |
|
459 } |
|
460 } |
|
461 } |
|
462 |
|
463 /*! |
|
464 Returns handwriting recignition speed attribute. |
|
465 */ |
|
466 HbHwrWritingSpeed HbInputSettingProxy::hwrWritingSpeed() const |
|
467 { |
|
468 Q_D(const HbInputSettingProxy); |
|
469 HbHwrWritingSpeed res = HbHwrSpeedNormal; |
|
470 |
|
471 HbSettingProxyInternalData *prData = d->proxyData(); |
|
472 if (prData) { |
|
473 res = prData->hwrSpeed; |
|
540 } |
474 } |
541 |
475 |
542 return res; |
476 return res; |
543 } |
477 } |
544 |
478 |
545 /*! |
479 /*! |
546 Returns active touch keyboard type. |
480 Strores detail mode for Chinese CangJie input mode. |
547 |
481 */ |
548 \sa setActiveTouchKeyboard |
482 void HbInputSettingProxy::setDetailedCangjieMode(HbCangjieDetailMode cangjieDetail) |
549 \sa activeHwKeyboard |
483 { |
550 */ |
484 Q_D(HbInputSettingProxy); |
551 HbKeyboardType HbInputSettingProxy::activeTouchKeyboard() const |
485 HbSettingProxyInternalData *prData = d->proxyData(); |
552 { |
486 if (prData) { |
553 Q_D(const HbInputSettingProxy); |
487 bool notify = false; |
554 HbKeyboardType res = HbKeyboardNone; |
488 d->lock(); |
555 |
489 if (prData->cangjieMode != cangjieDetail) { |
556 HbSettingProxyInternalData *prData = d->proxyData(); |
490 prData->cangjieMode = cangjieDetail; |
557 if (prData) { |
491 notify = true; |
558 res = prData->iTouchKeyboard; |
492 } |
493 d->unlock(); |
|
494 if (notify) { |
|
495 emit detailedCangjieModeChanged(cangjieDetail); |
|
496 } |
|
497 } |
|
498 } |
|
499 |
|
500 /*! |
|
501 Returns detail mode for Chinese CangJie input mode. |
|
502 */ |
|
503 HbCangjieDetailMode HbInputSettingProxy::detailedCangjieMode() const |
|
504 { |
|
505 Q_D(const HbInputSettingProxy); |
|
506 HbCangjieDetailMode res = HbCangjieNormal; |
|
507 |
|
508 HbSettingProxyInternalData *prData = d->proxyData(); |
|
509 if (prData) { |
|
510 res = prData->cangjieMode; |
|
559 } |
511 } |
560 |
512 |
561 return res; |
513 return res; |
562 } |
514 } |
563 |
515 |
564 /*! |
516 /*! |
565 Returns active keyboard type. |
517 Returns active keyboard for given screen oriention. |
566 |
518 */ |
567 \sa setActiveKeyboard |
519 HbKeyboardType HbInputSettingProxy::activeKeyboard(Qt::Orientation orientation) const |
568 */ |
520 { |
569 HbKeyboardType HbInputSettingProxy::activeKeyboard() const |
521 Q_D(const HbInputSettingProxy); |
570 { |
522 |
571 Q_D(const HbInputSettingProxy); |
523 if (orientation == Qt::Horizontal) { |
572 HbKeyboardType res = HbKeyboardNone; |
524 HbSettingProxyInternalData *prData = d->proxyData(); |
573 |
525 if (prData) { |
574 HbSettingProxyInternalData *prData = d->proxyData(); |
526 d->lock(); |
575 if (prData) { |
527 if (prData->flipStatus == true) { |
576 res = prData->iActiveKeyboard; |
528 return HbKeyboardHardwareLandcape; |
577 } |
529 } |
578 |
530 d->unlock(); |
579 return res; |
531 } |
532 return HbKeyboardTouchLandscape; |
|
533 } else { |
|
534 return HbKeyboardTouchPortrait; |
|
535 } |
|
580 } |
536 } |
581 |
537 |
582 /*! |
538 /*! |
583 Returns the preferred input method for given screen orientation. Initially this value is empty |
539 Returns the preferred input method for given screen orientation. Initially this value is empty |
584 and the framework will resolve the default handler. |
540 and the framework will resolve the default handler. |
593 |
549 |
594 HbSettingProxyInternalData *prData = d->proxyData(); |
550 HbSettingProxyInternalData *prData = d->proxyData(); |
595 if (prData) { |
551 if (prData) { |
596 d->lock(); |
552 d->lock(); |
597 if (orientation == Qt::Horizontal) { |
553 if (orientation == Qt::Horizontal) { |
598 result = prData->iPreferredMethodHorizontal.descriptor(); |
554 result = prData->preferredMethodHorizontal.descriptor(); |
599 } else { |
555 } else { |
600 result = prData->iPreferredMethodVertical.descriptor(); |
556 result = prData->preferredMethodVertical.descriptor(); |
601 } |
557 } |
602 d->unlock(); |
558 d->unlock(); |
603 } |
559 } |
604 |
560 |
605 return result; |
561 return result; |
606 } |
562 } |
607 |
563 |
608 /*! |
564 /*! |
609 Returns the preferred input method for current screen orientation. Initially this value is empty |
565 Returns custom data associated to preferred input method. |
610 and the framework will resolve the default handler. |
|
611 |
566 |
612 \sa setPreferredInputMethod |
567 \sa setPreferredInputMethod |
613 */ |
568 */ |
614 HbInputMethodDescriptor HbInputSettingProxy::preferredInputMethod() const |
569 QByteArray HbInputSettingProxy::preferredInputMethodCustomData(Qt::Orientation orientation) const |
615 { |
570 { |
616 Q_D(const HbInputSettingProxy); |
571 Q_D(const HbInputSettingProxy); |
617 |
572 |
618 HbInputMethodDescriptor result; |
573 QByteArray result; |
619 |
574 |
620 HbSettingProxyInternalData *prData = d->proxyData(); |
575 HbSettingProxyInternalData *prData = d->proxyData(); |
621 if (prData) { |
576 if (prData) { |
622 d->lock(); |
577 d->lock(); |
623 if (prData->iScreenOrientation == Qt::Horizontal) { |
578 if (orientation == Qt::Horizontal) { |
624 result = prData->iPreferredMethodHorizontal.descriptor(); |
579 result = prData->preferredMethodHorizontal.data(); |
625 } else { |
580 } else { |
626 result = prData->iPreferredMethodVertical.descriptor(); |
581 result = prData->preferredMethodVertical.data(); |
627 } |
|
628 d->unlock(); |
|
629 } |
|
630 |
|
631 return result; |
|
632 } |
|
633 |
|
634 /*! |
|
635 Returns custom data associated to preferred input method. |
|
636 |
|
637 \sa setPreferredInputMethod |
|
638 */ |
|
639 QByteArray HbInputSettingProxy::preferredInputMethodCustomData(Qt::Orientation orientation) const |
|
640 { |
|
641 Q_D(const HbInputSettingProxy); |
|
642 |
|
643 QByteArray result; |
|
644 |
|
645 HbSettingProxyInternalData *prData = d->proxyData(); |
|
646 if (prData) { |
|
647 d->lock(); |
|
648 if (orientation == Qt::Horizontal) { |
|
649 result = prData->iPreferredMethodHorizontal.data(); |
|
650 } else { |
|
651 result = prData->iPreferredMethodVertical.data(); |
|
652 } |
582 } |
653 d->unlock(); |
583 d->unlock(); |
654 } |
584 } |
655 |
585 |
656 return result; |
586 return result; |
670 Q_D(HbInputSettingProxy); |
600 Q_D(HbInputSettingProxy); |
671 HbSettingProxyInternalData *prData = d->proxyData(); |
601 HbSettingProxyInternalData *prData = d->proxyData(); |
672 if (prData) { |
602 if (prData) { |
673 d->lock(); |
603 d->lock(); |
674 if (orientation == Qt::Horizontal) { |
604 if (orientation == Qt::Horizontal) { |
675 prData->iPreferredMethodHorizontal = inputMethod; |
605 prData->preferredMethodHorizontal = inputMethod; |
676 prData->iPreferredMethodHorizontal.setData(customData); |
606 prData->preferredMethodHorizontal.setData(customData); |
677 } else { |
607 } else { |
678 prData->iPreferredMethodVertical = inputMethod; |
608 prData->preferredMethodVertical = inputMethod; |
679 prData->iPreferredMethodVertical.setData(customData); |
609 prData->preferredMethodVertical.setData(customData); |
680 } |
610 } |
681 d->unlock(); |
611 d->unlock(); |
682 } |
612 } |
683 } |
613 } |
684 |
614 |
692 Q_D(HbInputSettingProxy); |
622 Q_D(HbInputSettingProxy); |
693 HbSettingProxyInternalData *prData = d->proxyData(); |
623 HbSettingProxyInternalData *prData = d->proxyData(); |
694 if (prData) { |
624 if (prData) { |
695 bool notify = false; |
625 bool notify = false; |
696 d->lock(); |
626 d->lock(); |
697 if (prData->iGlobalPrimaryInputLanguage != language) { |
627 if (prData->globalPrimaryInputLanguage != language) { |
698 prData->iGlobalPrimaryInputLanguage = language; |
628 prData->globalPrimaryInputLanguage = language; |
699 notify = true; |
629 notify = true; |
700 } |
630 } |
701 d->unlock(); |
631 d->unlock(); |
702 if (notify) { |
632 if (notify) { |
703 emit globalInputLanguageChanged(language); |
633 emit globalInputLanguageChanged(language); |
715 Q_D(HbInputSettingProxy); |
645 Q_D(HbInputSettingProxy); |
716 HbSettingProxyInternalData *prData = d->proxyData(); |
646 HbSettingProxyInternalData *prData = d->proxyData(); |
717 if (prData) { |
647 if (prData) { |
718 bool notify = false; |
648 bool notify = false; |
719 d->lock(); |
649 d->lock(); |
720 if (prData->iGlobalSecondaryInputLanguage != language) { |
650 if (prData->globalSecondaryInputLanguage != language) { |
721 prData->iGlobalSecondaryInputLanguage = language; |
651 prData->globalSecondaryInputLanguage = language; |
722 notify = true; |
652 notify = true; |
723 } |
653 } |
724 d->unlock(); |
654 d->unlock(); |
725 if (notify) { |
655 if (notify) { |
726 emit globalSecondaryInputLanguageChanged(language); |
656 emit globalSecondaryInputLanguageChanged(language); |
727 } |
|
728 } |
|
729 } |
|
730 |
|
731 /*! |
|
732 Sets active hardware keyboard type. Will emit signal activeHwKeyboardChanged if keyboard is changed. |
|
733 |
|
734 \sa activeHwKeyboard |
|
735 \sa activeTouchKeyboard |
|
736 \sa setActiveTouchKeyboard |
|
737 \sa setActiveHwKeyboard |
|
738 */ |
|
739 void HbInputSettingProxy::setActiveHwKeyboard(HbKeyboardType keyboard) |
|
740 { |
|
741 Q_D(HbInputSettingProxy); |
|
742 HbSettingProxyInternalData *prData = d->proxyData(); |
|
743 if (prData) { |
|
744 bool notify = false; |
|
745 d->lock(); |
|
746 if (prData->iHwKeyboard != keyboard) { |
|
747 prData->iHwKeyboard = keyboard; |
|
748 notify = true; |
|
749 } |
|
750 d->unlock(); |
|
751 if (notify) { |
|
752 emit activeHwKeyboardChanged(keyboard); |
|
753 } |
|
754 } |
|
755 } |
|
756 |
|
757 /*! |
|
758 Sets active touch keyboard type. Will emit signal activeTouchKeyboardChanged keyboard is changed. |
|
759 |
|
760 \sa activeTouchKeyboard |
|
761 \sa activeHwKeyboard |
|
762 \sa setActiveTouchKeyboard |
|
763 \sa setActiveHwKeyboard |
|
764 */ |
|
765 void HbInputSettingProxy::setActiveTouchKeyboard(HbKeyboardType keyboard) |
|
766 { |
|
767 Q_D(HbInputSettingProxy); |
|
768 HbSettingProxyInternalData *prData = d->proxyData(); |
|
769 if (prData) { |
|
770 bool notify = false; |
|
771 d->lock(); |
|
772 if (prData->iTouchKeyboard != keyboard) { |
|
773 prData->iTouchKeyboard = keyboard; |
|
774 notify = true; |
|
775 } |
|
776 d->unlock(); |
|
777 if (notify) { |
|
778 emit activeTouchKeyboardChanged(keyboard); |
|
779 } |
|
780 } |
|
781 } |
|
782 |
|
783 /*! |
|
784 Sets active keyboard type. Will emit signal activeKeyboardChanged if keyboard is changed. |
|
785 |
|
786 \sa activeKeyboard |
|
787 \sa activeHwKeyboard |
|
788 \sa setactiveKeyboard |
|
789 \sa setActiveHwKeyboard |
|
790 */ |
|
791 void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard) |
|
792 { |
|
793 Q_D(HbInputSettingProxy); |
|
794 HbSettingProxyInternalData *prData = d->proxyData(); |
|
795 if (prData) { |
|
796 bool notify = false; |
|
797 d->lock(); |
|
798 if (prData->iActiveKeyboard != keyboard) { |
|
799 prData->iActiveKeyboard = keyboard; |
|
800 notify = true; |
|
801 } |
|
802 d->unlock(); |
|
803 if (notify) { |
|
804 emit activeKeyboardChanged(keyboard); |
|
805 } |
657 } |
806 } |
658 } |
807 } |
659 } |
808 |
660 |
809 /*! |
661 /*! |
818 Q_D(const HbInputSettingProxy); |
670 Q_D(const HbInputSettingProxy); |
819 bool res = false; |
671 bool res = false; |
820 |
672 |
821 HbSettingProxyInternalData *prData = d->proxyData(); |
673 HbSettingProxyInternalData *prData = d->proxyData(); |
822 if (prData) { |
674 if (prData) { |
823 res = prData->iPredictiveInputState & keyboardType; |
675 res = prData->predictiveInputState & keyboardType; |
824 } |
676 } |
825 |
677 |
826 return res; |
678 return res; |
827 } |
679 } |
828 |
680 |
837 HbSettingProxyInternalData *prData = d->proxyData(); |
689 HbSettingProxyInternalData *prData = d->proxyData(); |
838 if (prData) { |
690 if (prData) { |
839 bool notify = false; |
691 bool notify = false; |
840 d->lock(); |
692 d->lock(); |
841 |
693 |
842 HbKeyboardSettingFlags newValue = prData->iPredictiveInputState; |
694 HbKeyboardSettingFlags newValue = prData->predictiveInputState; |
843 if (newStatus) { |
695 if (newStatus) { |
844 newValue |= keyboardType; |
696 newValue |= keyboardType; |
845 } else { |
697 } else { |
846 newValue &= ~keyboardType; |
698 newValue &= ~keyboardType; |
847 } |
699 } |
848 if (prData->iPredictiveInputState != newValue) { |
700 if (prData->predictiveInputState != newValue) { |
849 prData->iPredictiveInputState = newValue; |
701 prData->predictiveInputState = newValue; |
850 notify = true; |
702 notify = true; |
851 } |
703 } |
852 d->unlock(); |
704 d->unlock(); |
853 if (notify) { |
705 if (notify) { |
854 emit predictiveInputStateChanged(keyboardType, newStatus); |
706 emit predictiveInputStateChanged(keyboardType, newStatus); |
867 Q_D(const HbInputSettingProxy); |
719 Q_D(const HbInputSettingProxy); |
868 bool res = false; |
720 bool res = false; |
869 |
721 |
870 HbSettingProxyInternalData *prData = d->proxyData(); |
722 HbSettingProxyInternalData *prData = d->proxyData(); |
871 if (prData) { |
723 if (prData) { |
872 if (activeKeyboard() & HbQwertyKeyboardMask) { |
724 HbInputMethod *im = HbInputMethod::activeInputMethod(); |
873 res = prData->iPredictiveInputState & HbKeyboardSettingQwerty; |
725 if (im) { |
726 HbInputState state = im->inputState(); |
|
727 if (state.keyboard() & HbQwertyKeyboardMask) { |
|
728 res = prData->predictiveInputState & HbKeyboardSettingQwerty; |
|
729 } else { |
|
730 res = prData->predictiveInputState & HbKeyboardSetting12key; |
|
731 } |
|
732 } |
|
733 } |
|
734 |
|
735 return res; |
|
736 } |
|
737 |
|
738 /*! |
|
739 Sets the status of predictive text input feature for active keyboard. |
|
740 |
|
741 \sa predictiveInputStatusForActiveKeyboard |
|
742 */ |
|
743 void HbInputSettingProxy::setPredictiveInputStatusForActiveKeyboard(bool newStatus) |
|
744 { |
|
745 HbInputMethod *im = HbInputMethod::activeInputMethod(); |
|
746 if (im) { |
|
747 HbInputState state = im->inputState(); |
|
748 if (state.keyboard() & HbQwertyKeyboardMask) { |
|
749 setPredictiveInputStatus(HbKeyboardSettingQwerty, newStatus); |
|
874 } else { |
750 } else { |
875 res = prData->iPredictiveInputState & HbKeyboardSetting12key; |
751 setPredictiveInputStatus(HbKeyboardSetting12key, newStatus); |
876 } |
752 } |
877 } |
|
878 |
|
879 return res; |
|
880 } |
|
881 |
|
882 /*! |
|
883 Sets the status of predictive text input feature for active keyboard. |
|
884 |
|
885 \sa predictiveInputStatusForActiveKeyboard |
|
886 */ |
|
887 void HbInputSettingProxy::setPredictiveInputStatusForActiveKeyboard(bool newStatus) |
|
888 { |
|
889 if (activeKeyboard() & HbQwertyKeyboardMask) { |
|
890 setPredictiveInputStatus(HbKeyboardSettingQwerty, newStatus); |
|
891 } else { |
|
892 setPredictiveInputStatus(HbKeyboardSetting12key, newStatus); |
|
893 } |
753 } |
894 } |
754 } |
895 |
755 |
896 /*! |
756 /*! |
897 Returns path to a writable location that should be used as a base storage folder for |
757 Returns path to a writable location that should be used as a base storage folder for |
914 } |
774 } |
915 #endif |
775 #endif |
916 } |
776 } |
917 |
777 |
918 /*! |
778 /*! |
919 Returns path to input method plugin folder. |
779 Returns paths to input method plugin folders. |
780 |
|
781 All the paths will not necessarily exist in the filesystem. |
|
920 */ |
782 */ |
921 QStringList HbInputSettingProxy::inputMethodPluginPaths() |
783 QStringList HbInputSettingProxy::inputMethodPluginPaths() |
922 { |
784 { |
923 QStringList result; |
785 QStringList result; |
924 |
786 |
933 |
795 |
934 return QStringList(result); |
796 return QStringList(result); |
935 } |
797 } |
936 |
798 |
937 /*! |
799 /*! |
938 Returns list of paths to all possible keymap plugin locations. |
800 Returns list of paths to all possible keymap locations. |
801 |
|
802 All the paths will not necessarily exist in the filesystem. |
|
939 */ |
803 */ |
940 QStringList HbInputSettingProxy::keymapPluginPaths() |
804 QStringList HbInputSettingProxy::keymapPluginPaths() |
941 { |
805 { |
942 QStringList result; |
806 QStringList result; |
807 #ifdef Q_OS_SYMBIAN |
|
943 QFileInfoList list = QDir::drives(); |
808 QFileInfoList list = QDir::drives(); |
944 |
|
945 #ifdef Q_OS_SYMBIAN |
|
946 for (int counter = 0; counter < list.count(); counter ++) { |
809 for (int counter = 0; counter < list.count(); counter ++) { |
947 result.append(list.at(counter).absoluteFilePath() + QString("/resource/keymaps")); |
810 result.append(list.at(counter).absoluteFilePath() + QString("/resource/keymaps")); |
948 } |
811 } |
949 #else |
812 #else |
950 result.append(HB_RESOURCES_DIR + (QDir::separator() + QString("keymaps"))); |
813 result.append(HB_RESOURCES_DIR + (QDir::separator() + QString("keymaps"))); |
951 for (int counter = 0; counter < list.count(); counter ++) { |
|
952 result.append(list.at(counter).absoluteFilePath() + QString("resource/keymaps")); |
|
953 } |
|
954 #endif |
814 #endif |
955 result.sort(); |
|
956 //Append the default resource at the end |
815 //Append the default resource at the end |
957 result.append(":/keymaps"); |
816 result.append(":/keymaps"); |
958 return QStringList(result); |
817 return QStringList(result); |
959 } |
818 } |
960 |
819 |
983 return writablePath() + QDir::separator() + QString("dictionary"); |
842 return writablePath() + QDir::separator() + QString("dictionary"); |
984 } |
843 } |
985 |
844 |
986 /*! |
845 /*! |
987 Returns list of paths where prediction engine plugins will be searched. |
846 Returns list of paths where prediction engine plugins will be searched. |
847 |
|
848 All the paths will not necessarily exist in the filesystem. |
|
988 */ |
849 */ |
989 QStringList HbInputSettingProxy::predictionEnginePaths() |
850 QStringList HbInputSettingProxy::predictionEnginePaths() |
990 { |
851 { |
991 QStringList result; |
852 QStringList result; |
992 |
853 |
1021 Q_D(const HbInputSettingProxy); |
882 Q_D(const HbInputSettingProxy); |
1022 HbInputDigitType res = HbDigitTypeLatin; |
883 HbInputDigitType res = HbDigitTypeLatin; |
1023 |
884 |
1024 HbSettingProxyInternalData *prData = d->proxyData(); |
885 HbSettingProxyInternalData *prData = d->proxyData(); |
1025 if (prData) { |
886 if (prData) { |
1026 res = prData->iDigitType; |
887 res = prData->digitType; |
1027 } |
888 } |
1028 |
889 |
1029 return res; |
890 return res; |
1030 } |
891 } |
1031 |
892 |
1038 { |
899 { |
1039 Q_D(HbInputSettingProxy); |
900 Q_D(HbInputSettingProxy); |
1040 HbSettingProxyInternalData *prData = d->proxyData(); |
901 HbSettingProxyInternalData *prData = d->proxyData(); |
1041 if (prData) { |
902 if (prData) { |
1042 d->lock(); |
903 d->lock(); |
1043 if (prData->iDigitType != digitType) { |
904 if (prData->digitType != digitType) { |
1044 prData->iDigitType = digitType; |
905 prData->digitType = digitType; |
1045 } |
906 } |
1046 d->unlock(); |
907 d->unlock(); |
1047 } |
908 } |
1048 } |
909 } |
1049 |
910 |
1057 Q_D(HbInputSettingProxy); |
918 Q_D(HbInputSettingProxy); |
1058 bool res = false; |
919 bool res = false; |
1059 |
920 |
1060 HbSettingProxyInternalData *prData = d->proxyData(); |
921 HbSettingProxyInternalData *prData = d->proxyData(); |
1061 if (prData) { |
922 if (prData) { |
1062 res = prData->iQwertyTextCasing; |
923 res = prData->qwertyTextCasing; |
1063 } |
924 } |
1064 |
925 |
1065 return res; |
926 return res; |
1066 } |
927 } |
1067 |
928 |
1075 Q_D(HbInputSettingProxy); |
936 Q_D(HbInputSettingProxy); |
1076 HbSettingProxyInternalData *prData = d->proxyData(); |
937 HbSettingProxyInternalData *prData = d->proxyData(); |
1077 if (prData) { |
938 if (prData) { |
1078 bool notify = false; |
939 bool notify = false; |
1079 d->lock(); |
940 d->lock(); |
1080 if (prData->iQwertyTextCasing != status) { |
941 if (prData->qwertyTextCasing != status) { |
1081 prData->iQwertyTextCasing = status; |
942 prData->qwertyTextCasing = status; |
1082 notify = true; |
943 notify = true; |
1083 } |
944 } |
1084 d->unlock(); |
945 d->unlock(); |
1085 if (notify) { |
946 if (notify) { |
1086 emit automaticTextCasingStateForQwertyChanged(status); |
947 emit automaticTextCasingStateForQwertyChanged(status); |
1099 Q_D(HbInputSettingProxy); |
960 Q_D(HbInputSettingProxy); |
1100 HbSettingProxyInternalData *prData = d->proxyData(); |
961 HbSettingProxyInternalData *prData = d->proxyData(); |
1101 if (prData) { |
962 if (prData) { |
1102 bool notify = false; |
963 bool notify = false; |
1103 d->lock(); |
964 d->lock(); |
1104 if (prData->iQwertyCharacterPreview != previewEnabled) { |
965 if (prData->qwertyCharacterPreview != previewEnabled) { |
1105 prData->iQwertyCharacterPreview = previewEnabled; |
966 prData->qwertyCharacterPreview = previewEnabled; |
1106 notify = true; |
967 notify = true; |
1107 } |
968 } |
1108 d->unlock(); |
969 d->unlock(); |
1109 if (notify) { |
970 if (notify) { |
1110 emit characterPreviewStateForQwertyChanged(previewEnabled); |
971 emit characterPreviewStateForQwertyChanged(previewEnabled); |
1124 |
985 |
1125 bool res = false; |
986 bool res = false; |
1126 |
987 |
1127 HbSettingProxyInternalData *prData = d->proxyData(); |
988 HbSettingProxyInternalData *prData = d->proxyData(); |
1128 if (prData) { |
989 if (prData) { |
1129 res = prData->iQwertyCharacterPreview; |
990 res = prData->qwertyCharacterPreview; |
1130 } |
991 } |
1131 |
992 |
1132 return res; |
993 return res; |
1133 } |
994 } |
1134 |
995 |
1135 /*! |
996 /*! |
1136 \deprecated HbInputSettingProxy::activeCustomInputMethod() const |
997 Returns the status of regional input correction feature. |
1137 is deprecated. Use preferredInputMethod instead. |
998 |
1138 Returns active custom input method. The pluginNameAndPath field is empty if no custom input methid is active. |
999 \sa enableRegionalCorrection. |
1139 |
1000 */ |
1140 \sa setActiveCustomInputMethod |
1001 bool HbInputSettingProxy::regionalCorrectionEnabled() |
1141 */ |
1002 { |
1142 HbInputMethodDescriptor HbInputSettingProxy::activeCustomInputMethod() const |
1003 Q_D(const HbInputSettingProxy); |
1143 { |
1004 bool res = false; |
1144 return HbInputMethodDescriptor(); |
1005 HbSettingProxyInternalData *prData = d->proxyData(); |
1145 } |
1006 if (prData) { |
1146 |
1007 res = prData->regionalCorrectionStatus; |
1147 /*! |
1008 } |
1148 \deprecated HbInputSettingProxy::setActiveCustomInputMethod(const HbInputMethodDescriptor&) |
1009 return res; |
1149 is deprecated. Use setPreferredInputMethod instead. |
1010 } |
1150 \sa activeCustomInputMethod |
1011 |
1151 */ |
1012 /*! |
1152 void HbInputSettingProxy::setActiveCustomInputMethod(const HbInputMethodDescriptor &inputMethod) |
1013 Sets the status of regional input correction feature. Will emit signal regionalCorretionStatusChanged if status is changed. |
1153 { |
1014 |
1154 Q_UNUSED(inputMethod) |
1015 \sa regionalCorrectionEnabled. |
1155 } |
1016 */ |
1156 |
1017 void HbInputSettingProxy::enableRegionalCorrection(bool newStatus) |
1157 /*! |
1018 { |
1158 Returns the current screen orientation in settings |
1019 Q_D(HbInputSettingProxy); |
1159 */ |
|
1160 Qt::Orientation HbInputSettingProxy::screenOrientation() |
|
1161 { |
|
1162 Q_D(HbInputSettingProxy); |
|
1163 |
|
1164 Qt::Orientation orientation = Qt::Vertical; |
|
1165 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1166 if (prData) { |
|
1167 orientation = prData->iScreenOrientation; |
|
1168 } |
|
1169 return orientation; |
|
1170 } |
|
1171 |
|
1172 /*! |
|
1173 Sets the current screen orientation in settings. This completes orientation change |
|
1174 started with notifyScreenOrientationChange. Nothing is done, If |
|
1175 notifyScreenOrientationChange has not been called before calling this. |
|
1176 */ |
|
1177 void HbInputSettingProxy::setScreenOrientation(Qt::Orientation screenOrientation) |
|
1178 { |
|
1179 Q_D(HbInputSettingProxy); |
|
1180 |
|
1181 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1182 if (prData) { |
|
1183 d->lock(); |
|
1184 if (prData->iOrientationChangeCompleted) { |
|
1185 d->unlock(); |
|
1186 return; |
|
1187 } |
|
1188 prData->iScreenOrientation = screenOrientation; |
|
1189 d->unlock(); |
|
1190 |
|
1191 // notify everyone that the orientation has changed. |
|
1192 d->handleDeviceSpecificOriantationAndFlipChange(); |
|
1193 emit orientationChanged(screenOrientation); |
|
1194 |
|
1195 // set orientation change operation completed. |
|
1196 d->lock(); |
|
1197 prData->iOrientationChangeCompleted = true; |
|
1198 d->unlock(); |
|
1199 } |
|
1200 } |
|
1201 |
|
1202 /*! |
|
1203 Starts screen orientation change sequence. Emits orientationAboutToChange signal |
|
1204 and set internal orientation change flag to true. Whoever calls this |
|
1205 method, must also complete the orientation change sequence by calling setScreenOrientation. |
|
1206 Generally this mechanims is connected to operating system level screen orientation attribute |
|
1207 begind the scenes and there is no need to call this directly from application or input |
|
1208 method. |
|
1209 */ |
|
1210 void HbInputSettingProxy::notifyScreenOrientationChange() |
|
1211 { |
|
1212 Q_D(HbInputSettingProxy); |
|
1213 |
|
1214 HbSettingProxyInternalData *prData = d->proxyData(); |
1020 HbSettingProxyInternalData *prData = d->proxyData(); |
1215 if (prData) { |
1021 if (prData) { |
1216 bool notify = false; |
1022 bool notify = false; |
1217 d->lock(); |
1023 d->lock(); |
1218 if (prData->iOrientationChangeCompleted) { |
1024 if (prData->regionalCorrectionStatus != newStatus) { |
1219 prData->iOrientationChangeCompleted = false; |
1025 prData->regionalCorrectionStatus = newStatus; |
1220 notify = true; |
|
1221 } |
|
1222 d->unlock(); |
|
1223 if (notify) { |
|
1224 emit orientationAboutToChange(); |
|
1225 } |
|
1226 } |
|
1227 |
|
1228 } |
|
1229 |
|
1230 /*! |
|
1231 Returns true if the orientation change is completed |
|
1232 */ |
|
1233 bool HbInputSettingProxy::orientationChangeCompleted() const |
|
1234 { |
|
1235 Q_D(const HbInputSettingProxy); |
|
1236 |
|
1237 bool completed = true; |
|
1238 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1239 if (prData) { |
|
1240 completed = prData->iOrientationChangeCompleted; |
|
1241 } |
|
1242 return completed; |
|
1243 } |
|
1244 |
|
1245 /*! |
|
1246 Method for initializing orientation state of the input framework. Needed only on |
|
1247 framework level, should not be called by applications. |
|
1248 */ |
|
1249 void HbInputSettingProxy::initializeOrientation(Qt::Orientation screenOrientation) |
|
1250 { |
|
1251 Q_D(HbInputSettingProxy); |
|
1252 |
|
1253 // call handleDeviceSpecificOriantationAndFlipChange method |
|
1254 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1255 if (prData) { |
|
1256 d->lock(); |
|
1257 prData->iScreenOrientation = screenOrientation; |
|
1258 if (screenOrientation == Qt::Vertical) { |
|
1259 prData->iActiveKeyboard = HbKeyboardVirtual12Key; |
|
1260 } else { |
|
1261 prData->iActiveKeyboard = HbKeyboardVirtualQwerty; |
|
1262 } |
|
1263 d->unlock(); |
|
1264 } |
|
1265 } |
|
1266 |
|
1267 /*! |
|
1268 Returns the status of regional input correction feature. |
|
1269 |
|
1270 \sa enableRegionalCorrection. |
|
1271 */ |
|
1272 bool HbInputSettingProxy::regionalCorrectionEnabled() |
|
1273 { |
|
1274 Q_D(const HbInputSettingProxy); |
|
1275 bool res = false; |
|
1276 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1277 if (prData) { |
|
1278 res = prData->iRegionalCorrectionStatus; |
|
1279 } |
|
1280 return res; |
|
1281 } |
|
1282 |
|
1283 /*! |
|
1284 Sets the status of regional input correction feature. Will emit signal regionalCorretionStatusChanged if status is changed. |
|
1285 |
|
1286 \sa regionalCorrectionEnabled. |
|
1287 */ |
|
1288 void HbInputSettingProxy::enableRegionalCorrection(bool newStatus) |
|
1289 { |
|
1290 Q_D(HbInputSettingProxy); |
|
1291 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1292 if (prData) { |
|
1293 bool notify = false; |
|
1294 d->lock(); |
|
1295 if (prData->iRegionalCorrectionStatus != newStatus) { |
|
1296 prData->iRegionalCorrectionStatus = newStatus; |
|
1297 notify = true; |
1026 notify = true; |
1298 } |
1027 } |
1299 d->unlock(); |
1028 d->unlock(); |
1300 if (notify) { |
1029 if (notify) { |
1301 emit regionalCorretionStatusChanged(newStatus); |
1030 emit regionalCorretionStatusChanged(newStatus); |
1313 Q_D(HbInputSettingProxy); |
1042 Q_D(HbInputSettingProxy); |
1314 HbSettingProxyInternalData *prData = d->proxyData(); |
1043 HbSettingProxyInternalData *prData = d->proxyData(); |
1315 if (prData) { |
1044 if (prData) { |
1316 bool notify = false; |
1045 bool notify = false; |
1317 d->lock(); |
1046 d->lock(); |
1318 if (prData->iKeypressTimeout != timeout) { |
1047 if (prData->keypressTimeout != timeout) { |
1319 prData->iKeypressTimeout = timeout; |
1048 prData->keypressTimeout = timeout; |
1320 notify = true; |
1049 notify = true; |
1321 } |
1050 } |
1322 d->unlock(); |
1051 d->unlock(); |
1323 if (notify) { |
1052 if (notify) { |
1324 emit keypressTimeoutChanged(timeout); |
1053 emit keypressTimeoutChanged(timeout); |
1335 { |
1064 { |
1336 Q_D(const HbInputSettingProxy); |
1065 Q_D(const HbInputSettingProxy); |
1337 int res = 0; |
1066 int res = 0; |
1338 HbSettingProxyInternalData *prData = d->proxyData(); |
1067 HbSettingProxyInternalData *prData = d->proxyData(); |
1339 if (prData) { |
1068 if (prData) { |
1340 res = prData->iKeypressTimeout; |
1069 res = prData->keypressTimeout; |
1341 } |
1070 } |
1342 return res; |
1071 return res; |
1343 } |
1072 } |
1344 |
1073 |
1345 /*! |
1074 /*! |
1352 Q_D(HbInputSettingProxy); |
1081 Q_D(HbInputSettingProxy); |
1353 HbSettingProxyInternalData *prData = d->proxyData(); |
1082 HbSettingProxyInternalData *prData = d->proxyData(); |
1354 if (prData) { |
1083 if (prData) { |
1355 bool notify = false; |
1084 bool notify = false; |
1356 d->lock(); |
1085 d->lock(); |
1357 HbKeyboardSettingFlags newValue = prData->iAutocompletion; |
1086 HbKeyboardSettingFlags newValue = prData->autocompletion; |
1358 if (state) { |
1087 if (state) { |
1359 newValue |= keyboardType; |
1088 newValue |= keyboardType; |
1360 } else { |
1089 } else { |
1361 newValue &= ~keyboardType; |
1090 newValue &= ~keyboardType; |
1362 } |
1091 } |
1363 if (prData->iAutocompletion != newValue) { |
1092 if (prData->autocompletion != newValue) { |
1364 prData->iAutocompletion = newValue; |
1093 prData->autocompletion = newValue; |
1365 notify = true; |
1094 notify = true; |
1366 } |
1095 } |
1367 d->unlock(); |
1096 d->unlock(); |
1368 if (notify) { |
1097 if (notify) { |
1369 emit autocompletionStateChanged(keyboardType, state); |
1098 emit autocompletionStateChanged(keyboardType, state); |
1381 { |
1110 { |
1382 Q_D(const HbInputSettingProxy); |
1111 Q_D(const HbInputSettingProxy); |
1383 bool res = false; |
1112 bool res = false; |
1384 HbSettingProxyInternalData *prData = d->proxyData(); |
1113 HbSettingProxyInternalData *prData = d->proxyData(); |
1385 if (prData) { |
1114 if (prData) { |
1386 res = prData->iAutocompletion & keyboardType; |
1115 res = prData->autocompletion & keyboardType; |
1387 } |
1116 } |
1388 return res; |
1117 return res; |
1389 } |
1118 } |
1390 |
1119 |
1391 /*! |
1120 /*! |
1398 Q_D(HbInputSettingProxy); |
1127 Q_D(HbInputSettingProxy); |
1399 HbSettingProxyInternalData *prData = d->proxyData(); |
1128 HbSettingProxyInternalData *prData = d->proxyData(); |
1400 if (prData) { |
1129 if (prData) { |
1401 bool notify = false; |
1130 bool notify = false; |
1402 d->lock(); |
1131 d->lock(); |
1403 if (prData->iTypingCorrectionLevel != level) { |
1132 if (prData->typingCorrectionLevel != level) { |
1404 prData->iTypingCorrectionLevel = level; |
1133 prData->typingCorrectionLevel = level; |
1405 notify = true; |
1134 notify = true; |
1406 } |
1135 } |
1407 d->unlock(); |
1136 d->unlock(); |
1408 if (notify) { |
1137 if (notify) { |
1409 emit typingCorrectionLevelChanged(level); |
1138 emit typingCorrectionLevelChanged(level); |
1421 { |
1150 { |
1422 Q_D(const HbInputSettingProxy); |
1151 Q_D(const HbInputSettingProxy); |
1423 HbTypingCorrectionLevel res = HbTypingCorrectionLevelHigh; |
1152 HbTypingCorrectionLevel res = HbTypingCorrectionLevelHigh; |
1424 HbSettingProxyInternalData *prData = d->proxyData(); |
1153 HbSettingProxyInternalData *prData = d->proxyData(); |
1425 if (prData) { |
1154 if (prData) { |
1426 res = prData->iTypingCorrectionLevel; |
1155 res = prData->typingCorrectionLevel; |
1427 } |
1156 } |
1428 return res; |
1157 return res; |
1429 } |
1158 } |
1430 |
1159 |
1431 /*! |
1160 /*! |
1438 Q_D(HbInputSettingProxy); |
1167 Q_D(HbInputSettingProxy); |
1439 HbSettingProxyInternalData *prData = d->proxyData(); |
1168 HbSettingProxyInternalData *prData = d->proxyData(); |
1440 if (prData) { |
1169 if (prData) { |
1441 bool notify = false; |
1170 bool notify = false; |
1442 d->lock(); |
1171 d->lock(); |
1443 if (prData->iPrimaryCandidateMode != mode) { |
1172 if (prData->primaryCandidateMode != mode) { |
1444 prData->iPrimaryCandidateMode = mode; |
1173 prData->primaryCandidateMode = mode; |
1445 notify = true; |
1174 notify = true; |
1446 } |
1175 } |
1447 d->unlock(); |
1176 d->unlock(); |
1448 if (notify) { |
1177 if (notify) { |
1449 emit primaryCandidateModeChanged(mode); |
1178 emit primaryCandidateModeChanged(mode); |
1460 { |
1189 { |
1461 Q_D(const HbInputSettingProxy); |
1190 Q_D(const HbInputSettingProxy); |
1462 HbPrimaryCandidateMode res = HbPrimaryCandidateModeExactTyping; |
1191 HbPrimaryCandidateMode res = HbPrimaryCandidateModeExactTyping; |
1463 HbSettingProxyInternalData *prData = d->proxyData(); |
1192 HbSettingProxyInternalData *prData = d->proxyData(); |
1464 if (prData) { |
1193 if (prData) { |
1465 res = prData->iPrimaryCandidateMode; |
1194 res = prData->primaryCandidateMode; |
1466 } |
1195 } |
1467 return res; |
1196 return res; |
1468 } |
1197 } |
1469 |
1198 |
1199 /*! |
|
1200 Set the variable to true if the default keypad is western for chinese input method |
|
1201 |
|
1202 \sa useWesternDefaultKeypadForChinese |
|
1203 */ |
|
1204 void HbInputSettingProxy::setWesternDefaultKeypadForChinese(bool set) |
|
1205 { |
|
1206 Q_D(const HbInputSettingProxy); |
|
1207 |
|
1208 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1209 if (prData) { |
|
1210 bool notify = false; |
|
1211 d->lock(); |
|
1212 if(prData->useWesternDefaultKeypadForChinese != set) { |
|
1213 prData->useWesternDefaultKeypadForChinese = set; |
|
1214 notify = true; |
|
1215 } |
|
1216 d->unlock(); |
|
1217 if(notify) { |
|
1218 emit chineseDefaultKeypadChanged(prData->useWesternDefaultKeypadForChinese); |
|
1219 } |
|
1220 } |
|
1221 } |
|
1222 |
|
1223 /*! |
|
1224 Get whether the default keypad is western for chinese input method |
|
1225 |
|
1226 \sa setWesternDefaultKeypadForChinese |
|
1227 */ |
|
1228 bool HbInputSettingProxy::useWesternDefaultKeypadForChinese() const |
|
1229 { |
|
1230 Q_D(const HbInputSettingProxy); |
|
1231 bool res = false; |
|
1232 HbSettingProxyInternalData *prData = d->proxyData(); |
|
1233 if (prData) { |
|
1234 res = prData->useWesternDefaultKeypadForChinese; |
|
1235 } |
|
1236 return res; |
|
1237 } |
|
1238 |
|
1239 /*! |
|
1240 \deprecated HbInputSettingProxy::setActiveKeyboard(HbKeyboardType) |
|
1241 is deprecated. |
|
1242 */ |
|
1243 void HbInputSettingProxy::setActiveKeyboard(HbKeyboardType keyboard) |
|
1244 { |
|
1245 Q_UNUSED(keyboard); |
|
1246 } |
|
1247 |
|
1470 // End of file |
1248 // End of file |