diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-10 03:01:07 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-10 03:01:07 (GMT) |
commit | 8df98549a4d84b5877e50318140c2041e17632fb (patch) | |
tree | 0c55d5ef4d8380ec45c6457a40b033dc45cbd579 /src/gui/inputmethod | |
parent | f55c317e377aaf0b3e24904e88dc1c4a6e15a20a (diff) | |
parent | 9a6de1fa0db0da8c4fa5eb904ef6d78cc619e332 (diff) | |
download | Qt-8df98549a4d84b5877e50318140c2041e17632fb.zip Qt-8df98549a4d84b5877e50318140c2041e17632fb.tar.gz Qt-8df98549a4d84b5877e50318140c2041e17632fb.tar.bz2 |
Merge branch '4.6' of ../qt into 4.6
Diffstat (limited to 'src/gui/inputmethod')
-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. |