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

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,
......
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