Commit 7156605d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Const'ify variable + initialize variable in header

parent f6e008cb
Pipeline #74371 passed with stage
in 11 minutes and 11 seconds
......@@ -22,7 +22,7 @@ QSet<qint64> TestSearchPlugin::search(const QString &query, const QVector<qint64
QSet<qint64> TestSearchPlugin::parseQuery(const QString &queryString)
{
QSet<qint64> resultSet;
Akonadi::SearchQuery query = Akonadi::SearchQuery::fromJSON(queryString.toLatin1());
const Akonadi::SearchQuery query = Akonadi::SearchQuery::fromJSON(queryString.toLatin1());
const QList<Akonadi::SearchTerm> subTerms = query.term().subTerms();
for (const Akonadi::SearchTerm &term : subTerms) {
if (term.key() == QLatin1String("plugin")) {
......
......@@ -86,7 +86,7 @@ static bool checkSearchSupportStatus()
} else {
const QStringList dirs = QCoreApplication::libraryPaths();
for (const QString &pluginDir : dirs) {
QDir dir(pluginDir + QLatin1String("/akonadi/"));
const QDir dir(pluginDir + QLatin1String("/akonadi/"));
const QStringList pluginFiles = dir.entryList(QDir::Files);
for (const QString &pluginFileName : pluginFiles) {
QPluginLoader loader(dir.absolutePath() + QLatin1Char('/') + pluginFileName);
......@@ -112,7 +112,7 @@ static bool checkAvailableAgentTypes()
const auto dirs = Akonadi::StandardDirs::locateAllResourceDirs(QStringLiteral("akonadi/agents"));
QStringList types;
for (const QString &pluginDir : dirs) {
QDir dir(pluginDir);
const QDir dir(pluginDir);
const QStringList plugins = dir.entryList(QStringList() << QStringLiteral("*.desktop"), QDir::Files);
for (const QString &plugin : plugins) {
QSettings pluginInfo(pluginDir + QLatin1Char('/') + plugin, QSettings::IniFormat);
......
......@@ -31,7 +31,7 @@ public:
KSharedConfigPtr config;
QString identifier;
QScopedPointer<KAboutData> aboutData;
QWidget *parentWidget = nullptr;
QWidget *const parentWidget;
};
} // namespace Akonadi
......
......@@ -13,8 +13,11 @@
#include <QTimer>
#include <QVariant>
#include <chrono>
#include <malloc.h>
using namespace std::chrono_literals;
namespace Akonadi
{
class Braveheart
......@@ -35,7 +38,7 @@ private:
malloc_trim(50 * 1024 * 1024);
});
// Fight for freedom every 15 minutes
freedom->start(15 * 60 * 1000);
freedom->start(15min);
qApp->setProperty("__Akonadi__Braveheart", true);
}
......
......@@ -24,7 +24,6 @@ class Akonadi::CollectionPathResolverPrivate : public JobPrivate
public:
explicit CollectionPathResolverPrivate(CollectionPathResolver *parent)
: JobPrivate(parent)
, mColId(-1)
{
}
......@@ -78,7 +77,7 @@ public:
Collection mCurrentNode;
QStringList mPathParts;
QString mPath;
Collection::Id mColId;
Collection::Id mColId = -1;
bool mPathToId = false;
};
......
......@@ -165,7 +165,7 @@ void AgentInstanceCreateJobPrivate::doStart()
int timeout = safetyTimeout;
#ifdef Q_OS_UNIX
// Increate the timeout when valgrinding the agent, because that slows down things a log.
QString agentValgrind = QString::fromLocal8Bit(qgetenv("AKONADI_VALGRIND"));
const QString agentValgrind = QString::fromLocal8Bit(qgetenv("AKONADI_VALGRIND"));
if (!agentValgrind.isEmpty() && agentType.identifier().contains(agentValgrind)) {
timeout *= 15;
}
......
......@@ -53,7 +53,7 @@ static QString defaultResourceId(KCoreConfigSkeleton *settings)
static QString dbusServiceName()
{
QString service = QStringLiteral("org.kde.pim.SpecialCollections");
const QString service = QStringLiteral("org.kde.pim.SpecialCollections");
if (ServerManager::hasInstanceIdentifier()) {
return service + ServerManager::instanceIdentifier();
}
......
......@@ -36,14 +36,14 @@ public:
SpecialCollectionsRequestJob *const q;
SpecialCollections *mSpecialCollections = nullptr;
int mPendingCreateJobs;
int mPendingCreateJobs = 0;
QByteArray mRequestedType;
AgentInstance mRequestedResource;
// Input:
QHash<QByteArray, bool> mDefaultFolders;
bool mRequestingDefaultFolders;
bool mRequestingDefaultFolders = false;
QHash<QString, QHash<QByteArray, bool>> mFoldersForResource;
QString mDefaultResourceType;
QVariantMap mDefaultResourceOptions;
......@@ -59,8 +59,6 @@ public:
SpecialCollectionsRequestJobPrivate::SpecialCollectionsRequestJobPrivate(SpecialCollections *collections, SpecialCollectionsRequestJob *qq)
: q(qq)
, mSpecialCollections(collections)
, mPendingCreateJobs(0)
, mRequestingDefaultFolders(false)
{
}
......
......@@ -12,7 +12,7 @@
#include <QTimer>
using namespace Akonadi;
using namespace std::chrono_literals;
class Akonadi::TagFetchJobPrivate : public JobPrivate
{
public:
......@@ -26,7 +26,7 @@ public:
Q_Q(TagFetchJob);
mEmitTimer = new QTimer(q);
mEmitTimer->setSingleShot(true);
mEmitTimer->setInterval(100);
mEmitTimer->setInterval(100ms);
q->connect(mEmitTimer, &QTimer::timeout, q, [this]() {
timeout();
});
......@@ -156,3 +156,6 @@ Tag::List TagFetchJob::tags() const
}
#include "moc_tagfetchjob.cpp"
#include <chrono>
using namespace std::chrono_literals;
......@@ -14,8 +14,8 @@
using namespace Akonadi;
MimeTypeChecker::MimeTypeChecker()
: d(new MimeTypeCheckerPrivate())
{
d = new MimeTypeCheckerPrivate();
}
MimeTypeChecker::MimeTypeChecker(const MimeTypeChecker &other)
......
......@@ -104,7 +104,7 @@ QStringList EntityOrderProxyModel::configStringsForDroppedUrls(const QList<QUrl>
QStringList droppedList;
droppedList.reserve(urls.count());
for (const QUrl &url : urls) {
Collection col = Collection::fromUrl(url);
const Collection col = Collection::fromUrl(url);
if (!col.isValid()) {
Item item = Item::fromUrl(url);
......
......@@ -18,7 +18,7 @@ namespace Akonadi
class RecursiveCollectionFilterProxyModelPrivate
{
Q_DECLARE_PUBLIC(RecursiveCollectionFilterProxyModel)
RecursiveCollectionFilterProxyModel *q_ptr;
RecursiveCollectionFilterProxyModel *const q_ptr;
public:
explicit RecursiveCollectionFilterProxyModelPrivate(RecursiveCollectionFilterProxyModel *model)
......
......@@ -54,7 +54,7 @@ public:
}
Q_DECLARE_PUBLIC(SelectionProxyModel)
SelectionProxyModel *q_ptr;
SelectionProxyModel *const q_ptr;
};
} // namespace Akonadi
......
......@@ -40,11 +40,8 @@ MonitorPrivate::MonitorPrivate(ChangeNotificationDependenciesFactory *dependenci
, mFetchChangedOnly(false)
, session(Session::defaultSession())
, collectionCache(nullptr)
, itemCache(nullptr)
, tagCache(nullptr)
, mCommandBuffer(parent, "handleCommands")
, pendingModificationChanges(Protocol::ModifySubscriptionCommand::None)
, pendingModificationTimer(nullptr)
, monitorReady(false)
, fetchCollection(false)
, fetchCollectionStatistics(false)
......
......@@ -104,8 +104,8 @@ public:
Protocol::ModifySubscriptionCommand::ModifiedParts pendingModificationChanges;
Protocol::ModifySubscriptionCommand pendingModification;
QTimer *pendingModificationTimer;
bool monitorReady;
QTimer *pendingModificationTimer = nullptr;
bool monitorReady = false;
// The waiting list
QQueue<Protocol::ChangeNotificationPtr> pendingNotifications;
......
Supports Markdown
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