summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlinecontrol_p.h
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-07-25 13:25:15 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-25 05:31:46 +0200
commita150880ae6ea698a2e979c93498db4f3bb66c1b0 (patch)
tree15d11535db1e3c3b2640b6b9f29bca1fddcb4d68 /src/gui/widgets/qlinecontrol_p.h
parentbe76c09981eab137abda0e855aa0aa4e5d11a2e7 (diff)
Delay masking the last character in Password echo mode.
If QT_GUI_PASSWORD_ECHO_DELAY is defined in qplatformdefs.h with an integer value in milliseconds, QLineEdit and TextInput will display the last character entered unmasked for that delay period and then mask the character as normal. If QT_GUI_PASSWORD_ECHO_DELAY is not defined then the behaviour is unchanged. Task-number: QTBUG-17003 Reviewed-by: Martin Jones (cherry picked from commit f9e7aee2019d321edd655bfde7de43f20a106971) Conflicts: src/declarative/graphicsitems/qdeclarativetextinput.cpp tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp Change-Id: I3683223189b7176e4ef5081ee315c95a0efb9cfe Reviewed-on: http://codereview.qt.nokia.com/2060 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src/gui/widgets/qlinecontrol_p.h')
-rw-r--r--src/gui/widgets/qlinecontrol_p.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index c6105f8472..44bd7214be 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -66,6 +66,8 @@
#include "QtGui/qcompleter.h"
#include "QtGui/qaccessible.h"
+#include "qplatformdefs.h"
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -85,6 +87,9 @@ public:
m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1),
m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0),
m_selstart(0), m_selend(0), m_passwordEchoEditing(false)
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ , m_passwordEchoTimer(0)
+#endif
{
init(txt);
}
@@ -222,6 +227,7 @@ public:
uint echoMode() const { return m_echoMode; }
void setEchoMode(uint mode)
{
+ cancelPasswordEchoTimer();
m_echoMode = mode;
m_passwordEchoEditing = false;
updateDisplayText();
@@ -271,7 +277,13 @@ public:
QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
void updatePasswordEchoEditing(bool editing);
- bool passwordEchoEditing() const { return m_passwordEchoEditing; }
+ bool passwordEchoEditing() const {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0)
+ return true;
+#endif
+ return m_passwordEchoEditing ;
+ }
QChar passwordCharacter() const { return m_passwordCharacter; }
void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
@@ -426,6 +438,18 @@ private:
bool m_passwordEchoEditing;
QChar m_passwordCharacter;
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ int m_passwordEchoTimer;
+#endif
+ void cancelPasswordEchoTimer()
+ {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ if (m_passwordEchoTimer != 0) {
+ killTimer(m_passwordEchoTimer);
+ m_passwordEchoTimer = 0;
+ }
+#endif
+ }
Q_SIGNALS:
void cursorPositionChanged(int, int);