on xenial help sign in
Ensure a runtime-change to an item's countVisible and count (with countVisible true) implicitly triggers also an alert.
eb1bd3bMirco Müller
plugins/Unity/Launcher/launcheritem.cpp+6
@@ -151,6 +151,9 @@ void LauncherItem::setCount(int count)
151 if (m_count != count) {
151 if (m_count != count) {
152 m_count = count;
152 m_count = count;
153 Q_EMIT countChanged(count);
153 Q_EMIT countChanged(count);
154+ if (m_countVisible) {
155+ setAlerting(true);
156+ }
154 }
157 }
155}
158}
156
159
@@ -164,6 +167,9 @@ void LauncherItem::setCountVisible(bool countVisible)
164 if (m_countVisible != countVisible) {
167 if (m_countVisible != countVisible) {
165 m_countVisible = countVisible;
168 m_countVisible = countVisible;
166 Q_EMIT countVisibleChanged(countVisible);
169 Q_EMIT countVisibleChanged(countVisible);
170+ if (countVisible) {
171+ setAlerting(true);
172+ }
167 }
173 }
168}
174}
169
175
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+6
@@ -130,6 +130,9 @@ void MockLauncherItem::setCount(int count)
130 {
130 {
131 m_count = count;
131 m_count = count;
132 Q_EMIT countChanged(count);
132 Q_EMIT countChanged(count);
133+ if (m_countVisible) {
134+ setAlerting(true);
135+ }
133 }
136 }
134}
137}
135
138
@@ -143,6 +146,9 @@ void MockLauncherItem::setCountVisible(bool countVisible)
143 if (m_countVisible != countVisible) {
146 if (m_countVisible != countVisible) {
144 m_countVisible = countVisible;
147 m_countVisible = countVisible;
145 Q_EMIT countVisibleChanged(countVisible);
148 Q_EMIT countVisibleChanged(countVisible);
149+ if (countVisible) {
150+ setAlerting(true);
151+ }
146 }
152 }
147}
153}
148
154
tests/mocks/Unity/Launcher/MockLauncherModel.cpp+6
@@ -34,6 +34,7 @@ MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(pa
34 item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this);
34 item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this);
35 item->setProgress(50);
35 item->setProgress(50);
36 item->setCountVisible(true);
36 item->setCountVisible(true);
37+ item->setAlerting(false);
37 m_list.append(item);
38 m_list.append(item);
38 item = new MockLauncherItem("music-app", "/usr/share/applications/music-app.desktop", "Music", "soundcloud", this);
39 item = new MockLauncherItem("music-app", "/usr/share/applications/music-app.desktop", "Music", "soundcloud", this);
39 m_list.append(item);
40 m_list.append(item);
@@ -43,25 +44,30 @@ MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(pa
43 item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this);
44 item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this);
44 item->setCount(1);
45 item->setCount(1);
45 item->setCountVisible(true);
46 item->setCountVisible(true);
47+ item->setAlerting(false);
46 m_list.append(item);
48 m_list.append(item);
47 item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this);
49 item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this);
48 item->setCount(12);
50 item->setCount(12);
49 item->setCountVisible(true);
51 item->setCountVisible(true);
52+ item->setAlerting(false);
50 item->setPinned(true);
53 item->setPinned(true);
51 m_list.append(item);
54 m_list.append(item);
52 item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this);
55 item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this);
53 item->setCount(123);
56 item->setCount(123);
54 item->setCountVisible(true);
57 item->setCountVisible(true);
58+ item->setAlerting(false);
55 m_list.append(item);
59 m_list.append(item);
56 item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
60 item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
57 item->setCount(1234567890);
61 item->setCount(1234567890);
58 item->setCountVisible(true);
62 item->setCountVisible(true);
63+ item->setAlerting(false);
59 item->setPinned(true);
64 item->setPinned(true);
60 m_list.append(item);
65 m_list.append(item);
61 item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
66 item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
62 item->setProgress(50);
67 item->setProgress(50);
63 item->setCount(5);
68 item->setCount(5);
64 item->setCountVisible(true);
69 item->setCountVisible(true);
70+ item->setAlerting(false);
65 item->setFocused(true);
71 item->setFocused(true);
66 item->setPinned(true);
72 item->setPinned(true);
67 m_list.append(item);
73 m_list.append(item);