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

Modernize code

parent 514469e2
Pipeline #39255 passed with stage
in 13 minutes and 14 seconds
......@@ -35,7 +35,7 @@ void EditorUtilTest::testUpperCase()
QFETCH(QString, result);
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
QTextDocument *document = new QTextDocument(this);
auto *document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......@@ -65,7 +65,7 @@ void EditorUtilTest::testLowerCase()
QFETCH(QString, result);
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
QTextDocument *document = new QTextDocument(this);
auto *document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......@@ -95,7 +95,7 @@ void EditorUtilTest::testSentenceCase()
QFETCH(QString, result);
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
QTextDocument *document = new QTextDocument(this);
auto *document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......@@ -127,7 +127,7 @@ void EditorUtilTest::testReverseCase()
QFETCH(int, startcursorposition);
QFETCH(int, endcursorposition);
QTextDocument *document = new QTextDocument(this);
auto *document = new QTextDocument(this);
document->setPlainText(input);
QTextCursor textCursor(document);
if (startcursorposition != -1 && endcursorposition != -1) {
......
......@@ -27,7 +27,7 @@ struct TestWindow : public QWidget {
createContent();
mMainWidget = new QTextEdit();
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mMainWidget);
......
......@@ -21,7 +21,7 @@ RichTextComposerWidgetTest::~RichTextComposerWidgetTest()
void RichTextComposerWidgetTest::shouldHaveDefaultValue()
{
KPIMTextEdit::RichTextComposerWidget w;
KPIMTextEdit::RichTextComposer *composer = w.findChild<KPIMTextEdit::RichTextComposer *>(QStringLiteral("richtextcomposer"));
auto *composer = w.findChild<KPIMTextEdit::RichTextComposer *>(QStringLiteral("richtextcomposer"));
QVERIFY(composer);
QVERIFY(w.richTextComposer());
}
......
......@@ -25,9 +25,9 @@ KLinkDialog::KLinkDialog(QWidget *parent)
setWindowTitle(i18nc("@title:window", "Manage Link"));
setModal(true);
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
QGridLayout *grid = new QGridLayout;
auto *grid = new QGridLayout;
textLabel = new QLabel(i18n("Link Text:"), this);
textLineEdit = new QLineEdit(this);
......
......@@ -272,7 +272,7 @@ void NestedListHelper::handleOnBulletType(int styleIndex)
{
QTextCursor cursor = textEdit->textCursor();
if (styleIndex != 0) {
QTextListFormat::Style style = static_cast<QTextListFormat::Style>(styleIndex);
auto style = static_cast<QTextListFormat::Style>(styleIndex);
QTextList *currentList = cursor.currentList();
QTextListFormat listFmt;
......
......@@ -118,7 +118,7 @@ void RichTextComposer::createActions(KActionCollection *ac)
void RichTextComposer::updateHighLighter()
{
KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *hlighter = qobject_cast<KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *>(highlighter());
auto *hlighter = qobject_cast<KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *>(highlighter());
if (hlighter) {
hlighter->toggleSpellHighlighting(checkSpellingEnabled());
}
......@@ -243,9 +243,9 @@ void RichTextComposer::forcePlainTextMarkup(bool force)
void RichTextComposer::insertPlainTextImplementation()
{
if (d->forcePlainTextMarkup) {
KPIMTextEdit::PlainTextMarkupBuilder *pb = new KPIMTextEdit::PlainTextMarkupBuilder();
auto *pb = new KPIMTextEdit::PlainTextMarkupBuilder();
pb->setQuotePrefix(defaultQuoteSign());
KPIMTextEdit::MarkupDirector *pmd = new KPIMTextEdit::MarkupDirector(pb);
auto *pmd = new KPIMTextEdit::MarkupDirector(pb);
pmd->processDocument(document());
const QString plainText = pb->getResult();
document()->setPlainText(plainText);
......
......@@ -145,7 +145,7 @@ void RichTextComposerActions::createActions(KActionCollection *ac)
ac->addAction(QStringLiteral("format_align_justify"), d->action_align_justify);
}
QActionGroup *alignmentGroup = new QActionGroup(this);
auto *alignmentGroup = new QActionGroup(this);
alignmentGroup->addAction(d->action_align_left);
alignmentGroup->addAction(d->action_align_center);
alignmentGroup->addAction(d->action_align_right);
......@@ -174,7 +174,7 @@ void RichTextComposerActions::createActions(KActionCollection *ac)
ac->addAction(QStringLiteral("direction_rtl"), d->action_direction_rtl);
}
QActionGroup *directionGroup = new QActionGroup(this);
auto *directionGroup = new QActionGroup(this);
directionGroup->addAction(d->action_direction_ltr);
directionGroup->addAction(d->action_direction_rtl);
......
......@@ -25,11 +25,11 @@ RichTextComposerWidget::RichTextComposerWidget(QWidget *parent)
: QWidget(parent)
, d(new KPIMTextEdit::RichTextComposerWidgetPrivate)
{
QHBoxLayout *layout = new QHBoxLayout(this);
auto *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
d->richTextComposer = new KPIMTextEdit::RichTextComposer(this);
d->richTextComposer->setObjectName(QStringLiteral("richtextcomposer"));
RichTextEditorWidget *editorWidget = new RichTextEditorWidget(d->richTextComposer, this);
auto *editorWidget = new RichTextEditorWidget(d->richTextComposer, this);
layout->addWidget(editorWidget);
}
......
......@@ -23,10 +23,10 @@ int main(int argc, char **argv)
parser.addVersionOption();
parser.addHelpOption();
parser.process(app);
KPIMTextEdit::RichTextComposer *richtextcomposerwidget = new KPIMTextEdit::RichTextComposer;
auto *richtextcomposerwidget = new KPIMTextEdit::RichTextComposer;
KActionCollection *ac = new KActionCollection(richtextcomposerwidget);
richtextcomposerwidget->createActions(ac);
KPIMTextEdit::RichTextEditorWidget *editor = new KPIMTextEdit::RichTextEditorWidget(richtextcomposerwidget);
auto *editor = new KPIMTextEdit::RichTextEditorWidget(richtextcomposerwidget);
editor->resize(800, 600);
editor->show();
......
......@@ -68,7 +68,7 @@ void EmoticonListWidgetSelector::slotEmoticonClicked(QListWidgetItem *item)
if (!item) {
return;
}
EmoticonTextEditItem *itemEmoticon = static_cast<EmoticonTextEditItem *>(item);
auto *itemEmoticon = static_cast<EmoticonTextEditItem *>(item);
Q_EMIT itemSelected(itemEmoticon->text());
}
......@@ -22,7 +22,7 @@ public:
: emoticonMenu(new QMenu())
{
selector = new EmoticonTextEditSelector(emoticonMenu);
QWidgetAction *action = new QWidgetAction(emoticonMenu);
auto *action = new QWidgetAction(emoticonMenu);
action->setDefaultWidget(selector);
emoticonMenu->addAction(action);
connect(emoticonMenu, &QMenu::aboutToShow, selector, &EmoticonTextEditSelector::loadEmoticons);
......
......@@ -16,7 +16,7 @@ using namespace KPIMTextEdit;
EmoticonTextEditSelector::EmoticonTextEditSelector(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *lay = new QHBoxLayout(this);
auto *lay = new QHBoxLayout(this);
lay->setSpacing(0);
lay->setContentsMargins(0, 0, 0, 0);
mUnicodeTab = new EmoticonUnicodeTab(this);
......
......@@ -65,7 +65,7 @@ void EmoticonUnicodeTab::loadEmoticons()
void EmoticonUnicodeTab::createPlainTextEmoticonTab(const QString &str, const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticons)
{
if (!emoticons.isEmpty()) {
EmoticonListWidgetSelector *selector = new EmoticonListWidgetSelector(this);
auto *selector = new EmoticonListWidgetSelector(this);
connect(selector, &KPIMTextEdit::EmoticonListWidgetSelector::itemSelected, this, &EmoticonUnicodeTab::itemSelected);
QStringList lst;
lst.reserve(emoticons.count());
......
......@@ -24,12 +24,12 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Insert HTML"));
QVBoxLayout *lay = new QVBoxLayout(q);
auto *lay = new QVBoxLayout(q);
QLabel *label = new QLabel(i18n("Insert HTML tags and texts:"));
lay->addWidget(label);
editor = new InsertHtmlEditor;
editor->setSpellCheckingSupport(false);
KPIMTextEdit::PlainTextEditorWidget *editorWidget = new KPIMTextEdit::PlainTextEditorWidget(editor);
auto *editorWidget = new KPIMTextEdit::PlainTextEditorWidget(editor);
lay->addWidget(editorWidget);
label = new QLabel(i18n("Example: <i> Hello word </i>"));
QFont font = label->font();
......
......@@ -27,7 +27,7 @@ InsertHtmlEditor::InsertHtmlEditor(QWidget *parent)
qCWarning(KPIMTEXTEDIT_LOG) << "Invalid definition name";
}
KSyntaxHighlighting::SyntaxHighlighter *hl = new KSyntaxHighlighting::SyntaxHighlighter(document());
auto *hl = new KSyntaxHighlighting::SyntaxHighlighter(document());
hl->setTheme((palette().color(QPalette::Base).lightness() < 128)
? mRepo.defaultTheme(KSyntaxHighlighting::Repository::DarkTheme)
: mRepo.defaultTheme(KSyntaxHighlighting::Repository::LightTheme));
......
......@@ -22,7 +22,7 @@ public:
InsertImageDialogPrivate(InsertImageDialog *qq)
: q(qq)
{
QVBoxLayout *vbox = new QVBoxLayout(q);
auto *vbox = new QVBoxLayout(q);
q->setWindowTitle(i18nc("@title:window", "Insert Image"));
imageWidget = new InsertImageWidget(q);
......
......@@ -33,9 +33,9 @@ public:
InsertImageWidgetPrivate(InsertImageWidget *qq)
: q(qq)
{
QVBoxLayout *lay = new QVBoxLayout(q);
auto *lay = new QVBoxLayout(q);
lay->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
QLabel *lab = new QLabel(i18n("Image Location:"));
imageUrlRequester = new KUrlRequester;
......
......@@ -24,7 +24,7 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Insert Table"));
QVBoxLayout *mainLayout = new QVBoxLayout(q);
auto *mainLayout = new QVBoxLayout(q);
insertTableWidget = new InsertTableWidget(q);
mainLayout->addWidget(insertTableWidget);
......
......@@ -35,7 +35,7 @@ public:
mBorder->setValue(1);
mBorder->setSuffix(i18n(" px"));
QGridLayout *gridLayout = new QGridLayout;
auto *gridLayout = new QGridLayout;
gridLayout->setContentsMargins(0, 0, 0, 0);
gridLayout->addWidget(new QLabel(i18n("Rows:")), 0, 0);
gridLayout->addWidget(mRows, 0, 1);
......
......@@ -22,7 +22,7 @@ public:
{
q->setWindowTitle(i18nc("@title:window", "Select Special Characters"));
QVBoxLayout *lay = new QVBoxLayout(q);
auto *lay = new QVBoxLayout(q);
mCharSelect = new KCharSelect(q, nullptr, KCharSelect::CharacterTable | KCharSelect::BlockCombos);
q->connect(mCharSelect, &KCharSelect::charSelected,
......
......@@ -26,10 +26,10 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Cell Format"));
QVBoxLayout *mainLayout = new QVBoxLayout;
auto *mainLayout = new QVBoxLayout;
q->setLayout(mainLayout);
QHBoxLayout *hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
QLabel *lab = new QLabel(i18n("Vertical Alignment:"));
hbox->addWidget(lab);
verticalAlignment = new QComboBox;
......
......@@ -29,10 +29,10 @@ public:
: q(qq)
{
q->setWindowTitle(i18nc("@title:window", "Table Format"));
QVBoxLayout *mainLayout = new QVBoxLayout(q);
auto *mainLayout = new QVBoxLayout(q);
QWidget *page = new QWidget(q);
QVBoxLayout *lay = new QVBoxLayout(page);
auto *lay = new QVBoxLayout(page);
lay->setContentsMargins(0, 0, 0, 0);
tableWidget = new InsertTableWidget;
lay->addWidget(tableWidget);
......@@ -40,7 +40,7 @@ public:
KSeparator *sep = new KSeparator;
lay->addWidget(sep);
QHBoxLayout *hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
QLabel *lab = new QLabel(i18n("Spacing:"));
hbox->addWidget(lab);
spacing = new QSpinBox;
......
......@@ -24,12 +24,12 @@ void TextGoToLineWidgetTest::shouldHaveDefaultValuesOnCreation()
KPIMTextEdit::TextGoToLineWidget edit;
edit.show();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
auto *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
QVERIFY(line);
QCOMPARE(line->minimum(), 1);
QPushButton *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
auto *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
QVERIFY(gotolinebutton);
QToolButton *closebutton = edit.findChild<QToolButton *>(QStringLiteral("closebutton"));
auto *closebutton = edit.findChild<QToolButton *>(QStringLiteral("closebutton"));
QVERIFY(closebutton);
QVERIFY(line->hasFocus());
}
......@@ -37,7 +37,7 @@ void TextGoToLineWidgetTest::shouldHaveDefaultValuesOnCreation()
void TextGoToLineWidgetTest::shouldEmitGoToLineSignalWhenPressOnButton()
{
KPIMTextEdit::TextGoToLineWidget edit;
QPushButton *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
auto *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
QSignalSpy spy(&edit, &KPIMTextEdit::TextGoToLineWidget::moveToLine);
QTest::mouseClick(gotolinebutton, Qt::LeftButton);
QCOMPARE(spy.count(), 1);
......@@ -46,8 +46,8 @@ void TextGoToLineWidgetTest::shouldEmitGoToLineSignalWhenPressOnButton()
void TextGoToLineWidgetTest::shouldEmitGoToLineSignalCorrectValueWhenPressOnButton()
{
KPIMTextEdit::TextGoToLineWidget edit;
QPushButton *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
auto *gotolinebutton = edit.findChild<QPushButton *>(QStringLiteral("gotoline"));
auto *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
line->setValue(5);
QCOMPARE(line->value(), 5);
QSignalSpy spy(&edit, &KPIMTextEdit::TextGoToLineWidget::moveToLine);
......@@ -62,7 +62,7 @@ void TextGoToLineWidgetTest::shouldHideWidgetWhenClickOnCloseButton()
edit.show();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
QVERIFY(edit.isVisible());
QToolButton *closebutton = edit.findChild<QToolButton *>(QStringLiteral("closebutton"));
auto *closebutton = edit.findChild<QToolButton *>(QStringLiteral("closebutton"));
QTest::mouseClick(closebutton, Qt::LeftButton);
QVERIFY(!edit.isVisible());
}
......@@ -81,7 +81,7 @@ void TextGoToLineWidgetTest::shouldEmitGoToLineSignalWhenSpinboxHasFocusAndWePre
KPIMTextEdit::TextGoToLineWidget edit;
edit.show();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
auto *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
line->setFocus();
QVERIFY(line->hasFocus());
line->setValue(5);
......@@ -96,7 +96,7 @@ void TextGoToLineWidgetTest::shouldHasFocusEachTimeThatItShown()
KPIMTextEdit::TextGoToLineWidget edit;
edit.show();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
auto *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
QVERIFY(line);
QVERIFY(line->hasFocus());
edit.hide();
......@@ -111,7 +111,7 @@ void TextGoToLineWidgetTest::shouldSetFocusWhenWeRecallGotToLine()
KPIMTextEdit::TextGoToLineWidget edit;
edit.show();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
auto *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
QVERIFY(line->hasFocus());
edit.setFocus();
QVERIFY(!line->hasFocus());
......@@ -124,7 +124,7 @@ void TextGoToLineWidgetTest::shouldChangeMaximumValue()
KPIMTextEdit::TextGoToLineWidget edit;
edit.show();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
QSpinBox *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
auto *line = edit.findChild<QSpinBox *>(QStringLiteral("line"));
QCOMPARE(line->value(), 1);
QCOMPARE(line->minimum(), 1);
......
......@@ -23,11 +23,11 @@ using namespace KPIMTextEdit;
TextEditFindBarBase::TextEditFindBarBase(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
QHBoxLayout *lay = new QHBoxLayout;
auto *topLayout = new QVBoxLayout(this);
auto *lay = new QHBoxLayout;
topLayout->addLayout(lay);
QToolButton *closeBtn = new QToolButton(this);
auto *closeBtn = new QToolButton(this);
closeBtn->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
closeBtn->setIconSize(QSize(16, 16));
closeBtn->setToolTip(i18n("Close"));
......@@ -221,7 +221,7 @@ bool TextEditFindBarBase::event(QEvent *e)
// With a shortcut override we can catch this before it gets to kactions.
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) {
if (shortCutOverride) {
e->accept();
......
......@@ -21,7 +21,7 @@ using namespace KPIMTextEdit;
TextReplaceWidget::TextReplaceWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *lay = new QHBoxLayout(this);
auto *lay = new QHBoxLayout(this);
QLabel *label = new QLabel(i18nc("Replace text", "Replace:"), this);
lay->addWidget(label);
const int marg1 = lay->contentsMargins().left();
......@@ -59,7 +59,7 @@ void TextReplaceWidget::slotSearchStringEmpty(bool isEmpty)
TextFindWidget::TextFindWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *lay = new QHBoxLayout(this);
auto *lay = new QHBoxLayout(this);
const int marg1 = lay->contentsMargins().left();
const int marg2 = lay->contentsMargins().right();
lay->setContentsMargins(marg1, 0, marg2, 0);
......@@ -82,10 +82,10 @@ TextFindWidget::TextFindWidget(QWidget *parent)
lay->addWidget(mFindPrevBtn);
mFindPrevBtn->setEnabled(false);
QPushButton *optionsBtn = new QPushButton(this);
auto *optionsBtn = new QPushButton(this);
optionsBtn->setText(i18n("Options"));
optionsBtn->setToolTip(i18n("Modify search behavior"));
QMenu *optionsMenu = new QMenu(optionsBtn);
auto *optionsMenu = new QMenu(optionsBtn);
mCaseSensitiveAct = optionsMenu->addAction(i18n("Case sensitive"));
mCaseSensitiveAct->setCheckable(true);
......
......@@ -33,9 +33,9 @@ TextGoToLineWidget::TextGoToLineWidget(QWidget *parent)
: QWidget(parent)
, d(new KPIMTextEdit::TextGoToLineWidgetPrivate)
{
QHBoxLayout *hbox = new QHBoxLayout(this);
auto *hbox = new QHBoxLayout(this);
hbox->setContentsMargins(2, 2, 2, 2);
QToolButton *closeBtn = new QToolButton(this);
auto *closeBtn = new QToolButton(this);
closeBtn->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
closeBtn->setIconSize(QSize(16, 16));
closeBtn->setToolTip(i18n("Close"));
......@@ -119,7 +119,7 @@ bool TextGoToLineWidget::event(QEvent *e)
// With a shortcut override we can catch this before it gets to kactions.
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->accept();
slotCloseBar();
......
......@@ -136,7 +136,7 @@ bool TextMessageIndicator::eventFilter(QObject *obj, QEvent *event)
/* if the parent object (scroll area) resizes, the message should
resize as well */
if (event->type() == QEvent::Resize) {
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
auto *resizeEvent = static_cast<QResizeEvent *>(event);
if (resizeEvent->oldSize() != resizeEvent->size()) {
computeSizeAndResize();
}
......
......@@ -157,7 +157,7 @@ void PlainTextEditor::contextMenuEvent(QContextMenuEvent *event)
if (checkSpellingEnabled() && d->activateLanguageMenu) {
QMenu *languagesMenu = new QMenu(i18n("Spell Checking Language"), popup);
QActionGroup *languagesGroup = new QActionGroup(languagesMenu);
auto *languagesGroup = new QActionGroup(languagesMenu);
languagesGroup->setExclusive(true);
QString defaultSpellcheckingLanguage = spellCheckingLanguage();
......@@ -328,7 +328,7 @@ void PlainTextEditor::slotCheckSpelling()
slotDisplayMessageIndicator(i18n("Nothing to spell check."));
return;
}
Sonnet::BackgroundChecker *backgroundSpellCheck = new Sonnet::BackgroundChecker;
auto *backgroundSpellCheck = new Sonnet::BackgroundChecker;
if (backgroundSpellCheck->speller().availableBackends().isEmpty()) {
slotDisplayMessageIndicator(i18n("No backend available for spell checking."));
delete backgroundSpellCheck;
......@@ -342,7 +342,7 @@ void PlainTextEditor::slotCheckSpelling()
backgroundSpellCheck->speller().addToSession(word);
}
}
Sonnet::Dialog *spellDialog = new Sonnet::Dialog(backgroundSpellCheck, nullptr);
auto *spellDialog = new Sonnet::Dialog(backgroundSpellCheck, nullptr);
backgroundSpellCheck->setParent(spellDialog);
spellDialog->setAttribute(Qt::WA_DeleteOnClose, true);
connect(spellDialog, &Sonnet::Dialog::replace, this, &PlainTextEditor::slotSpellCheckerCorrected);
......@@ -422,7 +422,7 @@ void PlainTextEditor::deleteWordForward()
bool PlainTextEditor::event(QEvent *ev)
{
if (ev->type() == QEvent::ShortcutOverride) {
QKeyEvent *e = static_cast<QKeyEvent *>(ev);
auto *e = static_cast<QKeyEvent *>(ev);
if (overrideShortcut(e)) {
e->accept();
return true;
......@@ -846,7 +846,7 @@ QString PlainTextEditor::spellCheckingConfigFileName() const
void PlainTextEditor::slotLanguageSelected()
{
QAction *languageAction = static_cast<QAction *>(QObject::sender());
auto *languageAction = static_cast<QAction *>(QObject::sender());
setSpellCheckingLanguage(languageAction->data().toString());
}
......
......@@ -78,7 +78,7 @@ QString PlainTextEditorWidget::toPlainText() const
void PlainTextEditorWidget::init(PlainTextEditor *customEditor)
{
QVBoxLayout *lay = new QVBoxLayout(this);
auto *lay = new QVBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
d->mTextToSpeechWidget = new KPIMTextEdit::TextToSpeechWidget(this);
lay->addWidget(d->mTextToSpeechWidget);
......
......@@ -19,7 +19,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
KPIMTextEdit::PlainTextEditorWidget *w = new KPIMTextEdit::PlainTextEditorWidget();
auto *w = new KPIMTextEdit::PlainTextEditorWidget();
w->resize(800, 600);
w->show();
app.exec();
......
......@@ -217,7 +217,7 @@ QMenu *RichTextEditor::mousePopupMenu(QPoint pos)
if (checkSpellingEnabled() && d->activateLanguageMenu) {
QMenu *languagesMenu = new QMenu(i18n("Spell Checking Language"), popup);
QActionGroup *languagesGroup = new QActionGroup(languagesMenu);
auto *languagesGroup = new QActionGroup(languagesMenu);
languagesGroup->setExclusive(true);
QString defaultSpellcheckingLanguage = spellCheckingLanguage();
......@@ -434,7 +434,7 @@ void RichTextEditor::checkSpelling(bool force)
}
return;
}
Sonnet::BackgroundChecker *backgroundSpellCheck = new Sonnet::BackgroundChecker;
auto *backgroundSpellCheck = new Sonnet::BackgroundChecker;
if (backgroundSpellCheck->speller().availableBackends().isEmpty()) {
if (force) {
if (KMessageBox::Yes == KMessageBox::questionYesNo(this, i18n("No backend available for spell checking. Do you want to send the email anyways?"))) {
......@@ -454,8 +454,8 @@ void RichTextEditor::checkSpelling(bool force)
backgroundSpellCheck->speller().addToSession(word);
}
}
Sonnet::Dialog *spellDialog = new Sonnet::Dialog(backgroundSpellCheck, force ? this : nullptr);
QDialogButtonBox *buttonBox = spellDialog->findChild<QDialogButtonBox *>();
auto *spellDialog = new Sonnet::Dialog(backgroundSpellCheck, force ? this : nullptr);
auto *buttonBox = spellDialog->findChild<QDialogButtonBox *>();
if (buttonBox) {
QPushButton *skipButton = new QPushButton(i18n("Skip"));
buttonBox->addButton(skipButton, QDialogButtonBox::ActionRole);
......@@ -684,7 +684,7 @@ void RichTextEditor::slotToggleAutoSpellCheck()
void RichTextEditor::slotLanguageSelected()
{
QAction *languageAction = static_cast<QAction *>(QObject::sender());
auto *languageAction = static_cast<QAction *>(QObject::sender());
setSpellCheckingLanguage(languageAction->data().toString());
}