Skip to content

Commit

Permalink
[nemo-qml-plugin-calendar] Quantize alarm time for display. Contribut…
Browse files Browse the repository at this point in the history
…es to JB#33108

Previously the code required the alarm time to be specific values
or it would be displayed as ReminderNone (i.e. no reminder) in the
calendar UI.

This commit ensures that we quantize the alarm time to one of the
specific values for display, as arbitrary times can be set if the
event comes from e.g. sync rather than created on the device.
  • Loading branch information
Chris Adams committed Jan 8, 2019
1 parent 41b2867 commit edda2b8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/calendarutils.cpp
Expand Up @@ -120,24 +120,24 @@ NemoCalendarEvent::Reminder NemoCalendarUtils::getReminder(const KCalCore::Event
return NemoCalendarEvent::ReminderNone;
}

switch (sec) {
case 0:
if (sec >= 0) {
return NemoCalendarEvent::ReminderTime;
case -5 * 60:
} else if (sec >= (-5 * 60)) {
return NemoCalendarEvent::Reminder5Min;
case -15 * 60:
} else if (sec >= (-15 * 60)) {
return NemoCalendarEvent::Reminder15Min;
case -30 * 60:
} else if (sec >= (-30 * 60)) {
return NemoCalendarEvent::Reminder30Min;
case -60 * 60:
} else if (sec >= (-60 * 60)) {
return NemoCalendarEvent::Reminder1Hour;
case -2 * 60 * 60:
} else if (sec >= (-2 * 60 * 60)) {
return NemoCalendarEvent::Reminder2Hour;
case -24 * 60 * 60:
} else if (sec >= (-24 * 60 * 60)) {
return NemoCalendarEvent::Reminder1Day;
case -2 * 24 * 60 * 60:
} else if (sec >= (-2 * 24 * 60 * 60)
&& sec <= (-3 * 24 * 60 * 60)) {
return NemoCalendarEvent::Reminder2Day;
default:
} else {
return NemoCalendarEvent::ReminderNone;
}
}
Expand Down

0 comments on commit edda2b8

Please sign in to comment.