diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2017-11-07 13:47:01 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2017-12-06 13:01:02 +0300 |
commit | d328dd6ac7250c4453ff2dc5d8c9c13ac3b236bc (patch) | |
tree | 5484afd2cf320fac9eb93996bf1f3febad16b312 | |
parent | e5dbb80ab44f38fec3a5eb5e1d9a2057c0521282 (diff) | |
download | kconfig-d328dd6ac7250c4453ff2dc5d8c9c13ac3b236bc.tar.gz kconfig-d328dd6ac7250c4453ff2dc5d8c9c13ac3b236bc.tar.bz2 |
Fix the result of KDesktopFile::sortOrder()
Summary:
KDesktopFile::sortOrder() returns the value of SortOrder key
as a string whithout parsing it as a list.
But according to Desktop Entry Specification
https://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
it's type is "string(s)", i.e. the same type as the type of
Actions and MimeType keys, and thus it should be read the same way.
Reviewers: #frameworks, dfaure
Reviewed By: dfaure
Subscribers: dfaure, #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D8689
-rw-r--r-- | autotests/kdesktopfiletest.cpp | 19 | ||||
-rw-r--r-- | autotests/kdesktopfiletest.h | 1 | ||||
-rw-r--r-- | src/core/kdesktopfile.cpp | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp index 66fc8827..d0a0a262 100644 --- a/autotests/kdesktopfiletest.cpp +++ b/autotests/kdesktopfiletest.cpp @@ -62,6 +62,25 @@ void KDesktopFileTest::testRead() QCOMPARE(df.fileName(), QFileInfo(fileName).canonicalFilePath()); } +void KDesktopFileTest::testReadDirectory() +{ + QTemporaryFile file("testReadDirectoryXXXXXX.directory"); + QVERIFY(file.open()); + const QString fileName = file.fileName(); + QTextStream ts(&file); + ts << + "[Desktop Entry]\n" + "Type=Directory\n" + "SortOrder=2.desktop;1.desktop;\n" + "\n"; + file.close(); + QVERIFY(QFile::exists(fileName)); + KDesktopFile df(fileName); + QCOMPARE(df.readType(), QString::fromLatin1("Directory")); + QCOMPARE(df.sortOrder(), QStringList() << QString::fromLatin1("2.desktop") + << QString::fromLatin1("1.desktop")); +} + void KDesktopFileTest::testReadLocalized_data() { QTest::addColumn<QLocale>("locale"); diff --git a/autotests/kdesktopfiletest.h b/autotests/kdesktopfiletest.h index ed6679a2..f63edd0d 100644 --- a/autotests/kdesktopfiletest.h +++ b/autotests/kdesktopfiletest.h @@ -27,6 +27,7 @@ class KDesktopFileTest : public QObject private Q_SLOTS: void initTestCase(); void testRead(); + void testReadDirectory(); void testReadLocalized_data(); void testReadLocalized(); void testUnsuccessfulTryExec(); diff --git a/src/core/kdesktopfile.cpp b/src/core/kdesktopfile.cpp index 52a97ec7..8d53ece4 100644 --- a/src/core/kdesktopfile.cpp +++ b/src/core/kdesktopfile.cpp @@ -330,7 +330,7 @@ QStringList KDesktopFile::sortOrder() const { Q_D(const KDesktopFile); - return d->desktopGroup.readEntry("SortOrder", QStringList()); + return d->desktopGroup.readXdgListEntry("SortOrder"); } //void KDesktopFile::virtual_hook( int id, void* data ) |