Commit 09aa49e3 authored by Laurent Montel's avatar Laurent Montel 😁

Clean up code + const'ify

parent 4baf051b
Pipeline #36609 failed with stage
in 74 minutes and 54 seconds
......@@ -54,9 +54,8 @@ DKIMAdvancedWidget::~DKIMAdvancedWidget()
void DKIMAdvancedWidget::slotConfigureAuthenticationServer()
{
QPointer<DKIMAuthenticationVerifiedServerDialog> dlg = new DKIMAuthenticationVerifiedServerDialog(this);
dlg->exec();
delete dlg;
DKIMAuthenticationVerifiedServerDialog dlg(this);
dlg.exec();
}
void DKIMAdvancedWidget::loadSettings()
......
......@@ -75,9 +75,8 @@ DKIMPolicyWidget::DKIMPolicyWidget(QWidget *parent)
mRulesButton->setEnabled(false);
ruleLayout->addWidget(mRulesButton);
connect(mRulesButton, &QPushButton::clicked, this, [this]() {
QPointer<MessageViewer::DKIMManageRulesDialog> dlg = new MessageViewer::DKIMManageRulesDialog(this);
dlg->exec();
delete dlg;
MessageViewer::DKIMManageRulesDialog dlg(this);
dlg.exec();
});
ruleLayout->addStretch(1);
......
......@@ -19,12 +19,12 @@ static const char myConfigGroupName[] = "ExpireAccountTrashFolderConfigDialog";
ExpireAccountTrashFolderConfigDialog::ExpireAccountTrashFolderConfigDialog(QWidget *parent)
: QDialog(parent)
, mExpireAccountTrashFolderConfig(new ExpireAccountTrashFolderConfigWidget(this))
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
setWindowTitle(i18nc("@title:window", "Configure Expiry Account Trash Folder"));
mExpireAccountTrashFolderConfig = new ExpireAccountTrashFolderConfigWidget(this);
mExpireAccountTrashFolderConfig->setObjectName(QStringLiteral("mExpireAccountTrashFolderConfig"));
mainLayout->addWidget(mExpireAccountTrashFolderConfig);
......
......@@ -20,7 +20,7 @@ public:
private:
void writeConfig();
void readConfig();
ExpireAccountTrashFolderConfigWidget *mExpireAccountTrashFolderConfig = nullptr;
ExpireAccountTrashFolderConfigWidget *const mExpireAccountTrashFolderConfig;
};
#endif // EXPIREACCOUNTTRASHFOLDERCONFIGDIALOG_H
......@@ -13,12 +13,12 @@
ExpireAccountTrashFolderConfigWidget::ExpireAccountTrashFolderConfigWidget(QWidget *parent)
: QWidget(parent)
, mCollectionExpiryWidget(new MailCommon::CollectionExpiryWidget(this))
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
mCollectionExpiryWidget = new MailCommon::CollectionExpiryWidget(this);
mCollectionExpiryWidget->setObjectName(QStringLiteral("mCollectionExpiryWidget"));
connect(mCollectionExpiryWidget, &MailCommon::CollectionExpiryWidget::saveAndExpireRequested, this, &ExpireAccountTrashFolderConfigWidget::slotSaveAndExpireRequested);
mainLayout->addWidget(mCollectionExpiryWidget);
......
......@@ -22,7 +22,7 @@ public:
private:
void save(bool saveSettings, bool expireNow);
void slotSaveAndExpireRequested();
MailCommon::CollectionExpiryWidget *mCollectionExpiryWidget = nullptr;
MailCommon::CollectionExpiryWidget *const mCollectionExpiryWidget;
};
#endif // EXPIREACCOUNTTRASHFOLDERCONFIGWIDGET_H
......@@ -18,12 +18,12 @@ static const char myConfigGroupName[] = "FolderConfigureSettingsDialog";
FolderConfigureSettingsDialog::FolderConfigureSettingsDialog(QWidget *parent)
: QDialog(parent)
, mFolderConfigureSettingsWidget(new FolderConfigureSettingsWidget(this))
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
setWindowTitle(i18nc("@title:window", "Configure Folder Settings"));
mFolderConfigureSettingsWidget = new FolderConfigureSettingsWidget(this);
mFolderConfigureSettingsWidget->setObjectName(QStringLiteral("mFolderConfigureSettingsWidget"));
mainLayout->addWidget(mFolderConfigureSettingsWidget);
......
......@@ -21,7 +21,7 @@ private:
void slotSave();
void readConfig();
void writeConfig();
FolderConfigureSettingsWidget *mFolderConfigureSettingsWidget = nullptr;
FolderConfigureSettingsWidget *const mFolderConfigureSettingsWidget;
};
#endif // FOLDERCONFIGURESETTINGSDIALOG_H
......@@ -10,8 +10,8 @@
FolderConfigureSettingsExperyWidget::FolderConfigureSettingsExperyWidget(QWidget *parent)
: FolderConfigureSettingsPageBase(parent)
, mCollectionExpiryWidget(new MailCommon::CollectionExpiryWidget(this))
{
mCollectionExpiryWidget = new MailCommon::CollectionExpiryWidget(this);
mCollectionExpiryWidget->setObjectName(QStringLiteral("mCollectionExpiryWidget"));
mCollectionExpiryWidget->hideExpireNowButton();
addMainWidget(mCollectionExpiryWidget);
......
......@@ -21,7 +21,7 @@ public:
~FolderConfigureSettingsExperyWidget();
void save(Akonadi::Collection &col);
private:
MailCommon::CollectionExpiryWidget *mCollectionExpiryWidget = nullptr;
MailCommon::CollectionExpiryWidget *const mCollectionExpiryWidget;
};
#endif // FOLDERCONFIGURESETTINGSEXPERYWIDGET_H
......@@ -10,10 +10,10 @@
FolderConfigureSettingsGeneralWidget::FolderConfigureSettingsGeneralWidget(QWidget *parent)
: FolderConfigureSettingsPageBase(parent)
, mCollectionGeneralWidget(new MailCommon::CollectionGeneralWidget(this))
{
QWidget *mainWidget = new QWidget(this);
QHBoxLayout *mainLayout = new QHBoxLayout(mainWidget);
mCollectionGeneralWidget = new MailCommon::CollectionGeneralWidget(this);
mCollectionGeneralWidget->setObjectName(QStringLiteral("mCollectionGeneralWidget"));
mainLayout->addWidget(mCollectionGeneralWidget);
addMainWidget(mainWidget);
......
......@@ -22,7 +22,7 @@ public:
~FolderConfigureSettingsGeneralWidget();
void save(Akonadi::Collection &col);
private:
MailCommon::CollectionGeneralWidget *mCollectionGeneralWidget = nullptr;
MailCommon::CollectionGeneralWidget *const mCollectionGeneralWidget;
};
#endif // FOLDERCONFIGURESETTINGSGENERALWIDGET_H
......@@ -10,8 +10,8 @@
FolderConfigureSettingsTemplateWidget::FolderConfigureSettingsTemplateWidget(QWidget *parent)
: FolderConfigureSettingsPageBase(parent)
, mCollectionTemplateWidget(new MailCommon::CollectionTemplatesWidget(this))
{
mCollectionTemplateWidget = new MailCommon::CollectionTemplatesWidget(this);
mCollectionTemplateWidget->setObjectName(QStringLiteral("mCollectionTemplateWidget"));
addMainWidget(mCollectionTemplateWidget);
}
......
......@@ -22,7 +22,7 @@ public:
~FolderConfigureSettingsTemplateWidget();
void save(Akonadi::Collection &col);
private:
MailCommon::CollectionTemplatesWidget *mCollectionTemplateWidget = nullptr;
MailCommon::CollectionTemplatesWidget *const mCollectionTemplateWidget;
};
#endif // FOLDERCONFIGURESETTINGSTEMPLATEWIDGET_H
......@@ -28,8 +28,8 @@ private:
void slotRelationCreated(KJob *job);
void createEvent();
Akonadi::Item mItem;
Akonadi::Collection mCollection;
KCalendarCore::Event::Ptr mEventPtr;
const Akonadi::Collection mCollection;
const KCalendarCore::Event::Ptr mEventPtr;
};
}
......
......@@ -33,8 +33,8 @@ private Q_SLOTS:
private:
void createNote();
Akonadi::Item mItem;
Akonadi::Collection mCollection;
const Akonadi::Item mItem;
const Akonadi::Collection mCollection;
Akonadi::NoteUtils::NoteMessageWrapper mNote;
};
}
......
......@@ -21,8 +21,8 @@ using namespace MessageViewer;
ViewerPluginExternalscriptInterface::ViewerPluginExternalscriptInterface(KActionCollection *ac, QWidget *parent)
: ViewerPluginInterface(parent)
, mActionGroup(new QActionGroup(this))
{
mActionGroup = new QActionGroup(this);
createAction(ac);
}
......
......@@ -14,11 +14,11 @@ K_PLUGIN_CLASS_WITH_JSON(TemplateParserEmailAddressRequesterAkonadi,
TemplateParserEmailAddressRequesterAkonadi::TemplateParserEmailAddressRequesterAkonadi(QWidget *parent, const QList<QVariant> &)
: TemplateParser::TemplateParserEmailAddressRequesterBase(parent)
, mEmailAddressRequester(new Akonadi::EmailAddressRequester(this))
{
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
mEmailAddressRequester = new Akonadi::EmailAddressRequester(this);
mEmailAddressRequester->setObjectName(QStringLiteral("EmailAddressRequester"));
mainLayout->addWidget(mEmailAddressRequester);
connect(mEmailAddressRequester, &Akonadi::EmailAddressRequester::textChanged, this, &TemplateParser::TemplateParserEmailAddressRequesterBase::textChanged);
......
......@@ -26,7 +26,7 @@ public:
void clear() override;
private:
Akonadi::EmailAddressRequester *mEmailAddressRequester = nullptr;
Akonadi::EmailAddressRequester *const mEmailAddressRequester;
};
#endif // TEMPLATEPARSEREMAILADDRESSREQUESTERAKONADI_H
......@@ -18,8 +18,8 @@
AdblockInterceptorInterface::AdblockInterceptorInterface(QObject *parent)
: WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
, mAdblockManager(new AdBlock::AdblockManager(this))
{
mAdblockManager = new AdBlock::AdblockManager(this);
}
AdblockInterceptorInterface::~AdblockInterceptorInterface()
......
......@@ -35,7 +35,7 @@ private:
mutable WebEngineViewer::WebHitTestResult mCurrentWebHitTest;
QAction *mShowBlockableItems = nullptr;
QAction *mBlockImage = nullptr;
AdBlock::AdblockManager *mAdblockManager = nullptr;
AdBlock::AdblockManager *const mAdblockManager;
QWebEngineView *mWebEngineView = nullptr;
};
......
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