aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-10-24 13:28:30 +0200
committerMitch Curtis <mitch.curtis@qt.io>2018-10-26 09:53:10 +0000
commitc7a94110987672308ed04b40fd8ed207d1c8d93b (patch)
tree8e924ee3bd84fb31e90ac4e1a16a8c511b3113c7
parentabbc5a8ecc6a66c87d90a0f7acf15451c3808c1b (diff)
Be more restrictive about which information is included in logging
- Introduce SENSITIVE_DEBUG flag that should be explicitly enabled in order to have certain information included in logging output. - Replace qWarning() with qCWarning() where appropriate. Change-Id: I6386f9cb3ce375101f3c42f407d4af380f1ff75e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
-rw-r--r--src/virtualkeyboard/inputcontext.cpp13
-rw-r--r--src/virtualkeyboard/virtualkeyboarddebug.h5
2 files changed, 15 insertions, 3 deletions
diff --git a/src/virtualkeyboard/inputcontext.cpp b/src/virtualkeyboard/inputcontext.cpp
index 80739819..7a856e21 100644
--- a/src/virtualkeyboard/inputcontext.cpp
+++ b/src/virtualkeyboard/inputcontext.cpp
@@ -444,7 +444,11 @@ void InputContext::sendKeyClick(int key, const QString &text, int modifiers)
if (d->focus && d->inputContext) {
QKeyEvent pressEvent(QEvent::KeyPress, key, Qt::KeyboardModifiers(modifiers), text);
QKeyEvent releaseEvent(QEvent::KeyRelease, key, Qt::KeyboardModifiers(modifiers), text);
- VIRTUALKEYBOARD_DEBUG() << "InputContext::sendKeyClick():" << key;
+ VIRTUALKEYBOARD_DEBUG().nospace() << "InputContext::sendKeyClick()"
+#ifdef SENSITIVE_DEBUG
+ << ": " << key
+#endif
+ ;
d->stateFlags |= InputContextPrivate::KeyEventState;
d->inputContext->sendKeyEvent(&pressEvent);
@@ -452,8 +456,11 @@ void InputContext::sendKeyClick(int key, const QString &text, int modifiers)
if (d->activeKeys.isEmpty())
d->stateFlags &= ~InputContextPrivate::KeyEventState;
} else {
- qWarning() << "InputContext::sendKeyClick(): no focus to send key click" << key << text
- << "- QGuiApplication::focusWindow() is:" << QGuiApplication::focusWindow();
+ VIRTUALKEYBOARD_WARN() << "InputContext::sendKeyClick(): no focus to send key click"
+#ifdef SENSITIVE_DEBUG
+ << key << text
+#endif
+ << "- QGuiApplication::focusWindow() is:" << QGuiApplication::focusWindow();
}
}
diff --git a/src/virtualkeyboard/virtualkeyboarddebug.h b/src/virtualkeyboard/virtualkeyboarddebug.h
index 17e53bdf..6dee6372 100644
--- a/src/virtualkeyboard/virtualkeyboarddebug.h
+++ b/src/virtualkeyboard/virtualkeyboarddebug.h
@@ -35,6 +35,11 @@
Q_DECLARE_LOGGING_CATEGORY(qlcVirtualKeyboard)
+// Enables logging of sensitive information, such as key events.
+// Should never be enabled by default.
+//#define SENSITIVE_DEBUG
+
#define VIRTUALKEYBOARD_DEBUG() qCDebug(qlcVirtualKeyboard)
+#define VIRTUALKEYBOARD_WARN() qCWarning(qlcVirtualKeyboard)
#endif // VIRTUALKEYBOARDDEBUG_H