Commit 28b7c1db authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 71c752ab
Pipeline #48550 failed with stage
in 14 minutes and 21 seconds
......@@ -26,7 +26,7 @@ AutoCreateScriptDialog::AutoCreateScriptDialog(QWidget *parent)
{
setWindowTitle(i18nc("@title:window", "Create Sieve Filter"));
auto mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -65,7 +65,7 @@ void SelectConvertParameterWidget::initialize()
hbox->addWidget(mWidth);
connect(mWidth, QOverload<int>::of(&QSpinBox::valueChanged), this, &SelectConvertParameterWidget::valueChanged);
QLabel *lab = new QLabel(QStringLiteral("x"), this);
auto lab = new QLabel(QStringLiteral("x"), this);
hbox->addWidget(lab);
mHeight = new QSpinBox(this);
......
......@@ -28,7 +28,7 @@ bool SieveHelpButton::event(QEvent *event)
{
if (event->type() == QEvent::WhatsThisClicked) {
auto clicked = static_cast<QWhatsThisClickedEvent *>(event);
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl(clicked->href()));
auto job = new KIO::OpenUrlJob(QUrl(clicked->href()));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
return true;
......
......@@ -20,7 +20,7 @@ SieveActionAbstractFlags::SieveActionAbstractFlags(SieveEditorGraphicalModeWidge
QWidget *SieveActionAbstractFlags::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
......
......@@ -26,7 +26,7 @@ SieveActionAddHeader::SieveActionAddHeader(SieveEditorGraphicalModeWidget *sieve
QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
......@@ -36,7 +36,7 @@ QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
connect(combo, &SelectAddHeaderPositionCombobox::valueChanged, this, &SieveActionAddHeader::valueChanged);
grid->addWidget(combo, 0, 0);
QLabel *lab = new QLabel(i18n("header:"));
auto lab = new QLabel(i18n("header:"));
grid->addWidget(lab, 0, 1);
auto headerEdit = new QLineEdit;
......
......@@ -23,12 +23,12 @@ SieveActionBreak::SieveActionBreak(SieveEditorGraphicalModeWidget *sieveGraphica
QWidget *SieveActionBreak::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("Name (optional):"));
auto lab = new QLabel(i18n("Name (optional):"));
lay->addWidget(lab);
auto subject = new QLineEdit;
......
......@@ -23,12 +23,12 @@ SieveActionConvert::SieveActionConvert(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionConvert::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QGridLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("From:"));
auto lab = new QLabel(i18n("From:"));
lay->addWidget(lab, 0, 0);
auto fromMimeType = new SelectMimeTypeComboBox;
......
......@@ -26,7 +26,7 @@ SieveActionDeleteHeader::SieveActionDeleteHeader(SieveEditorGraphicalModeWidget
QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
......@@ -36,7 +36,7 @@ QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
connect(matchType, &SelectMatchTypeComboBox::valueChanged, this, &SieveActionDeleteHeader::valueChanged);
grid->addWidget(matchType, 0, 0);
QLabel *lab = new QLabel(i18n("header:"));
auto lab = new QLabel(i18n("header:"));
grid->addWidget(lab, 0, 1);
auto headerEdit = new QLineEdit;
......
......@@ -24,12 +24,12 @@ SieveActionEnclose::SieveActionEnclose(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionEnclose::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Subject:"));
auto lab = new QLabel(i18n("Subject:"));
grid->addWidget(lab, 0, 0);
auto subject = new QLineEdit;
......
......@@ -23,11 +23,11 @@ SieveActionEReject::SieveActionEReject(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionEReject::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("text:"));
auto lab = new QLabel(i18n("text:"));
lay->addWidget(lab);
auto edit = new MultiLineEdit;
......
......@@ -23,12 +23,12 @@ SieveActionExtractText::SieveActionExtractText(SieveEditorGraphicalModeWidget *s
QWidget *SieveActionExtractText::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Number of characters:"));
auto lab = new QLabel(i18n("Number of characters:"));
grid->addWidget(lab, 0, 0);
auto nbCharacters = new QSpinBox;
......
......@@ -88,18 +88,18 @@ void SieveActionFileInto::setParamWidgetValue(QXmlStreamReader &element, QWidget
QWidget *SieveActionFileInto::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout(w);
lay->setContentsMargins({});
if (mHasCopySupport) {
QCheckBox *copy = new QCheckBox(i18n("Keep a copy"));
auto copy = new QCheckBox(i18n("Keep a copy"));
copy->setObjectName(QStringLiteral("copy"));
lay->addWidget(copy);
connect(copy, &QCheckBox::clicked, this, &SieveActionFileInto::valueChanged);
}
if (mHasMailBoxSupport) {
QCheckBox *create = new QCheckBox(i18n("Create folder"));
auto create = new QCheckBox(i18n("Create folder"));
create->setObjectName(QStringLiteral("create"));
connect(create, &QCheckBox::clicked, this, &SieveActionFileInto::valueChanged);
lay->addWidget(create);
......
......@@ -47,11 +47,11 @@ QString SieveActionKeep::help() const
QWidget *SieveActionKeep::createParamWidget(QWidget *parent) const
{
if (mHasFlagSupport) {
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *addFlags = new QLabel(i18n("Add flags:"));
auto addFlags = new QLabel(i18n("Add flags:"));
lay->addWidget(addFlags);
auto flagsWidget = new SelectFlagsWidget;
......
......@@ -25,7 +25,7 @@ SieveActionNotify::SieveActionNotify(SieveEditorGraphicalModeWidget *sieveGraphi
QWidget *SieveActionNotify::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
......@@ -35,7 +35,7 @@ QWidget *SieveActionNotify::createParamWidget(QWidget *parent) const
connect(importanceCombobox, &SelectImportanceCombobox::valueChanged, this, &SieveActionNotify::valueChanged);
lay->addWidget(importanceCombobox);
QLabel *lab = new QLabel(i18n("message:"));
auto lab = new QLabel(i18n("message:"));
lay->addWidget(lab);
auto message = new QLineEdit;
......
......@@ -27,18 +27,18 @@ SieveActionRedirect::SieveActionRedirect(SieveEditorGraphicalModeWidget *sieveGr
QWidget *SieveActionRedirect::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
if (mHasCopySupport) {
QCheckBox *copy = new QCheckBox(i18n("Keep a copy"));
auto copy = new QCheckBox(i18n("Keep a copy"));
copy->setObjectName(QStringLiteral("copy"));
connect(copy, &QCheckBox::clicked, this, &SieveActionRedirect::valueChanged);
lay->addWidget(copy);
}
if (mHasListSupport) {
QCheckBox *list = new QCheckBox(i18n("Use list"));
auto list = new QCheckBox(i18n("Use list"));
list->setObjectName(QStringLiteral("list"));
connect(list, &QCheckBox::clicked, this, &SieveActionRedirect::valueChanged);
lay->addWidget(list);
......
......@@ -23,11 +23,11 @@ SieveActionReject::SieveActionReject(SieveEditorGraphicalModeWidget *sieveGraphi
QWidget *SieveActionReject::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("text:"));
auto lab = new QLabel(i18n("text:"));
lay->addWidget(lab);
auto edit = new MultiLineEdit;
......
......@@ -26,12 +26,12 @@ SieveActionReplace::SieveActionReplace(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionReplace::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Subject:"));
auto lab = new QLabel(i18n("Subject:"));
grid->addWidget(lab, 0, 0);
auto subject = new QLineEdit;
......
......@@ -27,7 +27,7 @@ SieveActionSetVariable::SieveActionSetVariable(SieveEditorGraphicalModeWidget *s
QWidget *SieveActionSetVariable::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
......@@ -38,13 +38,13 @@ QWidget *SieveActionSetVariable::createParamWidget(QWidget *parent) const
grid->addWidget(modifier, 0, 0);
if (mHasRegexCapability) {
QCheckBox *protectAgainstUseRegexp = new QCheckBox(i18n("Protect special character"));
auto protectAgainstUseRegexp = new QCheckBox(i18n("Protect special character"));
connect(protectAgainstUseRegexp, &QCheckBox::clicked, this, &SieveActionSetVariable::valueChanged);
protectAgainstUseRegexp->setObjectName(QStringLiteral("regexprotect"));
grid->addWidget(protectAgainstUseRegexp, 0, 1);
}
QLabel *lab = new QLabel(i18n("Value:"));
auto lab = new QLabel(i18n("Value:"));
grid->addWidget(lab, 1, 0);
auto value = new QLineEdit;
......
......@@ -30,7 +30,7 @@ SieveActionVacation::SieveActionVacation(SieveEditorGraphicalModeWidget *sieveGr
QWidget *SieveActionVacation::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
auto w = new QWidget(parent);
auto grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
......
......@@ -28,7 +28,7 @@ SelectFlagsListDialog::SelectFlagsListDialog(QWidget *parent)
auto mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(mListWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......@@ -81,7 +81,7 @@ SelectFlagsListWidget::~SelectFlagsListWidget()
void SelectFlagsListWidget::init()
{
QListWidgetItem *item = new QListWidgetItem(i18n("Deleted"), this);
auto item = new QListWidgetItem(i18n("Deleted"), this);
item->setData(FlagsRealName, QStringLiteral("\\\\Deleted"));
item->setCheckState(Qt::Unchecked);
item = new QListWidgetItem(i18n("Answered"), this);
......
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