Merge lp:~3v1n0/sni-qt/xenial-sru1 into lp:sni-qt/16.04

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 104
Merged at revision: 102
Proposed branch: lp:~3v1n0/sni-qt/xenial-sru1
Merge into: lp:sni-qt/16.04
Diff against target: 215 lines (+82/-11)
7 files modified
debian/changelog (+10/-0)
src/fsutils.cpp (+19/-4)
src/iconcache.cpp (+11/-2)
src/iconcache.h (+2/-2)
src/statusnotifieritem.cpp (+12/-2)
tests/auto/fsutilstest.cpp (+1/-0)
tests/auto/iconcachetest.cpp (+27/-1)
To merge this branch: bzr merge lp:~3v1n0/sni-qt/xenial-sru1
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+317569@code.launchpad.net

Commit message

Release Xenial SRU

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2015-07-29 17:00:47 +0000
+++ debian/changelog 2017-02-17 01:01:40 +0000
@@ -1,3 +1,13 @@
1sni-qt (0.2.7+15.10.20150729-0ubuntu2) UNRELEASED; urgency=medium
2
3 * statusnotifieritem: reset app usertime on activation to ensure
4 compiz will raise it (LP: #627195)
5 * IconCache: get the proper theme path based on the fact we're using a
6 themed icon or not (LP: #1600136)
7 * fsutils: always use $XDG_RUNTIME_DIR if it's set for saving icons
8
9 -- Marco Trevisan (Treviño) <mail@3v1n0.net> Fri, 17 Feb 2017 01:59:03 +0100
10
1sni-qt (0.2.7+15.10.20150729-0ubuntu1) wily; urgency=low11sni-qt (0.2.7+15.10.20150729-0ubuntu1) wily; urgency=low
212
3 [ Robert Bruce Park ]13 [ Robert Bruce Park ]
414
=== modified file 'src/fsutils.cpp'
--- src/fsutils.cpp 2011-10-14 21:41:08 +0000
+++ src/fsutils.cpp 2017-02-17 01:01:40 +0000
@@ -32,16 +32,31 @@
3232
33QString generateTempDir(const QString& prefix)33QString generateTempDir(const QString& prefix)
34{34{
35 QDir dir = QDir::temp();35 QDir dir;
36 QString path = QString::fromUtf8(getenv("XDG_RUNTIME_DIR"));
37
38 if (!path.isEmpty()) {
39 dir.setPath(path);
40 } else if (!getenv("SNAP")) {
41 dir = QDir::temp();
42 } else {
43 // Try to get the .cache from $XDG_CACHE_HOME, if it's not set,
44 // it has to be in ~/.cache as per XDG standard
45 path = QString::fromUtf8(getenv("XDG_CACHE_HOME"));
46 if (path.isEmpty()) {
47 path = QDir::cleanPath(QDir::homePath() + "/.cache");
48 }
49
50 dir.setPath(path);
51 }
52
36 if (!dir.mkpath(".")) {53 if (!dir.mkpath(".")) {
37 qCritical("Failed to generate temporary file for prefix %s: could not create %s",54 qCritical("Failed to generate temporary file for prefix %s: could not create %s",
38 qPrintable(prefix), qPrintable(dir.path()));55 qPrintable(prefix), qPrintable(dir.path()));
39 return QString();56 return QString();
40 }57 }
4158
42 QString tmpl = QString("%1/%2-XXXXXX")59 QString tmpl = QDir::cleanPath(dir.path() + '/' + prefix + "-XXXXXX");
43 .arg(dir.path())
44 .arg(prefix);
45 QByteArray ba = QFile::encodeName(tmpl);60 QByteArray ba = QFile::encodeName(tmpl);
46 const char* name = mkdtemp(ba.data());61 const char* name = mkdtemp(ba.data());
47 if (!name) {62 if (!name) {
4863
=== modified file 'src/iconcache.cpp'
--- src/iconcache.cpp 2011-10-10 16:37:00 +0000
+++ src/iconcache.cpp 2017-02-17 01:01:40 +0000
@@ -26,7 +26,6 @@
26#include <QDateTime>26#include <QDateTime>
27#include <QDebug>27#include <QDebug>
28#include <QDir>28#include <QDir>
29#include <QIcon>
30#include <QList>29#include <QList>
3130
32const int IconCache::MaxIconCount = 20;31const int IconCache::MaxIconCount = 20;
@@ -86,8 +85,18 @@
86 }85 }
87}86}
8887
89QString IconCache::themePath() const88QString IconCache::themePath(const QIcon& icon) const
90{89{
90 if (!icon.isNull() && !icon.name().isEmpty() && QIcon::hasThemeIcon(icon.name())) {
91 QString dataHome = QString::fromUtf8(getenv("XDG_DATA_HOME"));
92
93 if (dataHome.isEmpty()) {
94 dataHome = QDir::homePath() + "/.local/share";
95 }
96
97 return QDir::cleanPath(dataHome + "/icons");
98 }
99
91 return m_themePath;100 return m_themePath;
92}101}
93102
94103
=== modified file 'src/iconcache.h'
--- src/iconcache.h 2011-10-10 16:37:00 +0000
+++ src/iconcache.h 2017-02-17 01:01:40 +0000
@@ -19,6 +19,7 @@
1919
20// Qt20// Qt
21#include <QObject>21#include <QObject>
22#include <QIcon>
22#include <QStringList>23#include <QStringList>
2324
24class QIcon;25class QIcon;
@@ -35,8 +36,7 @@
3536
36 static const int MaxIconCount;37 static const int MaxIconCount;
3738
38 QString themePath() const;39 QString themePath(const QIcon& icon = QIcon()) const;
39
40 QString nameForIcon(const QIcon& icon) const;40 QString nameForIcon(const QIcon& icon) const;
4141
42 // Internal, testing only42 // Internal, testing only
4343
=== modified file 'src/statusnotifieritem.cpp'
--- src/statusnotifieritem.cpp 2015-07-04 13:55:52 +0000
+++ src/statusnotifieritem.cpp 2017-02-17 01:01:40 +0000
@@ -36,6 +36,10 @@
36#include <QTranslator>36#include <QTranslator>
37#include <QWheelEvent>37#include <QWheelEvent>
3838
39#if defined(Q_WS_X11)
40#include <QX11Info>
41#endif
42
39static const char* SNI_CATEGORY_PROPERTY = "_sni_qt_category";43static const char* SNI_CATEGORY_PROPERTY = "_sni_qt_category";
40static const char* DEFAULT_CATEGORY = "ApplicationStatus";44static const char* DEFAULT_CATEGORY = "ApplicationStatus";
4145
@@ -174,7 +178,7 @@
174void StatusNotifierItem::Activate(int, int)178void StatusNotifierItem::Activate(int, int)
175{179{
176 SNI_DEBUG;180 SNI_DEBUG;
177 sendActivated(QSystemTrayIcon::Trigger);181 sendActivatedByTrigger();
178}182}
179183
180void StatusNotifierItem::ContextMenu(int, int)184void StatusNotifierItem::ContextMenu(int, int)
@@ -200,7 +204,7 @@
200204
201QString StatusNotifierItem::iconThemePath() const205QString StatusNotifierItem::iconThemePath() const
202{206{
203 return m_iconCache->themePath();207 return m_iconCache->themePath(trayIcon->icon());
204}208}
205209
206QString StatusNotifierItem::iconName() const210QString StatusNotifierItem::iconName() const
@@ -288,6 +292,12 @@
288292
289void StatusNotifierItem::sendActivatedByTrigger()293void StatusNotifierItem::sendActivatedByTrigger()
290{294{
295#if defined(Q_WS_X11)
296 // Workarounds LP: #627195
297 if (QString::fromUtf8(getenv("XDG_CURRENT_DESKTOP")).split(':').contains("Unity")) {
298 QX11Info::setAppUserTime(0);
299 }
300#endif
291 sendActivated(QSystemTrayIcon::Trigger);301 sendActivated(QSystemTrayIcon::Trigger);
292}302}
293303
294304
=== modified file 'tests/auto/fsutilstest.cpp'
--- tests/auto/fsutilstest.cpp 2011-10-15 12:32:18 +0000
+++ tests/auto/fsutilstest.cpp 2017-02-17 01:01:40 +0000
@@ -49,6 +49,7 @@
49 {49 {
50 QDir::setCurrent(m_baseDirName);50 QDir::setCurrent(m_baseDirName);
51 m_sandBoxDirName = m_baseDirName + "/sandbox";51 m_sandBoxDirName = m_baseDirName + "/sandbox";
52 setenv("XDG_RUNTIME_DIR", m_sandBoxDirName.toLocal8Bit().constData(), 1 /*overwrite*/);
52 setenv("TMPDIR", m_sandBoxDirName.toLocal8Bit().constData(), 1 /*overwrite*/);53 setenv("TMPDIR", m_sandBoxDirName.toLocal8Bit().constData(), 1 /*overwrite*/);
53 }54 }
5455
5556
=== modified file 'tests/auto/iconcachetest.cpp'
--- tests/auto/iconcachetest.cpp 2011-10-10 16:37:00 +0000
+++ tests/auto/iconcachetest.cpp 2017-02-17 01:01:40 +0000
@@ -73,6 +73,32 @@
73 QVERIFY(info.isDir());73 QVERIFY(info.isDir());
74 }74 }
7575
76 void testThemePathForIcon()
77 {
78 QList<int> sizes = QList<int>() << 16 << 22 << 32;
79 QIcon icon = createTestIcon(sizes, Qt::red);
80
81 IconCache cache(m_sandBoxDirName);
82 QString themePath = cache.themePath(icon);
83 QCOMPARE(themePath, m_sandBoxDirName + "/icons");
84
85 QFileInfo info(themePath);
86 QVERIFY(info.isDir());
87 }
88
89 void testThemePathForThemedIcons()
90 {
91 IconCache cache(m_sandBoxDirName);
92 QIcon icon = QIcon::fromTheme("indicator-messages");
93 QString themePath = cache.themePath(icon);
94
95 if (icon.name().isEmpty()) {
96 QSKIP("Icon has not been found in theme, so there's nothing to test here", SkipSingle);
97 }
98
99 QCOMPARE(themePath, QDir::homePath() + "/.local/share/icons");
100 }
101
76 void testPixmapIcon()102 void testPixmapIcon()
77 {103 {
78 IconCache cache(m_sandBoxDirName);104 IconCache cache(m_sandBoxDirName);
@@ -82,7 +108,7 @@
82108
83 QString name = cache.nameForIcon(icon);109 QString name = cache.nameForIcon(icon);
84 Q_FOREACH(int size, sizes) {110 Q_FOREACH(int size, sizes) {
85 QString dirName = cache.themePath() + QString("/hicolor/%1x%1/apps").arg(size);111 QString dirName = cache.themePath(icon) + QString("/hicolor/%1x%1/apps").arg(size);
86 QVERIFY(QFile::exists(dirName));112 QVERIFY(QFile::exists(dirName));
87 QImage image;113 QImage image;
88 QVERIFY(image.load(dirName + "/" + name + ".png"));114 QVERIFY(image.load(dirName + "/" + name + ".png"));

Subscribers

People subscribed via source and target branches