forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kde-frameworks/kconfig: Add fix for relativePath
Package-Manager: Portage-2.3.3, Repoman-2.3.1
- Loading branch information
Showing
2 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
kde-frameworks/kconfig/files/kconfig-5.33.0-relativePath.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
commit 3ad00c4e56eb9fe6ea7386f8ca1db6e15c26ac11 | ||
Author: Wolfgang Bauer <[email protected]> | ||
Date: Tue Apr 25 23:37:11 2017 +0200 | ||
|
||
Fix relativePath calculation in KDesktopFile::locateLocal() | ||
|
||
The "dir" and "path" variables were obviously swapped here by mistake. | ||
This resulted in the relativePath always being empty, and made the | ||
function return "~/.local/share/" (or "~/.config/") instead of the | ||
correct path. | ||
|
||
BUG: 345100 | ||
FIXED-IN: 5.34.0 | ||
Differential Revision: https://phabricator.kde.org/D5502 | ||
|
||
diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp | ||
index 393a6a0..a046196 100644 | ||
--- a/autotests/kdesktopfiletest.cpp | ||
+++ b/autotests/kdesktopfiletest.cpp | ||
@@ -255,3 +255,34 @@ void KDesktopFileTest::testTryExecWithAuthorizeAction() | ||
QVERIFY(!desktopFile.tryExec()); | ||
} | ||
} | ||
+ | ||
+void KDesktopFileTest::testLocateLocal_data() | ||
+{ | ||
+ QString systemConfigLocation = QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation).last(); | ||
+ QString writableConfigLocation = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); | ||
+ QString systemDataLocation = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).last(); | ||
+ QString writableDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); | ||
+ | ||
+ QTest::addColumn<QString>("path"); | ||
+ QTest::addColumn<QString>("result"); | ||
+ | ||
+ QTest::newRow("configLocation, system-wide") << systemConfigLocation + "/test.desktop" << writableConfigLocation + "/test.desktop"; | ||
+ QTest::newRow("autostart, system-wide") << systemConfigLocation + "/autostart/test.desktop" << writableConfigLocation + "/autostart/test.desktop"; | ||
+ QTest::newRow("dataLocation, system-wide") << systemDataLocation + "/test.desktop" << writableDataLocation + "/test.desktop"; | ||
+ QTest::newRow("applications, system-wide") << systemDataLocation + "/applications/test.desktop" << writableDataLocation + "/applications/test.desktop"; | ||
+ QTest::newRow("desktop-directories, system-wide") << systemDataLocation + "/desktop-directories/test.directory" << writableDataLocation + "/desktop-directories/test.directory"; | ||
+ QTest::newRow("configLocation, writable") << writableConfigLocation + "/test.desktop" << writableConfigLocation + "/test.desktop"; | ||
+ QTest::newRow("autostart, writable") << writableConfigLocation + "/autostart/test.desktop" << writableConfigLocation + "/autostart/test.desktop"; | ||
+ QTest::newRow("dataLocation, writable") << writableDataLocation + "/test.desktop" << writableDataLocation + "/test.desktop"; | ||
+ QTest::newRow("applications, writable") << writableDataLocation + "/applications/test.desktop" << writableDataLocation + "/applications/test.desktop"; | ||
+ QTest::newRow("desktop-directories, writable") << writableDataLocation + "/desktop-directories/test.directory" << writableDataLocation + "/desktop-directories/test.directory"; | ||
+ QTest::newRow("unknown location") << "/test.desktop" << writableDataLocation + "/test.desktop"; | ||
+} | ||
+ | ||
+void KDesktopFileTest::testLocateLocal() | ||
+{ | ||
+ QFETCH(QString, path); | ||
+ QFETCH(QString, result); | ||
+ | ||
+ QCOMPARE(KDesktopFile::locateLocal(path), result); | ||
+} | ||
diff --git a/autotests/kdesktopfiletest.h b/autotests/kdesktopfiletest.h | ||
index eb0bd1d..ed6679a 100644 | ||
--- a/autotests/kdesktopfiletest.h | ||
+++ b/autotests/kdesktopfiletest.h | ||
@@ -34,6 +34,8 @@ private Q_SLOTS: | ||
void testActionGroup(); | ||
void testIsAuthorizedDesktopFile(); | ||
void testTryExecWithAuthorizeAction(); | ||
+ void testLocateLocal_data(); | ||
+ void testLocateLocal(); | ||
|
||
}; | ||
|
||
diff --git a/src/core/kdesktopfile.cpp b/src/core/kdesktopfile.cpp | ||
index 4a55030..52a97ec 100644 | ||
--- a/src/core/kdesktopfile.cpp | ||
+++ b/src/core/kdesktopfile.cpp | ||
@@ -83,14 +83,14 @@ QString KDesktopFile::locateLocal(const QString &path) | ||
// Relative to config? (e.g. for autostart) | ||
Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) { | ||
if (path.startsWith(dir + plus)) { | ||
- relativePath = dir.mid(path.length() + 1); | ||
+ relativePath = path.mid(dir.length() + 1); | ||
return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + relativePath; | ||
} | ||
} | ||
// Relative to xdg data dir? (much more common) | ||
Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) { | ||
if (path.startsWith(dir + plus)) { | ||
- relativePath = dir.mid(path.length() + 1); | ||
+ relativePath = path.mid(dir.length() + 1); | ||
} | ||
} | ||
if (relativePath.isEmpty()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 1999-2017 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=6 | ||
|
||
VIRTUALX_REQUIRED="test" | ||
inherit kde5 | ||
|
||
DESCRIPTION="Framework for reading and writing configuration" | ||
LICENSE="LGPL-2+" | ||
KEYWORDS="~amd64 ~arm ~x86" | ||
IUSE="nls" | ||
|
||
RDEPEND=" | ||
$(add_qt_dep qtgui) | ||
$(add_qt_dep qtxml) | ||
" | ||
DEPEND="${RDEPEND} | ||
nls? ( $(add_qt_dep linguist-tools) ) | ||
test? ( $(add_qt_dep qtconcurrent) ) | ||
" | ||
|
||
# bug 560086 | ||
RESTRICT+=" test" | ||
|
||
DOCS=( DESIGN docs/DESIGN.kconfig docs/options.md ) | ||
|
||
PATCHES=( "${FILESDIR}/${P}-relativePath.patch" ) |