Commit 0091f6ea authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 47a70b17
Pipeline #39286 passed with stage
in 15 minutes and 26 seconds
......@@ -112,7 +112,7 @@ AutoCorrectionWidget::AutoCorrectionWidget(QWidget *parent)
slotEnableDisableAbreviationList();
slotEnableDisableTwoUpperEntry();
QMenu *menu = new QMenu(this);
auto *menu = new QMenu(this);
d->ui->importAutoCorrection->setMenu(menu);
QAction *act = new QAction(i18n("LibreOffice Autocorrection"), this);
......@@ -547,7 +547,7 @@ void AutoCorrectionWidget::slotEnableDisableTwoUpperEntry()
void AutoCorrectionWidget::slotImportAutoCorrection(QAction *act)
{
if (act) {
AutoCorrectionWidget::ImportFileType type = act->data().value<AutoCorrectionWidget::ImportFileType>();
auto type = act->data().value<AutoCorrectionWidget::ImportFileType>();
QString title;
QString filter;
switch (type) {
......
......@@ -91,7 +91,7 @@ bool ImportLibreOfficeAutocorrection::importFile(Type type, const KArchiveDirect
}
documentList = archiveDirectory->entry(archiveFileName);
if (documentList && documentList->isFile()) {
const KArchiveFile *archiveFile = static_cast<const KArchiveFile *>(documentList);
const auto *archiveFile = static_cast<const KArchiveFile *>(documentList);
archiveFile->copyTo(mTempDir->path());
QFile file(mTempDir->path() + QLatin1Char('/') + archiveFileName);
QDomDocument doc;
......
......@@ -26,7 +26,7 @@ ConfigureTestDialog::ConfigureTestDialog(PimCommon::AutoCorrection *autoCorrecti
: QDialog(parent)
{
setWindowTitle(QStringLiteral("Configure Autocorrection"));
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);
......@@ -92,8 +92,8 @@ AutocorrectionTestWidget::AutocorrectionTestWidget(QWidget *parent)
PimCommon::PimCommonSettings::self()->load();
mAutoCorrection = new PimCommon::AutoCorrection;
QVBoxLayout *lay = new QVBoxLayout(this);
QToolBar *bar = new QToolBar;
auto *lay = new QVBoxLayout(this);
auto *bar = new QToolBar;
lay->addWidget(bar);
bar->addAction(QStringLiteral("Configure..."), this, &AutocorrectionTestWidget::slotConfigure);
QAction *richText = new QAction(QStringLiteral("HTML mode"), this);
......@@ -138,7 +138,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
AutocorrectionTestWidget *w = new AutocorrectionTestWidget();
auto *w = new AutocorrectionTestWidget();
w->resize(800, 600);
w->show();
......
......@@ -21,7 +21,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
PimCommon::RichTextEditWithAutoCorrection *w = new PimCommon::RichTextEditWithAutoCorrection;
auto *w = new PimCommon::RichTextEditWithAutoCorrection;
w->show();
app.exec();
......
......@@ -23,11 +23,11 @@ void ConfigurePluginsListWidgetTest::shouldHaveDefaultValue()
{
PimCommon::ConfigurePluginsListWidget w;
QVBoxLayout *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
auto *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0));
QTreeWidget *mListWidget = w.findChild<QTreeWidget *>(QStringLiteral("listwidget"));
auto *mListWidget = w.findChild<QTreeWidget *>(QStringLiteral("listwidget"));
QVERIFY(mListWidget);
QVERIFY(mListWidget->isSortingEnabled());
}
......
......@@ -27,19 +27,19 @@ void ConfigurePluginsWidgetTest::shouldHaveDefaultValue()
{
PimCommon::ConfigurePluginsWidget w;
KMessageWidget *mMessageWidget = w.findChild<KMessageWidget *>(QStringLiteral("mMessageWidget"));
auto *mMessageWidget = w.findChild<KMessageWidget *>(QStringLiteral("mMessageWidget"));
QVERIFY(mMessageWidget);
QVERIFY(!mMessageWidget->isCloseButtonVisible());
QVERIFY(!mMessageWidget->text().isEmpty());
QSplitter *mSplitter = w.findChild<QSplitter *>(QStringLiteral("splitter"));
auto *mSplitter = w.findChild<QSplitter *>(QStringLiteral("splitter"));
QVERIFY(mSplitter);
QCOMPARE(mSplitter->count(), 2);
PimCommon::ConfigurePluginsListWidget *mConfigureListWidget = mSplitter->findChild<PimCommon::ConfigurePluginsListWidget *>(QStringLiteral("configureListWidget"));
auto *mConfigureListWidget = mSplitter->findChild<PimCommon::ConfigurePluginsListWidget *>(QStringLiteral("configureListWidget"));
QVERIFY(mConfigureListWidget);
QTextEdit *mDescription = mSplitter->findChild<QTextEdit *>(QStringLiteral("description"));
auto *mDescription = mSplitter->findChild<QTextEdit *>(QStringLiteral("description"));
QVERIFY(mDescription);
QVERIFY(mDescription->isReadOnly());
QVERIFY(mDescription->document()->isEmpty());
......
......@@ -26,7 +26,7 @@ ConfigurePluginDialog::~ConfigurePluginDialog()
void ConfigurePluginDialog::initLayout(bool addSpacer)
{
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->addWidget(createLayout());
if (addSpacer) {
layout->addStretch(1);
......
......@@ -20,7 +20,7 @@ using namespace PimCommon;
ConfigurePluginsListWidget::ConfigurePluginsListWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
......@@ -56,7 +56,7 @@ void ConfigurePluginsListWidget::slotItemChanged(QTreeWidgetItem *item, int colu
void ConfigurePluginsListWidget::slotItemSelectionChanged()
{
QTreeWidgetItem *item = mListWidget->currentItem();
if (PluginItem *pluginItem = dynamic_cast<PluginItem *>(item)) {
if (auto *pluginItem = dynamic_cast<PluginItem *>(item)) {
Q_EMIT descriptionChanged(pluginItem->mDescription);
}
}
......@@ -115,7 +115,7 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
topLevel->setFlags(topLevel->flags() & ~Qt::ItemIsSelectable);
const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(groupName, prefixKey);
for (const PimCommon::PluginUtilData &data : lst) {
PluginItem *subItem = new PluginItem(topLevel);
auto *subItem = new PluginItem(topLevel);
subItem->setText(0, data.mName);
subItem->mIdentifier = data.mIdentifier;
subItem->mDescription = data.mDescription;
......@@ -127,8 +127,8 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
subItem->setCheckState(0, isPluginActivated ? Qt::Checked : Qt::Unchecked);
}
if (data.mHasConfigureDialog) {
QToolButton *but = new QToolButton(mListWidget);
QAction *act = new QAction(but);
auto *but = new QToolButton(mListWidget);
auto *act = new QAction(but);
const QStringList actData {
configureGroupName, data.mIdentifier
};
......
......@@ -37,7 +37,7 @@ ConfigurePluginsWidget::~ConfigurePluginsWidget()
void ConfigurePluginsWidget::initLayout(ConfigurePluginsListWidget *configurePluginListWidget)
{
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
mMessageWidget = new KMessageWidget(i18n("Restart is necessary for applying the changes."), this);
......
......@@ -25,7 +25,7 @@ void CustomToolsWidgetNgTest::shouldHaveDefaultValue()
PimCommon::CustomToolsWidgetNg widget;
widget.show();
QStackedWidget *stackWidget = widget.findChild<QStackedWidget *>(QStringLiteral("stackedwidget"));
auto *stackWidget = widget.findChild<QStackedWidget *>(QStringLiteral("stackedwidget"));
QVERIFY(stackWidget);
}
......
......@@ -31,7 +31,7 @@ CustomToolsWidgetNg::CustomToolsWidgetNg(QWidget *parent)
: QWidget(parent)
, d(new PimCommon::CustomToolsWidgetNgPrivate)
{
QHBoxLayout *lay = new QHBoxLayout(this);
auto *lay = new QHBoxLayout(this);
d->mStackedWidget = new QStackedWidget;
d->mStackedWidget->setObjectName(QStringLiteral("stackedwidget"));
lay->addWidget(d->mStackedWidget);
......
......@@ -27,7 +27,7 @@ void ActionTypeTest::shouldHaveDefaultValue()
void ActionTypeTest::shouldAssignValue()
{
QAction *act = new QAction(nullptr);
auto *act = new QAction(nullptr);
PimCommon::ActionType::Type type = PimCommon::ActionType::File;
PimCommon::ActionType actionType(act, type);
QCOMPARE(actionType.action(), act);
......
......@@ -30,18 +30,18 @@ LogActivitiesDialogTest::~LogActivitiesDialogTest()
void LogActivitiesDialogTest::shouldHaveDefaultValue()
{
PimCommon::LogActivitiesDialog w;
QVBoxLayout *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
auto *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
PimCommon::LogActivitiesWidget *mLogWidget = w.findChild<PimCommon::LogActivitiesWidget *>(QStringLiteral("logwidget"));
auto *mLogWidget = w.findChild<PimCommon::LogActivitiesWidget *>(QStringLiteral("logwidget"));
QVERIFY(mLogWidget);
QCheckBox *mEnableLogActivities = w.findChild<QCheckBox *>(QStringLiteral("enablelogactivities"));
auto *mEnableLogActivities = w.findChild<QCheckBox *>(QStringLiteral("enablelogactivities"));
QVERIFY(mEnableLogActivities);
QVERIFY(!mEnableLogActivities->text().isEmpty());
QVERIFY(!mEnableLogActivities->isChecked());
QDialogButtonBox *buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
auto *buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
const QList<QAbstractButton *> lstButtonBox = buttonBox->buttons();
......@@ -60,9 +60,9 @@ void LogActivitiesDialogTest::shouldHaveDefaultValue()
void LogActivitiesDialogTest::shouldClearLog()
{
PimCommon::LogActivitiesDialog w;
QDialogButtonBox *buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
auto *buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
PimCommon::LogActivitiesWidget *mLogWidget = w.findChild<PimCommon::LogActivitiesWidget *>(QStringLiteral("logwidget"));
auto *mLogWidget = w.findChild<PimCommon::LogActivitiesWidget *>(QStringLiteral("logwidget"));
QVERIFY(mLogWidget->log().isEmpty());
......@@ -87,7 +87,7 @@ void LogActivitiesDialogTest::shouldHaveCorrectLogActivities()
{
PimCommon::LogActivitiesManager::self()->setEnableLogActivities(true);
PimCommon::LogActivitiesDialog w;
QCheckBox *mEnableLogActivities = w.findChild<QCheckBox *>(QStringLiteral("enablelogactivities"));
auto *mEnableLogActivities = w.findChild<QCheckBox *>(QStringLiteral("enablelogactivities"));
QVERIFY(mEnableLogActivities->isChecked());
}
......
......@@ -22,11 +22,11 @@ LogActivitiesWidgetTest::~LogActivitiesWidgetTest()
void LogActivitiesWidgetTest::shouldHaveDefaultValue()
{
PimCommon::LogActivitiesWidget w;
QVBoxLayout *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
auto *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0));
KPIMTextEdit::PlainTextEditorWidget *mLog = w.findChild<KPIMTextEdit::PlainTextEditorWidget *>(QStringLiteral("log"));
auto *mLog = w.findChild<KPIMTextEdit::PlainTextEditorWidget *>(QStringLiteral("log"));
QVERIFY(mLog);
QVERIFY(mLog->isReadOnly());
}
......
......@@ -23,7 +23,7 @@ LogActivitiesDialog::LogActivitiesDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Log activities"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mLogWidget = new LogActivitiesWidget(this);
......@@ -46,7 +46,7 @@ LogActivitiesDialog::LogActivitiesDialog(QWidget *parent)
mSaveButton->setObjectName(QStringLiteral("savebutton"));
mSaveButton->setEnabled(false);
LogactivitiesPurposeMenuWidget *purposeMenu = new LogactivitiesPurposeMenuWidget(this, this);
auto *purposeMenu = new LogactivitiesPurposeMenuWidget(this, this);
mShareButton = new QPushButton(i18n("Share..."), this);
mShareButton->setMenu(purposeMenu->menu());
mShareButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share")));
......
......@@ -13,7 +13,7 @@ using namespace PimCommon;
LogActivitiesWidget::LogActivitiesWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
......
......@@ -14,7 +14,7 @@
LogActivitiesMainWidget::LogActivitiesMainWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *mainLayout = new QHBoxLayout(this);
auto *mainLayout = new QHBoxLayout(this);
QPushButton *button = new QPushButton(QStringLiteral("Open Log"), this);
connect(button, &QPushButton::clicked, this, &LogActivitiesMainWidget::slotOpenDialog);
mainLayout->addWidget(button);
......
......@@ -19,7 +19,7 @@ int main(int argc, char **argv)
parser.process(app);
LogActivitiesMainWidget *w = new LogActivitiesMainWidget;
auto *w = new LogActivitiesMainWidget;
w->show();
app.exec();
return 0;
......
......@@ -34,7 +34,7 @@ void ShareServiceUrlManagerPrivate::initializeMenu()
{
mMenu = new KActionMenu(QIcon::fromTheme(QStringLiteral("document-share")), i18n("Share On..."), q);
for (int i = 0; i < ShareServiceUrlManager::ServiceEndType; ++i) {
const ShareServiceUrlManager::ServiceType type = static_cast<ShareServiceUrlManager::ServiceType>(i);
const auto type = static_cast<ShareServiceUrlManager::ServiceType>(i);
QAction *action = new QAction(i18nc("@action:inmenu Share On...", "%1", typeToI18n(type)), q);
action->setData(QVariant::fromValue(type));
const QIcon icon = typeToIcon(type);
......@@ -127,7 +127,7 @@ KActionMenu *ShareServiceUrlManager::menu() const
void ShareServiceUrlManager::slotSelectServiceUrl(QAction *act)
{
if (act) {
const ServiceType type = act->data().value<PimCommon::ShareServiceUrlManager::ServiceType>();
const auto type = act->data().value<PimCommon::ShareServiceUrlManager::ServiceType>();
Q_EMIT serviceUrlSelected(type);
}
}
......
......@@ -26,7 +26,7 @@ TemplateEditDialog::TemplateEditDialog(QWidget *parent, bool defaultTemplate)
: QDialog(parent)
{
setWindowTitle(defaultTemplate ? i18n("Default template") : i18n("Template"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = nullptr;
if (defaultTemplate) {
buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
......@@ -44,10 +44,10 @@ TemplateEditDialog::TemplateEditDialog(QWidget *parent, bool defaultTemplate)
mainLayout->addWidget(w);
mainLayout->addWidget(buttonBox);
QVBoxLayout *vbox = new QVBoxLayout;
auto *vbox = new QVBoxLayout;
vbox->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
QLabel *label = new QLabel(i18n("Name:"));
hbox->addWidget(label);
......
......@@ -39,7 +39,7 @@ public:
void createListWidgetItem(const QString &name, const QString &text, bool isDefaultTemplate)
{
QListWidgetItem *item = new QListWidgetItem(name, q);
auto *item = new QListWidgetItem(name, q);
item->setData(TemplateListWidget::Text, text);
item->setData(TemplateListWidget::DefaultTemplate, isDefaultTemplate);
if (isDefaultTemplate) {
......@@ -154,7 +154,7 @@ public:
{
const QList<QListWidgetItem *> lstSelectedItems = q->selectedItems();
const bool listSelectedIsEmpty = lstSelectedItems.isEmpty();
QMenu *menu = new QMenu(q);
auto *menu = new QMenu(q);
if (!listSelectedIsEmpty) {
menu->addAction(i18n("Insert template"), q, [this]() {
......@@ -328,7 +328,7 @@ QMimeData *TemplateListWidget::mimeData(const QList<QListWidgetItem *> items) co
if (items.isEmpty()) {
return nullptr;
}
QMimeData *mimeData = new QMimeData();
auto *mimeData = new QMimeData();
QListWidgetItem *item = items.first();
mimeData->setText(item->data(TemplateListWidget::Text).toString());
return mimeData;
......
......@@ -24,14 +24,14 @@ TranslatorTest::TranslatorTest()
void TranslatorTest::shouldHaveDefaultValuesOnCreation()
{
PimCommon::TranslatorWidget edit;
QComboBox *from = edit.findChild<QComboBox *>(QStringLiteral("from"));
QComboBox *to = edit.findChild<QComboBox *>(QStringLiteral("to"));
auto *from = edit.findChild<QComboBox *>(QStringLiteral("from"));
auto *to = edit.findChild<QComboBox *>(QStringLiteral("to"));
PimCommon::TranslatorTextEdit *inputtext = edit.findChild<PimCommon::TranslatorTextEdit *>(QStringLiteral("inputtext"));
KPIMTextEdit::PlainTextEditorWidget *translatedText = edit.findChild<KPIMTextEdit::PlainTextEditorWidget *>(QStringLiteral("translatedtext"));
QPushButton *translate = edit.findChild<QPushButton *>(QStringLiteral("translate-button"));
QPushButton *clear = edit.findChild<QPushButton *>(QStringLiteral("clear-button"));
QPushButton *invert = edit.findChild<QPushButton *>(QStringLiteral("invert-button"));
auto *inputtext = edit.findChild<PimCommon::TranslatorTextEdit *>(QStringLiteral("inputtext"));
auto *translatedText = edit.findChild<KPIMTextEdit::PlainTextEditorWidget *>(QStringLiteral("translatedtext"));
auto *translate = edit.findChild<QPushButton *>(QStringLiteral("translate-button"));
auto *clear = edit.findChild<QPushButton *>(QStringLiteral("clear-button"));
auto *invert = edit.findChild<QPushButton *>(QStringLiteral("invert-button"));
QVERIFY(invert);
QVERIFY(clear);
QVERIFY(translate);
......@@ -50,8 +50,8 @@ void TranslatorTest::shouldEnableTranslateButtonWhenTextToTranslateIsNotEmpty()
{
PimCommon::TranslatorWidget edit;
PimCommon::TranslatorTextEdit *inputtext = edit.findChild<PimCommon::TranslatorTextEdit *>(QStringLiteral("inputtext"));
QPushButton *translate = edit.findChild<QPushButton *>(QStringLiteral("translate-button"));
auto *inputtext = edit.findChild<PimCommon::TranslatorTextEdit *>(QStringLiteral("inputtext"));
auto *translate = edit.findChild<QPushButton *>(QStringLiteral("translate-button"));
inputtext->setPlainText(QStringLiteral("Foo"));
QCOMPARE(translate->isEnabled(), true);
}
......@@ -59,11 +59,11 @@ void TranslatorTest::shouldEnableTranslateButtonWhenTextToTranslateIsNotEmpty()
void TranslatorTest::shouldDisableTranslateButtonAndClearTextWhenClickOnClearButton()
{
PimCommon::TranslatorWidget edit;
PimCommon::TranslatorTextEdit *inputtext = edit.findChild<PimCommon::TranslatorTextEdit *>(QStringLiteral("inputtext"));
QPushButton *translate = edit.findChild<QPushButton *>(QStringLiteral("translate-button"));
KPIMTextEdit::PlainTextEditorWidget *translatedText = edit.findChild<KPIMTextEdit::PlainTextEditorWidget *>(QStringLiteral("translatedtext"));
auto *inputtext = edit.findChild<PimCommon::TranslatorTextEdit *>(QStringLiteral("inputtext"));
auto *translate = edit.findChild<QPushButton *>(QStringLiteral("translate-button"));
auto *translatedText = edit.findChild<KPIMTextEdit::PlainTextEditorWidget *>(QStringLiteral("translatedtext"));
inputtext->setPlainText(QStringLiteral("Foo"));
QPushButton *clear = edit.findChild<QPushButton *>(QStringLiteral("clear-button"));
auto *clear = edit.findChild<QPushButton *>(QStringLiteral("clear-button"));
QTest::mouseClick(clear, Qt::LeftButton);
QCOMPARE(inputtext->toPlainText(), QString());
QCOMPARE(translatedText->toPlainText(), QString());
......@@ -73,14 +73,14 @@ void TranslatorTest::shouldDisableTranslateButtonAndClearTextWhenClickOnClearBut
void TranslatorTest::shouldInvertLanguageWhenClickOnInvertButton()
{
PimCommon::TranslatorWidget edit;
QComboBox *from = edit.findChild<QComboBox *>(QStringLiteral("from"));
QComboBox *to = edit.findChild<QComboBox *>(QStringLiteral("to"));
auto *from = edit.findChild<QComboBox *>(QStringLiteral("from"));
auto *to = edit.findChild<QComboBox *>(QStringLiteral("to"));
const int fromIndex = 5;
const int toIndex = 7;
from->setCurrentIndex(fromIndex);
to->setCurrentIndex(toIndex);
QPushButton *invert = edit.findChild<QPushButton *>(QStringLiteral("invert-button"));
auto *invert = edit.findChild<QPushButton *>(QStringLiteral("invert-button"));
QTest::mouseClick(invert, Qt::LeftButton);
const int newFromIndex = from->currentIndex();
const int newToIndex = to->currentIndex();
......
......@@ -19,7 +19,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
PimCommon::TranslatorWidget *w = new PimCommon::TranslatorWidget();
auto *w = new PimCommon::TranslatorWidget();
w->show();
app.exec();
delete w;
......
......@@ -19,7 +19,7 @@ TranslatorDebugDialog::TranslatorDebugDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Translator Debug"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
mUser1Button = new QPushButton(this);
......
......@@ -201,10 +201,10 @@ void TranslatorWidget::init()
connect(d->abstractTranslator, &PimCommon::GoogleTranslator::translateDone, this, &TranslatorWidget::slotTranslateDone);
connect(d->abstractTranslator, &PimCommon::GoogleTranslator::translateFailed, this, &TranslatorWidget::slotTranslateFailed);
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout *hboxLayout = new QHBoxLayout;
QToolButton *closeBtn = new QToolButton(this);
auto *hboxLayout = new QHBoxLayout;
auto *closeBtn = new QToolButton(this);
closeBtn->setObjectName(QStringLiteral("close-button"));
closeBtn->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
closeBtn->setIconSize(QSize(16, 16));
......@@ -275,7 +275,7 @@ void TranslatorWidget::init()
d->splitter = new QSplitter;
d->splitter->setChildrenCollapsible(false);
d->inputText = new TranslatorTextEdit(this);
KPIMTextEdit::PlainTextEditorWidget *editorWidget = new KPIMTextEdit::PlainTextEditorWidget(d->inputText);
auto *editorWidget = new KPIMTextEdit::PlainTextEditorWidget(d->inputText);
d->inputText->setObjectName(QStringLiteral("inputtext"));
d->inputText->setPlaceholderText(i18n("Drag text that you want to translate. (Be careful text will be send to Google Server)."));
connect(d->inputText, &TranslatorTextEdit::textChanged, this, &TranslatorWidget::slotTextChanged);
......@@ -432,7 +432,7 @@ bool TranslatorWidget::event(QEvent *e)
// window-global actions (e.g. Emil Sedgh binds Esc to "close tab").
// With a shortcut override we can catch this before it gets to kactions.
if (e->type() == QEvent::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();
slotCloseWidget();
......
......@@ -26,7 +26,7 @@ QTextDocument *LogItemDelegate::document(const QStyleOptionViewItem &option, con
if (!index.isValid()) {
return nullptr;
}
QTextDocument *document = new QTextDocument(nullptr);
auto *document = new QTextDocument(nullptr);
document->setDocumentMargin(1);
const QColor textColor = index.data(Qt::ForegroundRole).value<QColor>();
QStyleOptionViewItem option4 = option;
......@@ -97,7 +97,7 @@ QWidget *LogItemDelegate::createEditor(QWidget *, const QStyleOptionViewItem &,
CustomLogWidget::CustomLogWidget(QWidget *parent)
: QListWidget(parent)
{
LogItemDelegate *itemDelegate = new LogItemDelegate(this);
auto *itemDelegate = new LogItemDelegate(this);
setItemDelegate(itemDelegate);
}
......@@ -107,7 +107,7 @@ CustomLogWidget::~CustomLogWidget()
void CustomLogWidget::addTitleLogEntry(const QString &log)
{
QListWidgetItem *item = new QListWidgetItem(log);
auto *item = new QListWidgetItem(log);
item->setForeground(Qt::black);
QFont font = item->font();
font.setBold(true);
......@@ -119,7 +119,7 @@ void CustomLogWidget::addTitleLogEntry(const QString &log)
void CustomLogWidget::addInfoLogEntry(const QString &log)
{
QListWidgetItem *item = new QListWidgetItem(log);
auto *item = new QListWidgetItem(log);
item->setForeground(Qt::blue);
item->setData(ItemLogType, Info);
addItem(item);
......@@ -128,7 +128,7 @@ void CustomLogWidget::addInfoLogEntry(const QString &log)
void CustomLogWidget::addErrorLogEntry(const QString &log)
{
QListWidgetItem *item = new QListWidgetItem(log);
auto *item = new QListWidgetItem(log);
item->setForeground(Qt::red);
item->setData(ItemLogType, Error);
addItem(item);
......@@ -137,7 +137,7 @@ void CustomLogWidget::addErrorLogEntry(const QString &log)
void CustomLogWidget::addEndLineLogEntry()
{
QListWidgetItem *item = new QListWidgetItem;
auto *item = new QListWidgetItem;
item->setData(ItemLogType, EndLine);
addItem(item);
scrollToItem(item);
......
......@@ -16,7 +16,7 @@ using namespace PimCommon;
LineEditWithCompleterNg::LineEditWithCompleterNg(QWidget *parent)</