diff -Nru qtbase-opensource-src-5.6.1+dfsg/debian/changelog qtbase-opensource-src-5.6.1+dfsg/debian/changelog --- qtbase-opensource-src-5.6.1+dfsg/debian/changelog 2016-10-06 09:18:59.000000000 +0200 +++ qtbase-opensource-src-5.6.1+dfsg/debian/changelog 2017-01-13 18:22:49.000000000 +0100 @@ -1,3 +1,10 @@ +qtbase-opensource-src (5.6.1+dfsg-3ubuntu7~2ubuntu1) UNRELEASED; urgency=medium + + * debian/patches/qdbustrayicon-try-to-save-temp-icons-in-readable-location.patch: + - try to save temp icons in readable locations to work in snap + + -- Marco Trevisan (TreviƱo) Fri, 13 Jan 2017 18:22:06 +0100 + qtbase-opensource-src (5.6.1+dfsg-3ubuntu7~2) yakkety; urgency=medium * debian/patches/Stop-unloading-plugins-in-QPluginLoader-and-QFactory.patch: diff -Nru qtbase-opensource-src-5.6.1+dfsg/debian/patches/0001-QDBusTrayIcon-try-to-save-temp-icons-in-readable-loc.patch~ qtbase-opensource-src-5.6.1+dfsg/debian/patches/0001-QDBusTrayIcon-try-to-save-temp-icons-in-readable-loc.patch~ --- qtbase-opensource-src-5.6.1+dfsg/debian/patches/0001-QDBusTrayIcon-try-to-save-temp-icons-in-readable-loc.patch~ 1970-01-01 01:00:00.000000000 +0100 +++ qtbase-opensource-src-5.6.1+dfsg/debian/patches/0001-QDBusTrayIcon-try-to-save-temp-icons-in-readable-loc.patch~ 2017-01-13 18:16:05.000000000 +0100 @@ -0,0 +1,69 @@ +It's better to save icons in $XDG_RUNTIME_DIR or +$XDG_CACHE_HOME paths than in $TMPDIR as these +places are readable from the desktop environment +when an app is ran confined in a sandbox (as in +snap packages) + +We enforce the check of saving the icon when the +indicator process name isn't available (as we might +be running in a confined world), but we're running +in Unity. +--- + .../themes/genericunix/dbustray/qdbustrayicon.cpp | 32 +++++++++++++++++++++- + 1 file changed, 31 insertions(+), 1 deletion(-) + +diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp +index 5c4157c..3592f15 100644 +--- a/src/platformsupport/dbustray/qdbustrayicon.cpp ++++ b/src/platformsupport/dbustray/qdbustrayicon.cpp +@@ -65,9 +65,33 @@ QT_BEGIN_NAMESPACE + + Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray") + ++static QString iconTempPath() ++{ ++ QString tempPath; ++ ++ QString xdgRuntimeDir = QString::fromUtf8(getenv("XDG_RUNTIME_DIR")); ++ if (!xdgRuntimeDir.isEmpty()) { ++ tempPath = xdgRuntimeDir; ++ } else { ++ QString xdgCache = QString::fromUtf8(getenv("XDG_CACHE_HOME")); ++ if (!xdgCache.isEmpty()) { ++ tempPath = xdgCache; ++ } else { ++ tempPath = QDir::cleanPath(QDir::homePath() + QStringLiteral("/.cache")); ++ } ++ } ++ ++ QDir tempDir(tempPath); ++ if (tempDir.mkpath(QStringLiteral("."))) { ++ return tempPath; ++ } ++ ++ return QDir::tempPath(); ++} ++ + static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2"); + static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher"); +-static const QString TempFileTemplate = QDir::tempPath() + QLatin1String("/qt-trayicon-XXXXXX.png"); ++static const QString TempFileTemplate = iconTempPath() + QLatin1String("/qt-trayicon-XXXXXX.png"); + static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications"); + static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications"); + static const QString DefaultAction = QStringLiteral("default"); +@@ -171,6 +195,12 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon) + uint pid = session.interface()->servicePid(KDEWatcherService).value(); + QString processName = QLockFilePrivate::processNameByPid(pid); + necessary = processName.endsWith(QLatin1String("indicator-application-service")); ++ if (!necessary) { ++ // Accessing to process name might be not allowed if the application ++ // is confined, thus we can just rely on the current desktop in use ++ QString xdgDesktop = QString::fromUtf8(getenv("XDG_CURRENT_DESKTOP")); ++ necessary = xdgDesktop.toLower().split(QLatin1Char(':')).contains(QStringLiteral("unity")); ++ } + necessity_checked = true; + } + if (!necessary) +-- +2.7.4 + diff -Nru qtbase-opensource-src-5.6.1+dfsg/debian/patches/qdbustrayicon-try-to-save-temp-icons-in-readable-location.patch qtbase-opensource-src-5.6.1+dfsg/debian/patches/qdbustrayicon-try-to-save-temp-icons-in-readable-location.patch --- qtbase-opensource-src-5.6.1+dfsg/debian/patches/qdbustrayicon-try-to-save-temp-icons-in-readable-location.patch 1970-01-01 01:00:00.000000000 +0100 +++ qtbase-opensource-src-5.6.1+dfsg/debian/patches/qdbustrayicon-try-to-save-temp-icons-in-readable-location.patch 2017-01-13 18:21:25.000000000 +0100 @@ -0,0 +1,56 @@ +Description: try to save temp icons in readable locations to work in snap +Author: Marco Trevisan +Forwarded: yes, https://codereview.qt-project.org/#/c/182310/ + +Index: qtbase-opensource-src-5.6.1+dfsg/src/platformsupport/dbustray/qdbustrayicon.cpp +=================================================================== +--- qtbase-opensource-src-5.6.1+dfsg.orig/src/platformsupport/dbustray/qdbustrayicon.cpp ++++ qtbase-opensource-src-5.6.1+dfsg/src/platformsupport/dbustray/qdbustrayicon.cpp +@@ -58,9 +58,33 @@ QT_BEGIN_NAMESPACE + + Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray") + ++static QString iconTempPath() ++{ ++ QString tempPath; ++ ++ QString xdgRuntimeDir = QString::fromUtf8(getenv("XDG_RUNTIME_DIR")); ++ if (!xdgRuntimeDir.isEmpty()) { ++ tempPath = xdgRuntimeDir; ++ } else { ++ QString xdgCache = QString::fromUtf8(getenv("XDG_CACHE_HOME")); ++ if (!xdgCache.isEmpty()) { ++ tempPath = xdgCache; ++ } else { ++ tempPath = QDir::cleanPath(QDir::homePath() + QStringLiteral("/.cache")); ++ } ++ } ++ ++ QDir tempDir(tempPath); ++ if (tempDir.mkpath(QStringLiteral("."))) { ++ return tempPath; ++ } ++ ++ return QDir::tempPath(); ++} ++ + static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2"); + static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher"); +-static const QString TempFileTemplate = QDir::tempPath() + QStringLiteral("/qt-trayicon-XXXXXX.png"); ++static const QString TempFileTemplate = iconTempPath() + QStringLiteral("/qt-trayicon-XXXXXX.png"); + static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications"); + static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications"); + static const QString DefaultAction = QStringLiteral("default"); +@@ -153,6 +177,12 @@ QTemporaryFile *QDBusTrayIcon::tempIcon( + uint pid = session.interface()->servicePid(KDEWatcherService).value(); + QString processName = QLockFilePrivate::processNameByPid(pid); + necessary = processName.endsWith(QStringLiteral("indicator-application-service")); ++ if (!necessary) { ++ // Accessing to process name might be not allowed if the application ++ // is confined, thus we can just rely on the current desktop in use ++ QString xdgDesktop = QString::fromUtf8(getenv("XDG_CURRENT_DESKTOP")); ++ necessary = xdgDesktop.toLower().split(QLatin1Char(':')).contains(QStringLiteral("unity")); ++ } + necessity_checked = true; + } + if (!necessary) diff -Nru qtbase-opensource-src-5.6.1+dfsg/debian/patches/series qtbase-opensource-src-5.6.1+dfsg/debian/patches/series --- qtbase-opensource-src-5.6.1+dfsg/debian/patches/series 2016-10-06 09:18:59.000000000 +0200 +++ qtbase-opensource-src-5.6.1+dfsg/debian/patches/series 2017-01-13 18:19:27.000000000 +0100 @@ -39,3 +39,4 @@ net-bearer-nm-disconnect-ap-signals7.patch qnam-ubuntu-fix6.patch disable_overlay_scrollbars.diff +qdbustrayicon-try-to-save-temp-icons-in-readable-location.patch