summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-02-05 13:53:12 +0100
committeraxis <qt-info@nokia.com>2010-02-05 14:12:55 +0100
commitcafc2a861b139c33d3989c625deb76a874159fbe (patch)
tree90e738a7208b37bffd419b67cf6e1f88dda699d5
parent1e8a17edef013e70fa0d0c20a04e713c190c0bec (diff)
downloadqt4-tools-cafc2a861b139c33d3989c625deb76a874159fbe.tar.gz
Fixed a bug where text would disappear in password fields.
There were two bugs: - First, we need to avoid triggering the CancelTransaction call when committing the temporary preedit text, because otherwise FEP starts sending us spurious backspace events. Since the "triggeredBySymbian" variable is no longer descriptive for that use case, I renamed it in the process and that changed the negation of the flag. Notice the absense of a change inside commitTemporaryPreeditString(). That is because we want that one to avoid the transaction cancel, and therefore wee keep the old negation. - Second, m_cursorPos needs to be kept in sync with the widget state when we send the temporary preedit string, because the input context cannot separate between types of preedit text when it hits the first block in commitCurrentString() (types being either our temporary text, or FEP's text), and we have to avoid the longPress code path. RevBy: Janne Koskinen
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h2
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp17
2 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index f325fb9d79..d5243c3f07 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -96,7 +96,7 @@ protected:
void timerEvent(QTimerEvent *timerEvent);
private:
- void commitCurrentString(bool triggeredBySymbian);
+ void commitCurrentString(bool cancelFepTransaction);
void updateHints(bool mustUpdateInputCapabilities);
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 41481d038f..2b91711f6e 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -100,7 +100,7 @@ QCoeFepInputContext::~QCoeFepInputContext()
void QCoeFepInputContext::reset()
{
- commitCurrentString(false);
+ commitCurrentString(true);
}
void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType)
@@ -125,7 +125,7 @@ void QCoeFepInputContext::update()
void QCoeFepInputContext::setFocusWidget(QWidget *w)
{
- commitCurrentString(false);
+ commitCurrentString(true);
QInputContext::setFocusWidget(w);
@@ -218,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;
@@ -230,6 +230,7 @@ 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);
@@ -292,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;
@@ -738,16 +739,16 @@ 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)
longPress = 1;
@@ -764,7 +765,7 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
m_hasTempPreeditString = false;
longPress = 0;
- if (!triggeredBySymbian) {
+ if (cancelFepTransaction) {
CCoeFep* fep = CCoeEnv::Static()->Fep();
if (fep)
fep->CancelTransaction();