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

modernize code

parent 51debaf4
Pipeline #37449 passed with stage
in 29 minutes and 13 seconds
......@@ -22,6 +22,7 @@ using namespace KSieveUi;
AutoCreateScriptDialog::AutoCreateScriptDialog(QWidget *parent)
: QDialog(parent)
, mEditor(new SieveEditorGraphicalModeWidget(this))
{
setWindowTitle(i18nc("@title:window", "Create Sieve Filter"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
......@@ -32,7 +33,6 @@ AutoCreateScriptDialog::AutoCreateScriptDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::accepted, this, &AutoCreateScriptDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &AutoCreateScriptDialog::reject);
okButton->setFocus();
mEditor = new SieveEditorGraphicalModeWidget(this);
mainLayout->addWidget(mEditor);
mainLayout->addWidget(buttonBox);
readConfig();
......
......@@ -40,7 +40,7 @@ private:
void writeConfig();
private:
SieveEditorGraphicalModeWidget *mEditor = nullptr;
SieveEditorGraphicalModeWidget *const mEditor;
};
}
......
......@@ -56,7 +56,7 @@ QString SelectConvertParameterWidget::code() const
void SelectConvertParameterWidget::initialize()
{
QBoxLayout *hbox = new QHBoxLayout(this);
hbox->setContentsMargins(0, 0, 0, 0);
hbox->setContentsMargins({});
mWidth = new QSpinBox(this);
mWidth->setSuffix(i18n(" px"));
mWidth->setMinimum(1);
......
......@@ -22,7 +22,7 @@ QWidget *SieveActionAbstractFlags::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectFlagsWidget *flagsWidget = new SelectFlagsWidget;
connect(flagsWidget, &SelectFlagsWidget::valueChanged, this, &SieveActionAbstractFlags::valueChanged);
......
......@@ -27,7 +27,7 @@ QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
SelectAddHeaderPositionCombobox *combo = new SelectAddHeaderPositionCombobox;
......
......@@ -25,7 +25,7 @@ QWidget *SieveActionBreak::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("Name (optional):"));
......
......@@ -25,7 +25,7 @@ QWidget *SieveActionConvert::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *lay = new QGridLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("From:"));
......
......@@ -28,7 +28,7 @@ QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
SelectMatchTypeComboBox *matchType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......
......@@ -26,7 +26,7 @@ QWidget *SieveActionEnclose::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Subject:"));
......
......@@ -25,7 +25,7 @@ QWidget *SieveActionEReject::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("text:"));
lay->addWidget(lab);
......
......@@ -25,7 +25,7 @@ QWidget *SieveActionExtractText::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Number of characters:"));
......
......@@ -90,7 +90,7 @@ QWidget *SieveActionFileInto::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout(w);
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
if (mHasCopySupport) {
QCheckBox *copy = new QCheckBox(i18n("Keep a copy"));
......
......@@ -49,7 +49,7 @@ QWidget *SieveActionKeep::createParamWidget(QWidget *parent) const
if (mHasFlagSupport) {
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *addFlags = new QLabel(i18n("Add flags:"));
lay->addWidget(addFlags);
......
......@@ -27,7 +27,7 @@ QWidget *SieveActionNotify::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectImportanceCombobox *importanceCombobox = new SelectImportanceCombobox;
......
......@@ -29,7 +29,7 @@ QWidget *SieveActionRedirect::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
if (mHasCopySupport) {
QCheckBox *copy = new QCheckBox(i18n("Keep a copy"));
......
......@@ -25,7 +25,7 @@ QWidget *SieveActionReject::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("text:"));
lay->addWidget(lab);
......
......@@ -28,7 +28,7 @@ QWidget *SieveActionReplace::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Subject:"));
......
......@@ -29,7 +29,7 @@ QWidget *SieveActionSetVariable::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
SelectVariableModifierComboBox *modifier = new SelectVariableModifierComboBox;
......
......@@ -32,7 +32,7 @@ QWidget *SieveActionVacation::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = nullptr;
......
......@@ -14,7 +14,7 @@ AddressLineEdit::AddressLineEdit(QWidget *parent)
: AbstractSelectEmailLineEdit(parent)
{
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setContentsMargins({});
mLineEdit = new QLineEdit(this);
mainLayout->addWidget(mLineEdit);
mLineEdit->setClearButtonEnabled(true);
......
......@@ -22,10 +22,10 @@ using namespace KSieveUi;
SelectFlagsListDialog::SelectFlagsListDialog(QWidget *parent)
: QDialog(parent)
, mListWidget(new SelectFlagsListWidget(this))
{
setWindowTitle(i18nc("@title:window", "Flags"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mListWidget = new SelectFlagsListWidget(this);
mainLayout->addWidget(mListWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
......@@ -128,7 +128,7 @@ SelectFlagsWidget::SelectFlagsWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *lay = new QHBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
mEdit = new QLineEdit(this);
mEdit->setReadOnly(true);
mEdit->setPlaceholderText(i18n("Click on button for selecting flags..."));
......
......@@ -41,7 +41,7 @@ public:
private:
void readConfig();
void writeConfig();
SelectFlagsListWidget *mListWidget = nullptr;
SelectFlagsListWidget *const mListWidget;
};
class SelectFlagsWidget : public QWidget
......
......@@ -100,7 +100,7 @@ void SieveActionWidget::generatedScript(QString &script, QStringList &required,
void SieveActionWidget::initWidget()
{
mLayout = new QGridLayout(this);
mLayout->setContentsMargins(0, 0, 0, 0);
mLayout->setContentsMargins({});
mComboBox = new QComboBox;
mComboBox->setEditable(false);
......
......@@ -28,7 +28,7 @@ QWidget *SieveConditionAddress::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectAddressPartComboBox *selectAddressPart = new SelectAddressPartComboBox(mSieveGraphicalModeWidget);
......@@ -37,7 +37,7 @@ QWidget *SieveConditionAddress::createParamWidget(QWidget *parent) const
lay->addWidget(selectAddressPart);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
lay->addLayout(grid);
SelectMatchTypeComboBox *selectMatchCombobox = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
connect(selectMatchCombobox, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionAddress::valueChanged);
......
......@@ -25,7 +25,7 @@ QWidget *SieveConditionBody::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectBodyTypeWidget *bodyType = new SelectBodyTypeWidget;
......
......@@ -25,7 +25,7 @@ QWidget *SieveConditionConvert::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *lay = new QGridLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("From:"));
......
......@@ -26,7 +26,7 @@ QWidget *SieveConditionCurrentDate::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......
......@@ -27,7 +27,7 @@ QWidget *SieveConditionDate::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......@@ -36,7 +36,7 @@ QWidget *SieveConditionDate::createParamWidget(QWidget *parent) const
lay->addWidget(matchTypeCombo);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
lay->addLayout(grid);
QLabel *lab = new QLabel(i18n("header:"));
grid->addWidget(lab, 0, 0);
......
......@@ -29,7 +29,7 @@ QWidget *SieveConditionEnvelope::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectAddressPartComboBox *selectAddressPart = new SelectAddressPartComboBox(mSieveGraphicalModeWidget);
......@@ -38,7 +38,7 @@ QWidget *SieveConditionEnvelope::createParamWidget(QWidget *parent) const
lay->addWidget(selectAddressPart);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
lay->addLayout(grid);
SelectMatchTypeComboBox *selectMatchCombobox = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......
......@@ -27,7 +27,7 @@ QWidget *SieveConditionEnvironment::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Item:"));
grid->addWidget(lab, 0, 0);
......
......@@ -27,7 +27,7 @@ QWidget *SieveConditionExists::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QComboBox *combo = new QComboBox;
......
......@@ -25,7 +25,7 @@ QWidget *SieveConditionFalse::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *label = new QLabel(i18n("false"));
......
......@@ -29,7 +29,7 @@ QWidget *SieveConditionHasFlag::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectMatchTypeComboBox *selecttype = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
selecttype->setObjectName(QStringLiteral("matchtype"));
......@@ -37,7 +37,7 @@ QWidget *SieveConditionHasFlag::createParamWidget(QWidget *parent) const
lay->addWidget(selecttype);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
lay->addLayout(grid);
int row = 0;
......
......@@ -27,7 +27,7 @@ QWidget *SieveConditionHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......
......@@ -25,7 +25,7 @@ QWidget *SieveConditionIhave::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLineEdit *edit = new QLineEdit;
......
......@@ -24,7 +24,7 @@ QWidget *SieveConditionMailboxExists::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLineEdit *edit = new QLineEdit;
......
......@@ -28,7 +28,7 @@ QWidget *SieveConditionMetaData::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectMatchTypeComboBox *selectType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......@@ -37,7 +37,7 @@ QWidget *SieveConditionMetaData::createParamWidget(QWidget *parent) const
lay->addWidget(selectType);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
lay->addLayout(grid);
QLabel *lab = new QLabel(i18n("Mailbox:"));
......
......@@ -26,7 +26,7 @@ QWidget *SieveConditionMetaDataExists::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Mailbox:"));
......
......@@ -27,7 +27,7 @@ QWidget *SieveConditionServerMetaData::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectMatchTypeComboBox *selectType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
......@@ -36,7 +36,7 @@ QWidget *SieveConditionServerMetaData::createParamWidget(QWidget *parent) const
lay->addWidget(selectType);
QGridLayout *grid = new QGridLayout;
grid->setContentsMargins(0, 0, 0, 0);
grid->setContentsMargins({});
lay->addLayout(grid);
QLabel *lab = new QLabel(i18n("Mailbox:"));
......
......@@ -24,7 +24,7 @@ QWidget *SieveConditionServerMetaDataExists::createParamWidget(QWidget *parent)
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("Annotation:"));
......
......@@ -25,7 +25,7 @@ QWidget *SieveConditionSize::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QComboBox *combo = new QComboBox;
......
......@@ -30,7 +30,7 @@ QWidget *SieveConditionSpamTest::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QVBoxLayout *lay = new QVBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
if (mHasSpamTestPlusSupport) {
......
......@@ -25,7 +25,7 @@ QWidget *SieveConditionTrue::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *label = new QLabel(i18n("true"));
......
......@@ -27,7 +27,7 @@ QWidget *SieveConditionVirusTest::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QVBoxLayout *lay = new QVBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
w->setLayout(lay);
SelectRelationalMatchType *relation = new SelectRelationalMatchType;
......
......@@ -14,7 +14,7 @@ RegexpEditorLineEdit::RegexpEditorLineEdit(QWidget *parent)
{
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setContentsMargins({});
mLineEdit = new QLineEdit(this);
mLineEdit->setObjectName(QStringLiteral("lineedit"));
connect(mLineEdit, &QLineEdit::textChanged, this, &RegexpEditorLineEdit::textChanged);
......
......@@ -27,7 +27,7 @@ SelectBodyTypeWidget::~SelectBodyTypeWidget()
void SelectBodyTypeWidget::initialize()
{
QHBoxLayout *lay = new QHBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
mBodyCombobox = new QComboBox(this);
lay->addWidget(mBodyCombobox);
......
......@@ -33,7 +33,7 @@ SelectDateWidget::~SelectDateWidget()
void SelectDateWidget::initialize()
{
QHBoxLayout *lay = new QHBoxLayout(this);