Commit 6c0a58d9 authored by Sergio Martins's avatar Sergio Martins
Browse files

Port to Duration::isNull() instead of implicit cast to bool.

The bool operator will be removed, since it caused a bug in KCalCore::Period hashing
and there also seems to be bugs in KAlarm where Duration is implicitely cast to int
by mistake.
parent 685af727
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings)
set(KF5_VERSION "5.12.0")
set(KALARM_LIB_VERSION "4.79.0")
set(CALENDARCORE_LIB_VERSION "4.79.0")
set(CALENDARCORE_LIB_VERSION "4.82.0")
set(HOLIDAY_LIB_VERSION "4.79.0")
set(IDENTITYMANAGER_LIB_VERSION "4.79.0")
set(AKONADI_LIB_VERSION "4.79.0")
......
......@@ -906,7 +906,7 @@ void KAEventPrivate::set(const Event::Ptr &event)
mMainExpired = false;
alTime = dateTime;
alTime.setDateOnly(mStartDateTime.isDateOnly());
if (data.alarm->repeatCount() && data.alarm->snoozeTime()) {
if (data.alarm->repeatCount() && !data.alarm->snoozeTime().isNull()) {
mRepetition.set(data.alarm->snoozeTime(), data.alarm->repeatCount()); // values may be adjusted in setRecurrence()
mNextRepeat = data.nextRepeat;
}
......@@ -1075,7 +1075,7 @@ void KAEventPrivate::set(const Event::Ptr &event)
setRepeatAtLoginTrue(false); // clear other incompatible statuses
}
if (mMainExpired && deferralOffset && checkRecur() != KARecurrence::NO_RECUR) {
if (mMainExpired && !deferralOffset.isNull() && checkRecur() != KARecurrence::NO_RECUR) {
// Adjust the deferral time for an expired recurrence, since the
// offset is relative to the first actual occurrence.
DateTime dt = mRecurrence->getNextDateTime(mStartDateTime.addDays(-1).kDateTime());
......@@ -4270,7 +4270,7 @@ void KAEventPrivate::calcNextWorkingTime(const DateTime &nextTrigger) const
const int repeatFreq = mRepetition.intervalDays();
const bool weeklyRepeat = mRepetition && !(repeatFreq % 7);
const Duration interval = mRecurrence->regularInterval();
if ((interval && !(interval.asDays() % 7))
if ((!interval.isNull() && !(interval.asDays() % 7))
|| nDayPos == 1) {
// It recurs on the same day each week
if (!mRepetition || weeklyRepeat) {
......@@ -4732,7 +4732,7 @@ bool KAEventPrivate::mayOccurDailyDuringWork(const KDateTime &kdt) const
}
// Check if it always occurs on the same day of the week
const Duration interval = mRecurrence->regularInterval();
if (interval && interval.isDaily() && !(interval.asDays() % 7)) {
if (!interval.isNull() && interval.isDaily() && !(interval.asDays() % 7)) {
// It recurs weekly
if (!mRepetition || (mRepetition.isDaily() && !(mRepetition.intervalDays() % 7))) {
return false; // any repetitions are also weekly
......
......@@ -34,7 +34,7 @@ public:
Private(const Duration &interval, int count)
: mInterval(interval), mCount(count)
{
if ((!count && interval) || (count && !interval)) {
if ((!count && !interval.isNull()) || (count && interval.isNull())) {
mCount = 0;
mInterval = 0;
}
......@@ -74,7 +74,7 @@ Repetition &Repetition::operator=(const Repetition &other)
void Repetition::set(const Duration &interval, int count)
{
if (!count || !interval) {
if (!count || interval.isNull()) {
d->mCount = 0;
d->mInterval = 0;
} else {
......@@ -87,7 +87,7 @@ void Repetition::set(const Duration &interval)
{
if (d->mCount) {
d->mInterval = interval;
if (!interval) {
if (interval.isNull()) {
d->mCount = 0;
}
}
......
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