Commit adcb0ca5 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛
Browse files

Remove duplicated workDays() function

parent 7b027e46
Pipeline #79351 failed with stage
in 2 minutes and 35 seconds
......@@ -739,7 +739,7 @@ void KODayMatrix::paintEvent(QPaintEvent *)
p.setPen(actcol);
QPen tmppen;
const QList<QDate> workDays = KOGlobals::self()->workDays(mDays[0], mDays[NUMDAYS - 1]);
const QList<QDate> workDays = CalendarSupport::workDays(mDays[0], mDays[NUMDAYS - 1]);
for (int i = 0; i < NUMDAYS; ++i) {
row = i / 7;
column = isRTL ? 6 - (i - row * 7) : i - row * 7;
......
......@@ -70,35 +70,6 @@ int KOGlobals::firstDayOfWeek() const
return KOPrefs::instance()->mWeekStartDay + 1;
}
QList<QDate> KOGlobals::workDays(QDate startDate, QDate endDate) const
{
QList<QDate> result;
const int mask(~(KOPrefs::instance()->mWorkWeekMask));
const qint64 numDays = startDate.daysTo(endDate) + 1;
for (int i = 0; i < numDays; ++i) {
const QDate date = startDate.addDays(i);
if (!(mask & (1 << (date.dayOfWeek() - 1)))) {
result.append(date);
}
}
if (KOPrefs::instance()->mExcludeHolidays) {
for (const KHolidays::HolidayRegion *region : std::as_const(mHolidayRegions)) {
const KHolidays::Holiday::List list = region->holidays(startDate, endDate);
for (int i = 0; i < list.count(); ++i) {
const KHolidays::Holiday &h = list.at(i);
if (h.dayType() == KHolidays::Holiday::NonWorkday) {
result.removeAll(h.observedStartDate());
}
}
}
}
return result;
}
int KOGlobals::getWorkWeekMask()
{
return KOPrefs::instance()->mWorkWeekMask;
......
......@@ -35,11 +35,6 @@ public:
Q_REQUIRED_RESULT int firstDayOfWeek() const;
/**
Returns a list containing work days between @p start and @end.
*/
Q_REQUIRED_RESULT QList<QDate> workDays(QDate start, QDate end) const;
Q_REQUIRED_RESULT int getWorkWeekMask();
/**
......
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