From 0180165ed00d6c625b5dde3385b9bd8eea958896 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Thu, 8 Oct 2020 13:37:38 +0200 Subject: [PATCH] Const'ify variable/pointer --- agents/archivemailagent/archivemailagent.cpp | 2 +- agents/archivemailagent/archivemailagent.h | 2 +- agents/followupreminderagent/followupreminderagent.cpp | 2 +- agents/followupreminderagent/followupreminderagent.h | 2 +- .../followupreminderagent/jobs/followupreminderfinishtaskjob.h | 2 +- .../jobs/followupremindershowmessagejob.h | 2 +- agents/mailfilteragent/filterlogdialog.cpp | 3 --- agents/sendlateragent/sendlateragent.cpp | 2 +- agents/sendlateragent/sendlateragent.h | 2 +- agents/sendlateragent/sendlaterconfiguredialog.cpp | 2 +- agents/sendlateragent/sendlaterconfiguredialog.h | 2 +- agents/sendlateragent/sendlaterremovemessagejob.h | 2 +- agents/unifiedmailboxagent/settingsdialog.h | 2 +- 13 files changed, 12 insertions(+), 15 deletions(-) diff --git a/agents/archivemailagent/archivemailagent.cpp b/agents/archivemailagent/archivemailagent.cpp index 4d4ddade6..4cb42b313 100644 --- a/agents/archivemailagent/archivemailagent.cpp +++ b/agents/archivemailagent/archivemailagent.cpp @@ -24,6 +24,7 @@ ArchiveMailAgent::ArchiveMailAgent(const QString &id) : Akonadi::AgentBase(id) + , mArchiveManager(new ArchiveMailManager(this)) { Kdelibs4ConfigMigrator migrate(QStringLiteral("archivemailagent")); migrate.setConfigFiles(QStringList() << QStringLiteral("akonadi_archivemail_agentrc") << QStringLiteral("akonadi_archivemail_agent.notifyrc")); @@ -31,7 +32,6 @@ ArchiveMailAgent::ArchiveMailAgent(const QString &id) connect(this, &Akonadi::AgentBase::reloadConfiguration, this, &ArchiveMailAgent::reload); - mArchiveManager = new ArchiveMailManager(this); connect(mArchiveManager, &ArchiveMailManager::needUpdateConfigDialogBox, this, &ArchiveMailAgent::needUpdateConfigDialogBox); Akonadi::Monitor *collectionMonitor = new Akonadi::Monitor(this); diff --git a/agents/archivemailagent/archivemailagent.h b/agents/archivemailagent/archivemailagent.h index dc026591b..0be22c6c2 100644 --- a/agents/archivemailagent/archivemailagent.h +++ b/agents/archivemailagent/archivemailagent.h @@ -45,7 +45,7 @@ protected: private: void mailCollectionRemoved(const Akonadi::Collection &collection); QTimer *mTimer = nullptr; - ArchiveMailManager *mArchiveManager = nullptr; + ArchiveMailManager *const mArchiveManager; }; #endif /* ARCHIVEMAILAGENT_H */ diff --git a/agents/followupreminderagent/followupreminderagent.cpp b/agents/followupreminderagent/followupreminderagent.cpp index 48f195713..69d82c3f1 100644 --- a/agents/followupreminderagent/followupreminderagent.cpp +++ b/agents/followupreminderagent/followupreminderagent.cpp @@ -27,6 +27,7 @@ FollowUpReminderAgent::FollowUpReminderAgent(const QString &id) : Akonadi::AgentBase(id) + , mManager(new FollowUpReminderManager(this)) { Kdelibs4ConfigMigrator migrate(QStringLiteral("followupreminderagent")); migrate.setConfigFiles(QStringList() << QStringLiteral("akonadi_followupreminder_agentrc") << QStringLiteral("akonadi_followupreminder_agent.notifyrc")); @@ -36,7 +37,6 @@ FollowUpReminderAgent::FollowUpReminderAgent(const QString &id) QDBusConnection::sessionBus().registerObject(QStringLiteral("/FollowUpReminder"), this, QDBusConnection::ExportAdaptors); const QString service = Akonadi::ServerManager::self()->agentServiceName(Akonadi::ServerManager::Agent, QStringLiteral("akonadi_followupreminder_agent")); QDBusConnection::sessionBus().registerService(service); - mManager = new FollowUpReminderManager(this); setNeedsNetwork(true); changeRecorder()->setMimeTypeMonitored(KMime::Message::mimeType()); diff --git a/agents/followupreminderagent/followupreminderagent.h b/agents/followupreminderagent/followupreminderagent.h index a1a56c040..a33b190f7 100644 --- a/agents/followupreminderagent/followupreminderagent.h +++ b/agents/followupreminderagent/followupreminderagent.h @@ -29,7 +29,7 @@ protected: void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) override; private: - FollowUpReminderManager *mManager = nullptr; + FollowUpReminderManager *const mManager; QTimer *mTimer = nullptr; }; diff --git a/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.h b/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.h index 293a6b35f..4210ac5f2 100644 --- a/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.h +++ b/agents/followupreminderagent/jobs/followupreminderfinishtaskjob.h @@ -28,7 +28,7 @@ private: void slotItemFetchJobDone(KJob *job); void slotItemModifiedResult(KJob *job); void closeTodo(); - Akonadi::Item::Id mTodoId; + const Akonadi::Item::Id mTodoId; }; #endif // FOLLOWUPREMINDERFINISHTASKJOB_H diff --git a/agents/followupreminderagent/jobs/followupremindershowmessagejob.h b/agents/followupreminderagent/jobs/followupremindershowmessagejob.h index 2d0db55f0..b22328694 100644 --- a/agents/followupreminderagent/jobs/followupremindershowmessagejob.h +++ b/agents/followupreminderagent/jobs/followupremindershowmessagejob.h @@ -21,7 +21,7 @@ public: private: Q_DISABLE_COPY(FollowUpReminderShowMessageJob) - Akonadi::Item::Id mId; + const Akonadi::Item::Id mId; }; #endif // FOLLOWUPREMINDERSHOWMESSAGEJOB_H diff --git a/agents/mailfilteragent/filterlogdialog.cpp b/agents/mailfilteragent/filterlogdialog.cpp index b3eaa717c..f460b94aa 100644 --- a/agents/mailfilteragent/filterlogdialog.cpp +++ b/agents/mailfilteragent/filterlogdialog.cpp @@ -102,9 +102,6 @@ FilterLogDialog::FilterLogDialog(QWidget *parent) mLogPatternDescBox->setChecked( FilterLog::instance()->isContentTypeEnabled(FilterLog::PatternDescription)); connect(mLogPatternDescBox, &QCheckBox::clicked, this, &FilterLogDialog::slotChangeLogDetail); - // TODO - //QWhatsThis::add( mLogPatternDescBox, - // i18n( "" ) ); mLogRuleEvaluationBox = new QCheckBox(i18n("Log filter &rule evaluation")); layout->addWidget(mLogRuleEvaluationBox); diff --git a/agents/sendlateragent/sendlateragent.cpp b/agents/sendlateragent/sendlateragent.cpp index 21d4a0374..5a1120ee0 100644 --- a/agents/sendlateragent/sendlateragent.cpp +++ b/agents/sendlateragent/sendlateragent.cpp @@ -35,12 +35,12 @@ SendLaterAgent::SendLaterAgent(const QString &id) : Akonadi::AgentBase(id) + , mManager(new SendLaterManager(this)) { Kdelibs4ConfigMigrator migrate(QStringLiteral("sendlateragent")); migrate.setConfigFiles(QStringList() << QStringLiteral("akonadi_sendlater_agentrc") << QStringLiteral("akonadi_sendlater_agent.notifyrc")); migrate.migrate(); - mManager = new SendLaterManager(this); connect(mManager, &SendLaterManager::needUpdateConfigDialogBox, this, &SendLaterAgent::needUpdateConfigDialogBox); new SendLaterAgentAdaptor(this); QDBusConnection::sessionBus().registerObject(QStringLiteral("/SendLaterAgent"), this, QDBusConnection::ExportAdaptors); diff --git a/agents/sendlateragent/sendlateragent.h b/agents/sendlateragent/sendlateragent.h index 426a57c91..5b8cb81af 100644 --- a/agents/sendlateragent/sendlateragent.h +++ b/agents/sendlateragent/sendlateragent.h @@ -45,7 +45,7 @@ private: void slotSendNow(Akonadi::Item::Id id); void slotStartAgent(); bool mAgentInitialized = false; - SendLaterManager *mManager = nullptr; + SendLaterManager *const mManager; }; #endif // SENDLATERAGENT_H diff --git a/agents/sendlateragent/sendlaterconfiguredialog.cpp b/agents/sendlateragent/sendlaterconfiguredialog.cpp index e9c4f109a..6f90e0ca1 100644 --- a/agents/sendlateragent/sendlaterconfiguredialog.cpp +++ b/agents/sendlateragent/sendlaterconfiguredialog.cpp @@ -20,6 +20,7 @@ SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent) : QDialog(parent) + , mWidget(new SendLaterWidget(this)) { setWindowTitle(i18nc("@title:window", "Configure")); setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail"))); @@ -30,7 +31,6 @@ SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent) okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::rejected, this, &SendLaterConfigureDialog::reject); - mWidget = new SendLaterWidget(this); mWidget->setObjectName(QStringLiteral("sendlaterwidget")); connect(mWidget, &SendLaterWidget::sendNow, this, &SendLaterConfigureDialog::sendNow); mainLayout->addWidget(mWidget); diff --git a/agents/sendlateragent/sendlaterconfiguredialog.h b/agents/sendlateragent/sendlaterconfiguredialog.h index a955578b0..102990d0b 100644 --- a/agents/sendlateragent/sendlaterconfiguredialog.h +++ b/agents/sendlateragent/sendlaterconfiguredialog.h @@ -29,7 +29,7 @@ private: void slotSave(); void readConfig(); void writeConfig(); - SendLaterWidget *mWidget = nullptr; + SendLaterWidget *const mWidget; }; #endif // SENDLATERCONFIGUREDIALOG_H diff --git a/agents/sendlateragent/sendlaterremovemessagejob.h b/agents/sendlateragent/sendlaterremovemessagejob.h index f2fdad1a8..cea36d12a 100644 --- a/agents/sendlateragent/sendlaterremovemessagejob.h +++ b/agents/sendlateragent/sendlaterremovemessagejob.h @@ -25,7 +25,7 @@ private: Q_DISABLE_COPY(SendLaterRemoveMessageJob) void slotItemDeleteDone(KJob *job); void deleteItem(); - QVector mListItems; + const QVector mListItems; int mIndex = 0; }; diff --git a/agents/unifiedmailboxagent/settingsdialog.h b/agents/unifiedmailboxagent/settingsdialog.h index 46c7213b2..ec45b4ad9 100644 --- a/agents/unifiedmailboxagent/settingsdialog.h +++ b/agents/unifiedmailboxagent/settingsdialog.h @@ -32,7 +32,7 @@ private: QStandardItemModel *mBoxModel = nullptr; UnifiedMailboxManager &mBoxManager; MailKernel *const mKernel; - KSharedConfigPtr mConfig; + const KSharedConfigPtr mConfig; }; #endif