Commit f53ec60c authored by Laurent Montel's avatar Laurent Montel 😁

Fix error found by cppcheck

parent 0cae468c
......@@ -718,7 +718,6 @@ void KODayMatrix::paintEvent(QPaintEvent *)
const int dayHeight = mDaySize.height();
const int dayWidth = mDaySize.width();
int row, column;
int selectionWidth, selectionHeight;
const bool isRTL = KOGlobals::self()->reverseLayout();
QPalette pal = palette();
......@@ -758,7 +757,7 @@ void KODayMatrix::paintEvent(QPaintEvent *)
p.fillRect(isRTL ? 0 : column * dayWidth, row * dayHeight,
(7 - column) * dayWidth, dayHeight, selectionColor);
// draw full block till last line
selectionHeight = mSelEnd / 7 - row;
int selectionHeight = mSelEnd / 7 - row;
if (selectionHeight + row >= 6) {
selectionHeight = 6 - row;
}
......@@ -768,7 +767,7 @@ void KODayMatrix::paintEvent(QPaintEvent *)
}
// draw last block from left to mSelEnd
if (mSelEnd / 7 < 6) {
selectionWidth = mSelEnd - 7 * (mSelEnd / 7) + 1;
int selectionWidth = mSelEnd - 7 * (mSelEnd / 7) + 1;
p.fillRect(isRTL ?
(7 - selectionWidth) * dayWidth :
0,
......
......@@ -82,36 +82,6 @@ bool SummaryEventInfo::skip(const KCalCore::Event::Ptr &event)
return false;
}
void SummaryEventInfo::dateDiff(const QDate &date, int &days)
{
QDate currentDate;
QDate eventDate;
if (QDate::isLeapYear(date.year()) && date.month() == 2 && date.day() == 29) {
currentDate = QDate(date.year(), QDate::currentDate().month(), QDate::currentDate().day());
if (!QDate::isLeapYear(QDate::currentDate().year())) {
eventDate = QDate(date.year(), date.month(), 28); // celebrate one day earlier ;)
} else {
eventDate = QDate(date.year(), date.month(), date.day());
}
} else {
currentDate = QDate(QDate::currentDate().year(),
QDate::currentDate().month(),
QDate::currentDate().day());
eventDate = QDate(QDate::currentDate().year(), date.month(), date.day());
}
int offset = currentDate.daysTo(eventDate);
if (offset < 0) {
days = 365 + offset;
if (QDate::isLeapYear(QDate::currentDate().year())) {
days++;
}
} else {
days = offset;
}
}
SummaryEventInfo::SummaryEventInfo()
: makeBold(false)
{
......
......@@ -59,8 +59,6 @@ public:
bool makeBold;
private:
static void dateDiff(const QDate &date, int &days);
static bool skip(const KCalCore::Event::Ptr &event);
static bool mShowBirthdays, mShowAnniversaries;
};
......
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