[SCM] qtbase packaging branch, experimental, updated. debian/5.7.1-20161021+dfsg-1-2-gc08a17f
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Sat Oct 22 12:18:03 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/qt/qtbase.git;a=commitdiff;h=c08a17f
The following commit has been merged in the experimental branch:
commit c08a17fd7636399ff14fce300cfc4a417c37cc74
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date: Sat Oct 22 15:17:31 2016 +0300
Backport two QSettings-related patches, needed for LXQt.
---
debian/changelog | 4 +
debian/patches/qsettings_XDG_CONFIG_DIRS.diff | 171 ++++++++++++
debian/patches/qsettings_simplify_logic.diff | 372 ++++++++++++++++++++++++++
debian/patches/series | 2 +
4 files changed, 549 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index b7527c4..a93aa97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
qtbase-opensource-src (5.7.1~20161021+dfsg-2) UNRELEASED; urgency=medium
+ [ Dmitry Shachnev ]
+ * Backport two patches to add proper support for XDG_CONFIG_DIRS to
+ QSettings; needed for LXQt transition (qsettings_simplify_logic.diff,
+ qsettings_XDG_CONFIG_DIRS.diff).
-- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org> Sat, 22 Oct 2016 15:16:26 +0300
diff --git a/debian/patches/qsettings_XDG_CONFIG_DIRS.diff b/debian/patches/qsettings_XDG_CONFIG_DIRS.diff
new file mode 100644
index 0000000..1c7974b
--- /dev/null
+++ b/debian/patches/qsettings_XDG_CONFIG_DIRS.diff
@@ -0,0 +1,171 @@
+Description: QSettings: add proper support for XDG_CONFIG_DIRS
+ Update fallback mechanism for Q_XDG_PLATFORM based systems to follow the
+ Xdg specification.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=4758555f3e44af34
+Last-Update: 2016-10-22
+
+--- a/src/corelib/io/qsettings.cpp
++++ b/src/corelib/io/qsettings.cpp
+@@ -137,7 +137,18 @@
+
+ typedef QHash<QString, QConfFile *> ConfFileHash;
+ typedef QCache<QString, QConfFile> ConfFileCache;
+-typedef QHash<int, QString> PathHash;
++namespace {
++ struct Path
++ {
++ // Note: Defining constructors explicitly because of buggy C++11
++ // implementation in MSVC (uniform initialization).
++ Path() {}
++ Path(const QString & p, bool ud) : path(p), userDefined(ud) {}
++ QString path;
++ bool userDefined; //!< true - user defined, overridden by setPath
++ };
++}
++typedef QHash<int, Path> PathHash;
+ typedef QVector<QConfFileCustomFormat> CustomFormatVector;
+
+ Q_GLOBAL_STATIC(ConfFileHash, usedHashFunc)
+@@ -1075,22 +1086,22 @@
+ */
+ #ifdef Q_OS_WIN
+ pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope),
+- windowsConfigPath(CSIDL_APPDATA) + QDir::separator());
++ Path(windowsConfigPath(CSIDL_APPDATA) + QDir::separator(), false));
+ pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope),
+- windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator());
++ Path(windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator(), false));
+ #else
+ const QString userPath = make_user_path();
+- pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), userPath);
+- pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), systemPath);
++ pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), Path(userPath, false));
++ pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::SystemScope), Path(systemPath, false));
+ #ifndef Q_OS_MAC
+- pathHash->insert(pathHashKey(QSettings::NativeFormat, QSettings::UserScope), userPath);
+- pathHash->insert(pathHashKey(QSettings::NativeFormat, QSettings::SystemScope), systemPath);
++ pathHash->insert(pathHashKey(QSettings::NativeFormat, QSettings::UserScope), Path(userPath, false));
++ pathHash->insert(pathHashKey(QSettings::NativeFormat, QSettings::SystemScope), Path(systemPath, false));
+ #endif
+ #endif // Q_OS_WIN
+ }
+ }
+
+-static QString getPath(QSettings::Format format, QSettings::Scope scope)
++static Path getPath(QSettings::Format format, QSettings::Scope scope)
+ {
+ Q_ASSERT((int)QSettings::NativeFormat == 0);
+ Q_ASSERT((int)QSettings::IniFormat == 1);
+@@ -1100,14 +1111,23 @@
+ if (pathHash->isEmpty())
+ initDefaultPaths(&locker);
+
+- QString result = pathHash->value(pathHashKey(format, scope));
+- if (!result.isEmpty())
++ Path result = pathHash->value(pathHashKey(format, scope));
++ if (!result.path.isEmpty())
+ return result;
+
+ // fall back on INI path
+ return pathHash->value(pathHashKey(QSettings::IniFormat, scope));
+ }
+
++#if defined(QT_BUILD_INTERNAL) && defined(Q_XDG_PLATFORM) && !defined(QT_NO_STANDARDPATHS)
++// Note: Suitable only for autotests.
++void Q_AUTOTEST_EXPORT clearDefaultPaths()
++{
++ QMutexLocker locker(&settingsGlobalMutex);
++ pathHashFunc()->clear();
++}
++#endif // QT_BUILD_INTERNAL && Q_XDG_PLATFORM && !QT_NO_STANDARDPATHS
++
+ QConfFileSettingsPrivate::QConfFileSettingsPrivate(QSettings::Format format,
+ QSettings::Scope scope,
+ const QString &organization,
+@@ -1127,16 +1147,44 @@
+ QString orgFile = org + extension;
+
+ if (scope == QSettings::UserScope) {
+- QString userPath = getPath(format, QSettings::UserScope);
++ Path userPath = getPath(format, QSettings::UserScope);
+ if (!application.isEmpty())
+- confFiles.append(QConfFile::fromName(userPath + appFile, true));
+- confFiles.append(QConfFile::fromName(userPath + orgFile, true));
++ confFiles.append(QConfFile::fromName(userPath.path + appFile, true));
++ confFiles.append(QConfFile::fromName(userPath.path + orgFile, true));
+ }
+
+- QString systemPath = getPath(format, QSettings::SystemScope);
+- if (!application.isEmpty())
+- confFiles.append(QConfFile::fromName(systemPath + appFile, false));
+- confFiles.append(QConfFile::fromName(systemPath + orgFile, false));
++ Path systemPath = getPath(format, QSettings::SystemScope);
++#if defined(Q_XDG_PLATFORM) && !defined(QT_NO_STANDARDPATHS)
++ // check if the systemPath wasn't overridden by QSettings::setPath()
++ if (!systemPath.userDefined) {
++ // Note: We can't use QStandardPaths::locateAll() as we need all the
++ // possible files (not just the existing ones) and there is no way
++ // to exclude user specific (XDG_CONFIG_HOME) directory from the search.
++ QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation);
++ // remove the QStandardLocation::writableLocation() (XDG_CONFIG_HOME)
++ if (!dirs.isEmpty())
++ dirs.takeFirst();
++ QStringList paths;
++ if (!application.isEmpty()) {
++ paths.reserve(dirs.size() * 2);
++ for (const auto &dir : qAsConst(dirs))
++ paths.append(dir + QLatin1Char('/') + appFile);
++ } else {
++ paths.reserve(dirs.size());
++ }
++ for (const auto &dir : qAsConst(dirs))
++ paths.append(dir + QLatin1Char('/') + orgFile);
++
++ // Note: No check for existence of files is done intentionaly.
++ for (const auto &path : qAsConst(paths))
++ confFiles.append(QConfFile::fromName(path, false));
++ } else
++#endif // Q_XDG_PLATFORM && !QT_NO_STANDARDPATHS
++ {
++ if (!application.isEmpty())
++ confFiles.append(QConfFile::fromName(systemPath.path + appFile, false));
++ confFiles.append(QConfFile::fromName(systemPath.path + orgFile, false));
++ }
+
+ initAccess();
+ }
+@@ -2187,9 +2235,10 @@
+ \list 1
+ \li
--
qtbase packaging
More information about the pkg-kde-commits
mailing list