Commit 6d6866c2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning

parent e0692c1c
......@@ -158,7 +158,7 @@ public:
void EwsOAuthUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request)
{
returnUriReceived(request->requestUrl());
Q_EMIT returnUriReceived(request->requestUrl());
}
void EwsOAuthReplyHandler::networkReplyFinished(QNetworkReply *reply)
......@@ -236,7 +236,7 @@ void EwsOAuthRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info
) {
qCDebug(EWSCLI_LOG) << QStringLiteral("Found redirect URI - blocking request");
redirectUriIntercepted(url);
Q_EMIT redirectUriIntercepted(url);
info.block(true);
}
}
......@@ -356,7 +356,8 @@ QVariantMap EwsOAuthPrivate::queryToVarmap(const QUrl &url)
{
QUrlQuery query(url);
QVariantMap varmap;
for (const auto &item : query.queryItems()) {
const auto items = query.queryItems();
for (const auto &item : items) {
varmap[item.first] = item.second;
}
return varmap;
......@@ -383,7 +384,7 @@ void EwsOAuthPrivate::redirectUriIntercepted(const QUrl &url)
return;
}
#endif
mOAuth2.authorizationCallbackReceived(queryToVarmap(url));
Q_EMIT mOAuth2.authorizationCallbackReceived(queryToVarmap(url));
}
#ifdef HAVE_QCA
......@@ -398,7 +399,7 @@ void EwsOAuthPrivate::pkeyAuthResult(KJob *j)
} else {
varmap[QStringLiteral("error")] = job->errorString();
}
mOAuth2.authorizationCallbackReceived(varmap);
Q_EMIT mOAuth2.authorizationCallbackReceived(varmap);
}
#endif
......@@ -445,7 +446,7 @@ EwsOAuth::~EwsOAuth()
void EwsOAuth::init()
{
requestWalletMap();
Q_EMIT requestWalletMap();
}
bool EwsOAuth::getAuthData(QString &username, QString &password, QStringList &customHeaders)
......
......@@ -169,7 +169,7 @@ EwsFindItemResponse::EwsFindItemResponse(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......@@ -188,7 +188,7 @@ bool EwsFindItemResponse::parseRootFolder(QXmlStreamReader &reader)
{
if (reader.namespaceUri() != ewsMsgNsUri || reader.name() != QLatin1String("RootFolder")) {
return setErrorMsg(QStringLiteral("Failed to read EWS request - expected %1 element (got %2).")
.arg(QStringLiteral("RootFolder")).arg(reader.qualifiedName().toString()));
.arg(QStringLiteral("RootFolder"), reader.qualifiedName().toString()));
}
if (!reader.attributes().hasAttribute(QStringLiteral("TotalItemsInView"))
......@@ -236,7 +236,7 @@ bool EwsFindItemResponse::parseRootFolder(QXmlStreamReader &reader)
if (reader.namespaceUri() != ewsTypeNsUri || reader.name() != QLatin1String("Items")) {
return setErrorMsg(QStringLiteral("Failed to read EWS request - expected %1 element (got %2).")
.arg(QStringLiteral("Items")).arg(reader.qualifiedName().toString()));
.arg(QStringLiteral("Items"), reader.qualifiedName().toString()));
}
if (!reader.readNextStartElement()) {
......
......@@ -111,7 +111,7 @@ EwsGetItemRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......
......@@ -41,7 +41,7 @@ public:
void start() override;
public Q_SLOTS:
void eventsProcessed(const Response &response);
void eventsProcessed(const EwsEventRequestBase::Response &response);
Q_SIGNALS:
void eventsReceived(KJob *job);
protected Q_SLOTS:
......
......@@ -260,7 +260,7 @@ bool EwsItemPrivate::timezoneReader(QXmlStreamReader &reader, QVariant &val)
QStringRef idRef = reader.attributes().value(QStringLiteral("Id"));
if (idRef.isNull()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading %1 element - missing %2 attribute")
.arg(reader.name().toString()).arg(QStringLiteral("Id"));
.arg(reader.name().toString(), QStringLiteral("Id"));
reader.skipCurrentElement();
return false;
} else {
......
......@@ -98,7 +98,7 @@ EwsMoveItemRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......
......@@ -67,26 +67,26 @@ EwsOccurrence::EwsOccurrence(QXmlStreamReader &reader)
d->mStart = QDateTime::fromString(reader.readElementText(), Qt::ISODate);
if (reader.error() != QXmlStreamReader::NoError || !d->mStart.isValid()) {
qCWarning(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(QStringLiteral("Occurrence")).arg(QStringLiteral("Start"));
.arg(QStringLiteral("Occurrence"), QStringLiteral("Start"));
return;
}
} else if (reader.name() == QLatin1String("End")) {
d->mEnd = QDateTime::fromString(reader.readElementText(), Qt::ISODate);
if (reader.error() != QXmlStreamReader::NoError || !d->mStart.isValid()) {
qCWarning(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(QStringLiteral("Occurrence")).arg(QStringLiteral("End"));
.arg(QStringLiteral("Occurrence"), QStringLiteral("End"));
return;
}
} else if (reader.name() == QLatin1String("OriginalStart")) {
d->mStart = QDateTime::fromString(reader.readElementText(), Qt::ISODate);
if (reader.error() != QXmlStreamReader::NoError || !d->mStart.isValid()) {
qCWarning(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(QStringLiteral("Occurrence")).arg(QStringLiteral("OriginalStart"));
.arg(QStringLiteral("Occurrence"), QStringLiteral("OriginalStart"));
return;
}
} else {
qCWarning(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - unknown element: %2.")
.arg(QStringLiteral("Occurrence")).arg(reader.name().toString());
.arg(QStringLiteral("Occurrence"), reader.name().toString());
return;
}
}
......
......@@ -178,7 +178,7 @@ bool EwsPoxAutodiscoverRequest::readResponse(QXmlStreamReader &reader)
}
} else {
return setErrorMsg(QStringLiteral("Failed to read POX response - unknown element '%1' inside '%2'")
.arg(reader.name().toString()).arg(QStringLiteral("Response")));
.arg(reader.name().toString(), QStringLiteral("Response")));
}
}
return true;
......
......@@ -119,7 +119,7 @@ EwsRecurrence::EwsRecurrence(QXmlStreamReader &reader)
}
} else {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - unknown element: %2.")
.arg(QStringLiteral("Recurrence")).arg(elmName);
.arg(QStringLiteral("Recurrence"), elmName);
return;
}
}
......@@ -171,13 +171,13 @@ bool EwsRecurrence::readRelativeYearlyRecurrence(QXmlStreamReader &reader)
month = decodeEnumString<short>(text, monthNames, monthNameCount, &ok);
if (reader.error() != QXmlStreamReader::NoError || !ok) {
qCWarning(EWSCLI_LOG) << QStringLiteral("Failed to read EWS request - invalid %1 element (value: %2).")
.arg(QStringLiteral("Month").arg(text));
.arg(QStringLiteral("Month"), text);
return false;
}
hasMonth = true;
} else {
qCWarning(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - unknown element: %2.")
.arg(QStringLiteral("RelativeYearlyRecurrence")).arg(elmName);
.arg(QStringLiteral("RelativeYearlyRecurrence"), elmName);
return false;
}
}
......@@ -413,7 +413,7 @@ bool EwsRecurrence::readWeeklyRecurrence(QXmlStreamReader &reader)
hasWeekStart = true;
} else {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - unknown element: %2.")
.arg(QStringLiteral("WeeklyRecurrence")).arg(elmName);
.arg(QStringLiteral("WeeklyRecurrence"), elmName);
return false;
}
}
......@@ -493,7 +493,7 @@ bool EwsRecurrence::readEndDateRecurrence(QXmlStreamReader &reader)
reader.skipCurrentElement();
} else {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - unknown element: %2.")
.arg(QStringLiteral("EndDateRecurrence")).arg(elmName);
.arg(QStringLiteral("EndDateRecurrence"), elmName);
return false;
}
}
......
......@@ -83,7 +83,7 @@ EwsUnsubscribeRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......
......@@ -143,7 +143,7 @@ EwsUpdateItemRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......@@ -161,13 +161,13 @@ EwsUpdateItemRequest::Response::Response(QXmlStreamReader &reader)
} else if (reader.name() == QLatin1String("ConflictResults")) {
if (!reader.readNextStartElement()) {
setErrorMsg(QStringLiteral("Failed to read EWS request - expected a %1 element inside %2 element.")
.arg(QStringLiteral("Value")).arg(QStringLiteral("ConflictResults")));
.arg(QStringLiteral("Value"), QStringLiteral("ConflictResults")));
return;
}
if (reader.name() != QLatin1String("Count")) {
setErrorMsg(QStringLiteral("Failed to read EWS request - expected a %1 element inside %2 element.")
.arg(QStringLiteral("Count")).arg(QStringLiteral("ConflictResults")));
.arg(QStringLiteral("Count"), QStringLiteral("ConflictResults")));
return;
}
......
......@@ -243,7 +243,7 @@ bool ewsXmlEnumReader(QXmlStreamReader &reader, QVariant &val, const QVector<QSt
if (it == items.cend()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - unknown value %2.")
.arg(elmName).arg(text);
.arg(elmName, text);
return false;
}
return true;
......@@ -282,7 +282,7 @@ QString readXmlElementValue(QXmlStreamReader &reader, bool &ok, const QString &p
QString val = reader.readElementText();
if (reader.error() != QXmlStreamReader::NoError) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(parentElement).arg(elmName.toString());
.arg(parentElement, elmName.toString());
reader.skipCurrentElement();
val.clear();
ok = false;
......@@ -301,7 +301,7 @@ int readXmlElementValue(QXmlStreamReader &reader, bool &ok, const QString &paren
val = valStr.toInt(&ok);
if (!ok) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(parentElement).arg(elmName.toString());
.arg(parentElement, elmName.toString());
}
}
......@@ -318,7 +318,7 @@ long readXmlElementValue(QXmlStreamReader &reader, bool &ok, const QString &pare
val = valStr.toLong(&ok);
if (!ok) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(parentElement).arg(elmName.toString());
.arg(parentElement, elmName.toString());
}
}
......@@ -335,7 +335,7 @@ QDateTime readXmlElementValue(QXmlStreamReader &reader, bool &ok, const QString
val = QDateTime::fromString(valStr, Qt::ISODate);
if (!val.isValid()) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(parentElement).arg(elmName.toString());
.arg(parentElement, elmName.toString());
ok = false;
}
}
......@@ -356,7 +356,7 @@ bool readXmlElementValue(QXmlStreamReader &reader, bool &ok, const QString &pare
val = false;
} else {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Failed to read %1 element - invalid %2 element.")
.arg(parentElement).arg(elmName.toString());
.arg(parentElement, elmName.toString());
ok = false;
}
}
......
......@@ -68,7 +68,7 @@ void EwsModifyItemFlagsJob::start()
Q_FOREACH (const Item &item, mItems) {
EwsItemType type = EwsItemHandler::mimeToItemType(item.mimeType());
if (type == EwsItemTypeUnknown) {
setErrorText(QStringLiteral("Unknown item type %1 for item %2").arg(item.mimeType()).arg(item.remoteId()));
setErrorText(QStringLiteral("Unknown item type %1 for item %2").arg(item.mimeType(), item.remoteId()));
emitResult();
return;
} else {
......
......@@ -662,7 +662,7 @@ void EwsResource::itemMoveRequestFinished(KJob *job)
Item &item = *it;
if (resp.isSuccess()) {
qCDebugNC(EWSRES_AGENTIF_LOG) << QStringLiteral("itemsMoved: succeeded for item %1 (new id: %2)")
.arg(ewsHash(item.remoteId())).arg(ewsHash(resp.itemId().id()));
.arg(ewsHash(item.remoteId()), ewsHash(resp.itemId().id()));
if (item.isValid()) {
/* Log item deletion in the source folder so that the next sync doesn't trip over
* non-existent items. Use old remote ids for that. */
......@@ -1339,7 +1339,7 @@ void EwsResource::reauthNotificationDismissed(bool accepted)
if (accepted) {
mAuth->authenticate(true);
} else {
Q_EMIT authFailed(QStringLiteral("Interactive authentication request denied"));
authFailed(QStringLiteral("Interactive authentication request denied"));
}
}
}
......
......@@ -165,7 +165,7 @@ void FakeEwsConnection::dataAvailable()
if (resp == FakeEwsServer::EmptyResponse) {
qCInfoNC(EWSFAKE_LOG) << QStringLiteral("Returning default response 500.");
resp = { QStringLiteral(""), 500 };
resp = { QLatin1String(""), 500 };
}
QByteArray buffer;
......
......@@ -69,7 +69,7 @@ void FakeEwsServerThread::setDialog(const FakeEwsServer::DialogEntry::List &dial
}
}
void FakeEwsServerThread::setDefaultReplyCallback(FakeEwsServer::DialogEntry::ReplyCallback defaultReplyCallback)
void FakeEwsServerThread::setDefaultReplyCallback(const FakeEwsServer::DialogEntry::ReplyCallback &defaultReplyCallback)
{
QMutexLocker lock(&mMutex);
......
......@@ -44,7 +44,7 @@ public:
}
void setDialog(const FakeEwsServer::DialogEntry::List &dialog);
void setDefaultReplyCallback(FakeEwsServer::DialogEntry::ReplyCallback defaultReplyCallback);
void setDefaultReplyCallback(const FakeEwsServer::DialogEntry::ReplyCallback &defaultReplyCallback);
void queueEventsXml(const QStringList &events);
bool waitServerStarted() const;
Q_SIGNALS:
......
......@@ -116,7 +116,8 @@ void CollectionStateMonitor<T>::forceRecheck()
auto fetchJob = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive, this);
fetchJob->setFetchScope(mMonitor.collectionFetchScope());
if (fetchJob->exec()) {
for (const auto &col : fetchJob->collections()) {
const auto collections = fetchJob->collections();
for (const auto &col : collections) {
const auto remoteId = col.remoteId();
const auto state = mStateHash.find(remoteId);
if (state != mStateHash.end()) {
......
......@@ -52,7 +52,7 @@ private:
static void setUpTokenFunction(const QString &accessToken, const QString &refreshToken, const QString &idToken, quint64 time, int tokenLifetime, int extTokenLifetime, QString &tokenReplyData);
static void dumpEvents(const QStringList &events, const QStringList &expectedEvents);
void setUpOAuth(EwsOAuth &oAuth, QStringList &events, QString password, QMap<QString, QString> map);
void setUpOAuth(EwsOAuth &oAuth, QStringList &events, const QString &password, const QMap<QString, QString> &map);
};
void UtEwsOAuth::initialInteractiveSuccessful()
......@@ -322,7 +322,7 @@ void UtEwsOAuth::dumpEvents(const QStringList &events, const QStringList &expect
}
}
void UtEwsOAuth::setUpOAuth(EwsOAuth &oAuth, QStringList &events, QString password, QMap<QString, QString> map)
void UtEwsOAuth::setUpOAuth(EwsOAuth &oAuth, QStringList &events, const QString &password, const QMap<QString, QString> &map)
{
connect(Mock::QWebEngineView::instance.data(), &Mock::QWebEngineView::logEvent, this, [&events](const QString &event) {
events.append(event);
......
......@@ -341,7 +341,7 @@ QUrlQuery QOAuth2AuthorizationCodeFlow::mapToSortedQuery(QMap<QString, QVariant>
QUrlQuery query;
QStringList keys = map.keys();
keys.sort();
for (const auto &key : keys) {
for (const auto &key : qAsConst(keys)) {
query.addQueryItem(key, map[key].toString());
}
return query;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment