From 8b9d1c574157d588368bf7495f7130e1d6452897 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Wed, 28 Oct 2015 18:10:46 +0100 Subject: [PATCH] Chery-picking upstream version 1.3.0. --- .gitignore | 10 ------- CMakeLists.txt | 2 +- debian/changelog | 6 ++++ desktopenvironment_p.cpp | 1 - release.sh | 2 ++ xdgaction.cpp | 1 - xdgaction.h | 2 -- xdgautostart.cpp | 21 +++++++------- xdgautostart.h | 1 - xdgdesktopfile.cpp | 60 +++++++++++++++++----------------------- xdgdesktopfile.h | 8 ++++-- xdgdesktopfile_p.h | 1 - xdgdirs.cpp | 1 + xdgmenu.cpp | 5 ++-- xdgmenureader.cpp | 5 ++-- xdgmenurules.cpp | 11 ++++---- xdgmenurules.h | 10 +++---- xdgmimetype.h | 2 +- xmlhelper.cpp | 3 -- xmlhelper.h | 1 - 20 files changed, 66 insertions(+), 87 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 69b2842..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -build* -*.qm -*~ -*.autosave -*-swp -*.swp -CMakeLists.txt.user* -nbproject/ -*.tar.gz -/test diff --git a/CMakeLists.txt b/CMakeLists.txt index 7422650..d7c6686 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ option(BUILD_TESTS "Builds tests" OFF) set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(QTXDG_MAJOR_VERSION 1) -set(QTXDG_MINOR_VERSION 2) +set(QTXDG_MINOR_VERSION 3) set(QTXDG_PATCH_VERSION 0) set(QTXDG_VERSION_STRING ${QTXDG_MAJOR_VERSION}.${QTXDG_MINOR_VERSION}.${QTXDG_PATCH_VERSION}) diff --git a/debian/changelog b/debian/changelog index 1af9660..6ec40f9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libqtxdg (1.3.0-1) experimental; urgency=medium + + * Cherry-picking upstream version 1.3.0. + + -- Alf Gaida Wed, 28 Oct 2015 18:09:50 +0100 + libqtxdg (1.2.0+20150807-2) unstable; urgency=medium * cme fix dpkg-control diff --git a/desktopenvironment_p.cpp b/desktopenvironment_p.cpp index 38056c0..4214e9a 100644 --- a/desktopenvironment_p.cpp +++ b/desktopenvironment_p.cpp @@ -25,7 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #include static inline QByteArray detectDesktopEnvironment() diff --git a/release.sh b/release.sh index 98b997f..f60eb6a 100755 --- a/release.sh +++ b/release.sh @@ -1,3 +1,5 @@ +#!/bin/bash + PROJECT="libqtxdg" version="$1" prefix=$PROJECT-$version diff --git a/xdgaction.cpp b/xdgaction.cpp index 9fd24fe..44d70ea 100644 --- a/xdgaction.cpp +++ b/xdgaction.cpp @@ -25,7 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #include "xdgaction.h" #include "xdgicon.h" #include diff --git a/xdgaction.h b/xdgaction.h index d642d10..154a908 100644 --- a/xdgaction.h +++ b/xdgaction.h @@ -25,8 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - - #ifndef QTXDG_XDGACTION_H #define QTXDG_XDGACTION_H diff --git a/xdgautostart.cpp b/xdgautostart.cpp index 4328950..85344d1 100644 --- a/xdgautostart.cpp +++ b/xdgautostart.cpp @@ -25,23 +25,24 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #include "xdgautostart.h" #include "xdgdirs.h" #include #include #include -/************************************************ -The Autostart Directories are $XDG_CONFIG_DIRS/autostart. If the same filename is -located under multiple Autostart Directories only the file under the most -important directory should be used. -When multiple .desktop files with the same name exists in multiple directories -then only the Hidden key in the most important .desktop file must be considered: -If it is set to true all .desktop files with the same name in the other -directories MUST be ignored as well. - ************************************************/ +/** + * The Autostart Directories are $XDG_CONFIG_DIRS/autostart. If the same filename is + * located under multiple Autostart Directories only the file under the most + * important directory should be used. + * + * When multiple .desktop files with the same name exists in multiple directories + * then only the Hidden key in the most important .desktop file must be considered: + * If it is set to true all .desktop files with the same name in the other + * directories MUST be ignored as well. + */ + XdgDesktopFileList XdgAutoStart::desktopFileList(bool excludeHidden) { QStringList dirs; diff --git a/xdgautostart.h b/xdgautostart.h index ec268a2..d12afa4 100644 --- a/xdgautostart.h +++ b/xdgautostart.h @@ -25,7 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #ifndef QTXDG_XDGAUTOSTART_H #define QTXDG_XDGAUTOSTART_H diff --git a/xdgdesktopfile.cpp b/xdgdesktopfile.cpp index 9aac1a0..75a80bf 100644 --- a/xdgdesktopfile.cpp +++ b/xdgdesktopfile.cpp @@ -25,44 +25,38 @@ * * END_COMMON_COPYRIGHT_HEADER */ - - -/********************************************************************* - See: http://standards.freedesktop.org/desktop-entry-spec - -*********************************************************************/ -#include - +#include "desktopenvironment_p.cpp" #include "xdgdesktopfile.h" #include "xdgdesktopfile_p.h" - -#include -#include - -#include "xdgicon.h" #include "xdgdirs.h" -#include "desktopenvironment_p.cpp" +#include "xdgicon.h" #include +#include + +#include +#include +#include +#include #include #include -#include #include -#include #include -#include -#include -#include -#include // for the % operator -#include - #include -#include -#include +#include +#include +#include #include +#include +#include // for the % operator #include -#include -#include +#include +#include + + +/** + * See: http://standards.freedesktop.org/desktop-entry-spec + */ // A list of executables that can't be run with QProcess::startDetached(). They // will be run with QProcess::start() @@ -616,12 +610,12 @@ void XdgDesktopFile::setLocalizedValue(const QString &key, const QVariant &value /************************************************ - LC_MESSAGES value Possible keys in order of matching - lang_COUNTRY@MODIFIER lang_COUNTRY@MODIFIER, lang_COUNTRY, lang@MODIFIER, lang, + LC_MESSAGES value Possible keys in order of matching + lang_COUNTRY@MODIFIER lang_COUNTRY@MODIFIER, lang_COUNTRY, lang@MODIFIER, lang, default value - lang_COUNTRY lang_COUNTRY, lang, default value - lang@MODIFIER lang@MODIFIER, lang, default value - lang lang, default value + lang_COUNTRY lang_COUNTRY, lang, default value + lang@MODIFIER lang@MODIFIER, lang, default value + lang lang, default value ************************************************/ QString XdgDesktopFile::localizedKey(const QString& key) const { @@ -633,7 +627,6 @@ QString XdgDesktopFile::localizedKey(const QString& key) const if (lang.isEmpty()) lang = getenv("LANG"); - QString modifier = lang.section('@', 1); if (!modifier.isEmpty()) lang.truncate(lang.length() - modifier.length() - 1); @@ -647,8 +640,6 @@ QString XdgDesktopFile::localizedKey(const QString& key) const if (!country.isEmpty()) lang.truncate(lang.length() - country.length() - 1); - - //qDebug() << "LC_MESSAGES: " << getenv("LC_MESSAGES"); //qDebug() << "Lang:" << lang; //qDebug() << "Country:" << country; @@ -884,7 +875,6 @@ QString expandEnvVariables(const QString str) replaceVar(res, "XDG_PICTURES_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); replaceVar(res, "XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)); replaceVar(res, "XDG_PHOTOS_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); - replaceVar(res, "XDG_MOVIES_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)); return res; } diff --git a/xdgdesktopfile.h b/xdgdesktopfile.h index cad9147..da7c90f 100644 --- a/xdgdesktopfile.h +++ b/xdgdesktopfile.h @@ -25,8 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - - #ifndef QTXDG_XDGDESKTOPFILE_H #define QTXDG_XDGDESKTOPFILE_H @@ -92,6 +90,12 @@ public: //! Returns true if both files contain the identical key-value pairs bool operator==(const XdgDesktopFile &other) const; + //! Returns false if both files contain the identical key-value pairs + inline bool operator!=(const XdgDesktopFile &other) const + { + return !operator==(other); + } + //! Loads an DesktopFile from the file with the given fileName. virtual bool load(const QString& fileName); diff --git a/xdgdesktopfile_p.h b/xdgdesktopfile_p.h index e0e9754..0479933 100644 --- a/xdgdesktopfile_p.h +++ b/xdgdesktopfile_p.h @@ -25,7 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #ifndef XDGDESKTOPFILE_P_H #define XDGDESKTOPFILE_P_H diff --git a/xdgdirs.cpp b/xdgdirs.cpp index 8b93e37..0d7debe 100644 --- a/xdgdirs.cpp +++ b/xdgdirs.cpp @@ -32,6 +32,7 @@ #include #include + static const QString userDirectoryString[8] = { "Desktop", diff --git a/xdgmenu.cpp b/xdgmenu.cpp index ba0e698..c17259f 100644 --- a/xdgmenu.cpp +++ b/xdgmenu.cpp @@ -25,7 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #include "xdgmenu.h" #include "xdgmenu_p.h" #include "xdgmenureader.h" @@ -39,12 +38,12 @@ #include #include #include -#include #include +#include +#include #include #include #include -#include #include #include #include diff --git a/xdgmenureader.cpp b/xdgmenureader.cpp index 6207eb9..8333c9a 100644 --- a/xdgmenureader.cpp +++ b/xdgmenureader.cpp @@ -30,12 +30,11 @@ #include "xdgdirs.h" #include "xmlhelper.h" +#include +#include #include #include -#include #include -#include -#include #include #include diff --git a/xdgmenurules.cpp b/xdgmenurules.cpp index eab1da7..514c4a0 100644 --- a/xdgmenurules.cpp +++ b/xdgmenurules.cpp @@ -25,17 +25,16 @@ * * END_COMMON_COPYRIGHT_HEADER */ -/********************************************************************* - See: http://standards.freedesktop.org/desktop-entry-spec - -*********************************************************************/ - #include "xdgmenurules.h" #include "xmlhelper.h" -#include #include +#include + +/** + * See: http://standards.freedesktop.org/desktop-entry-spec + */ XdgMenuRule::XdgMenuRule(const QDomElement& element, QObject* parent) : QObject(parent) diff --git a/xdgmenurules.h b/xdgmenurules.h index 422a33f..3444fcd 100644 --- a/xdgmenurules.h +++ b/xdgmenurules.h @@ -25,12 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - -/********************************************************************* - See: http://standards.freedesktop.org/desktop-entry-spec - -*********************************************************************/ - #ifndef QTXDG_XDGMENURULES_H #define QTXDG_XDGMENURULES_H @@ -41,6 +35,10 @@ #include "xdgdesktopfile.h" +/** + * See: http://standards.freedesktop.org/desktop-entry-spec + */ + class XdgMenuRule : public QObject { Q_OBJECT diff --git a/xdgmimetype.h b/xdgmimetype.h index 0edf085..622ddc7 100644 --- a/xdgmimetype.h +++ b/xdgmimetype.h @@ -77,7 +77,7 @@ public: inline bool operator!=(const XdgMimeType &other) const { - return QMimeType::operator==(other); + return !QMimeType::operator==(other); } void swap(XdgMimeType &other) diff --git a/xmlhelper.cpp b/xmlhelper.cpp index 13781b8..648500c 100644 --- a/xmlhelper.cpp +++ b/xmlhelper.cpp @@ -33,9 +33,6 @@ #include -/************************************************ - - ************************************************/ QDebug operator<<(QDebug dbg, const QDomElement &el) { QDomNamedNodeMap map = el.attributes(); diff --git a/xmlhelper.h b/xmlhelper.h index 571dbb9..4a10c2e 100644 --- a/xmlhelper.h +++ b/xmlhelper.h @@ -25,7 +25,6 @@ * * END_COMMON_COPYRIGHT_HEADER */ - #ifndef QTXDG_XMLHELPER_H #define QTXDG_XMLHELPER_H