Commit 76a23124 authored by David Jarvie's avatar David Jarvie

Move detailed workings of adjusting start-of-day time into KAEvent

parent 813fa5d1
......@@ -2219,14 +2219,7 @@ void AlarmCalendar::adjustStartOfDay()
if (!isValid())
return;
for (ResourceMap::ConstIterator rit = mResourceMap.constBegin(); rit != mResourceMap.constEnd(); ++rit)
{
const KAEvent::List events = rit.value();
for (int i = 0, end = events.count(); i < end; ++i)
{
if (events[i]->startDateTime().isDateOnly() && events[i]->recurs())
events[i]->adjustRecurrenceStartOfDay();
}
}
KAEvent::adjustStartOfDay(rit.value());
}
// vim: et sw=4:
......@@ -3545,12 +3545,17 @@ void KAEvent::Private::setRecurrence(const KARecurrence& recurrence)
/******************************************************************************
* Called when the user changes the start-of-day time.
* Adjust the start time of a date-only alarm's recurrence.
* Adjust the start time of the recurrence to match, for each date-only event in
* a list.
*/
void KAEvent::adjustRecurrenceStartOfDay()
void KAEvent::adjustStartOfDay(const KAEvent::List& events)
{
if (d->mRecurrence)
d->mRecurrence->setStartDateTime(d->mStartDateTime.effectiveKDateTime(), d->mStartDateTime.isDateOnly());
for (int i = 0, end = events.count(); i < end; ++i)
{
Private* p = events[i]->d;
if (p->mStartDateTime.isDateOnly() && p->checkRecur() != KARecurrence::NO_RECUR)
p->mRecurrence->setStartDateTime(p->mStartDateTime.effectiveKDateTime(), true);
}
}
/******************************************************************************
......
......@@ -528,12 +528,12 @@ class KALARM_CAL_EXPORT KAEvent
bool setRecurAnnualByDate(int freq, const QList<int>& months, int day, KARecurrence::Feb29Type, int count, const QDate& end);
bool setRecurAnnualByPos(int freq, const QList<MonthPos>& pos, const QList<int>& months, int count, const QDate& end);
// static QValueList<MonthPos> convRecurPos(const QValueList<KCal::RecurrenceRule::WDayPos>&);
void adjustRecurrenceStartOfDay();
#ifdef KDE_NO_DEBUG_OUTPUT
void dumpDebug() const { }
#else
void dumpDebug() const { d->dumpDebug(); }
#endif
static void adjustStartOfDay(const KAEvent::List&);
static int currentCalendarVersion();
static QByteArray currentCalendarVersionString();
#ifdef USE_AKONADI
......
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