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

Proposed by Marco Trevisan (Treviño) on 2017-02-17
Status: Merged
Approved by: Andrea Azzarone on 2017-02-17
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) 2017-02-17 Approve on 2017-02-17
Review via email: mp+317569@code.launchpad.net

Commit message

Release Xenial SRU

To post a comment you must log in.
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-07-29 17:00:47 +0000
3+++ debian/changelog 2017-02-17 01:01:40 +0000
4@@ -1,3 +1,13 @@
5+sni-qt (0.2.7+15.10.20150729-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * statusnotifieritem: reset app usertime on activation to ensure
8+ compiz will raise it (LP: #627195)
9+ * IconCache: get the proper theme path based on the fact we're using a
10+ themed icon or not (LP: #1600136)
11+ * fsutils: always use $XDG_RUNTIME_DIR if it's set for saving icons
12+
13+ -- Marco Trevisan (Treviño) <mail@3v1n0.net> Fri, 17 Feb 2017 01:59:03 +0100
14+
15 sni-qt (0.2.7+15.10.20150729-0ubuntu1) wily; urgency=low
16
17 [ Robert Bruce Park ]
18
19=== modified file 'src/fsutils.cpp'
20--- src/fsutils.cpp 2011-10-14 21:41:08 +0000
21+++ src/fsutils.cpp 2017-02-17 01:01:40 +0000
22@@ -32,16 +32,31 @@
23
24 QString generateTempDir(const QString& prefix)
25 {
26- QDir dir = QDir::temp();
27+ QDir dir;
28+ QString path = QString::fromUtf8(getenv("XDG_RUNTIME_DIR"));
29+
30+ if (!path.isEmpty()) {
31+ dir.setPath(path);
32+ } else if (!getenv("SNAP")) {
33+ dir = QDir::temp();
34+ } else {
35+ // Try to get the .cache from $XDG_CACHE_HOME, if it's not set,
36+ // it has to be in ~/.cache as per XDG standard
37+ path = QString::fromUtf8(getenv("XDG_CACHE_HOME"));
38+ if (path.isEmpty()) {
39+ path = QDir::cleanPath(QDir::homePath() + "/.cache");
40+ }
41+
42+ dir.setPath(path);
43+ }
44+
45 if (!dir.mkpath(".")) {
46 qCritical("Failed to generate temporary file for prefix %s: could not create %s",
47 qPrintable(prefix), qPrintable(dir.path()));
48 return QString();
49 }
50
51- QString tmpl = QString("%1/%2-XXXXXX")
52- .arg(dir.path())
53- .arg(prefix);
54+ QString tmpl = QDir::cleanPath(dir.path() + '/' + prefix + "-XXXXXX");
55 QByteArray ba = QFile::encodeName(tmpl);
56 const char* name = mkdtemp(ba.data());
57 if (!name) {
58
59=== modified file 'src/iconcache.cpp'
60--- src/iconcache.cpp 2011-10-10 16:37:00 +0000
61+++ src/iconcache.cpp 2017-02-17 01:01:40 +0000
62@@ -26,7 +26,6 @@
63 #include <QDateTime>
64 #include <QDebug>
65 #include <QDir>
66-#include <QIcon>
67 #include <QList>
68
69 const int IconCache::MaxIconCount = 20;
70@@ -86,8 +85,18 @@
71 }
72 }
73
74-QString IconCache::themePath() const
75+QString IconCache::themePath(const QIcon& icon) const
76 {
77+ if (!icon.isNull() && !icon.name().isEmpty() && QIcon::hasThemeIcon(icon.name())) {
78+ QString dataHome = QString::fromUtf8(getenv("XDG_DATA_HOME"));
79+
80+ if (dataHome.isEmpty()) {
81+ dataHome = QDir::homePath() + "/.local/share";
82+ }
83+
84+ return QDir::cleanPath(dataHome + "/icons");
85+ }
86+
87 return m_themePath;
88 }
89
90
91=== modified file 'src/iconcache.h'
92--- src/iconcache.h 2011-10-10 16:37:00 +0000
93+++ src/iconcache.h 2017-02-17 01:01:40 +0000
94@@ -19,6 +19,7 @@
95
96 // Qt
97 #include <QObject>
98+#include <QIcon>
99 #include <QStringList>
100
101 class QIcon;
102@@ -35,8 +36,7 @@
103
104 static const int MaxIconCount;
105
106- QString themePath() const;
107-
108+ QString themePath(const QIcon& icon = QIcon()) const;
109 QString nameForIcon(const QIcon& icon) const;
110
111 // Internal, testing only
112
113=== modified file 'src/statusnotifieritem.cpp'
114--- src/statusnotifieritem.cpp 2015-07-04 13:55:52 +0000
115+++ src/statusnotifieritem.cpp 2017-02-17 01:01:40 +0000
116@@ -36,6 +36,10 @@
117 #include <QTranslator>
118 #include <QWheelEvent>
119
120+#if defined(Q_WS_X11)
121+#include <QX11Info>
122+#endif
123+
124 static const char* SNI_CATEGORY_PROPERTY = "_sni_qt_category";
125 static const char* DEFAULT_CATEGORY = "ApplicationStatus";
126
127@@ -174,7 +178,7 @@
128 void StatusNotifierItem::Activate(int, int)
129 {
130 SNI_DEBUG;
131- sendActivated(QSystemTrayIcon::Trigger);
132+ sendActivatedByTrigger();
133 }
134
135 void StatusNotifierItem::ContextMenu(int, int)
136@@ -200,7 +204,7 @@
137
138 QString StatusNotifierItem::iconThemePath() const
139 {
140- return m_iconCache->themePath();
141+ return m_iconCache->themePath(trayIcon->icon());
142 }
143
144 QString StatusNotifierItem::iconName() const
145@@ -288,6 +292,12 @@
146
147 void StatusNotifierItem::sendActivatedByTrigger()
148 {
149+#if defined(Q_WS_X11)
150+ // Workarounds LP: #627195
151+ if (QString::fromUtf8(getenv("XDG_CURRENT_DESKTOP")).split(':').contains("Unity")) {
152+ QX11Info::setAppUserTime(0);
153+ }
154+#endif
155 sendActivated(QSystemTrayIcon::Trigger);
156 }
157
158
159=== modified file 'tests/auto/fsutilstest.cpp'
160--- tests/auto/fsutilstest.cpp 2011-10-15 12:32:18 +0000
161+++ tests/auto/fsutilstest.cpp 2017-02-17 01:01:40 +0000
162@@ -49,6 +49,7 @@
163 {
164 QDir::setCurrent(m_baseDirName);
165 m_sandBoxDirName = m_baseDirName + "/sandbox";
166+ setenv("XDG_RUNTIME_DIR", m_sandBoxDirName.toLocal8Bit().constData(), 1 /*overwrite*/);
167 setenv("TMPDIR", m_sandBoxDirName.toLocal8Bit().constData(), 1 /*overwrite*/);
168 }
169
170
171=== modified file 'tests/auto/iconcachetest.cpp'
172--- tests/auto/iconcachetest.cpp 2011-10-10 16:37:00 +0000
173+++ tests/auto/iconcachetest.cpp 2017-02-17 01:01:40 +0000
174@@ -73,6 +73,32 @@
175 QVERIFY(info.isDir());
176 }
177
178+ void testThemePathForIcon()
179+ {
180+ QList<int> sizes = QList<int>() << 16 << 22 << 32;
181+ QIcon icon = createTestIcon(sizes, Qt::red);
182+
183+ IconCache cache(m_sandBoxDirName);
184+ QString themePath = cache.themePath(icon);
185+ QCOMPARE(themePath, m_sandBoxDirName + "/icons");
186+
187+ QFileInfo info(themePath);
188+ QVERIFY(info.isDir());
189+ }
190+
191+ void testThemePathForThemedIcons()
192+ {
193+ IconCache cache(m_sandBoxDirName);
194+ QIcon icon = QIcon::fromTheme("indicator-messages");
195+ QString themePath = cache.themePath(icon);
196+
197+ if (icon.name().isEmpty()) {
198+ QSKIP("Icon has not been found in theme, so there's nothing to test here", SkipSingle);
199+ }
200+
201+ QCOMPARE(themePath, QDir::homePath() + "/.local/share/icons");
202+ }
203+
204 void testPixmapIcon()
205 {
206 IconCache cache(m_sandBoxDirName);
207@@ -82,7 +108,7 @@
208
209 QString name = cache.nameForIcon(icon);
210 Q_FOREACH(int size, sizes) {
211- QString dirName = cache.themePath() + QString("/hicolor/%1x%1/apps").arg(size);
212+ QString dirName = cache.themePath(icon) + QString("/hicolor/%1x%1/apps").arg(size);
213 QVERIFY(QFile::exists(dirName));
214 QImage image;
215 QVERIFY(image.load(dirName + "/" + name + ".png"));

Subscribers

People subscribed via source and target branches