summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/inputmethod/qcoefepinputcontext_s60.cpp')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index e5ab3003a0..2b91711f6e 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -71,7 +71,6 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_inlinePosition(0),
m_formatRetriever(0),
m_pointerHandler(0),
- m_longPress(0),
m_cursorPos(0),
m_hasTempPreeditString(false)
{
@@ -101,7 +100,7 @@ QCoeFepInputContext::~QCoeFepInputContext()
void QCoeFepInputContext::reset()
{
- commitCurrentString(false);
+ commitCurrentString(true);
}
void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType)
@@ -126,7 +125,7 @@ void QCoeFepInputContext::update()
void QCoeFepInputContext::setFocusWidget(QWidget *w)
{
- commitCurrentString(false);
+ commitCurrentString(true);
QInputContext::setFocusWidget(w);
@@ -219,7 +218,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
break;
case Qt::Key_Select:
if (!m_preeditString.isEmpty()) {
- commitCurrentString(false);
+ commitCurrentString(true);
return true;
}
break;
@@ -231,10 +230,11 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
&& focusWidget()->inputMethodHints() & Qt::ImhHiddenText
&& !keyEvent->text().isEmpty()) {
// Send some temporary preedit text in order to make text visible for a moment.
+ m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
m_preeditString = keyEvent->text();
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent imEvent(m_preeditString, attributes);
- QApplication::sendEvent(focusWidget(), &imEvent);
+ sendEvent(imEvent);
m_tempPreeditStringTimeout.start(1000, this);
m_hasTempPreeditString = true;
update();
@@ -293,7 +293,7 @@ void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
Q_ASSERT(focusWidget());
if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) {
- commitCurrentString(false);
+ commitCurrentString(true);
int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
QList<QInputMethodEvent::Attribute> attributes;
@@ -739,31 +739,33 @@ void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLin
void QCoeFepInputContext::DoCommitFepInlineEditL()
{
- commitCurrentString(true);
+ commitCurrentString(false);
}
-void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
+void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction)
{
+ int longPress = 0;
+
if (m_preeditString.size() == 0) {
QWidget *w = focusWidget();
- if (triggeredBySymbian && w) {
+ if (!cancelFepTransaction && 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;
+ longPress = 1;
}
return;
}
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event(QLatin1String(""), attributes);
- event.setCommitString(m_preeditString, 0-m_longPress, m_longPress);
+ event.setCommitString(m_preeditString, 0-longPress, longPress);
m_preeditString.clear();
sendEvent(event);
m_hasTempPreeditString = false;
- m_longPress = 0;
+ longPress = 0;
- if (!triggeredBySymbian) {
+ if (cancelFepTransaction) {
CCoeFep* fep = CCoeEnv::Static()->Fep();
if (fep)
fep->CancelTransaction();