From a4f600c14d7be575d59b8d888d69804fdede45f9 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Sat, 17 Feb 2024 10:10:30 +0100 Subject: [PATCH] Axivion: Show error messages on CredentialQuery errors Use more writeDisrupting() for logging Axivion errors. Don't translate "Axivion". Change-Id: Ic04ff0afe66d79be3d319b16948f7861225e8927 Reviewed-by: hjk Reviewed-by: --- src/plugins/axivion/axivionplugin.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index ec64dcc4ba5..f3246fb8dc3 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -205,7 +205,7 @@ class AxivionTextMark : public TextMark { public: AxivionTextMark(const FilePath &filePath, const Dto::LineMarkerDto &issue) - : TextMark(filePath, issue.startLine, {Tr::tr("Axivion"), s_axivionTextMarkId}) + : TextMark(filePath, issue.startLine, {QString("Axivion"), s_axivionTextMarkId}) { const QString markText = issue.description; const QString id = issue.kind + QString::number(issue.id.value_or(-1)); @@ -308,7 +308,7 @@ static QUrl urlForProject(const QString &projectName) QString dashboard = settings().server.dashboard; if (!dashboard.endsWith(QLatin1Char('/'))) dashboard += QLatin1Char('/'); - return QUrl(dashboard).resolved(QStringLiteral("api/projects/")).resolved(projectName); + return QUrl(dashboard).resolved(QString("api/projects/")).resolved(projectName); } static constexpr int httpStatusCodeOk = 200; @@ -428,8 +428,7 @@ static Group dtoRecipe(const Storage> &dtoStorage) } return NetworkError(reply->url(), error, reply->errorString()); }; - - MessageManager::writeFlashing(QStringLiteral("Axivion: %1").arg(getError().message())); + MessageManager::writeDisrupting(QString("Axivion: %1").arg(getError().message())); return DoneResult::Error; }; @@ -493,7 +492,8 @@ static Group authorizationRecipe() const auto onGetCredentialDone = [](const CredentialQuery &credential, DoneWith result) { if (result == DoneWith::Success) dd->m_apiToken = credential.data(); - // TODO: Show the message about keystore error and info that we can't authorize without it. + else + MessageManager::writeDisrupting(QString("Axivion: %1").arg(credential.errorString())); }; const Storage passwordStorage; @@ -549,6 +549,9 @@ static Group authorizationRecipe() credential.setData(*dd->m_apiToken); return SetupResult::Continue; }; + const auto onSetCredentialDone = [](const CredentialQuery &credential) { + MessageManager::writeDisrupting(QString("Axivion: %1").arg(credential.errorString())); + }; return { Group { @@ -572,7 +575,7 @@ static Group authorizationRecipe() apiTokenStorage, onGroupSetup(onApiTokenGroupSetup), dtoRecipe(apiTokenStorage), - CredentialQueryTask(onSetCredentialSetup) + CredentialQueryTask(onSetCredentialSetup, onSetCredentialDone, CallDoneIf::Error) } } }