on xenial help sign in
Ensure a runtime-change to an item's countVisible and count (with countVisible true) implicitly triggers also an alert.
commiteb1bd3b4e5c1005aa4f69fd5f1fdd1f63dc94380 authorMirco Müller <mirco.mueller@canonical.com> dateThu 2 Jul 2015, 15:12 (11 years ago) parent53b19b9
3 files changed+18
plugins/Unity/Launcher/launcheritem.cpp+6 tests/mocks/Unity/Launcher/MockLauncherItem.cpp+6 tests/mocks/Unity/Launcher/MockLauncherModel.cpp+6
plugins/Unity/Launcher/launcheritem.cpp+6
@@ -151,6 +151,9 @@ void LauncherItem::setCount(int count)
151151 if (m_count != count) {
152152 m_count = count;
153153 Q_EMIT countChanged(count);
154+ if (m_countVisible) {
155+ setAlerting(true);
156+ }
154157 }
155158}
156159
@@ -164,6 +167,9 @@ void LauncherItem::setCountVisible(bool countVisible)
164167 if (m_countVisible != countVisible) {
165168 m_countVisible = countVisible;
166169 Q_EMIT countVisibleChanged(countVisible);
170+ if (countVisible) {
171+ setAlerting(true);
172+ }
167173 }
168174}
169175
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+6
@@ -130,6 +130,9 @@ void MockLauncherItem::setCount(int count)
130130 {
131131 m_count = count;
132132 Q_EMIT countChanged(count);
133+ if (m_countVisible) {
134+ setAlerting(true);
135+ }
133136 }
134137}
135138
@@ -143,6 +146,9 @@ void MockLauncherItem::setCountVisible(bool countVisible)
143146 if (m_countVisible != countVisible) {
144147 m_countVisible = countVisible;
145148 Q_EMIT countVisibleChanged(countVisible);
149+ if (countVisible) {
150+ setAlerting(true);
151+ }
146152 }
147153}
148154
tests/mocks/Unity/Launcher/MockLauncherModel.cpp+6
@@ -34,6 +34,7 @@ MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(pa
3434 item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this);
3535 item->setProgress(50);
3636 item->setCountVisible(true);
37+ item->setAlerting(false);
3738 m_list.append(item);
3839 item = new MockLauncherItem("music-app", "/usr/share/applications/music-app.desktop", "Music", "soundcloud", this);
3940 m_list.append(item);
@@ -43,25 +44,30 @@ MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(pa
4344 item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this);
4445 item->setCount(1);
4546 item->setCountVisible(true);
47+ item->setAlerting(false);
4648 m_list.append(item);
4749 item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this);
4850 item->setCount(12);
4951 item->setCountVisible(true);
52+ item->setAlerting(false);
5053 item->setPinned(true);
5154 m_list.append(item);
5255 item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this);
5356 item->setCount(123);
5457 item->setCountVisible(true);
58+ item->setAlerting(false);
5559 m_list.append(item);
5660 item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this);
5761 item->setCount(1234567890);
5862 item->setCountVisible(true);
63+ item->setAlerting(false);
5964 item->setPinned(true);
6065 m_list.append(item);
6166 item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this);
6267 item->setProgress(50);
6368 item->setCount(5);
6469 item->setCountVisible(true);
70+ item->setAlerting(false);
6571 item->setFocused(true);
6672 item->setPinned(true);
6773 m_list.append(item);