From 4ba14fe9a9555a9c03592ac77d75efff0b0918b1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 1 Nov 2018 16:58:40 +0100 Subject: [PATCH] Ref T401, mapping tool login updates crashpad info --- src/blackgui/components/dblogincomponent.cpp | 5 +++++ src/blackmisc/network/authenticateduser.cpp | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/blackgui/components/dblogincomponent.cpp b/src/blackgui/components/dblogincomponent.cpp index fab6e0188..3ae703730 100644 --- a/src/blackgui/components/dblogincomponent.cpp +++ b/src/blackgui/components/dblogincomponent.cpp @@ -138,6 +138,7 @@ namespace BlackGui void CDbLoginComponent::setUserInfo(const CAuthenticatedUser &user) { + if (!sGui || sGui->isShuttingDown()) { return; } if (user.isAuthenticated()) { CLogMessage(this).info("User authenticated: %1") << user.toQString(); @@ -152,6 +153,10 @@ namespace BlackGui { ui->le_Info->setText("You can create model change requests"); } + + // crashpad info + sGui->setCrashInfoUserName(user.getRealNameAndId()); + sGui->appendCrashInfo(QStringLiteral("Login as user %1 %2").arg(user.getRealNameAndId(), user.getRolesAsString())); } else { diff --git a/src/blackmisc/network/authenticateduser.cpp b/src/blackmisc/network/authenticateduser.cpp index 8b7b6bfbb..ffbd93fde 100644 --- a/src/blackmisc/network/authenticateduser.cpp +++ b/src/blackmisc/network/authenticateduser.cpp @@ -17,6 +17,7 @@ #include #include +#include #include namespace BlackMisc @@ -38,7 +39,7 @@ namespace BlackMisc { if (hasValidRealName()) { - return m_realname + " " + getDbKeyAsStringInParentheses(); + return m_realname % QStringLiteral(" ") % getDbKeyAsStringInParentheses(); } else { @@ -49,13 +50,8 @@ namespace BlackMisc QString CAuthenticatedUser::convertToQString(bool i18n) const { Q_UNUSED(i18n); - if (m_realname.isEmpty()) return ""; - QString s = m_realname; - if (this->hasValidDbKey()) - { - s.append(this->getDbKeyAsStringInParentheses(" ")); - } - return s; + if (m_realname.isEmpty()) { return QStringLiteral(""); } + return m_realname % (this->hasValidDbKey() ? this->getDbKeyAsStringInParentheses(" ") : QStringLiteral("")); } CAuthenticatedUser CAuthenticatedUser::fromDatabaseJson(const QJsonObject &json)