summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-06-09 14:35:40 +0200
committeraxis <qt-info@nokia.com>2009-06-10 13:24:52 +0200
commit8c265860b41214daade7c8a28237c1e07ea71a3c (patch)
tree5aa778cd5f7617ee1c5ea5669de32d9d33033bd0 /src/gui/inputmethod/qcoefepinputcontext_s60.cpp
parent3ffd60631a3716c3b38de86df3af9deca1196c76 (diff)
Fixed the mouse handler of FEP when in inline edit mode.
We now commit the text if the mouse handler is invoked. This prevents the case where the VK cannot be brought up because the widget is the only focusable widget and is stuck in inline edit mode.
Diffstat (limited to 'src/gui/inputmethod/qcoefepinputcontext_s60.cpp')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp71
1 files changed, 17 insertions, 54 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 0a5fd22ca3..1dfb0124c9 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -123,9 +123,7 @@ void QCoeFepInputContext::update()
void QCoeFepInputContext::setFocusWidget(QWidget *w)
{
- commitCurrentString();
-
- CCoeEnv::Static()->Fep()->CancelTransaction();
+ commitCurrentString(false);
QInputContext::setFocusWidget(w);
@@ -292,56 +290,17 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
{
Q_ASSERT(m_isEditing);
+ Q_ASSERT(focusWidget());
- if (!m_pointerHandler) {
- QInputContext::mouseHandler(x, event);
- }
-
- TPointerEvent::TType type;
- TUint modifiers = 0;
-
- if (event->type() == QEvent::MouseButtonPress) {
- if (event->button() == Qt::LeftButton) {
- type = TPointerEvent::EButton1Down;
- } else if (event->button() == Qt::RightButton) {
- type = TPointerEvent::EButton3Down;
- } else if (event->button() == Qt::MidButton) {
- type = TPointerEvent::EButton2Down;
- } else {
- return;
- }
- } else if (event->type() == QEvent::MouseButtonRelease) {
- if (event->button() == Qt::LeftButton) {
- type = TPointerEvent::EButton1Up;
- } else if (event->button() == Qt::RightButton) {
- type = TPointerEvent::EButton3Up;
- } else if (event->button() == Qt::MidButton) {
- type = TPointerEvent::EButton2Up;
- } else {
- return;
- }
- } else if (event->type() == QEvent::MouseMove) {
- type = TPointerEvent::EMove;
- } else if (event->type() == QEvent::DragMove) {
- type = TPointerEvent::EDrag;
- } else {
- return;
- }
+ if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) {
+ commitCurrentString(false);
+ int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
- if (event->modifiers() & Qt::ShiftModifier) {
- modifiers |= EModifierShift;
- }
- if (event->modifiers() & Qt::AltModifier) {
- modifiers |= EModifierAlt;
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos + x, 0, QVariant());
+ QInputMethodEvent event("", attributes);
+ sendEvent(event);
}
- if (event->modifiers() & Qt::ControlModifier) {
- modifiers |= EModifierCtrl;
- }
- if (event->modifiers() & Qt::KeypadModifier) {
- modifiers |= EModifierKeypad;
- }
-
- m_pointerHandler->HandlePointerEventInInlineTextL(type, modifiers, x);
}
TCoeInputCapabilities QCoeFepInputContext::inputCapabilities()
@@ -712,12 +671,10 @@ void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLin
void QCoeFepInputContext::DoCommitFepInlineEditL()
{
- commitCurrentString();
-
- m_isEditing = false;
+ commitCurrentString(true);
}
-void QCoeFepInputContext::commitCurrentString()
+void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
{
if (m_preeditString.size() == 0) {
return;
@@ -728,6 +685,12 @@ void QCoeFepInputContext::commitCurrentString()
event.setCommitString(m_preeditString, 0, 0);//m_preeditString.size());
m_preeditString.clear();
sendEvent(event);
+
+ m_isEditing = false;
+
+ if (!triggeredBySymbian) {
+ CCoeEnv::Static()->Fep()->CancelTransaction();
+ }
}
MCoeFepAwareTextEditor_Extension1* QCoeFepInputContext::Extension1(TBool& aSetToTrue)