Hello community,

here is the log from the commit of package kdelibs4 for openSUSE:Factory 
checked in at 2013-08-30 11:39:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kdelibs4 (Old)
 and      /work/SRC/openSUSE:Factory/.kdelibs4.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kdelibs4"

Changes:
--------
--- /work/SRC/openSUSE:Factory/kdelibs4/kdelibs4-apidocs.changes        
2013-08-18 22:21:22.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kdelibs4.new/kdelibs4-apidocs.changes   
2013-08-30 11:39:35.000000000 +0200
@@ -1,0 +2,9 @@
+Mon Aug 26 14:54:36 UTC 2013 - hrvoje.sen...@gmail.com
+
+- Added patch from upstream:
+  0003-Fix-reordering-of-apps-for-a-derived-mimetype.patch -- fixes 
+  a bug introduced by 871cccc8a88a60 that made it impossible to 
+  re-order file type associations both in System settings and in 
+  the open with list (kde#321706)
+
+-------------------------------------------------------------------
kdelibs4.changes: same change

New:
----
  0003-Fix-reordering-of-apps-for-a-derived-mimetype.patch

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

Other differences:
------------------
++++++ kdelibs4.spec ++++++
--- /var/tmp/diff_new_pack.YpcH7I/_old  2013-08-30 11:39:36.000000000 +0200
+++ /var/tmp/diff_new_pack.YpcH7I/_new  2013-08-30 11:39:36.000000000 +0200
@@ -108,6 +108,9 @@
 Patch100:       0001-when-the-request-theme-does-not-exist-delete-all-old.patch
 # PATCH-FIX-UPSTREAM 
0002-Fix-crash-when-failing-to-get-audio-CD-block-device.patch -- fixes crash 
when failing to get audio CD block device (kde#314544)
 Patch101:       0002-Fix-crash-when-failing-to-get-audio-CD-block-device.patch
+# PATCH-FIX-UPSTREAM 0003-Fix-reordering-of-apps-for-a-derived-mimetype.patch 
-- fixes a bug introduced by 871cccc8a88a60 that made it impossible to re-order
+# file type associations both in System settings and in the open with list 
(kde#321706)
+Patch102:       0003-Fix-reordering-of-apps-for-a-derived-mimetype.patch
 PreReq:         permissions
 Requires:       soprano >= %( echo `rpm -q --queryformat '%{VERSION}' 
libsoprano-devel`)
 Recommends:     strigi >= %( echo `rpm -q --queryformat '%{VERSION}' 
strigi-devel`)
@@ -174,6 +177,7 @@
 %patch11 -p1
 %patch100 -p1
 %patch101 -p1
+%patch102 -p1
 
 %build
   EXTRA_FLAGS="-DLIB_INSTALL_DIR=%{_kde4_libdir} \

++++++ 0003-Fix-reordering-of-apps-for-a-derived-mimetype.patch ++++++
>From 7f42bf2530090526d0150428fe58b87123317e2e Mon Sep 17 00:00:00 2001
From: David Faure <fa...@kde.org>
Date: Mon, 26 Aug 2013 15:46:22 +0200
Subject: [PATCH 1/1] Fix reordering of apps for a derived mimetype.

This fixes a bug introduced by 871cccc8a88a60 that made it impossible to 
re-order
file type associations both in System settings and in the open with list. Hence
it contains a new way of detecting duplicate (inherited) mimetype entries, that
the original was supposed to fix.

Unittest is in kde-runtime, commit 967979f (if I can commit it fast enough ;)

Patch by Mathias Tillman.
REVIEW: 111951
BUG: 321706
FIXED-IN: 4.11.1
---
 kdecore/services/kservice.cpp | 45 ++++++++++++++++++++++++++++++++++---------
 kded/kbuildservicefactory.cpp |  2 +-
 kded/kmimeassociations.cpp    | 25 ------------------------
 kded/kmimeassociations.h      |  1 -
 4 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/kdecore/services/kservice.cpp b/kdecore/services/kservice.cpp
index 8e81929..d7945bf 100644
--- a/kdecore/services/kservice.cpp
+++ b/kdecore/services/kservice.cpp
@@ -227,17 +227,44 @@ void KServicePrivate::init( const KDesktopFile *config, 
KService* q )
                            << "has an empty mimetype!";
             continue;
         }
-        int initialPreference = m_initialPreference;
-        if ( st_it.hasNext() ) {
-            // TODO better syntax - separate group with mimetype=number 
entries?
-            bool isNumber;
-            const int val = st_it.peekNext().toInt(&isNumber);
-            if (isNumber) {
-                initialPreference = val;
-                st_it.next();
+
+        // The following searches through the list for duplicate, inherited 
mimetypes
+        // For example, if application/rtf and text/plain are both listed 
application/rtf is removed
+        // since it is inherited from text/plain
+        // This is a reworked fix for revision 
871cccc8a88a600c8f850a020d44bfc5f5858caa
+        bool shouldAdd = true;
+        KMimeType::Ptr mimeType1 = 
KMimeTypeRepository::self()->findMimeTypeByName(st);
+        if (mimeType1) {
+            foreach(const QString mime2, lstServiceTypes) {
+                // Don't compare the mimetype with itself
+                if (st == mime2) {
+                    continue;
+                }
+
+                // is checks for inheritance and aliases, so this should 
suffice
+                if (mimeType1->is(mime2)) {
+                    shouldAdd = false;
+                    break;
+                }
             }
         }
-        
m_serviceTypes.push_back(KService::ServiceTypeAndPreference(initialPreference, 
st));
+
+        // Only add unique mimetypes
+        if (shouldAdd) {
+            int initialPreference = m_initialPreference;
+            if (st_it.hasNext()) {
+                // TODO better syntax - separate group with mimetype=number 
entries?
+                bool isNumber;
+                const int val = st_it.peekNext().toInt(&isNumber);
+                if (isNumber) {
+                    initialPreference = val;
+                    st_it.next();
+                }
+            }
+            
m_serviceTypes.push_back(KService::ServiceTypeAndPreference(initialPreference, 
st));
+        } else {
+            //kDebug(servicesDebugArea())<<"Not adding"<<st<<"from"<<entryPath;
+        }
     }
 
     if (entryMap.contains(QLatin1String("Actions"))) {
diff --git a/kded/kbuildservicefactory.cpp b/kded/kbuildservicefactory.cpp
index 7f89a99..5fb091b 100644
--- a/kded/kbuildservicefactory.cpp
+++ b/kded/kbuildservicefactory.cpp
@@ -183,7 +183,7 @@ void KBuildServiceFactory::collectInheritedServices(const 
QString& mimeTypeName,
                 KServiceOffer offer(*itserv);
                 offer.setMimeTypeInheritanceLevel(mimeTypeInheritanceLevel);
                 //kDebug(7021) << "INHERITANCE: Adding service" << 
(*itserv).service()->entryPath() << "to" << mimeTypeName << 
"mimeTypeInheritanceLevel=" << mimeTypeInheritanceLevel;
-                m_offerHash.addInheritedServiceOffer( mimeTypeName, offer );
+                m_offerHash.addServiceOffer( mimeTypeName, offer );
             }
         }
     }
diff --git a/kded/kmimeassociations.cpp b/kded/kmimeassociations.cpp
index b0af7bc..052251d 100644
--- a/kded/kmimeassociations.cpp
+++ b/kded/kmimeassociations.cpp
@@ -137,31 +137,6 @@ void KOfferHash::addServiceOffer(const QString& 
serviceType, const KServiceOffer
     }
 }
 
-void KOfferHash::addInheritedServiceOffer(const QString& serviceType, const 
KServiceOffer& offer)
-{
-    KService::Ptr service = offer.service();
-    //kDebug(7021) << "Adding" << service->entryPath() << "to" << serviceType 
<< offer.preference();
-    ServiceTypeOffersData& data = m_serviceTypeData[serviceType]; // find or 
create
-    QList<KServiceOffer>& offers = data.offers;
-    QSet<KService::Ptr>& offerSet = data.offerSet;
-    if ( !offerSet.contains( service ) ) {
-        offers.append( offer );
-        offerSet.insert( service );
-    } else {
-        // This happens when a desktop file mentions both a base mimetype and 
a derived one.
-        // Example: emacs.desktop: MimeType=text/plain;text/x-csrc;
-        // We want to ignore the derived mimetype, and only keep the base one, 
so that
-        // the user can choose another text/plain editor in mimeapps.list (cf 
xdg-list, jan 2013).
-        QMutableListIterator<KServiceOffer> sfit(data.offers);
-        while (sfit.hasNext()) {
-            if (sfit.next().service() == service) { // we can compare 
KService::Ptrs because they are from the memory hash
-                sfit.remove();
-                sfit.insert( offer );
-            }
-        }
-    }
-}
-
 void KOfferHash::removeServiceOffer(const QString& serviceType, KService::Ptr 
service)
 {
     ServiceTypeOffersData& data = m_serviceTypeData[serviceType]; // find or 
create
diff --git a/kded/kmimeassociations.h b/kded/kmimeassociations.h
index 4a2c713..e8d1612 100644
--- a/kded/kmimeassociations.h
+++ b/kded/kmimeassociations.h
@@ -45,7 +45,6 @@ public:
         return QList<KServiceOffer>();
     }
     void addServiceOffer(const QString& serviceType, const KServiceOffer& 
offer);
-    void addInheritedServiceOffer(const QString& serviceType, const 
KServiceOffer& offer);
     void removeServiceOffer(const QString& serviceType, KService::Ptr service);
     bool hasRemovedOffer(const QString& serviceType, KService::Ptr service) 
const;
 
-- 
1.8.3.4


-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to