Commit d9fbb286 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify variables

parent c7eecb0c
Pipeline #36765 failed with stage
in 45 minutes and 5 seconds
......@@ -123,7 +123,7 @@ public:
ObjectReadPermission mObjectReadPermission;
ObjectWritePermission mObjectWritePermission;
ObjectDeletePermission mObjectDeletePermission;
bool mAdminFlag;
bool mAdminFlag = false;
};
typedef QMap<qlonglong, Permissions> UserPermissions;
......
......@@ -15,7 +15,6 @@ using namespace OXA;
FoldersRequestDeltaJob::FoldersRequestDeltaJob(qulonglong lastSync, QObject *parent)
: KJob(parent)
, mLastSync(lastSync)
, mJobFinishedCount(0)
{
}
......
......@@ -53,10 +53,10 @@ private Q_SLOTS:
void fetchDeletedJobFinished(KJob *);
private:
qulonglong mLastSync;
const qulonglong mLastSync;
Folder::List mModifiedFolders;
Folder::List mDeletedFolders;
int mJobFinishedCount;
int mJobFinishedCount = 0;
};
}
......
......@@ -56,8 +56,8 @@ private Q_SLOTS:
void davJobFinished(KJob *);
private:
qulonglong mLastSync;
Mode mMode;
const qulonglong mLastSync;
const Mode mMode;
Folder::List mFolders;
};
}
......
......@@ -11,9 +11,6 @@
using namespace OXA;
Object::Object()
: mObjectStatus(Created)
, mObjectId(-1)
, mFolderId(-1)
{
}
......
......@@ -65,9 +65,9 @@ public:
KCalendarCore::Incidence::Ptr task() const;
private:
ObjectStatus mObjectStatus;
qlonglong mObjectId;
qlonglong mFolderId;
ObjectStatus mObjectStatus = Created;
qlonglong mObjectId = -1;
qlonglong mFolderId = -1;
QString mLastModified;
Folder::Module mModule;
KContacts::Addressee mContact;
......
......@@ -58,7 +58,7 @@ private:
qulonglong mLastSync;
Object::List mModifiedObjects;
Object::List mDeletedObjects;
int mJobFinishedCount;
int mJobFinishedCount = 0;
};
}
......
......@@ -49,7 +49,7 @@ private Q_SLOTS:
private:
Folder mFolder;
qulonglong mLastSync;
Mode mMode;
const Mode mMode;
Object::List mObjects;
};
}
......
......@@ -12,9 +12,9 @@ using namespace OXA;
OXErrors::EditErrorID OXErrors::getEditErrorID(const QString &errorText)
{
int b1Pos = errorText.indexOf(QLatin1Char('['));
int b2Pos = errorText.indexOf(QLatin1Char(']'));
QString errorID = errorText.mid(b1Pos + 1, b2Pos - b1Pos - 1);
const int b1Pos = errorText.indexOf(QLatin1Char('['));
const int b2Pos = errorText.indexOf(QLatin1Char(']'));
const QString errorID = errorText.mid(b1Pos + 1, b2Pos - b1Pos - 1);
bool ok;
int eid = errorID.toInt(&ok);
......
......@@ -16,9 +16,6 @@ using namespace OXA;
UpdateUsersJob::UpdateUsersJob(QObject *parent)
: KJob(parent)
, mUserIdRequestFinished(false)
, mUsersRequestFinished(false)
, mUserId(-1)
{
}
......
......@@ -30,10 +30,10 @@ private Q_SLOTS:
private:
void finish();
bool mUserIdRequestFinished;
bool mUsersRequestFinished;
bool mUserIdRequestFinished = false;
bool mUsersRequestFinished = false;
User::List mUsers;
qlonglong mUserId;
qlonglong mUserId = -1;
};
}
......
......@@ -11,7 +11,6 @@
using namespace OXA;
User::User()
: mUid(-1)
{
}
......
......@@ -32,7 +32,7 @@ public:
QString name() const;
private:
qlonglong mUid;
qlonglong mUid = -1;
QString mEmail;
QString mName;
};
......
......@@ -27,7 +27,7 @@ private Q_SLOTS:
void davJobFinished(KJob *);
private:
qlonglong mUserId;
qlonglong mUserId = -1;
};
}
......
......@@ -43,7 +43,7 @@ private:
void loadFromCache();
void saveToCache();
qlonglong mCurrentUserId;
qlonglong mCurrentUserId = -1;
QMap<qlonglong, User> mUsers;
QString mIdentifier;
......
......@@ -71,7 +71,7 @@ private:
bool mServerTestFailed = false;
KWallet::Wallet *mWallet = nullptr;
QString mInitalPassword;
QString mIdentifier;
const QString mIdentifier;
Settings &mSettings;
};
......
......@@ -293,7 +293,7 @@ Akonadi::Item::List Pop3Test::checkMailsOnAkonadiServer(const QList<QByteArray>
itemMailBodies.insert(itemMailBody);
}
foreach (const QByteArray &mail, mails) {
for (const QByteArray &mail : mails) {
KMime::Message::Ptr ourMail(new KMime::Message());
ourMail->setContent(KMime::CRLFtoLF(mail));
ourMail->parse();
......
......@@ -17,8 +17,7 @@
#include <KLocalizedString>
POPSession::POPSession(Settings &settings, const QString &password)
: mCurrentJob(nullptr)
, mPassword(password)
: mPassword(password)
, mSettings(settings)
{
KIO::Scheduler::connect(SIGNAL(slaveError(KIO::Slave*,int,QString)), this, SLOT(slotSlaveError(KIO::Slave*,int,QString)));
......
......@@ -58,7 +58,7 @@ private:
QPointer<KIO::Slave> mSlave;
SlaveBaseJob *mCurrentJob = nullptr;
QString mPassword;
const QString mPassword;
Settings &mSettings;
};
......
......@@ -61,7 +61,8 @@ bool VCardDirResource::loadAddressees()
QDirIterator it(vCardDirectoryName());
while (it.hasNext()) {
it.next();
if (it.fileName() != QLatin1String(".") && it.fileName() != QLatin1String("..") && it.fileName() != QLatin1String("WARNING_README.txt")) {
const QString filename = it.fileName();
if (filename != QLatin1String(".") && filename != QLatin1String("..") && filename != QLatin1String("WARNING_README.txt")) {
QFile file(it.filePath());
if (file.open(QIODevice::ReadOnly)) {
const QByteArray data = file.readAll();
......
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