Chery-picking upstream version 1.3.0.

This commit is contained in:
Alf Gaida 2015-10-28 18:10:46 +01:00
parent fda60de834
commit 8b9d1c5741
20 changed files with 66 additions and 87 deletions

10
.gitignore vendored
View File

@ -1,10 +0,0 @@
build*
*.qm
*~
*.autosave
*-swp
*.swp
CMakeLists.txt.user*
nbproject/
*.tar.gz
/test

View File

@ -7,7 +7,7 @@ option(BUILD_TESTS "Builds tests" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(QTXDG_MAJOR_VERSION 1) set(QTXDG_MAJOR_VERSION 1)
set(QTXDG_MINOR_VERSION 2) set(QTXDG_MINOR_VERSION 3)
set(QTXDG_PATCH_VERSION 0) set(QTXDG_PATCH_VERSION 0)
set(QTXDG_VERSION_STRING ${QTXDG_MAJOR_VERSION}.${QTXDG_MINOR_VERSION}.${QTXDG_PATCH_VERSION}) set(QTXDG_VERSION_STRING ${QTXDG_MAJOR_VERSION}.${QTXDG_MINOR_VERSION}.${QTXDG_PATCH_VERSION})

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
libqtxdg (1.3.0-1) experimental; urgency=medium
* Cherry-picking upstream version 1.3.0.
-- Alf Gaida <agaida@siduction.org> Wed, 28 Oct 2015 18:09:50 +0100
libqtxdg (1.2.0+20150807-2) unstable; urgency=medium libqtxdg (1.2.0+20150807-2) unstable; urgency=medium
* cme fix dpkg-control * cme fix dpkg-control

View File

@ -25,7 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
static inline QByteArray detectDesktopEnvironment() static inline QByteArray detectDesktopEnvironment()

View File

@ -1,3 +1,5 @@
#!/bin/bash
PROJECT="libqtxdg" PROJECT="libqtxdg"
version="$1" version="$1"
prefix=$PROJECT-$version prefix=$PROJECT-$version

View File

@ -25,7 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#include "xdgaction.h" #include "xdgaction.h"
#include "xdgicon.h" #include "xdgicon.h"
#include <QDebug> #include <QDebug>

View File

@ -25,8 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#ifndef QTXDG_XDGACTION_H #ifndef QTXDG_XDGACTION_H
#define QTXDG_XDGACTION_H #define QTXDG_XDGACTION_H

View File

@ -25,23 +25,24 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#include "xdgautostart.h" #include "xdgautostart.h"
#include "xdgdirs.h" #include "xdgdirs.h"
#include <QDebug> #include <QDebug>
#include <QSet> #include <QSet>
#include <QDir> #include <QDir>
/************************************************
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: * The Autostart Directories are $XDG_CONFIG_DIRS/autostart. If the same filename is
If it is set to true all .desktop files with the same name in the other * located under multiple Autostart Directories only the file under the most
directories MUST be ignored as well. * 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) XdgDesktopFileList XdgAutoStart::desktopFileList(bool excludeHidden)
{ {
QStringList dirs; QStringList dirs;

View File

@ -25,7 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#ifndef QTXDG_XDGAUTOSTART_H #ifndef QTXDG_XDGAUTOSTART_H
#define QTXDG_XDGAUTOSTART_H #define QTXDG_XDGAUTOSTART_H

View File

@ -25,44 +25,38 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#include "desktopenvironment_p.cpp"
/*********************************************************************
See: http://standards.freedesktop.org/desktop-entry-spec
*********************************************************************/
#include <stdlib.h>
#include "xdgdesktopfile.h" #include "xdgdesktopfile.h"
#include "xdgdesktopfile_p.h" #include "xdgdesktopfile_p.h"
#include <QMimeDatabase>
#include <QMimeType>
#include "xdgicon.h"
#include "xdgdirs.h" #include "xdgdirs.h"
#include "desktopenvironment_p.cpp" #include "xdgicon.h"
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <QDebug>
#include <QDBusInterface>
#include <QDesktopServices>
#include <QDir>
#include <QSharedData> #include <QSharedData>
#include <QFile> #include <QFile>
#include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug>
#include <QHash> #include <QHash>
#include <QProcess>
#include <QUrl>
#include <QDesktopServices>
#include <QStringBuilder> // for the % operator
#include <QStandardPaths>
#include <QList> #include <QList>
#include <QtAlgorithms> #include <QMimeDatabase>
#include <unistd.h> #include <QMimeType>
#include <QProcess>
#include <QSettings> #include <QSettings>
#include <QStandardPaths>
#include <QStringBuilder> // for the % operator
#include <QTextStream> #include <QTextStream>
#include <QFile> #include <QUrl>
#include <QDBusInterface> #include <QtAlgorithms>
/**
* See: http://standards.freedesktop.org/desktop-entry-spec
*/
// A list of executables that can't be run with QProcess::startDetached(). They // A list of executables that can't be run with QProcess::startDetached(). They
// will be run with QProcess::start() // 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 LC_MESSAGES value Possible keys in order of matching
lang_COUNTRY@MODIFIER lang_COUNTRY@MODIFIER, lang_COUNTRY, lang@MODIFIER, lang, lang_COUNTRY@MODIFIER lang_COUNTRY@MODIFIER, lang_COUNTRY, lang@MODIFIER, lang,
default value default value
lang_COUNTRY lang_COUNTRY, lang, default value lang_COUNTRY lang_COUNTRY, lang, default value
lang@MODIFIER lang@MODIFIER, lang, default value lang@MODIFIER lang@MODIFIER, lang, default value
lang lang, default value lang lang, default value
************************************************/ ************************************************/
QString XdgDesktopFile::localizedKey(const QString& key) const QString XdgDesktopFile::localizedKey(const QString& key) const
{ {
@ -633,7 +627,6 @@ QString XdgDesktopFile::localizedKey(const QString& key) const
if (lang.isEmpty()) if (lang.isEmpty())
lang = getenv("LANG"); lang = getenv("LANG");
QString modifier = lang.section('@', 1); QString modifier = lang.section('@', 1);
if (!modifier.isEmpty()) if (!modifier.isEmpty())
lang.truncate(lang.length() - modifier.length() - 1); lang.truncate(lang.length() - modifier.length() - 1);
@ -647,8 +640,6 @@ QString XdgDesktopFile::localizedKey(const QString& key) const
if (!country.isEmpty()) if (!country.isEmpty())
lang.truncate(lang.length() - country.length() - 1); lang.truncate(lang.length() - country.length() - 1);
//qDebug() << "LC_MESSAGES: " << getenv("LC_MESSAGES"); //qDebug() << "LC_MESSAGES: " << getenv("LC_MESSAGES");
//qDebug() << "Lang:" << lang; //qDebug() << "Lang:" << lang;
//qDebug() << "Country:" << country; //qDebug() << "Country:" << country;
@ -884,7 +875,6 @@ QString expandEnvVariables(const QString str)
replaceVar(res, "XDG_PICTURES_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); replaceVar(res, "XDG_PICTURES_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
replaceVar(res, "XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)); replaceVar(res, "XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
replaceVar(res, "XDG_PHOTOS_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); replaceVar(res, "XDG_PHOTOS_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
replaceVar(res, "XDG_MOVIES_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
return res; return res;
} }

View File

@ -25,8 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#ifndef QTXDG_XDGDESKTOPFILE_H #ifndef QTXDG_XDGDESKTOPFILE_H
#define QTXDG_XDGDESKTOPFILE_H #define QTXDG_XDGDESKTOPFILE_H
@ -92,6 +90,12 @@ public:
//! Returns true if both files contain the identical key-value pairs //! Returns true if both files contain the identical key-value pairs
bool operator==(const XdgDesktopFile &other) const; 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. //! Loads an DesktopFile from the file with the given fileName.
virtual bool load(const QString& fileName); virtual bool load(const QString& fileName);

View File

@ -25,7 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#ifndef XDGDESKTOPFILE_P_H #ifndef XDGDESKTOPFILE_P_H
#define XDGDESKTOPFILE_P_H #define XDGDESKTOPFILE_P_H

View File

@ -32,6 +32,7 @@
#include <QDebug> #include <QDebug>
#include <QStandardPaths> #include <QStandardPaths>
static const QString userDirectoryString[8] = static const QString userDirectoryString[8] =
{ {
"Desktop", "Desktop",

View File

@ -25,7 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#include "xdgmenu.h" #include "xdgmenu.h"
#include "xdgmenu_p.h" #include "xdgmenu_p.h"
#include "xdgmenureader.h" #include "xdgmenureader.h"
@ -39,12 +38,12 @@
#include <QtXml/QDomElement> #include <QtXml/QDomElement>
#include <QtXml/QDomNamedNodeMap> #include <QtXml/QDomNamedNodeMap>
#include <QFile> #include <QFile>
#include <QSettings>
#include <QFileInfo> #include <QFileInfo>
#include <QFileSystemWatcher>
#include <QSettings>
#include <QDir> #include <QDir>
#include <QHash> #include <QHash>
#include <QLocale> #include <QLocale>
#include <QFileSystemWatcher>
#include <QTranslator> #include <QTranslator>
#include <QCoreApplication> #include <QCoreApplication>
#include <QCryptographicHash> #include <QCryptographicHash>

View File

@ -30,12 +30,11 @@
#include "xdgdirs.h" #include "xdgdirs.h"
#include "xmlhelper.h" #include "xmlhelper.h"
#include <QDebug>
#include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug>
#include <QString> #include <QString>
#include <QDir>
#include <QDebug>
#include <QtXml/QDomNamedNodeMap> #include <QtXml/QDomNamedNodeMap>
#include <QtXml/QDomNode> #include <QtXml/QDomNode>

View File

@ -25,18 +25,17 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
/*********************************************************************
See: http://standards.freedesktop.org/desktop-entry-spec
*********************************************************************/
#include "xdgmenurules.h" #include "xdgmenurules.h"
#include "xmlhelper.h" #include "xmlhelper.h"
#include <QStringList>
#include <QDebug> #include <QDebug>
#include <QStringList>
/**
* See: http://standards.freedesktop.org/desktop-entry-spec
*/
XdgMenuRule::XdgMenuRule(const QDomElement& element, QObject* parent) : XdgMenuRule::XdgMenuRule(const QDomElement& element, QObject* parent) :
QObject(parent) QObject(parent)
{ {

View File

@ -25,12 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
/*********************************************************************
See: http://standards.freedesktop.org/desktop-entry-spec
*********************************************************************/
#ifndef QTXDG_XDGMENURULES_H #ifndef QTXDG_XDGMENURULES_H
#define QTXDG_XDGMENURULES_H #define QTXDG_XDGMENURULES_H
@ -41,6 +35,10 @@
#include "xdgdesktopfile.h" #include "xdgdesktopfile.h"
/**
* See: http://standards.freedesktop.org/desktop-entry-spec
*/
class XdgMenuRule : public QObject class XdgMenuRule : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -77,7 +77,7 @@ public:
inline bool operator!=(const XdgMimeType &other) const inline bool operator!=(const XdgMimeType &other) const
{ {
return QMimeType::operator==(other); return !QMimeType::operator==(other);
} }
void swap(XdgMimeType &other) void swap(XdgMimeType &other)

View File

@ -33,9 +33,6 @@
#include <QtXml/QDomNode> #include <QtXml/QDomNode>
/************************************************
************************************************/
QDebug operator<<(QDebug dbg, const QDomElement &el) QDebug operator<<(QDebug dbg, const QDomElement &el)
{ {
QDomNamedNodeMap map = el.attributes(); QDomNamedNodeMap map = el.attributes();

View File

@ -25,7 +25,6 @@
* *
* END_COMMON_COPYRIGHT_HEADER */ * END_COMMON_COPYRIGHT_HEADER */
#ifndef QTXDG_XMLHELPER_H #ifndef QTXDG_XMLHELPER_H
#define QTXDG_XMLHELPER_H #define QTXDG_XMLHELPER_H