diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-11-04 16:29:13 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-11-04 16:29:13 (GMT) |
commit | 2d915c820137ed9e33b958f5b46b55ee4f2fe8b3 (patch) | |
tree | 48c1c1b5e1eba69025fd16e780f389a1bf662624 /src/gui | |
parent | a314ed575a6d32ef2f31e9b5fd12b14f13208d4f (diff) | |
parent | e8e40214a29dbec18db5cf1e65aa8bd3f4d7468f (diff) | |
download | Qt-2d915c820137ed9e33b958f5b46b55ee4f2fe8b3.zip Qt-2d915c820137ed9e33b958f5b46b55ee4f2fe8b3.tar.gz Qt-2d915c820137ed9e33b958f5b46b55ee4f2fe8b3.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 9 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 43 |
2 files changed, 45 insertions, 7 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 1531036..452aa75 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -65,10 +65,10 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QCoeFepInputContext : public QInputContext, - public MCoeFepAwareTextEditor, - public MCoeFepAwareTextEditor_Extension1, - public MObjectProvider +class QCoeFepInputContext : public QInputContext, + public MCoeFepAwareTextEditor, + public MCoeFepAwareTextEditor_Extension1, + public MObjectProvider { Q_OBJECT @@ -97,6 +97,7 @@ private: void applyHints(Qt::InputMethodHints hints); void applyFormat(QList<QInputMethodEvent::Attribute> *attributes); void queueInputCapabilitiesChanged(); + bool needsInputPanel(); private Q_SLOTS: void ensureInputCapabilitiesChanged(); diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 3f21bc3..25b2313 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -47,6 +47,7 @@ #include <private/qcore_symbian_p.h> #include <fepitfr.h> +#include <hal.h> #include <limits.h> // You only find these enumerations on SDK 5 onwards, so we need to provide our own @@ -153,6 +154,44 @@ QString QCoeFepInputContext::language() } } +bool QCoeFepInputContext::needsInputPanel() +{ + switch (QSysInfo::s60Version()) { + case QSysInfo::SV_S60_3_1: + case QSysInfo::SV_S60_3_2: + // There are no touch phones for pre-5.0 SDKs. + return false; +#ifdef Q_CC_NOKIAX86 + default: + // For emulator we assume that we need an input panel, since we can't + // separate between phone types. + return true; +#else + case QSysInfo::SV_S60_5_0: { + // For SDK == 5.0, we need phone specific detection, since the HAL API + // is no good on most phones. However, all phones at the time of writing use the + // input panel, except N97 in landscape mode, but in this mode it refuses to bring + // up the panel anyway, so we don't have to care. + return true; + } + default: + // For unknown/newer types, we try to use the HAL API. + int keyboardEnabled; + int keyboardType; + int err[2]; + err[0] = HAL::Get(HAL::EKeyboard, keyboardType); + err[1] = HAL::Get(HAL::EKeyboardState, keyboardEnabled); + if (err[0] == KErrNone && err[1] == KErrNone + && keyboardType != 0 && keyboardEnabled) + // Means that we have some sort of keyboard. + return false; + + // Fall back to using the input panel. + return true; +#endif // !Q_CC_NOKIAX86 + } +} + bool QCoeFepInputContext::filterEvent(const QEvent *event) { // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically @@ -174,10 +213,8 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) } } - // For pre-5.0 SDKs, we don't launch the keyboard. - if (QSysInfo::s60Version() != QSysInfo::SV_S60_5_0) { + if (!needsInputPanel()) return false; - } if (event->type() == QEvent::RequestSoftwareInputPanel) { // Notify S60 that we want the virtual keyboard to show up. |