Commit d4bb2f3a authored by Laurent Montel's avatar Laurent Montel 😁

Modernize code (raw string literal + auto)

parent a6ed01bb
Pipeline #39254 passed with stage
in 26 minutes and 49 seconds
......@@ -266,17 +266,17 @@ static const TestCase testcases[] = {
Error::None, 0, 0
},
{
"Quoted string, escaped '\"'", "\"foo\\\"bar\"",
"Quoted string, escaped '\"'", R"("foo\"bar")",
{ { Lexer::QuotedString, "foo\"bar" }, { Lexer::None, nullptr } },
Error::None, 0, 0
},
{
"Quoted string, escaped '\\'", "\"foo\\\\bar\"",
"Quoted string, escaped '\\'", R"("foo\\bar")",
{ { Lexer::QuotedString, "foo\\bar" }, { Lexer::None, nullptr } },
Error::None, 0, 0
},
{
"Quoted string, excessive escapes", "\"\\fo\\o\"",
"Quoted string, excessive escapes", R"("\fo\o")",
{ { Lexer::QuotedString, "foo" }, { Lexer::None, nullptr } },
Error::None, 0, 0
},
......
......@@ -252,7 +252,7 @@ static struct TestCase {
{
"single two-element string list argument - quoted strings",
"command [\"string\",\"string\"];",
R"(command ["string","string"];)",
{ { CommandStart, "command", false },
{ StringListArgumentStart, nullptr, false },
{ StringListEntry, "string", false /*quoted*/ },
......
......@@ -936,7 +936,7 @@ void kio_sieveProtocol::listDir(const QUrl &url)
bool kio_sieveProtocol::saslInteract(void *in, AuthInfo &ai)
{
ksDebug << "sasl_interact" << returnEndLine();
sasl_interact_t *interact = (sasl_interact_t *)in;
auto *interact = (sasl_interact_t *)in;
//some mechanisms do not require username && pass, so it doesn't need a popup
//window for getting this info
......
......@@ -44,7 +44,7 @@ SessionThread::SessionThread(Session *session, QObject *parent)
saslInitialized = true;
}
QThread *thread = new QThread();
auto *thread = new QThread();
moveToThread(thread);
thread->start();
QMetaObject::invokeMethod(this, "doInit");
......@@ -305,7 +305,7 @@ bool SessionThread::saslInteract(void *in)
Q_ASSERT(QThread::currentThread() == thread());
qCDebug(KMANAGERSIEVE_LOG) << "SessionThread::saslInteract";
sasl_interact_t *interact = (sasl_interact_t *)in;
auto *interact = (sasl_interact_t *)in;
//some mechanisms do not require username && pass, so it doesn't need a popup
//window for getting this info
......
......@@ -291,7 +291,7 @@ SieveJob *SieveJob::put(const QUrl &destination, const QString &script, bool mak
commands.push(Private::Put);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = destination;
job->d->mScript = script;
job->d->mCommands = commands;
......@@ -306,7 +306,7 @@ SieveJob *SieveJob::get(const QUrl &source)
commands.push(Private::Get);
commands.push(Private::SearchActive);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = source;
job->d->mCommands = commands;
......@@ -319,7 +319,7 @@ SieveJob *SieveJob::list(const QUrl &source)
QStack<Private::Command> commands;
commands.push(Private::List);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = source;
job->d->mCommands = commands;
......@@ -332,7 +332,7 @@ SieveJob *SieveJob::del(const QUrl &url)
QStack<Private::Command> commands;
commands.push(Private::Delete);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = url;
job->d->mCommands = commands;
......@@ -344,7 +344,7 @@ SieveJob *SieveJob::deactivate(const QUrl &url)
{
QStack<Private::Command> commands;
commands.push(Private::Deactivate);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = url;
job->d->mCommands = commands;
......@@ -357,7 +357,7 @@ SieveJob *SieveJob::rename(const QUrl &url, const QString &newName)
QStack<Private::Command> commands;
commands.push(Private::Rename);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = url;
job->d->mNewName = newName;
job->d->mCommands = commands;
......@@ -371,7 +371,7 @@ SieveJob *SieveJob::check(const QUrl &url, const QString &script)
QStack<Private::Command> commands;
commands.push(Private::Check);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = url;
job->d->mScript = script;
job->d->mCommands = commands;
......@@ -385,7 +385,7 @@ SieveJob *SieveJob::activate(const QUrl &url)
QStack<Private::Command> commands;
commands.push(Private::Activate);
SieveJob *job = new SieveJob;
auto *job = new SieveJob;
job->d->mUrl = url;
job->d->mCommands = commands;
......
......@@ -25,7 +25,7 @@ AutoCreateScriptDialog::AutoCreateScriptDialog(QWidget *parent)
, mEditor(new SieveEditorGraphicalModeWidget(this))
{
setWindowTitle(i18nc("@title:window", "Create Sieve Filter"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
......@@ -87,7 +87,7 @@ bool AutoCreateScriptDialog::event(QEvent *e)
{
const bool shortCutOverride = (e->type() == QEvent::ShortcutOverride);
if (shortCutOverride || e->type() == QEvent::KeyPress) {
QKeyEvent *kev = static_cast<QKeyEvent * >(e);
auto *kev = static_cast<QKeyEvent * >(e);
if (kev->key() == Qt::Key_Escape) {
e->ignore();
return true;
......
......@@ -18,10 +18,10 @@ RegexpEditorLineEditTest::RegexpEditorLineEditTest(QObject *parent)
void RegexpEditorLineEditTest::shouldHaveDefaultValue()
{
KSieveUi::RegexpEditorLineEdit w;
QLineEdit *mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("lineedit"));
auto *mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("lineedit"));
QVERIFY(mLineEdit);
QHBoxLayout *mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainlayout"));
auto *mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainlayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0));
}
......
......@@ -29,25 +29,25 @@ void SelectHeadersDialogTest::shouldHaveDefaultValue()
KSieveUi::SelectHeadersDialog dlg;
QVERIFY(!dlg.windowTitle().isEmpty());
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
auto *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
QVBoxLayout *lay = dlg.findChild<QVBoxLayout *>(QStringLiteral("widgetlayout"));
auto *lay = dlg.findChild<QVBoxLayout *>(QStringLiteral("widgetlayout"));
QVERIFY(lay);
QCOMPARE(lay->contentsMargins(), QMargins(0, 0, 0, 0));
KSieveUi::SelectHeadersWidget *mListWidget = dlg.findChild<KSieveUi::SelectHeadersWidget *>(QStringLiteral("listwidget"));
auto *mListWidget = dlg.findChild<KSieveUi::SelectHeadersWidget *>(QStringLiteral("listwidget"));
QVERIFY(mListWidget);
QLabel *lab = dlg.findChild<QLabel *>(QStringLiteral("label"));
auto *lab = dlg.findChild<QLabel *>(QStringLiteral("label"));
QVERIFY(lab);
QVERIFY(!lab->text().isEmpty());
QLineEdit *mNewHeader = dlg.findChild<QLineEdit *>(QStringLiteral("newheader"));
auto *mNewHeader = dlg.findChild<QLineEdit *>(QStringLiteral("newheader"));
QVERIFY(mNewHeader);
QVERIFY(mNewHeader->isClearButtonEnabled());
QPushButton *mAddNewHeader = dlg.findChild<QPushButton *>(QStringLiteral("addnewheader"));
auto *mAddNewHeader = dlg.findChild<QPushButton *>(QStringLiteral("addnewheader"));
QVERIFY(mAddNewHeader);
QVERIFY(!mAddNewHeader->isEnabled());
}
......
......@@ -19,11 +19,11 @@ void SievePreviewGeneratedCodeWidgetTest::shouldHaveDefaultValues()
{
KSieveUi::SievePreviewGeneratedCodeWidget w;
QHBoxLayout *mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
auto *mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0));
QTextEdit *mTextEdit = w.findChild<QTextEdit *>(QStringLiteral("mTextEdit"));
auto *mTextEdit = w.findChild<QTextEdit *>(QStringLiteral("mTextEdit"));
QVERIFY(mTextEdit);
QVERIFY(mTextEdit->isReadOnly());
}
......@@ -17,10 +17,10 @@ SieveScriptListBoxTest::SieveScriptListBoxTest(QObject *parent)
void SieveScriptListBoxTest::shouldHaveDefaultValues()
{
KSieveUi::SieveScriptListBox lst(QStringLiteral("foo"));
QVBoxLayout *layout = lst.findChild<QVBoxLayout *>(QStringLiteral("layout"));
auto *layout = lst.findChild<QVBoxLayout *>(QStringLiteral("layout"));
QVERIFY(layout);
QListWidget *mSieveListScript = lst.findChild<QListWidget *>(QStringLiteral("mSieveListScript"));
auto *mSieveListScript = lst.findChild<QListWidget *>(QStringLiteral("mSieveListScript"));
QVERIFY(mSieveListScript);
QCOMPARE(mSieveListScript->dragDropMode(), QAbstractItemView::InternalMove);
}
......@@ -27,7 +27,7 @@ SieveHelpButton::~SieveHelpButton()
bool SieveHelpButton::event(QEvent *event)
{
if (event->type() == QEvent::WhatsThisClicked) {
QWhatsThisClickedEvent *clicked = static_cast<QWhatsThisClickedEvent *>(event);
auto *clicked = static_cast<QWhatsThisClickedEvent *>(event);
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl(clicked->href()));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
......
......@@ -21,10 +21,10 @@ SieveActionAbstractFlags::SieveActionAbstractFlags(SieveEditorGraphicalModeWidge
QWidget *SieveActionAbstractFlags::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
auto *lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
SelectFlagsWidget *flagsWidget = new SelectFlagsWidget;
auto *flagsWidget = new SelectFlagsWidget;
connect(flagsWidget, &SelectFlagsWidget::valueChanged, this, &SieveActionAbstractFlags::valueChanged);
flagsWidget->setObjectName(QStringLiteral("flagswidget"));
lay->addWidget(flagsWidget);
......@@ -36,10 +36,10 @@ void SieveActionAbstractFlags::setParamWidgetValue(QXmlStreamReader &element, QW
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("list")) {
SelectFlagsWidget *flagsWidget = w->findChild<SelectFlagsWidget *>(QStringLiteral("flagswidget"));
auto *flagsWidget = w->findChild<SelectFlagsWidget *>(QStringLiteral("flagswidget"));
flagsWidget->setFlags(AutoCreateScriptUtil::listValue(element));
} else if (tagName == QLatin1String("str")) {
SelectFlagsWidget *flagsWidget = w->findChild<SelectFlagsWidget *>(QStringLiteral("flagswidget"));
auto *flagsWidget = w->findChild<SelectFlagsWidget *>(QStringLiteral("flagswidget"));
flagsWidget->setFlags(QStringList() << element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
element.skipCurrentElement();
......
......@@ -26,11 +26,11 @@ SieveActionAddHeader::SieveActionAddHeader(SieveEditorGraphicalModeWidget *sieve
QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
auto *grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
SelectAddHeaderPositionCombobox *combo = new SelectAddHeaderPositionCombobox;
auto *combo = new SelectAddHeaderPositionCombobox;
combo->setObjectName(QStringLiteral("selectposition"));
connect(combo, &SelectAddHeaderPositionCombobox::valueChanged, this, &SieveActionAddHeader::valueChanged);
grid->addWidget(combo, 0, 0);
......@@ -38,7 +38,7 @@ QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
QLabel *lab = new QLabel(i18n("header:"));
grid->addWidget(lab, 0, 1);
QLineEdit *headerEdit = new QLineEdit;
auto *headerEdit = new QLineEdit;
connect(headerEdit, &QLineEdit::textChanged, this, &SieveActionAddHeader::valueChanged);
headerEdit->setObjectName(QStringLiteral("headeredit"));
grid->addWidget(headerEdit, 0, 2);
......@@ -46,7 +46,7 @@ QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
lab = new QLabel(i18n("value:"));
grid->addWidget(lab, 1, 1);
QLineEdit *valueEdit = new QLineEdit;
auto *valueEdit = new QLineEdit;
connect(valueEdit, &QLineEdit::textChanged, this, &SieveActionAddHeader::valueChanged);
valueEdit->setObjectName(QStringLiteral("valueedit"));
grid->addWidget(valueEdit, 1, 2);
......@@ -60,14 +60,14 @@ void SieveActionAddHeader::setParamWidgetValue(QXmlStreamReader &element, QWidge
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("tag")) {
SelectAddHeaderPositionCombobox *combo = w->findChild<SelectAddHeaderPositionCombobox *>(QStringLiteral("selectposition"));
auto *combo = w->findChild<SelectAddHeaderPositionCombobox *>(QStringLiteral("selectposition"));
combo->setCode(AutoCreateScriptUtil::tagValue(element.readElementText()), name(), error);
} else if (tagName == QLatin1String("str")) {
if (index == 0) {
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("headeredit"));
auto *edit = w->findChild<QLineEdit *>(QStringLiteral("headeredit"));
edit->setText(element.readElementText());
} else if (index == 1) {
QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("valueedit"));
auto *value = w->findChild<QLineEdit *>(QStringLiteral("valueedit"));
value->setText(AutoCreateScriptUtil::quoteStr(element.readElementText()));
} else {
tooManyArguments(tagName, index, 2, error);
......
......@@ -24,14 +24,14 @@ SieveActionBreak::SieveActionBreak(SieveEditorGraphicalModeWidget *sieveGraphica
QWidget *SieveActionBreak::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
auto *lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("Name (optional):"));
lay->addWidget(lab);
QLineEdit *subject = new QLineEdit;
auto *subject = new QLineEdit;
subject->setObjectName(QStringLiteral("name"));
connect(subject, &QLineEdit::textChanged, this, &SieveActionBreak::valueChanged);
lay->addWidget(subject);
......@@ -45,7 +45,7 @@ void SieveActionBreak::setParamWidgetValue(QXmlStreamReader &element, QWidget *w
if (tagName == QLatin1String("tag")) {
const QString tagValue = element.readElementText();
if (tagValue == QLatin1String("name")) {
QLineEdit *name = w->findChild<QLineEdit *>(QStringLiteral("name"));
auto *name = w->findChild<QLineEdit *>(QStringLiteral("name"));
name->setText(AutoCreateScriptUtil::strValue(element));
} else {
unknownTagValue(tagValue, error);
......
......@@ -24,14 +24,14 @@ SieveActionConvert::SieveActionConvert(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionConvert::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *lay = new QGridLayout;
auto *lay = new QGridLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("From:"));
lay->addWidget(lab, 0, 0);
SelectMimeTypeComboBox *fromMimeType = new SelectMimeTypeComboBox;
auto *fromMimeType = new SelectMimeTypeComboBox;
connect(fromMimeType, &SelectMimeTypeComboBox::valueChanged, this, &SieveActionConvert::valueChanged);
fromMimeType->setObjectName(QStringLiteral("from"));
lay->addWidget(fromMimeType, 0, 1);
......@@ -39,7 +39,7 @@ QWidget *SieveActionConvert::createParamWidget(QWidget *parent) const
lab = new QLabel(i18n("To:"));
lay->addWidget(lab, 0, 2);
SelectMimeTypeComboBox *toMimeType = new SelectMimeTypeComboBox;
auto *toMimeType = new SelectMimeTypeComboBox;
connect(toMimeType, &SelectMimeTypeComboBox::valueChanged, this, &SieveActionConvert::valueChanged);
toMimeType->setObjectName(QStringLiteral("to"));
lay->addWidget(toMimeType, 0, 3);
......@@ -47,7 +47,7 @@ QWidget *SieveActionConvert::createParamWidget(QWidget *parent) const
lab = new QLabel(i18n("Parameters:"));
lay->addWidget(lab, 1, 0);
SelectConvertParameterWidget *params = new SelectConvertParameterWidget;
auto *params = new SelectConvertParameterWidget;
connect(params, &SelectConvertParameterWidget::valueChanged, this, &SieveActionConvert::valueChanged);
params->setObjectName(QStringLiteral("params"));
lay->addWidget(params, 1, 1, 2, 3);
......@@ -62,10 +62,10 @@ void SieveActionConvert::setParamWidgetValue(QXmlStreamReader &element, QWidget
const QStringRef tagName = element.name();
if (tagName == QLatin1String("str")) {
if (index == 0) {
SelectMimeTypeComboBox *fromMimeType = w->findChild<SelectMimeTypeComboBox *>(QStringLiteral("from"));
auto *fromMimeType = w->findChild<SelectMimeTypeComboBox *>(QStringLiteral("from"));
fromMimeType->setCode(element.readElementText(), name(), error);
} else if (index == 1) {
SelectMimeTypeComboBox *toMimeType = w->findChild<SelectMimeTypeComboBox *>(QStringLiteral("to"));
auto *toMimeType = w->findChild<SelectMimeTypeComboBox *>(QStringLiteral("to"));
toMimeType->setCode(element.readElementText(), name(), error);
} else {
tooManyArguments(tagName, index, 2, error);
......@@ -73,7 +73,7 @@ void SieveActionConvert::setParamWidgetValue(QXmlStreamReader &element, QWidget
}
++index;
} else if (tagName == QLatin1String("list")) {
SelectConvertParameterWidget *params = w->findChild<SelectConvertParameterWidget *>(QStringLiteral("params"));
auto *params = w->findChild<SelectConvertParameterWidget *>(QStringLiteral("params"));
params->setCode(AutoCreateScriptUtil::listValue(element), error);
} else if (tagName == QLatin1String("crlf")) {
element.skipCurrentElement();
......
......@@ -27,11 +27,11 @@ SieveActionDeleteHeader::SieveActionDeleteHeader(SieveEditorGraphicalModeWidget
QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
auto *grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
SelectMatchTypeComboBox *matchType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
auto *matchType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
matchType->setObjectName(QStringLiteral("matchtype"));
connect(matchType, &SelectMatchTypeComboBox::valueChanged, this, &SieveActionDeleteHeader::valueChanged);
grid->addWidget(matchType, 0, 0);
......@@ -39,7 +39,7 @@ QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
QLabel *lab = new QLabel(i18n("header:"));
grid->addWidget(lab, 0, 1);
QLineEdit *headerEdit = new QLineEdit;
auto *headerEdit = new QLineEdit;
headerEdit->setObjectName(QStringLiteral("headeredit"));
connect(headerEdit, &QLineEdit::textChanged, this, &SieveActionDeleteHeader::valueChanged);
grid->addWidget(headerEdit, 0, 2);
......@@ -47,7 +47,7 @@ QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
lab = new QLabel(i18n("value:"));
grid->addWidget(lab, 1, 1);
QLineEdit *valueEdit = new QLineEdit;
auto *valueEdit = new QLineEdit;
valueEdit->setObjectName(QStringLiteral("valueedit"));
connect(valueEdit, &QLineEdit::textChanged, this, &SieveActionDeleteHeader::valueChanged);
grid->addWidget(valueEdit, 1, 2);
......@@ -69,14 +69,14 @@ void SieveActionDeleteHeader::parseValue(QXmlStreamReader &element, QWidget *w,
element.skipCurrentElement();
return;
} else if (tagName == QLatin1String("tag")) {
SelectMatchTypeComboBox *combo = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
auto *combo = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
combo->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), isNegative), name(), error);
} else if (tagName == QLatin1String("str")) {
if (index == 0) {
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("headeredit"));
auto *edit = w->findChild<QLineEdit *>(QStringLiteral("headeredit"));
edit->setText(element.readElementText());
} else if (index == 1) {
QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("valueedit"));
auto *value = w->findChild<QLineEdit *>(QStringLiteral("valueedit"));
value->setText(element.readElementText());
} else {
tooManyArguments(tagName, index, 2, error);
......
......@@ -25,14 +25,14 @@ SieveActionEnclose::SieveActionEnclose(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionEnclose::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
auto *grid = new QGridLayout;
grid->setContentsMargins({});
w->setLayout(grid);
QLabel *lab = new QLabel(i18n("Subject:"));
grid->addWidget(lab, 0, 0);
QLineEdit *subject = new QLineEdit;
auto *subject = new QLineEdit;
subject->setObjectName(QStringLiteral("subject"));
connect(subject, &QLineEdit::textChanged, this, &SieveActionEnclose::valueChanged);
grid->addWidget(subject, 0, 1);
......@@ -40,7 +40,7 @@ QWidget *SieveActionEnclose::createParamWidget(QWidget *parent) const
lab = new QLabel(i18n("headers:"));
grid->addWidget(lab, 1, 0);
QLineEdit *headers = new QLineEdit;
auto *headers = new QLineEdit;
headers->setObjectName(QStringLiteral("headers"));
connect(headers, &QLineEdit::textChanged, this, &SieveActionEnclose::valueChanged);
grid->addWidget(headers, 1, 1);
......@@ -48,7 +48,7 @@ QWidget *SieveActionEnclose::createParamWidget(QWidget *parent) const
lab = new QLabel(i18n("text:"));
grid->addWidget(lab, 2, 0);
MultiLineEdit *text = new MultiLineEdit;
auto *text = new MultiLineEdit;
text->setObjectName(QStringLiteral("text"));
connect(text, &MultiLineEdit::valueChanged, this, &SieveActionEnclose::valueChanged);
grid->addWidget(text, 2, 1);
......@@ -65,13 +65,13 @@ void SieveActionEnclose::setParamWidgetValue(QXmlStreamReader &element, QWidget
if (tagValue == QLatin1String("headers")) {
const QString strValue = AutoCreateScriptUtil::strValue(element);
if (!strValue.isEmpty()) {
QLineEdit *subject = w->findChild<QLineEdit *>(QStringLiteral("headers"));
auto *subject = w->findChild<QLineEdit *>(QStringLiteral("headers"));
subject->setText(strValue);
}
} else if (tagValue == QLatin1String("subject")) {
const QString strValue = AutoCreateScriptUtil::strValue(element);
if (!strValue.isEmpty()) {
QLineEdit *headers = w->findChild<QLineEdit *>(QStringLiteral("subject"));
auto *headers = w->findChild<QLineEdit *>(QStringLiteral("subject"));
headers->setText(strValue);
}
} else {
......@@ -79,7 +79,7 @@ void SieveActionEnclose::setParamWidgetValue(QXmlStreamReader &element, QWidget
qCDebug(LIBKSIEVE_LOG) << " SieveActionEnclose::setParamWidgetValue unknown tag value:" << tagValue;
}
} else if (tagName == QLatin1String("str")) {
MultiLineEdit *edit = w->findChild<MultiLineEdit *>(QStringLiteral("text"));
auto *edit = w->findChild<MultiLineEdit *>(QStringLiteral("text"));
edit->setPlainText(element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
element.skipCurrentElement();
......
......@@ -24,13 +24,13 @@ SieveActionEReject::SieveActionEReject(SieveEditorGraphicalModeWidget *sieveGrap
QWidget *SieveActionEReject::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QHBoxLayout *lay = new QHBoxLayout;
auto *lay = new QHBoxLayout;
lay->setContentsMargins({});
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("text:"));
lay->addWidget(lab);
MultiLineEdit *edit = new MultiLineEdit;
auto *edit = new MultiLineEdit;
connect(edit, &MultiLineEdit::textChanged, this, &SieveActionEReject::valueChanged);
edit->setObjectName(QStringLiteral("rejectmessage"));
lay->addWidget(edit);
......@@ -43,7 +43,7 @@ void SieveActionEReject::setParamWidgetValue(QXmlStreamReader &element, QWidget
const QStringRef tagName = element.name();
if (tagName == QLatin1String("str")) {
const QString tagValue = element.readElementText();
MultiLineEdit *edit = w->findChild<MultiLineEdit *>(QStringLiteral("rejectmessage"));
auto *edit = w->findChild<MultiLineEdit *>(QStringLiteral("rejectmessage"));
edit->setPlainText(tagValue);
} else if (tagName == QLatin1String("crlf")) {