diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-10-24 13:28:30 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-11-07 13:23:56 +0000 |
commit | 61780a113f02b3c62fb14516fe8ea47d91f9ed9a (patch) | |
tree | 00be9303fa6bd4a54cee06cc98448a5818129698 | |
parent | f7d77a44e4f69393a72dba2acc77d204c52f6aa0 (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>
(cherry picked from commit c7a94110987672308ed04b40fd8ed207d1c8d93b)
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
-rw-r--r-- | src/virtualkeyboard/inputcontext.cpp | 12 | ||||
-rw-r--r-- | src/virtualkeyboard/virtualkeyboarddebug.h | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/virtualkeyboard/inputcontext.cpp b/src/virtualkeyboard/inputcontext.cpp index 6d36ae5e..ccc29bb8 100644 --- a/src/virtualkeyboard/inputcontext.cpp +++ b/src/virtualkeyboard/inputcontext.cpp @@ -449,7 +449,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); @@ -457,7 +461,11 @@ void InputContext::sendKeyClick(int key, const QString &text, int modifiers) if (d->activeKeys.isEmpty()) d->stateFlags &= ~InputContextPrivate::KeyEventState; } else { - qWarning() << "InputContext::::sendKeyClick():" << key << "no focus"; + 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 |