Commit 5d49101f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some cppcheck warning

parent 25b7024b
Pipeline #83518 passed with stage
in 9 minutes and 22 seconds
......@@ -597,7 +597,6 @@ bool Agenda::eventFilter_drag(QObject *obj, QDropEvent *de)
Q_EMIT droppedIncidences(incidences, gridPosition, d->mAllDayMode);
}
return true;
break;
}
case QEvent::DragResponse:
......@@ -1151,8 +1150,8 @@ void Agenda::endItemAction()
d->mItemMoved = d->mItemMoved && !(d->mStartCell.x() == d->mEndCell.x() && d->mStartCell.y() == d->mEndCell.y());
bool addIncidence = false;
if (d->mItemMoved) {
bool addIncidence = false;
bool modify = false;
// get the main event and not the exception
......
......@@ -20,9 +20,9 @@ DecorationLabel::DecorationLabel(CalendarDecoration::Element *e, QWidget *parent
, mShortText(e->shortText())
, mLongText(e->longText())
, mExtensiveText(e->extensiveText())
, mPixmap(e->newPixmap(size()))
, mUrl(e->url())
{
mPixmap = e->newPixmap(size());
mUrl = e->url();
setUrl(mUrl);
connect(e, &CalendarDecoration::Element::gotNewExtensiveText, this, &DecorationLabel::setExtensiveText);
......
......@@ -304,7 +304,6 @@ void MonthGraphicsView::drawBackground(QPainter *p, const QRectF &rect)
p->setPen(Qt::NoPen);
p->drawRect(QRect(cellHeaderX, cellHeaderY, cellHeaderWidth, cellHeaderHeight));
QFont font = p->font();
if (cell->date() == QDate::currentDate()) {
font.setBold(true);
} else {
......
......@@ -299,11 +299,9 @@ void TimelineView::showDates(const QDate &start, const QDate &end, const QDate &
grid->setStartDateTime(QDateTime(start.startOfDay()));
d->mLeftView->clear();
uint index = 0;
// item for every calendar
TimelineItem *item = nullptr;
Akonadi::ETMCalendar::Ptr calres = calendar();
if (!calres) {
item = new TimelineItem(calendar(), index++, static_cast<QStandardItemModel *>(d->mGantt->model()), d->mGantt);
auto item = new TimelineItem(calendar(), index++, static_cast<QStandardItemModel *>(d->mGantt->model()), d->mGantt);
d->mLeftView->addTopLevelItem(new QTreeWidgetItem(QStringList() << i18n("Calendar")));
d->mCalendarItemMap.insert(-1, item);
} else {
......@@ -312,7 +310,7 @@ void TimelineView::showDates(const QDate &start, const QDate &end, const QDate &
for (const Akonadi::Collection &collection : collections) {
if (collection.contentMimeTypes().contains(Event::eventMimeType())) {
item = new TimelineItem(calendar(), index++, static_cast<QStandardItemModel *>(d->mGantt->model()), d->mGantt);
auto item = new TimelineItem(calendar(), index++, static_cast<QStandardItemModel *>(d->mGantt->model()), d->mGantt);
d->mLeftView->addTopLevelItem(new QTreeWidgetItem(QStringList() << CalendarSupport::displayName(calendar().data(), collection)));
const QColor resourceColor = EventViews::resourceColor(collection, preferences());
if (resourceColor.isValid()) {
......
......@@ -337,15 +337,12 @@ QVariant TodoModel::data(const QModelIndex &index, int role) const
// icon for recurring todos
// It's in the summary column so you don't accidentally click
// the checkbox ( which increments the next occurrence date ).
// category colour
if (role == Qt::DecorationRole && index.column() == SummaryColumn) {
if (todo->recurs()) {
return QVariant(QIcon::fromTheme(QStringLiteral("task-recurring")));
}
}
// category colour
if (role == Qt::DecorationRole && index.column() == SummaryColumn) {
QStringList categories = todo->categories();
const QStringList categories = todo->categories();
return categories.isEmpty() ? QVariant() : QVariant(CalendarSupport::KCalPrefs::instance()->categoryColor(categories.first()));
} else if (role == Qt::DecorationRole) {
return QVariant();
......
......@@ -145,7 +145,7 @@ public:
return todoFlatModel != nullptr;
}
TodoModel *todoModel = nullptr;
TodoModel *const todoModel;
QList<TodoView *> views;
QObject *parent = nullptr;
......@@ -937,11 +937,7 @@ void TodoView::setNewPercentage(QAction *action)
} else {
todo->setPercentComplete(percentage);
}
if (todo->recurs() && percentage == 100) {
changer()->modifyIncidence(todoItem, oldTodo, this);
} else {
changer()->modifyIncidence(todoItem, oldTodo, this);
}
changer()->modifyIncidence(todoItem, oldTodo, this);
} else {
qCDebug(CALENDARVIEW_LOG) << "Item is read only";
}
......
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