diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-25 18:20:45 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-25 18:20:45 (GMT) |
commit | e58b7f0cc139c5fda3d472c38161be8fb718db7d (patch) | |
tree | 3c20cccfe050d125a5f4736ba11b6383e8734be4 /src/gui/inputmethod | |
parent | c2a4a1b1e06f8b0d02e7b56c9eb0c19fd2fae80a (diff) | |
parent | 4c3539dfbc65d5decdd842d4181f9aa3d38d213c (diff) | |
download | Qt-e58b7f0cc139c5fda3d472c38161be8fb718db7d.zip Qt-e58b7f0cc139c5fda3d472c38161be8fb718db7d.tar.gz Qt-e58b7f0cc139c5fda3d472c38161be8fb718db7d.tar.bz2 |
Merge branch '4.6'
Conflicts:
doc/src/modules.qdoc
examples/assistant/simpletextviewer/findfiledialog.cpp
examples/webkit/fancybrowser/mainwindow.cpp
src/gui/widgets/qtabbar.cpp
src/gui/widgets/qtabbar_p.h
tests/auto/qpixmap/tst_qpixmap.cpp
tools/assistant/compat/helpdialog.cpp
tools/assistant/compat/tabbedbrowser.cpp
translations/translations.pri
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 6 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 68 |
2 files changed, 54 insertions, 20 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 2c65b4c..e24ee04 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -84,7 +84,7 @@ public: bool filterEvent(const QEvent *event); void mouseHandler( int x, QMouseEvent *event); - bool isComposing() const { return m_isEditing; } + bool isComposing() const { return !m_preeditString.isEmpty(); } void setFocusWidget(QWidget * w); void widgetDestroyed(QWidget *w); @@ -132,6 +132,7 @@ public: // From MObjectProvider public: TTypeUid::Ptr MopSupplyObject(TTypeUid id); + MObjectProvider *MopNext(); private: QSymbianControl *m_parent; @@ -139,13 +140,14 @@ private: QString m_preeditString; Qt::InputMethodHints m_lastImHints; TUint m_textCapabilities; - bool m_isEditing; bool m_inDestruction; bool m_pendingInputCapabilitiesChanged; int m_cursorVisibility; int m_inlinePosition; MFepInlineTextFormatRetriever *m_formatRetriever; MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; + int m_longPress; + int m_cursorPos; }; QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 19f296c..bdff5e7 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -65,13 +65,14 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new m_lastImHints(Qt::ImhNone), m_textCapabilities(TCoeInputCapabilities::EAllText), - m_isEditing(false), m_inDestruction(false), m_pendingInputCapabilitiesChanged(false), m_cursorVisibility(1), m_inlinePosition(0), m_formatRetriever(0), - m_pointerHandler(0) + m_pointerHandler(0), + m_longPress(0), + m_cursorPos(0) { m_fepState->SetObjectProvider(this); m_fepState->SetFlags(EAknEditorFlagDefault); @@ -79,7 +80,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); m_fepState->SetDefaultCase( EAknEditorLowerCase ); m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase ); - m_fepState->SetSpecialCharacterTableResourceId( 0 ); + m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); m_fepState->SetNumericKeymap( EAknEditorStandardNumberModeKeymap ); } @@ -202,14 +203,26 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event); - Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints()); - if (keyEvent->key() == Qt::Key_F20 && m_lastImHints & Qt::ImhHiddenText) { - // Special case in Symbian. On editors with secret text, F20 is for some reason - // considered to be a backspace. - QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(), - keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count()); - QApplication::sendEvent(focusWidget(), &modifiedEvent); - return true; + switch (keyEvent->key()) { + case Qt::Key_F20: + Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints()); + if (m_lastImHints & Qt::ImhHiddenText) { + // Special case in Symbian. On editors with secret text, F20 is for some reason + // considered to be a backspace. + QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(), + keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count()); + QApplication::sendEvent(focusWidget(), &modifiedEvent); + return true; + } + break; + case Qt::Key_Select: + if (!m_preeditString.isEmpty()) { + commitCurrentString(false); + return true; + } + break; + default: + break; } } @@ -243,7 +256,6 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) { - Q_ASSERT(m_isEditing); Q_ASSERT(focusWidget()); if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) { @@ -407,6 +419,14 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } m_fepState->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(flags)); + if (hints & ImhEmailCharactersOnly) { + m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); + } else if (hints & ImhUrlCharactersOnly) { + m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG); + } else { + m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); + } + if (hints & ImhHiddenText) { m_textCapabilities = TCoeInputCapabilities::EAllText | TCoeInputCapabilities::ESecretText; } else { @@ -478,8 +498,8 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, if (!w) return; - m_isEditing = true; - + m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + QList<QInputMethodEvent::Attribute> attributes; m_cursorVisibility = aCursorVisibility ? 1 : 0; @@ -543,8 +563,6 @@ void QCoeFepInputContext::CancelFepInlineEdit() event.setCommitString(QLatin1String(""), 0, 0); m_preeditString.clear(); sendEvent(event); - - m_isEditing = false; } TInt QCoeFepInputContext::DocumentLengthForFep() const @@ -683,16 +701,22 @@ void QCoeFepInputContext::DoCommitFepInlineEditL() void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) { if (m_preeditString.size() == 0) { + QWidget *w = focusWidget(); + if (triggeredBySymbian && w) { + // We must replace the last character only if the input box has already accepted one + if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) + m_longPress = 1; + } return; } QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(m_preeditString, 0, 0);//m_preeditString.size()); + event.setCommitString(m_preeditString, 0-m_longPress, m_longPress); m_preeditString.clear(); sendEvent(event); - m_isEditing = false; + m_longPress = 0; if (!triggeredBySymbian) { CCoeFep* fep = CCoeEnv::Static()->Fep(); @@ -733,6 +757,14 @@ TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(TTypeUid /*id*/) return TTypeUid::Null(); } +MObjectProvider *QCoeFepInputContext::MopNext() +{ + QWidget *w = focusWidget(); + if (w) + return w->effectiveWinId(); + return 0; +} + QT_END_NAMESPACE #endif // QT_NO_IM |