[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-02-23 16:38:15
Message-ID: 1235407095.530419.3618.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 930484 by dfaure:

Nice bug ;-)
Don't split the kdedirs on '/', split them on ':'... The list contained "home", \
                "dfaure", etc. and people would keep getting the warnings.
CCMAIL: mpyne@purinchu.net


 M  +2 -2      config/kdesktopfile.cpp  
 M  +15 -0     tests/kdesktopfiletest.cpp  
 M  +1 -0      tests/kdesktopfiletest.h  


--- trunk/KDE/kdelibs/kdecore/config/kdesktopfile.cpp #930483:930484
@@ -155,12 +155,12 @@
      return true; // Relative paths are ok.
 
   KStandardDirs *dirs = KGlobal::dirs();
-  QStringList kdePrefixes ( dirs->kfsstnd_prefixes().split(QDir::separator()) );
+  QStringList kdePrefixes( dirs->kfsstnd_prefixes().split(KPATH_SEPARATOR) );
   kdePrefixes += dirs->resourceDirs ("xdgdata-apps");
 
   // Check if the .desktop file is installed as part of KDE or XDG.
   foreach (const QString &prefix, kdePrefixes) {
-    if (!prefix.isEmpty() && path.startsWith(prefix))
+    if (path.startsWith(prefix))
       return true;
   }
 
--- trunk/KDE/kdelibs/kdecore/tests/kdesktopfiletest.cpp #930483:930484
@@ -18,6 +18,7 @@
 #include "kdesktopfiletest.h"
 #include <kconfiggroup.h>
 #include <ktemporaryfile.h>
+#include <kstandarddirs.h>
 #include "kdesktopfiletest.moc"
 
 #include "kdesktopfile.h"
@@ -67,3 +68,17 @@
     QVERIFY(cg.hasKey("Name"));
     QCOMPARE(cg.readEntry("Name"), QString("Encrypt file"));
 }
+
+void KDesktopFileTest::testIsAuthorizedDesktopFile()
+{
+    const QString fileName = QFile::decodeName(KDESRCDIR \
"../../kioslave/http/http_cache_cleaner.desktop"); +    \
QVERIFY(QFile::exists(fileName)); +    \
QVERIFY(!KDesktopFile::isAuthorizedDesktopFile(fileName)); +
+    const QString installedFile = KGlobal::dirs()->locate("services", \
"http_cache_cleaner.desktop"); +    if (!installedFile.isEmpty()) {
+        QVERIFY(KDesktopFile::isAuthorizedDesktopFile(installedFile));
+    } else {
+        qWarning("Skipping test for http_cache_cleaner.desktop, not found. kdelibs \
not installed?"); +    }
+}
--- trunk/KDE/kdelibs/kdecore/tests/kdesktopfiletest.h #930483:930484
@@ -27,6 +27,7 @@
 private Q_SLOTS:
     void testRead();
     void testActionGroup();
+    void testIsAuthorizedDesktopFile();
 
 };
 


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

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