Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mkcal] Remove alarms irrespective to timezone for recurrenceId. Cont…
…ributes to JB#50856
  • Loading branch information
dcaliste committed Aug 18, 2020
1 parent ab9497b commit 7b123b1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/extendedstorage.cpp
Expand Up @@ -577,9 +577,6 @@ void ExtendedStorage::clearAlarms(const Incidence::Ptr &incidence)
QMap<QString, QVariant> map;
map["APPLICATION"] = "libextendedkcal";
map["uid"] = incidence->uid();
if (incidence->hasRecurrenceId()) {
map["recurrenceId"] = incidence->recurrenceId().toString();
}

Timed::Interface timed;
if (!timed.isValid()) {
Expand All @@ -599,10 +596,18 @@ void ExtendedStorage::clearAlarms(const Incidence::Ptr &incidence)
const QList<QVariant> &result = reply.value();
for (int i = 0; i < result.size(); i++) {
uint32_t cookie = result[i].toUInt();
if (!incidence->hasRecurrenceId()) {
// We got a list of all alarm matching UID of this incidence
// - single event -> delete the alarm
// - recurring parent event -> the recurs() case, delete if
// recurrenceId attribute is empty (thus invalid KDateTime)
// - recurring exception event -> the hasRecurrenceId() case,
// delete if the recurrenceId attribute is matching in terms of KDateTime.
if (incidence->recurs() || incidence->hasRecurrenceId()) {
QDBusReply<QMap<QString, QVariant> > attributesReply = timed.query_attributes_sync(cookie);
const QMap<QString, QVariant> attributeMap = attributesReply.value();
if (attributeMap.contains("recurrenceId")) {
const QVariant recurrenceId = attributeMap.value("recurrenceId", QVariant(QString()));
KDateTime recid = KDateTime::fromString(recurrenceId.toString(), KDateTime::ISODate);
if (incidence->recurrenceId() != recid) {
continue;
}
}
Expand Down

0 comments on commit 7b123b1

Please sign in to comment.