diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2015-04-06 23:35:42 +0000 |
---|---|---|
committer | CI Train Bot <ci-train-bot@canonical.com> | 2015-04-06 23:35:42 +0000 |
commit | 227aa820086c19279743d502fd5e78cf17144b24 (patch) | |
tree | 9465713567b8af9f8f9762450bb43ae5a39a7fb8 /src/planner-snooze.cpp | |
parent | 9f48c6479a17771597544adc36eac968b9b5c027 (diff) | |
parent | 10c574cc26a4a55d63eed7f3b846efb4d766dd6b (diff) | |
download | ayatana-indicator-datetime-227aa820086c19279743d502fd5e78cf17144b24.tar.gz ayatana-indicator-datetime-227aa820086c19279743d502fd5e78cf17144b24.tar.bz2 ayatana-indicator-datetime-227aa820086c19279743d502fd5e78cf17144b24.zip |
Improve valarm support to honor calendar events' valarm triggers. Fixes: #1419001
Approved by: Ted Gould, PS Jenkins bot
Diffstat (limited to 'src/planner-snooze.cpp')
-rw-r--r-- | src/planner-snooze.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/planner-snooze.cpp b/src/planner-snooze.cpp index 29d5f06..e4062d2 100644 --- a/src/planner-snooze.cpp +++ b/src/planner-snooze.cpp @@ -51,14 +51,18 @@ public: return m_appointments; } - void add(const Appointment& appt_in) + void add(const Appointment& appt_in, const Alarm& alarm) { + // make a copy of the appointment with only this alarm Appointment appt = appt_in; + appt.alarms.clear(); + appt.alarms.push_back(alarm); // reschedule the alarm to go off N minutes from now - const auto alarm_duration_secs = appt.end - appt.begin; - appt.begin = m_clock->localtime().add_full(0,0,0,0,m_settings->snooze_duration.get(),0); - appt.end = appt.begin.add_full(0,0,0,0,0,alarm_duration_secs); + const auto offset = std::chrono::minutes(m_settings->snooze_duration.get()); + appt.begin += offset; + appt.end += offset; + appt.alarms[0].time += offset; // give it a new ID gchar* uid = e_uid_new(); @@ -95,9 +99,9 @@ SnoozePlanner::~SnoozePlanner() } void -SnoozePlanner::add(const Appointment& appointment) +SnoozePlanner::add(const Appointment& appointment, const Alarm& alarm) { - impl->add(appointment); + impl->add(appointment, alarm); } core::Property<std::vector<Appointment>>& |