Commit 0aabfdfb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

cppcheck fix

parent 815cfcee
Pipeline #83205 passed with stage
in 15 minutes and 46 seconds
......@@ -1256,8 +1256,8 @@ bool CalendarView::makeChildrenIndependent(const Akonadi::Item &item)
return false;
}
for (const Akonadi::Item &item : subIncs) {
incidence_unsub(item);
for (const Akonadi::Item &subInc : subIncs) {
incidence_unsub(subInc);
}
return true;
......
......@@ -74,10 +74,10 @@ public:
const QList<QWidget *> list = wdg->findChildren<QWidget *>();
for (QWidget *it : list) {
if (allowedTypes.contains(QLatin1String(it->metaObject()->className()))) {
const QString name = it->objectName();
if (name.startsWith(QLatin1String("X_"))) {
const QString objectName = it->objectName();
if (objectName.startsWith(QLatin1String("X_"))) {
new QTreeWidgetItem(this,
QStringList() << name << allowedTypes[QLatin1String(it->metaObject()->className())]
QStringList() << objectName << allowedTypes[QLatin1String(it->metaObject()->className())]
<< QLatin1String(it->metaObject()->className()) << it->whatsThis());
}
}
......
......@@ -97,7 +97,6 @@ void ApptSummaryWidget::updateView()
// the summary is the event summary
// the time range is the start-end time (only for non-floating events)
QLabel *label = nullptr;
int counter = 0;
QPixmap pm = QIcon::fromTheme(QStringLiteral("view-calendar-day")).pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize));
......@@ -134,7 +133,7 @@ void ApptSummaryWidget::updateView()
}
// Icon label
label = new QLabel(this);
auto label = new QLabel(this);
if (ev->categories().contains(QLatin1String("BIRTHDAY"), Qt::CaseInsensitive)) {
label->setPixmap(pmb);
} else if (ev->categories().contains(QLatin1String("ANNIVERSARY"), Qt::CaseInsensitive)) {
......
......@@ -148,8 +148,6 @@ void TodoSummaryWidget::updateView()
// not-started (no start date and 0% completed)
int counter = 0;
QLabel *label = nullptr;
if (!prList.isEmpty()) {
QPixmap pm = QIcon::fromTheme(QStringLiteral("view-calendar-tasks")).pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize));
......@@ -168,7 +166,7 @@ void TodoSummaryWidget::updateView()
*/
// Icon label
label = new QLabel(this);
auto label = new QLabel(this);
label->setPixmap(pm);
label->setMaximumWidth(label->minimumSizeHint().width());
mLayout->addWidget(label, counter, 0);
......
......@@ -232,8 +232,6 @@ void SDSummaryWidget::slotBirthdayJobFinished(KJob *job)
void SDSummaryWidget::createLabels()
{
QLabel *label = nullptr;
// Remove all special date labels from the layout and delete them, as we
// will re-create all labels below.
setUpdatesEnabled(false);
......@@ -423,7 +421,7 @@ void SDSummaryWidget::createLabels()
icon_name = QStringLiteral("view-calendar-special-occasion");
break;
}
label = new QLabel(this);
auto label = new QLabel(this);
if (icon_img.isNull()) {
label->setPixmap(QIcon::fromTheme(icon_name).pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize)));
} else {
......@@ -554,7 +552,7 @@ void SDSummaryWidget::createLabels()
counter++;
}
} else {
label = new QLabel(i18np("No special dates within the next 1 day", "No special dates pending within the next %1 days", mDaysAhead), this);
auto label = new QLabel(i18np("No special dates within the next 1 day", "No special dates pending within the next %1 days", mDaysAhead), this);
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
mLayout->addWidget(label, 0, 0);
mLabels.append(label);
......
......@@ -127,9 +127,9 @@ void KOViewManager::writeSettings(KConfig *config)
}
// write out custom view configuration
for (KOrg::BaseView *const view : std::as_const(mViews)) {
KConfigGroup group = KSharedConfig::openConfig()->group(view->identifier());
view->saveConfig(group);
for (KOrg::BaseView *const baseView : std::as_const(mViews)) {
KConfigGroup group = KSharedConfig::openConfig()->group(baseView->identifier());
baseView->saveConfig(group);
}
generalConfig.writeEntry("Range Mode", int(mRangeMode));
......@@ -389,7 +389,7 @@ void KOViewManager::showAgendaView()
QWidget *parent = mMainView->viewStack();
if (showBoth) {
if (!mAgendaViewTabs && showBoth) {
if (!mAgendaViewTabs) {
mAgendaViewTabs = new QTabWidget(mMainView->viewStack());
connect(mAgendaViewTabs, &QTabWidget::currentChanged, this, &KOViewManager::currentAgendaViewTabChanged);
mMainView->viewStack()->addWidget(mAgendaViewTabs);
......
......@@ -694,7 +694,7 @@ void ReparentingModelTest::testInvalidLayoutChanged()
class DummyNodeManager : public ReparentingModel::NodeManager
{
public:
DummyNodeManager(ReparentingModel &m)
explicit DummyNodeManager(ReparentingModel &m)
: ReparentingModel::NodeManager(m)
{
}
......
......@@ -161,10 +161,6 @@ bool ReparentingModel::validateNode(const Node *node) const
const Node *n = node;
int depth = 0;
while (n) {
if (!n) {
qCWarning(KORGANIZER_LOG) << "nullptr" << depth;
return false;
}
if ((intptr_t)(n) < 1000) {
// Detect corruptions with unlikely pointers
qCWarning(KORGANIZER_LOG) << "corrupt pointer" << depth;
......
Supports Markdown
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