Commit 24dac9ef authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent b9ee26c5
Pipeline #36724 failed with stage
in 60 minutes and 14 seconds
......@@ -56,7 +56,7 @@ private:
int mMigratorCount = 0;
static bool mError;
bool mChange = false;
bool mCloseWhenDone = false;
const bool mCloseWhenDone;
bool mAutoScrollList = true;
};
......
......@@ -133,16 +133,17 @@ void ContactsResource::retrieveItems(const Akonadi::Collection &collection)
const QFileInfoList entries = directory.entryInfoList();
for (const QFileInfo &entry : entries) {
if (entry.fileName() == QLatin1String("WARNING_README.txt")) {
const QString entryFileName = entry.fileName();
if (entryFileName == QLatin1String("WARNING_README.txt")) {
continue;
}
Item item;
item.setRemoteId(entry.fileName());
item.setRemoteId(entryFileName);
if (entry.fileName().endsWith(QLatin1String(".vcf"))) {
if (entryFileName.endsWith(QLatin1String(".vcf"))) {
item.setMimeType(KContacts::Addressee::mimeType());
} else if (entry.fileName().endsWith(QLatin1String(".ctg"))) {
} else if (entryFileName.endsWith(QLatin1String(".ctg"))) {
item.setMimeType(KContacts::ContactGroup::mimeType());
} else {
cancelTask(i18n("Found file of unknown format: '%1'", entry.absoluteFilePath()));
......
......@@ -18,7 +18,6 @@ EwsAutodiscoveryJob::EwsAutodiscoveryJob(const QString &email, const QString &us
, mPassword(password)
, mUserAgent(userAgent)
, mEnableNTLMv2(enableNTLMv2)
, mUsedCreds(false)
{
}
......
......@@ -38,17 +38,17 @@ private:
void parseEmail();
QString mEmail;
QString mUsername;
QString mPassword;
const QString mUsername;
const QString mPassword;
QString mUserAgent;
bool mEnableNTLMv2;
const QString mUserAgent;
const bool mEnableNTLMv2;
QQueue<QString> mUrlQueue;
QString mEwsUrl;
QString mOabUrl;
bool mUsedCreds;
bool mUsedCreds = false;
};
#endif
......@@ -13,7 +13,7 @@
EwsCreateItemJob::EwsCreateItemJob(EwsClient &client, const Akonadi::Item &item, const Akonadi::Collection &collection, EwsTagStore *tagStore, EwsResource *parent)
: EwsJob(parent)
, mItem(item)
, mCollection(collection)
, mCollection(collection) //never use
, mClient(client)
, mTagStore(tagStore)
{
......
......@@ -35,7 +35,7 @@ protected:
virtual void doStart() = 0;
Akonadi::Item mItem;
Akonadi::Collection mCollection;
const Akonadi::Collection mCollection;
EwsClient &mClient;
EwsTagStore *const mTagStore;
};
......
......@@ -11,7 +11,7 @@
EwsFetchItemDetailJob::EwsFetchItemDetailJob(EwsClient &client, QObject *parent, const Akonadi::Collection &collection)
: KCompositeJob(parent)
, mClient(client)
, mCollection(collection)
, mCollection(collection) //never used
{
mRequest = new EwsGetItemRequest(client, this);
connect(mRequest.data(), &KJob::result, this, &EwsFetchItemDetailJob::itemDetailFetched);
......
......@@ -32,7 +32,7 @@ protected:
Akonadi::Item::List mResultItems;
EwsClient &mClient;
QSet<QByteArray> mAddedFlags;
QSet<QByteArray> mRemovedFlags;
const QSet<QByteArray> mRemovedFlags;
private Q_SLOTS:
void itemModifyFinished(KJob *job);
};
......
......@@ -26,7 +26,6 @@ static const EwsPropertyField propPidMessageFlags(0x0e07, EwsPropTypeInteger);
EwsCreateMailJob::EwsCreateMailJob(EwsClient &client, const Akonadi::Item &item, const Akonadi::Collection &collection, EwsTagStore *tagStore, EwsResource *parent)
: EwsCreateItemJob(client, item, collection, tagStore, parent)
, mSend(false)
{
}
......
......@@ -23,7 +23,7 @@ private Q_SLOTS:
void mailCreateWorkaroundFinished(KJob *job);
void mailMoveWorkaroundFinished(KJob *job);
private:
bool mSend;
bool mSend = false;
};
#endif
......@@ -30,7 +30,7 @@ void EwsModifyMailJob::start()
EwsUpdateItemRequest *req = new EwsUpdateItemRequest(mClient, this);
EwsId itemId;
Q_FOREACH (const Item &item, mItems) {
for (const Item &item : qAsConst(mItems)) {
itemId = EwsId(item.remoteId(), item.remoteRevision());
if (mParts.contains("FLAGS")) {
......
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