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

Modernize code + const'ify

parent 24dac9ef
Pipeline #36758 failed with stage
in 51 minutes and 15 seconds
......@@ -31,7 +31,7 @@ NotesResource::~NotesResource()
QStringList NotesResource::allMimeTypes() const
{
return QStringList() << sNotesType;
return {sNotesType};
}
QString NotesResource::mimeType(const KCalendarCore::IncidenceBase::Ptr &) const
......
......@@ -82,7 +82,7 @@ void ICalResourceBase::itemRemoved(const Akonadi::Item &item)
return;
}
Incidence::Ptr i = mCalendar->instance(item.remoteId());
const Incidence::Ptr i = mCalendar->instance(item.remoteId());
if (i) {
if (!mCalendar->deleteIncidence(i)) {
qCritical() << "akonadi_ical_resource: Can't delete incidence with instance identifier "
......
......@@ -15,13 +15,7 @@ BatchFetcher::BatchFetcher(MessageHelper::Ptr messageHelper, const KIMAP::ImapSe
, m_scope(scope)
, m_session(session)
, m_batchSize(batchSize)
, m_uidBased(false)
, m_fetchedItemsInCurrentBatch(0)
, m_messageHelper(messageHelper)
, m_fetchInProgress(false)
, m_continuationRequested(false)
, m_gmailEnabled(false)
, m_searchInChunks(false)
{
}
......
......@@ -41,17 +41,17 @@ private Q_SLOTS:
private:
//Batch fetching
KIMAP::ImapSet m_currentSet;
KIMAP::FetchJob::FetchScope m_scope;
KIMAP::Session *m_session = nullptr;
int m_batchSize;
bool m_uidBased;
int m_fetchedItemsInCurrentBatch;
const KIMAP::FetchJob::FetchScope m_scope;
KIMAP::Session *const m_session;
const int m_batchSize;
bool m_uidBased = false;
int m_fetchedItemsInCurrentBatch = 0;
const MessageHelper::Ptr m_messageHelper;
bool m_fetchInProgress;
bool m_continuationRequested;
bool m_fetchInProgress = false;
bool m_continuationRequested = false;
KIMAP::ImapInterval m_searchUidInterval;
bool m_gmailEnabled;
bool m_searchInChunks;
bool m_gmailEnabled = false;
bool m_searchInChunks = false;
};
#endif // BATCHFETCHER_H
......@@ -23,7 +23,6 @@ ReplaceMessageJob::ReplaceMessageJob(const KMime::Message::Ptr &msg, KIMAP::Sess
, mMailbox(mailbox)
, mUidNext(uidNext)
, mOldUids(oldUids)
, mNewUid(-1)
, mMessageId(msg->messageID()->asUnicodeString().toUtf8())
{
}
......
......@@ -41,7 +41,7 @@ private:
const QString mMailbox;
qint64 mUidNext;
KIMAP::ImapSet mOldUids;
qint64 mNewUid;
qint64 mNewUid = -1;
const QByteArray mMessageId;
};
......
......@@ -198,7 +198,7 @@ public:
void setItemMergingMode(Akonadi::ItemSync::MergeMode mergeMode) override;
private:
ImapResourceBase *m_resource = nullptr;
ImapResourceBase *const m_resource;
const TaskArguments m_arguments;
};
......
......@@ -37,18 +37,7 @@
RetrieveItemsTask::RetrieveItemsTask(const ResourceStateInterface::Ptr &resource, QObject *parent)
: ResourceTask(CancelIfNoSession, resource, parent)
, m_session(nullptr)
, m_fetchedMissingBodies(-1)
, m_fetchMissingBodies(false)
, m_incremental(true)
, m_localHighestModSeq(-1)
, m_batchFetcher(nullptr)
, m_uidBasedFetch(true)
, m_flagsChanged(false)
, m_messageCount(-1)
, m_uidValidity(-1)
, m_nextUid(-1)
, m_highestModSeq(-1)
{
}
......
......@@ -58,22 +58,22 @@ private:
KIMAP::Session *m_session = nullptr;
QVector<qint64> m_messageUidsMissingBody;
int m_fetchedMissingBodies;
bool m_fetchMissingBodies;
bool m_incremental;
qint64 m_localHighestModSeq;
int m_fetchedMissingBodies = -1;
bool m_fetchMissingBodies = false;
bool m_incremental = true;
qint64 m_localHighestModSeq = -1;
BatchFetcher *m_batchFetcher = nullptr;
Akonadi::Collection m_modifiedCollection;
bool m_uidBasedFetch;
bool m_flagsChanged;
bool m_uidBasedFetch = true;
bool m_flagsChanged = false;
QElapsedTimer m_time;
// Results of SELECT
QString m_mailBox;
int m_messageCount;
int m_uidValidity;
qint64 m_nextUid;
qint64 m_highestModSeq;
int m_messageCount = -1;
int m_uidValidity = -1;
qint64 m_nextUid = -1;
qint64 m_highestModSeq = -1;
QList<QByteArray> m_flags;
};
......
......@@ -27,7 +27,7 @@ private Q_SLOTS:
private:
void doSearch(KIMAP::Session *session);
QString m_query;
const QString m_query;
};
#endif // SEARCHTASK_H
......@@ -103,7 +103,7 @@ private:
static qint64 m_requestCounter;
int m_maxPoolSize;
const int m_maxPoolSize;
ImapAccount *m_account = nullptr;
PasswordRequesterInterface *m_passwordRequester = nullptr;
KIMAP::SessionUiProxy::Ptr m_sessionUiProxy;
......
......@@ -34,9 +34,9 @@ private Q_SLOTS:
void onSettingsDialogFinished(int result);
private:
QString requestManualAuth(bool *userRejected);
Q_REQUIRED_RESULT QString requestManualAuth(bool *userRejected);
ImapResourceBase *m_resource = nullptr;
ImapResourceBase *const m_resource;
QDialog *m_requestDialog = nullptr;
QDialog *m_settingsDialog = nullptr;
};
......
......@@ -68,8 +68,8 @@ private:
void readSettings();
void populateDefaultAuthenticationOptions();
ImapResourceBase *m_parentResource = nullptr;
Ui::SetupServerView *m_ui = nullptr;
ImapResourceBase *const m_parentResource;
Ui::SetupServerView *const m_ui;
MailTransport::ServerTest *m_serverTest = nullptr;
bool m_subscriptionsChanged = false;
bool m_shouldClearCache = false;
......
......@@ -90,8 +90,8 @@ private:
QLineEdit *m_lineEdit = nullptr;
QCheckBox *m_enableSubscription = nullptr;
SubscriptionFilterProxyModel *m_filter = nullptr;
QStandardItemModel *m_model = nullptr;
SubscriptionFilterProxyModel *const m_filter;
QStandardItemModel *const m_model;
QMap<QString, QStandardItem *> m_itemsMap;
QPushButton *mUser1Button = nullptr;
};
......
......@@ -57,10 +57,7 @@ static const char warningFile[] = "WARNING_README.txt";
KAlarmDirResource::KAlarmDirResource(const QString &id)
: ResourceBase(id)
, mSettings(new Settings(config()))
, mCollectionId(-1)
, mCompatibility(KACalendar::Incompatible)
, mCollectionFetched(false)
, mWaitingToRetrieve(false)
{
qCDebug(KALARMDIRRESOURCE_LOG) << "Starting:" << id;
KAlarmResourceCommon::initialise(this);
......
......@@ -95,12 +95,12 @@ private:
QHash<QString, EventFile> mEvents; // cached alarms and file names, indexed by ID
QHash<QString, QString> mFileEventIds; // alarm IDs, indexed by file name
Akonadi_KAlarm_Dir_Resource::Settings *mSettings = nullptr;
Akonadi::Collection::Id mCollectionId; // ID of this resource's collection
Akonadi::Collection::Id mCollectionId = -1; // ID of this resource's collection
KACalendar::Compat mCompatibility;
int mVersion; // calendar format version
QStringList mChangedFiles; // files being written to
bool mCollectionFetched; // mCollectionId has been initialised
bool mWaitingToRetrieve; // retrieveCollections() needs to be called
bool mCollectionFetched = false; // mCollectionId has been initialised
bool mWaitingToRetrieve = false; // retrieveCollections() needs to be called
};
#endif
......@@ -23,7 +23,6 @@ namespace Akonadi_KAlarm_Dir_Resource {
SettingsDialog::SettingsDialog(WId windowId, Settings *settings)
: QDialog()
, mSettings(settings)
, mReadOnlySelected(false)
{
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
......
......@@ -25,8 +25,6 @@
KolabChangeItemsRelationsTask::KolabChangeItemsRelationsTask(const ResourceStateInterface::Ptr &resource, QObject *parent)
: KolabRelationResourceTask(resource, parent)
, mSession(nullptr)
, mAdding(false)
{
}
......
......@@ -16,7 +16,6 @@
KolabChangeItemsTagsTask::KolabChangeItemsTagsTask(const ResourceStateInterface::Ptr &resource, const QSharedPointer<TagConverter> &tagConverter, QObject *parent)
: KolabRelationResourceTask(resource, parent)
, mSession(nullptr)
, mTagConverter(tagConverter)
{
}
......
......@@ -23,7 +23,7 @@ protected:
private:
KIMAP::Session *mSession = nullptr;
QList<Akonadi::Tag> mChangedTags;
QSharedPointer<TagConverter> mTagConverter;
const QSharedPointer<TagConverter> mTagConverter;
private:
void processNextTag();
......
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