From kde-commits Mon Feb 23 16:38:15 2009 From: David Faure Date: Mon, 23 Feb 2009 16:38:15 +0000 To: kde-commits Subject: KDE/kdelibs/kdecore Message-Id: <1235407095.530419.3618.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123540711332465 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 #include +#include #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(); };