Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kcalendarcore for openSUSE:Factory 
checked in at 2021-02-17 18:10:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kcalendarcore (Old)
 and      /work/SRC/openSUSE:Factory/.kcalendarcore.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kcalendarcore"

Wed Feb 17 18:10:17 2021 rev:16 rq:871672 version:5.79.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/kcalendarcore/kcalendarcore.changes      
2021-01-13 18:17:11.252986345 +0100
+++ /work/SRC/openSUSE:Factory/.kcalendarcore.new.28504/kcalendarcore.changes   
2021-02-17 18:11:32.277940504 +0100
@@ -1,0 +2,12 @@
+Mon Feb  8 08:46:02 UTC 2021 - Christophe Giboudeaux <[email protected]>
+
+- Update to 5.79.0
+  * New feature release
+  * For more details please see:
+  * https://kde.org/announcements/kde-frameworks-5.79.0
+- Changes since 5.78.0:
+  * Unregister MemoryCalendar as an observer when deleting an incidence.
+  * Use the recurrenceId to delete the right occurrence.
+  * Also clear notebook associations when closing a MemoryCalendar.
+
+-------------------------------------------------------------------

Old:
----
  kcalendarcore-5.78.0.tar.xz
  kcalendarcore-5.78.0.tar.xz.sig

New:
----
  kcalendarcore-5.79.0.tar.xz
  kcalendarcore-5.79.0.tar.xz.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kcalendarcore.spec ++++++
--- /var/tmp/diff_new_pack.unKZz5/_old  2021-02-17 18:11:33.045941132 +0100
+++ /var/tmp/diff_new_pack.unKZz5/_new  2021-02-17 18:11:33.049941135 +0100
@@ -16,14 +16,14 @@
 #
 
 
-%define _tar_path 5.78
+%define _tar_path 5.79
 # Full KF5 version (e.g. 5.33.0)
 %{!?_kf5_version: %global _kf5_version %{version}}
 # Last major and minor KF5 version (e.g. 5.33)
 %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | 
awk -F. '{print $1"."$2}')}
 %bcond_without lang
 Name:           kcalendarcore
-Version:        5.78.0
+Version:        5.79.0
 Release:        0
 Summary:        Library to access and handle calendar data
 License:        LGPL-2.0-or-later


++++++ kcalendarcore-5.78.0.tar.xz -> kcalendarcore-5.79.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/.gitignore 
new/kcalendarcore-5.79.0/.gitignore
--- old/kcalendarcore-5.78.0/.gitignore 2021-01-02 13:22:00.000000000 +0100
+++ new/kcalendarcore-5.79.0/.gitignore 2021-01-30 18:40:29.000000000 +0100
@@ -18,3 +18,4 @@
 CMakeLists.txt.user*
 *.unc-backup*
 .cmake/
+/.clang-format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/CMakeLists.txt 
new/kcalendarcore-5.79.0/CMakeLists.txt
--- old/kcalendarcore-5.78.0/CMakeLists.txt     2021-01-02 13:22:00.000000000 
+0100
+++ new/kcalendarcore-5.79.0/CMakeLists.txt     2021-01-30 18:40:29.000000000 
+0100
@@ -1,11 +1,11 @@
 cmake_minimum_required(VERSION 3.5)
-set(KF5_VERSION "5.78.0") # handled by release scripts
+set(KF_VERSION "5.79.0") # handled by release scripts
 
-project(KCalendarCore VERSION ${KF5_VERSION})
+project(KCalendarCore VERSION ${KF_VERSION})
 
 # ECM setup
 include(FeatureSummary)
-find_package(ECM 5.78.0  NO_MODULE)
+find_package(ECM 5.79.0  NO_MODULE)
 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake 
Modules." URL "https://commits.kde.org/extra-cmake-modules";)
 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND 
FATAL_ON_MISSING_REQUIRED_PACKAGES)
 
@@ -37,7 +37,7 @@
   cmake_policy(SET CMP0053 NEW)
 endif()
 
-set(KCALENDARCORE_LIB_VERSION ${KF5_VERSION})
+set(KCALENDARCORE_LIB_VERSION ${KF_VERSION})
 ecm_setup_version(PROJECT VARIABLE_PREFIX KCALENDARCORE
   VERSION_HEADER "${KCalendarCore_BINARY_DIR}/kcalendarcore_version.h"
   PACKAGE_VERSION_FILE 
"${KCalendarCore_BINARY_DIR}/KF5CalendarCoreConfigVersion.cmake"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kcalendarcore-5.78.0/autotests/testmemorycalendar.cpp 
new/kcalendarcore-5.79.0/autotests/testmemorycalendar.cpp
--- old/kcalendarcore-5.78.0/autotests/testmemorycalendar.cpp   2021-01-02 
13:22:00.000000000 +0100
+++ new/kcalendarcore-5.79.0/autotests/testmemorycalendar.cpp   2021-01-30 
18:40:29.000000000 +0100
@@ -18,6 +18,35 @@
 
 using namespace KCalendarCore;
 
+void MemoryCalendarTest::testClose()
+{
+    MemoryCalendar::Ptr cal(new MemoryCalendar(QTimeZone::utc()));
+
+    Event::Ptr event1(new Event);
+    cal->addIncidence(event1);
+
+    const QString nbuid = QString::fromLatin1("test-notebook");
+    QVERIFY(cal->addNotebook(nbuid, true));
+
+    Event::Ptr event2(new Event);
+    cal->addIncidence(event2);
+    cal->setNotebook(event2, nbuid);
+
+    QCOMPARE(cal->incidences().count(), 2);
+    QVERIFY(cal->instance(event1->instanceIdentifier()));
+    QVERIFY(cal->instance(event2->instanceIdentifier()));
+    QVERIFY(cal->event(event1->uid()));
+    QVERIFY(cal->event(event2->uid()));
+    QCOMPARE(cal->incidences(nbuid).count(), 1);
+
+    cal->close();
+
+    QVERIFY(!cal->event(event1->uid()));
+    QVERIFY(!cal->event(event2->uid()));
+    QVERIFY(cal->incidences().isEmpty());
+    QVERIFY(cal->incidences(nbuid).isEmpty());
+}
+
 void MemoryCalendarTest::testValidity()
 {
     MemoryCalendar::Ptr cal(new MemoryCalendar(QTimeZone::utc()));
@@ -375,3 +404,47 @@
 
     cal->close();
 }
+
+void MemoryCalendarTest::testDeleteIncidence()
+{
+    MemoryCalendar::Ptr cal(new MemoryCalendar(QTimeZone::utc()));
+
+    Event::Ptr event = Event::Ptr(new Event());
+    event->setDtStart(QDateTime(QDate(2021, 1, 4), QTime(10, 13),
+                                QTimeZone("Europe/Paris")));
+
+    QVERIFY(cal->addEvent(event));
+    QVERIFY(cal->instance(event->instanceIdentifier()));
+
+    QVERIFY(cal->deleteIncidence(event));
+    QVERIFY(cal->instance(event->instanceIdentifier()).isNull());
+
+    event->recurrence()->setDaily(1);
+    event->recurrence()->setDuration(3);
+    QVERIFY(cal->addEvent(event));
+    QVERIFY(cal->instance(event->instanceIdentifier()));
+
+    Event::Ptr exception = Event::Ptr(event->clone());
+    exception->recurrence()->clear();
+    exception->setRecurrenceId(event->dtStart().addDays(1));
+    exception->setDtStart(event->dtStart().addDays(1).addSecs(3600));
+    QVERIFY(cal->addEvent(exception));
+    QVERIFY(cal->instance(exception->instanceIdentifier()));
+
+    Event::Ptr exception2 = Event::Ptr(event->clone());
+    exception2->recurrence()->clear();
+    exception2->setRecurrenceId(event->dtStart().addDays(2));
+    exception2->setDtStart(event->dtStart().addDays(2).addSecs(-3600));
+    QVERIFY(cal->addEvent(exception2));
+    QVERIFY(cal->instance(exception2->instanceIdentifier()));
+
+    QVERIFY(cal->deleteIncidence(exception));
+    QVERIFY(cal->incidence(event->uid(), exception->recurrenceId()).isNull());
+    QVERIFY(!cal->deleteIncidence(exception));
+    QVERIFY(cal->incidence(event->uid(), exception2->recurrenceId()));
+    QVERIFY(cal->incidence(event->uid()));
+
+    QVERIFY(cal->deleteIncidence(event));
+    QVERIFY(cal->incidence(event->uid(), exception2->recurrenceId()).isNull());
+    QVERIFY(cal->incidence(event->uid()).isNull());
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/autotests/testmemorycalendar.h 
new/kcalendarcore-5.79.0/autotests/testmemorycalendar.h
--- old/kcalendarcore-5.78.0/autotests/testmemorycalendar.h     2021-01-02 
13:22:00.000000000 +0100
+++ new/kcalendarcore-5.79.0/autotests/testmemorycalendar.h     2021-01-30 
18:40:29.000000000 +0100
@@ -15,6 +15,7 @@
 {
     Q_OBJECT
 private Q_SLOTS:
+    void testClose();
     void testValidity();
     void testInvalidTimeZone();
     void testEvents();
@@ -25,6 +26,7 @@
     void testRawEvents();
     void testRawEventsForDate();
     void testVisibility();
+    void testDeleteIncidence();
 };
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/src/CMakeLists.txt 
new/kcalendarcore-5.79.0/src/CMakeLists.txt
--- old/kcalendarcore-5.78.0/src/CMakeLists.txt 2021-01-02 13:22:00.000000000 
+0100
+++ new/kcalendarcore-5.79.0/src/CMakeLists.txt 2021-01-30 18:40:29.000000000 
+0100
@@ -53,7 +53,7 @@
 ecm_generate_export_header(KF5CalendarCore
     BASE_NAME kcalendarcore
     GROUP_BASE_NAME KF
-    VERSION ${KF5_VERSION}
+    VERSION ${KF_VERSION}
     DEPRECATED_BASE_VERSION 0
     DEPRECATION_VERSIONS 5.64
     EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/src/calendar.cpp 
new/kcalendarcore-5.79.0/src/calendar.cpp
--- old/kcalendarcore-5.78.0/src/calendar.cpp   2021-01-02 13:22:00.000000000 
+0100
+++ new/kcalendarcore-5.79.0/src/calendar.cpp   2021-01-30 18:40:29.000000000 
+0100
@@ -227,7 +227,7 @@
     } else {
         d->mFilter = d->mDefaultFilter;
     }
-    emit filterChanged();
+    Q_EMIT filterChanged();
 }
 
 CalFilter *Calendar::filter() const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/src/icalformat_p.cpp 
new/kcalendarcore-5.79.0/src/icalformat_p.cpp
--- old/kcalendarcore-5.78.0/src/icalformat_p.cpp       2021-01-02 
13:22:00.000000000 +0100
+++ new/kcalendarcore-5.79.0/src/icalformat_p.cpp       2021-01-30 
18:40:29.000000000 +0100
@@ -1820,11 +1820,7 @@
             // We can't change that -- in order to retain backwards 
compatibility.
             text = icalproperty_get_categories(p);
             const QString val = QString::fromUtf8(text);
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
-            const QStringList lstVal = val.split(QLatin1Char(','), 
QString::SkipEmptyParts);
-#else
             const QStringList lstVal = val.split(QLatin1Char(','), 
Qt::SkipEmptyParts);
-#endif
             for (const QString &cat : lstVal) {
                 // ensure no duplicates
                 if (!categories.contains(cat)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.78.0/src/memorycalendar.cpp 
new/kcalendarcore-5.79.0/src/memorycalendar.cpp
--- old/kcalendarcore-5.78.0/src/memorycalendar.cpp     2021-01-02 
13:22:00.000000000 +0100
+++ new/kcalendarcore-5.79.0/src/memorycalendar.cpp     2021-01-30 
18:40:29.000000000 +0100
@@ -89,6 +89,10 @@
                              IncidenceBase::IncidenceType type,
                              const QDateTime &recurrenceId = {}) const;
 
+    bool deleteIncidence(const QString &uid,
+                         IncidenceBase::IncidenceType type,
+                         const QDateTime &recurrenceId = {});
+
     Incidence::Ptr deletedIncidence(const QString &uid,
                                     const QDateTime &recurrenceId,
                                     IncidenceBase::IncidenceType type) const;
@@ -196,6 +200,8 @@
         table.clear();
     }
 
+    clearNotebookAssociations();
+
     setModified(false);
 
     setObserversEnabled(true);
@@ -207,54 +213,75 @@
     // relations is an Incidence's property, not a Todo's, so
     // we remove relations in deleteIncidence, not in deleteTodo.
     removeRelations(incidence);
+    // Notify while the incidence is still available,
+    // this is necessary so korganizer still has time to query for exceptions
+    notifyIncidenceAboutToBeDeleted(incidence);
+    incidence->unRegisterObserver(this);
     const Incidence::IncidenceType type = incidence->type();
-    const QString uid = incidence->uid();
-    auto incidenceIt = d->mIncidences[type].constFind(uid);
-    if (incidenceIt != d->mIncidences[type].cend()) {
-        // Notify while the incidence is still available,
-        // this is necessary so korganizer still has time to query for 
exceptions
-        notifyIncidenceAboutToBeDeleted(incidence);
-
-        d->mIncidences[type].erase(incidenceIt);
-        d->mIncidencesByIdentifier.remove(incidence->instanceIdentifier());
+    const QString &uid = incidence->uid();
+    bool deleted = d->deleteIncidence(uid, type, incidence->recurrenceId());
+    if (deleted) {
         setModified(true);
         if (deletionTracking()) {
             d->mDeletedIncidences[type].insert(uid, incidence);
         }
 
-        const QDateTime dt = 
incidence->dateTime(Incidence::RoleCalendarHashing);
-        if (dt.isValid()) {
-            
d->mIncidencesForDate[type].remove(dt.toTimeZone(timeZone()).date(), incidence);
-        }
         // Delete child-incidences.
-        if (!incidence->hasRecurrenceId()) {
+        if (!incidence->hasRecurrenceId() && incidence->recurs()) {
             deleteIncidenceInstances(incidence);
         }
-        notifyIncidenceDeleted(incidence);
-        return true;
     } else {
         qCWarning(KCALCORE_LOG) << incidence->typeStr() << " not found. uid=" 
<< uid;
-        return false;
     }
+    notifyIncidenceDeleted(incidence);
+    return deleted;
 }
 
 bool MemoryCalendar::deleteIncidenceInstances(const Incidence::Ptr &incidence)
 {
-    d->forIncidences<Incidence>(d->mIncidences[incidence->type()], 
incidence->uid(), [this](const Incidence::Ptr &incidence) {
-        if (incidence->hasRecurrenceId()) {
+    Incidence::List instances;
+    for (auto it = 
d->mIncidences[incidence->type()].constFind(incidence->uid()), end = 
d->mIncidences[incidence->type()].constEnd(); it != end && it.key() == 
incidence->uid(); ++it) {
+        if (it.value()->hasRecurrenceId()) {
             qCDebug(KCALCORE_LOG) << "deleting child"
                                   << ", type=" << int(incidence->type())
                                   << ", uid=" << incidence->uid()
 //                   << ", start=" << i->dtStart()
                                   << " from calendar";
-            deleteIncidence(incidence);
+            // Don't call deleteIncidence() now since it's modifying the
+            // mIncidences map we're iterating over.
+            instances.append(it.value());
         }
-    });
+    }
+    for (Incidence::Ptr instance : instances) {
+        deleteIncidence(instance);
+    }
 
     return true;
 }
 
 //@cond PRIVATE
+bool MemoryCalendar::Private::deleteIncidence(const QString &uid,
+                                              IncidenceBase::IncidenceType 
type,
+                                              const QDateTime &recurrenceId)
+{
+    for (auto it = mIncidences[type].find(uid), end = mIncidences[type].end(); 
it != end && it.key() == uid; ++it) {
+        Incidence::Ptr incidence = it.value();
+        if (recurrenceId.isNull() && incidence->hasRecurrenceId()) {
+            continue;
+        } else if (!recurrenceId.isNull() && (!incidence->hasRecurrenceId() || 
recurrenceId != incidence->recurrenceId())) {
+            continue;
+        }
+        mIncidences[type].erase(it);
+        mIncidencesByIdentifier.remove(incidence->instanceIdentifier());
+        const QDateTime dt = 
incidence->dateTime(Incidence::RoleCalendarHashing);
+        if (dt.isValid()) {
+            
mIncidencesForDate[type].remove(dt.toTimeZone(q->timeZone()).date(), incidence);
+        }
+        return true;
+    }
+    return false;
+}
+
 void MemoryCalendar::Private::deleteAllIncidences(Incidence::IncidenceType 
incidenceType)
 {
     for (auto &incidence : mIncidences[incidenceType]) {

Reply via email to