Commit 4aa611b5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove some cppcheck warning

parent f1bfb618
Pipeline #83621 failed with stage
in 27 minutes and 46 seconds
......@@ -65,10 +65,10 @@ void SpecialNotifierJob::slotItemFetchJobDone(KJob *job)
mFrom = mb->from()->asUnicodeString();
mSubject = mb->subject()->asUnicodeString();
if (NewMailNotifierAgentSettings::showPhoto()) {
auto job = new Akonadi::ContactSearchJob(this);
job->setLimit(1);
job->setQuery(Akonadi::ContactSearchJob::Email, KEmailAddress::firstEmailAddress(mFrom).toLower(), Akonadi::ContactSearchJob::ExactMatch);
connect(job, &Akonadi::ItemFetchJob::result, this, &SpecialNotifierJob::slotSearchJobFinished);
auto searchJob = new Akonadi::ContactSearchJob(this);
searchJob->setLimit(1);
searchJob->setQuery(Akonadi::ContactSearchJob::Email, KEmailAddress::firstEmailAddress(mFrom).toLower(), Akonadi::ContactSearchJob::ExactMatch);
connect(searchJob, &Akonadi::ItemFetchJob::result, this, &SpecialNotifierJob::slotSearchJobFinished);
} else {
emitNotification();
}
......
......@@ -87,8 +87,8 @@ void AkonadiSlave::get(const QUrl &url)
if (job->items().count() != 1) {
error(KIO::ERR_DOES_NOT_EXIST, i18n("No such item."));
} else {
const Item item = job->items().at(0);
QByteArray tmp = item.payloadData();
const Item itemJob = job->items().at(0);
const QByteArray tmp = itemJob.payloadData();
data(tmp);
data(QByteArray());
finished();
......
......@@ -13,7 +13,7 @@ class GidMigrator : public MigratorBase
{
Q_OBJECT
public:
GidMigrator(const QString &mimeType);
explicit GidMigrator(const QString &mimeType);
~GidMigrator() override;
Q_REQUIRED_RESULT QString displayName() const override;
......
......@@ -20,7 +20,7 @@ public:
{
}
NullableConfigGroup(const KConfigGroup &grp)
explicit NullableConfigGroup(const KConfigGroup &grp)
: mConfigGroup(grp)
{
}
......
......@@ -913,8 +913,8 @@ void DavGroupwareResource::onRetrieveItemsFinished(KJob *job)
auto CTagAttr = collection.attribute<CTagAttribute>(Collection::AddIfMissing);
qCDebug(DAVRESOURCE_LOG) << "Updating collection CTag from" << CTagAttr->CTag() << "to" << mCTagCache.value(collection.remoteId());
CTagAttr->setCTag(mCTagCache.value(collection.remoteId()));
auto job = new Akonadi::CollectionModifyJob(collection);
job->start();
auto modifyJob = new Akonadi::CollectionModifyJob(collection);
modifyJob->start();
}
itemsRetrievedIncremental(changedItems, Akonadi::Item::List());
......@@ -979,8 +979,8 @@ void DavGroupwareResource::onMultigetFinished(KJob *job)
auto CTagAttr = collection.attribute<CTagAttribute>(Collection::AddIfMissing);
qCDebug(DAVRESOURCE_LOG) << "Updating collection CTag from" << CTagAttr->CTag() << "to" << mCTagCache.value(collection.remoteId());
CTagAttr->setCTag(mCTagCache.value(collection.remoteId()));
auto job = new Akonadi::CollectionModifyJob(collection);
job->start();
auto modifyJob = new Akonadi::CollectionModifyJob(collection);
modifyJob->start();
}
itemsRetrievedIncremental(items, Akonadi::Item::List());
......
......@@ -28,7 +28,7 @@ public:
{
public:
protected:
Response(QXmlStreamReader &reader);
explicit Response(QXmlStreamReader &reader);
friend class EwsDeleteItemRequest;
};
......
......@@ -28,7 +28,7 @@ public:
}
protected:
Response(QXmlStreamReader &reader);
explicit Response(QXmlStreamReader &reader);
EwsId mId;
......
......@@ -25,7 +25,7 @@ public:
class Response : public EwsRequest::Response
{
protected:
Response(QXmlStreamReader &reader);
explicit Response(QXmlStreamReader &reader);
friend class EwsUnsubscribeRequest;
};
......
......@@ -67,7 +67,7 @@ public:
class DeleteUpdate : public Update
{
public:
DeleteUpdate(const EwsPropertyField &field)
explicit DeleteUpdate(const EwsPropertyField &field)
: Update(field, QVariant(), Delete)
{
}
......
......@@ -172,12 +172,12 @@ void EwsFetchFoldersJobPrivate::remoteFolderIdFullFetchDone(KJob *job)
mPendingFetchJobs = 0;
for (int i = 0, total = mRemoteFolderIds.size(); i < total; i += fetchBatchSize) {
auto req = new EwsGetFolderRequest(mClient, this);
req->setFolderIds(mRemoteFolderIds.mid(i, fetchBatchSize));
req->setFolderShape(shape);
connect(req, &EwsSyncFolderHierarchyRequest::result, this, &EwsFetchFoldersJobPrivate::remoteFolderDetailFetchDone);
req->start();
q->addSubjob(req);
auto folderReq = new EwsGetFolderRequest(mClient, this);
folderReq->setFolderIds(mRemoteFolderIds.mid(i, fetchBatchSize));
folderReq->setFolderShape(shape);
connect(folderReq, &EwsSyncFolderHierarchyRequest::result, this, &EwsFetchFoldersJobPrivate::remoteFolderDetailFetchDone);
folderReq->start();
q->addSubjob(folderReq);
mPendingFetchJobs++;
}
......
......@@ -177,12 +177,12 @@ void EwsCreateMailJob::mailCreateWorkaroundFinished(KJob *job)
EwsCreateItemRequest::Response resp = req->responses().first();
if (resp.isSuccess()) {
EwsId id = resp.itemId();
auto req = new EwsMoveItemRequest(mClient, this);
req->setItemIds(EwsId::List() << id);
req->setDestinationFolderId(EwsId(mCollection.remoteId()));
connect(req, &EwsCreateItemRequest::finished, this, &EwsCreateMailJob::mailMoveWorkaroundFinished);
addSubjob(req);
req->start();
auto moveItemReq = new EwsMoveItemRequest(mClient, this);
moveItemReq->setItemIds(EwsId::List() << id);
moveItemReq->setDestinationFolderId(EwsId(mCollection.remoteId()));
connect(moveItemReq, &EwsCreateItemRequest::finished, this, &EwsCreateMailJob::mailMoveWorkaroundFinished);
addSubjob(moveItemReq);
moveItemReq->start();
} else {
setErrorMsg(i18n("Failed to create mail item"));
emitResult();
......
......@@ -125,8 +125,8 @@ void UtEwsGetItemRequest::twoFailures()
auto id = resp.item()[EwsItemFieldItemId].value<EwsId>();
QCOMPARE(id, *idsIt);
}
idsIt++;
respClassesIt++;
++idsIt;
++respClassesIt;
}
}
......
......@@ -157,7 +157,7 @@ void UtEwsMoveItemRequest::twoItems()
for (const EwsMoveItemRequest::Response &resp : reqResponses) {
QCOMPARE(resp.responseClass(), EwsResponseSuccess);
QCOMPARE(resp.itemId(), *newIdsIt);
newIdsIt++;
++newIdsIt;
}
}
......@@ -240,8 +240,8 @@ void UtEwsMoveItemRequest::twoItemsOneFailed()
} else {
QCOMPARE(resp.itemId(), EwsId());
}
newIdsIt++;
respClassesIt++;
++newIdsIt;
++respClassesIt;
}
}
......
......@@ -141,7 +141,6 @@ Akonadi::Item KolabHelpers::translateFromImap(Kolab::FolderType folderType, cons
newItem.setRemoteId(imapItem.remoteId());
newItem.setGid(incidencePtr->instanceIdentifier());
return newItem;
break;
}
case Kolab::NoteObject: {
const KMime::Message::Ptr note = reader.getNote();
......@@ -156,7 +155,6 @@ Akonadi::Item KolabHelpers::translateFromImap(Kolab::FolderType folderType, cons
const Akonadi::NoteUtils::NoteMessageWrapper wrapper(note);
newItem.setGid(wrapper.uid());
return newItem;
break;
}
case Kolab::ContactObject: {
Akonadi::Item newItem(KContacts::Addressee::mimeType());
......@@ -164,7 +162,6 @@ Akonadi::Item KolabHelpers::translateFromImap(Kolab::FolderType folderType, cons
newItem.setRemoteId(imapItem.remoteId());
newItem.setGid(reader.getContact().uid());
return newItem;
break;
}
case Kolab::DistlistObject: {
KContacts::ContactGroup contactGroup = reader.getDistlist();
......@@ -186,7 +183,6 @@ Akonadi::Item KolabHelpers::translateFromImap(Kolab::FolderType folderType, cons
newItem.setRemoteId(imapItem.remoteId());
newItem.setGid(contactGroup.id());
return newItem;
break;
}
case Kolab::RelationConfigurationObject:
// Do nothing about tags and relations, this is handled separately in KolabRetrieveTagTask::onMessagesAvailable
......
......@@ -202,11 +202,11 @@ class KolabObjectReader::Private
{
public:
Private()
: mObjectType(InvalidObject)
: mAddressee(KContacts::Addressee())
, mObjectType(InvalidObject)
, mVersion(KolabV3)
, mOverrideObjectType(InvalidObject)
{
mAddressee = KContacts::Addressee();
}
KCalendarCore::Incidence::Ptr mIncidence;
......
......@@ -1679,7 +1679,7 @@ bool MixedMaildirStore::Private::visit(FileStore::ItemFetchJob *job)
Item::List::iterator endIt = items.end();
for (; it != endIt; ++it) {
if (!fillItem(findIt.value(), includeHeaders, includeBody, *it)) {
const QString errorText = i18nc("@info:status", "Error while reading mails from folder %1", collection.name());
errorText = i18nc("@info:status", "Error while reading mails from folder %1", collection.name());
q->notifyError(FileStore::Job::InvalidJobContext, errorText); // TODO should be a different error code
qCCritical(MIXEDMAILDIRRESOURCE_LOG) << "Failed to read item" << (*it).remoteId() << "in MBox file" << path;
return false;
......
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