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

const'ify variables + use auto + using {} as default values

parent aa9886e1
Pipeline #90483 passed with stage
in 5 minutes and 42 seconds
......@@ -70,7 +70,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
addPage(pageItem);
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
auto topLayout = new QVBoxLayout(topFrame);
if (about.displayName().isEmpty()) {
auto label = new QLabel(i18n("No about information available."), topFrame);
......@@ -87,7 +87,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
text += QLatin1String("<p>") + about.shortDescription() + QLatin1String("<br>") + about.copyrightStatement() + QLatin1String("</p>");
}
QString home = about.homepage();
const QString home = about.homepage();
if (!home.isEmpty()) {
text += QLatin1String("<a href=\"") + home + QLatin1String("\">") + home + QLatin1String("</a><br>");
}
......
......@@ -394,9 +394,9 @@ QSize Navigator::sizeHint() const
// Take vertical scrollbar into account
maxWidth += qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
int viewHeight = QListView::sizeHint().height();
const int viewHeight = QListView::sizeHint().height();
QSize size(maxWidth + rect().width() - contentsRect().width(), viewHeight);
const QSize size(maxWidth + rect().width() - contentsRect().width(), viewHeight);
return size;
}
......
......@@ -28,7 +28,7 @@ KcmKontact::KcmKontact(QWidget *parent, const QVariantList &args)
, mPluginCombo(new QComboBox(parent))
{
auto topLayout = new QVBoxLayout(this);
QBoxLayout *pluginStartupLayout = new QHBoxLayout();
auto pluginStartupLayout = new QHBoxLayout();
topLayout->addLayout(pluginStartupLayout);
auto forceStartupPluginCheckBox = new QCheckBox(Prefs::self()->forceStartupPluginItem()->label(), this);
......
......@@ -72,7 +72,7 @@ void KontactKCMultiDialogPrivate::_k_slotCurrentPageChanged(KPageWidgetItem *cur
Q_Q(KontactKCMultiDialog);
KCModuleProxy *previousModule = nullptr;
for (int i = 0; i < modules.count(); ++i) {
for (int i = 0, total = modules.count(); i < total; ++i) {
if (modules[i].item == previous) {
previousModule = modules[i].kcm;
}
......@@ -80,7 +80,7 @@ void KontactKCMultiDialogPrivate::_k_slotCurrentPageChanged(KPageWidgetItem *cur
// Delete global margins and spacing, since we want the contents to
// be able to touch the edges of the window
q->layout()->setContentsMargins(0, 0, 0, 0);
q->layout()->setContentsMargins({});
const KPageWidget *pageWidget = q->pageWidget();
pageWidget->layout()->setSpacing(0);
......@@ -268,7 +268,7 @@ void KontactKCMultiDialog::slotDefaultClicked()
return;
}
for (int i = 0; i < d->modules.count(); ++i) {
for (int i = 0, total = d->modules.count(); i < total; ++i) {
if (d->modules[i].item == item) {
d->modules[i].kcm->defaults();
d->_k_clientChanged();
......
......@@ -222,7 +222,7 @@ void MainWindow::initWidgets()
{
auto mTopWidget = new QWidget(this);
auto layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
layout->setSpacing(0);
mTopWidget->setLayout(layout);
setCentralWidget(mTopWidget);
......@@ -268,7 +268,7 @@ void MainWindow::initAboutScreen()
{
auto introbox = new QWidget(mPartsStack);
auto introboxHBoxLayout = new QHBoxLayout(introbox);
introboxHBoxLayout->setContentsMargins(0, 0, 0, 0);
introboxHBoxLayout->setContentsMargins({});
mPartsStack->addWidget(introbox);
mPartsStack->setCurrentWidget(introbox);
mIntroPart = new IntroductionWebEngineView(introbox);
......@@ -351,7 +351,7 @@ void MainWindow::loadPlugins()
const QString exeNameProp = pluginMetaData.value(QStringLiteral("X-KDE-KontactPartExecutableName"));
if (pluginMetaData.rawData().contains(QLatin1String("X-KDE-KontactPartLoadOnStart"))) {
bool loadOnStart = pluginMetaData.rawData().value(QStringLiteral("X-KDE-KontactPartLoadOnStart")).toBool();
const bool loadOnStart = pluginMetaData.rawData().value(QStringLiteral("X-KDE-KontactPartLoadOnStart")).toBool();
if (loadOnStart) {
mDelayedPreload.append(plugin);
}
......@@ -406,7 +406,7 @@ void MainWindow::unloadDisabledPlugins()
void MainWindow::updateShortcuts()
{
for (int i = 0; i < mActionPlugins.count(); ++i) {
for (int i = 0, total = mActionPlugins.count(); i < total; ++i) {
QAction *action = mActionPlugins.at(i);
const QKeySequence shortcut(QStringLiteral("Ctrl+%1").arg(mActionPlugins.count() - i));
actionCollection()->setDefaultShortcut(action, shortcut);
......
......@@ -18,7 +18,7 @@ SidePaneBase::SidePaneBase(KontactInterface::Core *core, QWidget *parent)
, mCore(core)
{
auto layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
}
SidePaneBase::~SidePaneBase()
......
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