diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-03-10 06:38:20 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-03-11 04:44:48 (GMT) |
commit | 27f0c5054e5326bf16f40436ba4e72927ea89cc1 (patch) | |
tree | d0658e2ed1632db0561c3413b74240214a34537e /src | |
parent | 68415b0bcc3e531dc16516aa6788aeef8bced6f2 (diff) | |
download | Qt-27f0c5054e5326bf16f40436ba4e72927ea89cc1.zip Qt-27f0c5054e5326bf16f40436ba4e72927ea89cc1.tar.gz Qt-27f0c5054e5326bf16f40436ba4e72927ea89cc1.tar.bz2 |
Don't reveal TextInput text on refocus in PasswordEchoOnEdit mode.
In PasswordEchoOnEdit mode return the display text instead of the
real text from inputMethodQuery() when not editing the password and
clear old password if new input is received through an input method
event.
Change-Id: I7f24f510bf8e356e460900c3b9ff55ea16b32ab3
Task-number: QTBUG-17562
Reviewed-by: Joona Petrell
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 12d0c98..b4395e3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1374,7 +1374,10 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) case Qt::ImCursorPosition: return QVariant(d->control->cursor()); case Qt::ImSurroundingText: - return QVariant(text()); + if (d->control->echoMode() == PasswordEchoOnEdit && !d->control->passwordEchoEditing()) + return QVariant(displayText()); + else + return QVariant(text()); case Qt::ImCurrentSelection: return QVariant(selectedText()); case Qt::ImMaximumTextLength: @@ -1867,6 +1870,8 @@ void QDeclarativeTextInputPrivate::init() #endif // QT_NO_CLIPBOARD q->connect(control, SIGNAL(updateMicroFocus()), q, SLOT(updateMicroFocus())); + q->connect(control, SIGNAL(displayTextChanged(QString)), + q, SLOT(updateRect())); q->updateSize(); oldValidity = control->hasAcceptableInput(); lastSelectionStart = 0; diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index bffc2b5..5a281ad 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -414,10 +414,14 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (isGettingInput) { // If any text is being input, remove selected text. priorState = m_undoState; + if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) { + updatePasswordEchoEditing(true); + m_selstart = 0; + m_selend = m_text.length(); + } removeSelectedText(); } - int c = m_cursor; // cursor position after insertion of commit string if (event->replacementStart() <= 0) c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); |