Commit 925e3885 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 12f9138d
Pipeline #39276 passed with stage
in 9 minutes and 17 seconds
......@@ -66,7 +66,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
QIcon pixmap = QIcon::fromTheme(icon);
QFrame *topFrame = new QFrame();
KPageWidgetItem *pageItem = new KPageWidgetItem(topFrame, title);
auto *pageItem = new KPageWidgetItem(topFrame, title);
pageItem->setIcon(pixmap);
addPage(pageItem);
......@@ -103,7 +103,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse);
topLayout->addWidget(label);
QTextBrowser *personView = new QTextBrowser(topFrame);
auto *personView = new QTextBrowser(topFrame);
personView->setReadOnly(true);
topLayout->addWidget(personView, 1);
......@@ -265,12 +265,12 @@ void AboutDialog::addLicenseText(const KAboutData &about)
const QString title = i18n("%1 License", about.displayName());
QFrame *topFrame = new QFrame();
KPageWidgetItem *page = new KPageWidgetItem(topFrame, title);
auto *page = new KPageWidgetItem(topFrame, title);
page->setIcon(QIcon(pixmap));
addPage(page);
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
QTextBrowser *textBrowser = new QTextBrowser(topFrame);
auto *textBrowser = new QTextBrowser(topFrame);
QString licenseStr;
const QList<KAboutLicense> lstLicenses = about.licenses();
for (const KAboutLicense &license : lstLicenses) {
......
......@@ -165,9 +165,9 @@ public:
protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
{
KontactInterface::Plugin *leftPlugin
auto *leftPlugin
= static_cast<KontactInterface::Plugin *>(left.internalPointer());
KontactInterface::Plugin *rightPlugin
auto *rightPlugin
= static_cast<KontactInterface::Plugin *>(right.internalPointer());
if (leftPlugin->weight() == rightPlugin->weight()) {
......@@ -261,7 +261,7 @@ Navigator::Navigator(SidePaneBase *parent)
mShowIcons = Prefs::self()->sidePaneShowIcons();
mShowText = Prefs::self()->sidePaneShowText();
QActionGroup *viewMode = new QActionGroup(this);
auto *viewMode = new QActionGroup(this);
connect(viewMode, &QActionGroup::triggered, this, &Navigator::slotActionTriggered);
mShowIconsAction = new QAction(i18nc("@action:inmenu", "Show Icons Only"), this);
......@@ -297,7 +297,7 @@ Navigator::Navigator(SidePaneBase *parent)
i18nc("@info:whatsthis",
"Choose this option if you want the sidebar items to have icons and text."));
QActionGroup *iconSize = new QActionGroup(this);
auto *iconSize = new QActionGroup(this);
connect(iconSize, &QActionGroup::triggered, this, &Navigator::slotActionTriggered);
mBigIconsAction = new QAction(i18nc("@action:inmenu", "Big Icons"), this);
......@@ -342,9 +342,9 @@ Navigator::Navigator(SidePaneBase *parent)
"Choose this option if you want to hide the icon sidebar. Press F9 to unhide."));
connect(mHideSideBarAction, &QAction::triggered, this, &Navigator::slotHideSideBarTriggered);
QAction *sep = new QAction(this);
auto *sep = new QAction(this);
sep->setSeparator(true);
QAction *sep2 = new QAction(this);
auto *sep2 = new QAction(this);
sep2->setSeparator(true);
QList<QAction *> actionList;
......@@ -358,7 +358,7 @@ Navigator::Navigator(SidePaneBase *parent)
setViewMode(ListMode);
setItemDelegate(new Delegate(this));
mModel = new Model(this);
SortFilterProxyModel *sortFilterProxyModel = new SortFilterProxyModel(this);
auto *sortFilterProxyModel = new SortFilterProxyModel(this);
sortFilterProxyModel->setSourceModel(mModel);
setModel(sortFilterProxyModel);
setSelectionModel(new SelectionModel(sortFilterProxyModel, this));
......@@ -456,7 +456,7 @@ void Navigator::dragMoveEvent(QDragMoveEvent *event)
} else {
const QModelIndex sourceIndex
= static_cast<const QSortFilterProxyModel *>(model())->mapToSource(dropIndex);
KontactInterface::Plugin *plugin
auto *plugin
= static_cast<KontactInterface::Plugin *>(sourceIndex.internalPointer());
if (!plugin->canDecodeMimeData(event->mimeData())) {
event->setAccepted(false);
......@@ -480,7 +480,7 @@ void Navigator::dropEvent(QDropEvent *event)
} else {
const QModelIndex sourceIndex
= static_cast<const QSortFilterProxyModel *>(model())->mapToSource(dropIndex);
KontactInterface::Plugin *plugin
auto *plugin
= static_cast<KontactInterface::Plugin *>(sourceIndex.internalPointer());
plugin->processDropEvent(event);
}
......
......@@ -33,7 +33,7 @@ Q_DECL_EXPORT KCModule *create_kontactconfig(QWidget *parent, const char *)
KcmKontact::KcmKontact(QWidget *parent)
: KCModule(parent)
{
QFormLayout *topLayout = new QFormLayout(this);
auto *topLayout = new QFormLayout(this);
QBoxLayout *pluginStartupLayout = new QHBoxLayout();
topLayout->addItem(pluginStartupLayout);
......
......@@ -206,7 +206,7 @@ int main(int argc, char **argv)
if (!app.isSessionRestored()) {
// There can only be one main window
if (KMainWindow::canBeRestored(1)) {
MainWindow *mainWindow = new MainWindow();
auto *mainWindow = new MainWindow();
app.setMainWindow(mainWindow);
app.setSessionRestored(true);
mainWindow->show();
......
......@@ -238,7 +238,7 @@ void MainWindow::activateInitialPluginModule()
void MainWindow::initWidgets()
{
QWidget *mTopWidget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout;
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
mTopWidget->setLayout(layout);
......@@ -258,7 +258,7 @@ void MainWindow::initWidgets()
paintAboutScreen(QStringLiteral("loading_kontact.html"), QVariantHash());
KPIM::ProgressStatusBarWidget *progressStatusBarWidget = new KPIM::ProgressStatusBarWidget(statusBar(), this);
auto *progressStatusBarWidget = new KPIM::ProgressStatusBarWidget(statusBar(), this);
mStatusMsgLabel
= new KSqueezedTextLabel(i18nc("@info:status", " Initializing..."), statusBar());
......@@ -289,7 +289,7 @@ void MainWindow::paintAboutScreen(const QString &templateName, const QVariantHas
void MainWindow::initAboutScreen()
{
QWidget *introbox = new QWidget(mPartsStack);
QHBoxLayout *introboxHBoxLayout = new QHBoxLayout(introbox);
auto *introboxHBoxLayout = new QHBoxLayout(introbox);
introboxHBoxLayout->setContentsMargins(0, 0, 0, 0);
mPartsStack->addWidget(introbox);
mPartsStack->setCurrentWidget(introbox);
......@@ -876,7 +876,7 @@ void MainWindow::slotOpenUrl(const QUrl &url)
KHelpClient::invokeHelp(QString(), app);
}
} else {
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url);
auto *job = new KIO::OpenUrlJob(url);
job->start();
}
}
......
......@@ -17,7 +17,7 @@ SidePaneBase::SidePaneBase(KontactInterface::Core *core, QWidget *parent)
: QWidget(parent)
, mCore(core)
{
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
}
......
......@@ -10,7 +10,7 @@
IntroductionWebEngineView::IntroductionWebEngineView(QWidget *parent)
: QWebEngineView(parent)
{
IntroductionWebEnginePage *pageEngine = new IntroductionWebEnginePage(this);
auto *pageEngine = new IntroductionWebEnginePage(this);
setPage(pageEngine);
setFocusPolicy(Qt::WheelFocus);
......
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