Skip to content

Commit

Permalink
Merge branch 'custom' into 'master'
Browse files Browse the repository at this point in the history
Don't override recurrence rules when they are complex

See merge request mer-core/nemo-qml-plugin-calendar!57
  • Loading branch information
pvuorela committed Jun 4, 2020
2 parents c8c824f + 8bdb77b commit 0cd9e2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/calendarutils.cpp
Expand Up @@ -47,6 +47,7 @@
#include <QFile>
#include <QUrl>
#include <QString>
#include <QBitArray>
#include <QByteArray>
#include <QtDebug>

Expand All @@ -63,9 +64,9 @@ CalendarEvent::Recur CalendarUtils::convertRecurrence(const KCalCore::Event::Ptr

if (rt == KCalCore::Recurrence::rDaily && freq == 1) {
return CalendarEvent::RecurDaily;
} else if (rt == KCalCore::Recurrence::rWeekly && freq == 1) {
} else if (rt == KCalCore::Recurrence::rWeekly && freq == 1 && event->recurrence()->days().count(true) == 0) {
return CalendarEvent::RecurWeekly;
} else if (rt == KCalCore::Recurrence::rWeekly && freq == 2) {
} else if (rt == KCalCore::Recurrence::rWeekly && freq == 2 && event->recurrence()->days().count(true) == 0) {
return CalendarEvent::RecurBiweekly;
} else if (rt == KCalCore::Recurrence::rMonthlyDay && freq == 1) {
return CalendarEvent::RecurMonthly;
Expand Down
6 changes: 1 addition & 5 deletions src/calendarworker.cpp
Expand Up @@ -342,11 +342,6 @@ bool CalendarWorker::setRecurrence(KCalCore::Event::Ptr &event, CalendarEvent::R

CalendarEvent::Recur oldRecur = CalendarUtils::convertRecurrence(event);

if (recur == CalendarEvent::RecurCustom) {
qWarning() << "Cannot assign RecurCustom, will assing RecurOnce";
recur = CalendarEvent::RecurOnce;
}

if (recur == CalendarEvent::RecurOnce)
event->recurrence()->clear();

Expand All @@ -370,6 +365,7 @@ bool CalendarWorker::setRecurrence(KCalCore::Event::Ptr &event, CalendarEvent::R
event->recurrence()->setYearly(1);
break;
case CalendarEvent::RecurCustom:
// Unable to handle the recurrence rules, keep the existing ones.
break;
}
return true;
Expand Down

0 comments on commit 0cd9e2b

Please sign in to comment.