[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [akonadi] src/core: Minor optimization.
From: Montel Laurent <null () kde ! org>
Date: 2016-12-31 14:26:19
Message-ID: E1cNKbz-0000hx-Pc () code ! kde ! org
[Download RAW message or body]
Git commit 660fd5217ba2e10a5d2157dcd0b5a79a159fb914 by Montel Laurent.
Committed on 31/12/2016 at 14:26.
Pushed by mlaurent into branch 'master'.
Minor optimization.
M +1 -1 src/core/jobs/itemsearchjob.cpp
M +2 -2 src/core/jobs/job.cpp
M +2 -2 src/core/jobs/resourcesynchronizationjob.cpp
M +1 -0 src/core/jobs/subscriptionjob.cpp
M +1 -1 src/core/jobs/trashrestorejob.cpp
M +2 -3 src/core/models/collectionmodel.cpp
M +3 -3 src/core/models/entitytreemodel.cpp
https://commits.kde.org/akonadi/660fd5217ba2e10a5d2157dcd0b5a79a159fb914
diff --git a/src/core/jobs/itemsearchjob.cpp b/src/core/jobs/itemsearchjob.cpp
index f1f1c33cb..385892ae8 100644
--- a/src/core/jobs/itemsearchjob.cpp
+++ b/src/core/jobs/itemsearchjob.cpp
@@ -39,7 +39,7 @@ public:
, mQuery(query)
, mRecursive(false)
, mRemote(false)
- , mEmitTimer(0)
+ , mEmitTimer(Q_NULLPTR)
{
}
diff --git a/src/core/jobs/job.cpp b/src/core/jobs/job.cpp
index 7c45dbcfc..d355168dd 100644
--- a/src/core/jobs/job.cpp
+++ b/src/core/jobs/job.cpp
@@ -38,7 +38,7 @@
using namespace Akonadi;
-static QDBusAbstractInterface *s_jobtracker = 0;
+static QDBusAbstractInterface *s_jobtracker = Q_NULLPTR;
//@cond PRIVATE
void JobPrivate::handleResponse(qint64 tag, const Protocol::Command &response)
@@ -361,7 +361,7 @@ bool Job::removeSubjob(KJob *job)
{
bool rv = KCompositeJob::removeSubjob(job);
if (job == d_ptr->mCurrentSubJob) {
- d_ptr->mCurrentSubJob = 0;
+ d_ptr->mCurrentSubJob = Q_NULLPTR;
QTimer::singleShot(0, this, SLOT(startNext()));
}
return rv;
diff --git a/src/core/jobs/resourcesynchronizationjob.cpp b/src/core/jobs/resourcesynchronizationjob.cpp
index 5a28c65c5..d4d5516ee 100644
--- a/src/core/jobs/resourcesynchronizationjob.cpp
+++ b/src/core/jobs/resourcesynchronizationjob.cpp
@@ -36,8 +36,8 @@ class ResourceSynchronizationJobPrivate : public KJobPrivateBase
public:
ResourceSynchronizationJobPrivate(ResourceSynchronizationJob *parent)
: q(parent)
- , interface(0)
- , safetyTimer(0)
+ , interface(Q_NULLPTR)
+ , safetyTimer(Q_NULLPTR)
, timeoutCount(60)
, collectionTreeOnly(false)
{
diff --git a/src/core/jobs/subscriptionjob.cpp b/src/core/jobs/subscriptionjob.cpp
index 2a08210b3..50a6f5272 100644
--- a/src/core/jobs/subscriptionjob.cpp
+++ b/src/core/jobs/subscriptionjob.cpp
@@ -66,6 +66,7 @@ void SubscriptionJob::doStart()
if (d->mSub.isEmpty() && d->mUnsub.isEmpty()) {
emitResult();
+ return;
}
Q_FOREACH (Collection col, d->mSub) { //krazy:exclude=foreach
diff --git a/src/core/jobs/trashrestorejob.cpp b/src/core/jobs/trashrestorejob.cpp
index 05daa79fd..cdcec46c5 100644
--- a/src/core/jobs/trashrestorejob.cpp
+++ b/src/core/jobs/trashrestorejob.cpp
@@ -182,7 +182,7 @@ void TrashRestoreJob::TrashRestoreJobPrivate::itemsReceived(const Akonadi::Item:
return;
}
- //Explicit target Q_DECL_OVERRIDEs the resource
+ //Explicit target overides the resource
if (mTargetCollection.isValid()) {
targetCollection = mTargetCollection;
}
diff --git a/src/core/models/collectionmodel.cpp b/src/core/models/collectionmodel.cpp
index a43cb6129..a76286b40 100644
--- a/src/core/models/collectionmodel.cpp
+++ b/src/core/models/collectionmodel.cpp
@@ -59,7 +59,7 @@ CollectionModel::~CollectionModel()
d->collections.clear();
delete d->monitor;
- d->monitor = 0;
+ d->monitor = Q_NULLPTR;
delete d;
}
@@ -146,8 +146,7 @@ QModelIndex CollectionModel::parent(const QModelIndex &index) const
if (!parentCol.isValid()) {
return QModelIndex();
}
- QVector<Collection::Id> list;
- list = d->childCollections.value(parentCol.parentCollection().id());
+ const QVector<Collection::Id> list = d->childCollections.value(parentCol.parentCollection().id());
int parentRow = list.indexOf(parentCol.id());
if (parentRow < 0) {
diff --git a/src/core/models/entitytreemodel.cpp b/src/core/models/entitytreemodel.cpp
index b2e413203..a98dd3d2e 100644
--- a/src/core/models/entitytreemodel.cpp
+++ b/src/core/models/entitytreemodel.cpp
@@ -753,7 +753,7 @@ QMimeData *EntityTreeModel::mimeData(const QModelIndexList &indexes) const
QMimeData *data = new QMimeData();
QList<QUrl> urls;
- foreach (const QModelIndex &index, indexes) {
+ for (const QModelIndex &index : indexes) {
if (index.column() != 0) {
continue;
}
@@ -1190,9 +1190,9 @@ QModelIndexList EntityTreeModel::modelIndexesForItem(const QAbstractItemModel *m
return QModelIndexList();
}
- QModelIndexList list = pair.second->d_ptr->indexesForItem(item);
+ const QModelIndexList list = pair.second->d_ptr->indexesForItem(item);
QModelIndexList proxyList;
- foreach (const QModelIndex &idx, list) {
+ for (const QModelIndex &idx : list) {
const QModelIndex pIdx = proxiedIndex(idx, pair.first);
if (pIdx.isValid()) {
proxyList << pIdx;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic