|
|
@ -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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|