[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore
From:       David Faure <faure () kde ! org>
Date:       2009-08-20 21:43:11
Message-ID: 1250804591.253996.19231.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1013849 by dfaure:

Forwardport 1013847 + 1013848.
Fix KMimeType::isDefault which could, well, never work, in the current form.
The docu (which I wrote!) says "Don't ever write code that compares mimetype \
pointers, compare names instead."


 M  +2 -2      services/kmimetype.cpp  
 M  +4 -0      tests/kmimetypetest.cpp  


--- trunk/KDE/kdelibs/kdecore/services/kmimetype.cpp #1013848:1013849
@@ -97,7 +97,7 @@
 
 bool KMimeType::isDefault() const
 {
-    return this == defaultMimeTypePtr().data();
+    return name() == defaultMimeType();
 }
 
 /**
@@ -524,7 +524,7 @@
     QString i = mimeTypeIcon;
 
     // if we don't find an icon, maybe we can use the one for the protocol
-    if ( i == unknown || i.isEmpty() || mt == defaultMimeTypePtr()
+    if ( i == unknown || i.isEmpty() || mt->name() == defaultMimeType()
         // and for the root of the protocol (e.g. trash:/) the protocol icon has \
priority over the mimetype icon  || _url.path().length() <= 1 )
     {
--- trunk/KDE/kdelibs/kdecore/tests/kmimetypetest.cpp #1013848:1013849
@@ -133,6 +133,10 @@
 
     KMimeType::Ptr bzip2 = KMimeType::mimeType("application/x-bzip2", \
KMimeType::ResolveAliases);  QVERIFY( bzip2 );
+
+    KMimeType::Ptr defaultMime = KMimeType::mimeType("application/octet-stream");
+    QVERIFY(defaultMime);
+    QVERIFY(defaultMime->isDefault());
 }
 
 void KMimeTypeTest::testIcons()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic