Hello community,

here is the log from the commit of package kactivities5 for openSUSE:Factory 
checked in at 2016-10-28 12:16:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kactivities5 (Old)
 and      /work/SRC/openSUSE:Factory/.kactivities5.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kactivities5"

Changes:
--------
--- /work/SRC/openSUSE:Factory/kactivities5/kactivities5.changes        
2016-09-14 23:08:43.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kactivities5.new/kactivities5.changes   
2016-10-28 12:16:52.000000000 +0200
@@ -1,0 +2,8 @@
+Sun Oct  2 12:49:35 UTC 2016 - [email protected]
+
+- Update to 5.27.0
+  * Sorting activities in the cache alphabetically by name (kde#362774)
+  * For more details please see:
+    https://www.kde.org/announcements/kde-frameworks-5.27.0.php
+
+-------------------------------------------------------------------

Old:
----
  kactivities-5.26.0.tar.xz

New:
----
  kactivities-5.27.0.tar.xz

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

Other differences:
------------------
++++++ kactivities5.spec ++++++
--- /var/tmp/diff_new_pack.jNC5tk/_old  2016-10-28 12:16:53.000000000 +0200
+++ /var/tmp/diff_new_pack.jNC5tk/_new  2016-10-28 12:16:53.000000000 +0200
@@ -17,9 +17,9 @@
 
 
 %define lname   libKF5Activities5
-%define _tar_path 5.26
+%define _tar_path 5.27
 Name:           kactivities5
-Version:        5.26.0
+Version:        5.27.0
 Release:        0
 %define kf5_version %{version}
 Summary:        KDE Plasma Activities support

++++++ kactivities-5.26.0.tar.xz -> kactivities-5.27.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kactivities-5.26.0/CMakeLists.txt 
new/kactivities-5.27.0/CMakeLists.txt
--- old/kactivities-5.26.0/CMakeLists.txt       2016-09-06 00:14:16.000000000 
+0200
+++ new/kactivities-5.27.0/CMakeLists.txt       2016-10-02 09:44:54.000000000 
+0200
@@ -36,7 +36,7 @@
 
 # Extra CMake stuff
 include(FeatureSummary)
-find_package(ECM 5.26.0  NO_MODULE)
+find_package(ECM 5.27.0  NO_MODULE)
 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake 
Modules." URL 
"https://projects.kde.org/projects/kdesupport/extra-cmake-modules";)
 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND 
FATAL_ON_MISSING_REQUIRED_PACKAGES)
 
@@ -53,8 +53,8 @@
 find_package (Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED COMPONENTS Core DBus)
 
 # KDE Frameworks
-set(KF5_VERSION "5.26.0") # handled by release scripts
-set(KF5_DEP_VERSION "5.26.0") # handled by release scripts
+set(KF5_VERSION "5.27.0") # handled by release scripts
+set(KF5_DEP_VERSION "5.27.0") # handled by release scripts
 
 # Basic includes
 include (CPack)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kactivities-5.26.0/src/common/dbus/org.kde.ActivityManager.Activities.h 
new/kactivities-5.27.0/src/common/dbus/org.kde.ActivityManager.Activities.h
--- old/kactivities-5.26.0/src/common/dbus/org.kde.ActivityManager.Activities.h 
2016-09-06 00:14:16.000000000 +0200
+++ new/kactivities-5.27.0/src/common/dbus/org.kde.ActivityManager.Activities.h 
2016-10-02 09:44:54.000000000 +0200
@@ -46,16 +46,6 @@
         , state(state)
     {
     }
-
-    bool operator<(const ActivityInfo &other) const
-    {
-        return id < other.id;
-    }
-
-    bool operator==(const ActivityInfo &other) const
-    {
-        return id == other.id;
-    }
 };
 
 typedef QList<ActivityInfo> ActivityInfoList;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kactivities-5.26.0/src/lib/activitiescache_p.cpp 
new/kactivities-5.27.0/src/lib/activitiescache_p.cpp
--- old/kactivities-5.26.0/src/lib/activitiescache_p.cpp        2016-09-06 
00:14:16.000000000 +0200
+++ new/kactivities-5.27.0/src/lib/activitiescache_p.cpp        2016-10-02 
09:44:54.000000000 +0200
@@ -122,8 +122,10 @@
 {
     // qDebug() << "Removing the activity";
 
-    auto where = std::lower_bound(m_activities.begin(), m_activities.end(),
-                                  ActivityInfo(id));
+    // Since we are sorting the activities by name now,
+    // we can not use lower_bound to search for an activity
+    // with a specified id
+    const auto where = find(id);
 
     if (where != m_activities.end() && where->id == id) {
         m_activities.erase(where);
@@ -166,7 +168,7 @@
 
 void ActivitiesCache::updateActivityState(const QString &id, int state)
 {
-    auto where = find<Mutable>(id);
+    auto where = getInfo<Mutable>(id);
 
     if (where && where->state != state) {
         auto isInvalid = [](int state) {
@@ -234,20 +236,27 @@
 {
     // qDebug() << "Setting activity info" << info.id;
 
-    auto where
-        = std::lower_bound(m_activities.begin(), m_activities.end(), info);
+    // Are we updating an existing activity, or adding a new one?
+    const auto iter = find(info.id);
+    const auto present = iter != m_activities.end();
 
-    if (where == m_activities.end() || where->id != info.id) {
-        // We haven't found the activity with the specified id.
-        // This means it is a new activity.
-        m_activities.insert(where, info);
-        emit activityAdded(info.id);
-        emit activityListChanged();
+    // If there is an activity with the specified id,
+    // we are going to remove it, temporarily.
+    if (present) {
+        m_activities.erase(iter);
+    }
 
-    } else {
-        // An existing activity changed
-        *where = info;
+    // Now, we need to find where to insert the activity
+    // and keep the cache sorted by name
+    const auto where = lower_bound(info);
+
+    m_activities.insert(where, info);
+
+    if (present) {
         emit activityChanged(info.id);
+    } else {
+        emit activityAdded(info.id);
+        emit activityListChanged();
     }
 }
 
@@ -255,7 +264,7 @@
     void ActivitiesCache::setActivity##WHAT(const QString &id,                 
\
                                             const QString &value)              
\
     {                                                                          
\
-        auto where = find<Mutable>(id);                                        
\
+        auto where = getInfo<Mutable>(id);                                     
\
                                                                                
\
         if (where) {                                                           
\
             where->What = value;                                               
\
@@ -277,12 +286,12 @@
 
     ActivityInfoList activities = _activities;
 
-    qSort(activities.begin(), activities.end());
-
     foreach (const ActivityInfo &info, activities) {
         m_activities << info;
     }
 
+    std::sort(m_activities.begin(), m_activities.end(), &infoLessThan);
+
     m_status = Consumer::Running;
     emit serviceStatusChanged(m_status);
     emit activityListChanged();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kactivities-5.26.0/src/lib/activitiescache_p.h 
new/kactivities-5.27.0/src/lib/activitiescache_p.h
--- old/kactivities-5.26.0/src/lib/activitiescache_p.h  2016-09-06 
00:14:16.000000000 +0200
+++ new/kactivities-5.27.0/src/lib/activitiescache_p.h  2016-10-02 
09:44:54.000000000 +0200
@@ -83,25 +83,41 @@
     template <typename _Result, typename _Functor>
     void passInfoFromReply(QDBusPendingCallWatcher *watcher, _Functor f);
 
-    template <int Policy = kamd::utils::Const>
-    inline typename kamd::utils::ptr_to<ActivityInfo, Policy>::type
-    find(const ActivityInfo &info)
+    static
+    bool infoLessThan(const ActivityInfo &info, const ActivityInfo &other)
     {
-        auto where
-            = std::lower_bound(m_activities.begin(), m_activities.end(), info);
+        const auto comp =
+            QString::compare(info.name, other.name, Qt::CaseInsensitive);
+        return comp < 0 || (comp == 0 && info.id < other.id);
+    }
 
-        if (where != m_activities.end() && where->id == info.id) {
-            return &(*where);
-        }
+    ActivityInfoList::iterator
+    find(const QString &id)
+    {
+        return std::find_if(m_activities.begin(), m_activities.end(),
+                            [&id] (const ActivityInfo &info) {
+                                return info.id == id;
+                            });
+    }
 
-        return Q_NULLPTR;
+    ActivityInfoList::iterator
+    lower_bound(const ActivityInfo &info)
+    {
+        return std::lower_bound(m_activities.begin(), m_activities.end(),
+                                info, &infoLessThan);
     }
 
     template <int Policy = kamd::utils::Const>
     inline typename kamd::utils::ptr_to<ActivityInfo, Policy>::type
-    find(const QString &id)
+    getInfo(const QString &id)
     {
-        return find<Policy>(ActivityInfo(id));
+        const auto where = find(id);
+
+        if (where != m_activities.end()) {
+            return &(*where);
+        }
+
+        return Q_NULLPTR;
     }
 
     template <typename TargetSlot>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kactivities-5.26.0/src/lib/debug_p.cpp 
new/kactivities-5.27.0/src/lib/debug_p.cpp
--- old/kactivities-5.26.0/src/lib/debug_p.cpp  2016-09-06 00:14:16.000000000 
+0200
+++ new/kactivities-5.27.0/src/lib/debug_p.cpp  2016-10-02 09:44:54.000000000 
+0200
@@ -21,9 +21,5 @@
 
 #include "debug_p.h"
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
 // logging category for this framework, default: log stuff >= warning
 Q_LOGGING_CATEGORY(KAMD_CORELIB, "org.kde.kactivities.lib.core", QtWarningMsg)
-#else
-Q_LOGGING_CATEGORY(KAMD_CORELIB, "org.kde.kactivities.lib.core")
-#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kactivities-5.26.0/src/lib/info.cpp 
new/kactivities-5.27.0/src/lib/info.cpp
--- old/kactivities-5.26.0/src/lib/info.cpp     2016-09-06 00:14:16.000000000 
+0200
+++ new/kactivities-5.27.0/src/lib/info.cpp     2016-10-02 09:44:54.000000000 
+0200
@@ -161,7 +161,7 @@
 {
     if (d->cache->m_status == Consumer::Unknown) return Info::Unknown;
 
-    auto info = d->cache->find(d->id);
+    auto info = d->cache->getInfo(d->id);
 
     if (!info) return Info::Invalid;
 
@@ -205,7 +205,7 @@
 #define CREATE_GETTER(What)                                                    
\
     QString Info::What() const                                                 
\
     {                                                                          
\
-        auto info = d->cache->find(d->id);                                     
\
+        auto info = d->cache->getInfo(d->id);                                  
\
         return info ? info->What : QString();                                  
\
     }
 


Reply via email to