summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/operations.qdoc7
-rw-r--r--src/libs/installer/createdesktopentryoperation.cpp7
-rw-r--r--src/libs/installer/installiconsoperation.cpp7
-rw-r--r--tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp2
-rw-r--r--tests/auto/installer/installiconsoperation/tst_installiconsoperation.cpp2
5 files changed, 20 insertions, 5 deletions
diff --git a/doc/operations.qdoc b/doc/operations.qdoc
index a01446a69..cec0dba40 100644
--- a/doc/operations.qdoc
+++ b/doc/operations.qdoc
@@ -162,7 +162,8 @@
If \c filename is absolute, the desktop entry is stored there.
Otherwise, it is stored in the location specified in
\c{$XDG_DATA_HOME/applications}, including the default path,
- as defined by freedesktop.org.
+ as defined by freedesktop.org. For system-wide installations,
+ it is stored in \c {/usr/local/share/applications} instead.
The key-value pairs are written to the file.
@@ -172,8 +173,8 @@
\li "InstallIcons" \c directory \c [Vendorprefix]
\li Installs the contents of \c directory into a location, as
specified by freedesktop.org. That is, into
- \c {$XDG_DATA_HOME/icons} or
- \c {$HOME/.local/share/icons}. The files are removed from their initial
+ \c {$XDG_DATA_HOME/icons}, \c {$HOME/.local/share/icons} or
+ \c {/usr/local/share/icons}. The files are removed from their initial
location. Make sure to add this operation after the operation
that extracts the files from the archive.
If you provide a \c Vendorprefix it replaces all characters up to the
diff --git a/src/libs/installer/createdesktopentryoperation.cpp b/src/libs/installer/createdesktopentryoperation.cpp
index 5907e2f21..1a56c193c 100644
--- a/src/libs/installer/createdesktopentryoperation.cpp
+++ b/src/libs/installer/createdesktopentryoperation.cpp
@@ -30,6 +30,8 @@
#include "errors.h"
#include "fileutils.h"
#include "globals.h"
+#include "adminauthorization.h"
+#include "remoteclient.h"
#include <QDir>
#include <QFile>
@@ -60,7 +62,10 @@ QString CreateDesktopEntryOperation::absoluteFileName()
.split(QLatin1Char(':'),
QString::SkipEmptyParts);
- XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); // default path
+ XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); // default user-specific path
+
+ if (AdminAuthorization::hasAdminRights() || RemoteClient::instance().isActive())
+ XDG_DATA_HOME.push_front(QLatin1String("/usr/local/share")); // default system-wide path
const QStringList directories = XDG_DATA_HOME;
QString directory;
diff --git a/src/libs/installer/installiconsoperation.cpp b/src/libs/installer/installiconsoperation.cpp
index eea83a462..9443b7f71 100644
--- a/src/libs/installer/installiconsoperation.cpp
+++ b/src/libs/installer/installiconsoperation.cpp
@@ -30,6 +30,8 @@
#include "fileutils.h"
#include "packagemanagercore.h"
#include "globals.h"
+#include "adminauthorization.h"
+#include "remoteclient.h"
#include <QDebug>
#include <QDir>
@@ -52,7 +54,10 @@ QString InstallIconsOperation::targetDirectory()
QStringList XDG_DATA_HOME = QString::fromLocal8Bit(qgetenv("XDG_DATA_HOME"))
.split(QLatin1Char(':'),
QString::SkipEmptyParts);
- XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); // default path
+ XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); // default user-specific path
+
+ if (AdminAuthorization::hasAdminRights() || RemoteClient::instance().isActive())
+ XDG_DATA_HOME.push_front(QLatin1String("/usr/local/share")); // default system-wide path
QString directory;
const QStringList& directories = XDG_DATA_HOME;
diff --git a/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp b/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp
index ac3fffbe1..32e23ea14 100644
--- a/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp
+++ b/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp
@@ -73,6 +73,8 @@ private:
.split(QLatin1Char(':'), QString::SkipEmptyParts);
// Default path if XDG_DATA_HOME is not set
directories.append(QDir::home().absoluteFilePath(QLatin1String(".local/share")));
+ // Default path if run as root
+ directories.append(QLatin1String("/usr/local/share"));
bool validPath = false;
foreach (const QString &dir, directories) {
// Desktop entry should be in one of the expected locations
diff --git a/tests/auto/installer/installiconsoperation/tst_installiconsoperation.cpp b/tests/auto/installer/installiconsoperation/tst_installiconsoperation.cpp
index d1a9c680e..fdbbb29bc 100644
--- a/tests/auto/installer/installiconsoperation/tst_installiconsoperation.cpp
+++ b/tests/auto/installer/installiconsoperation/tst_installiconsoperation.cpp
@@ -205,6 +205,8 @@ private slots:
.split(QLatin1Char(':'), QString::SkipEmptyParts);
// Default path if XDG_DATA_HOME is not set
directories.append(QDir::home().absoluteFilePath(QLatin1String(".local/share")));
+ // Default path if run as root
+ directories.append(QLatin1String("/usr/local/share"));
bool validPath = false;
foreach (const QString &dir, directories) {
// Icon directory should be one of the expected locations