summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-06-09 12:35:40 (GMT)
committeraxis <qt-info@nokia.com>2009-06-10 11:24:52 (GMT)
commit8c265860b41214daade7c8a28237c1e07ea71a3c (patch)
tree5aa778cd5f7617ee1c5ea5669de32d9d33033bd0 /src
parent3ffd60631a3716c3b38de86df3af9deca1196c76 (diff)
downloadQt-8c265860b41214daade7c8a28237c1e07ea71a3c.zip
Qt-8c265860b41214daade7c8a28237c1e07ea71a3c.tar.gz
Qt-8c265860b41214daade7c8a28237c1e07ea71a3c.tar.bz2
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')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h2
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp71
2 files changed, 18 insertions, 55 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index c2677b1..b33489e 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -92,7 +92,7 @@ public:
TCoeInputCapabilities inputCapabilities();
private:
- void commitCurrentString();
+ void commitCurrentString(bool triggeredBySymbian);
void updateHints();
void applyHints(Qt::InputMethodHints hints);
void applyFormat(QList<QInputMethodEvent::Attribute> *attributes);
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 0a5fd22..1dfb012 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)