@@ -99,18 +99,6 @@ QVariant LauncherModel::data(const QModelIndex &index, int role) const
9999 return QVariant();
100100}
101101
102−void LauncherModel::setAlerting(const QString &appId, bool alerting) {
103− int index = findApplication(appId);
104− if (index >= 0) {
105− QModelIndex modelIndex = this->index(index);
106− LauncherItem *item = m_list.at(index);
107− if (!item->focused()) {
108− item->setAlerting(alerting);
109− Q_EMIT dataChanged(modelIndex, modelIndex, {RoleAlerting});
110− }
111− }
112−}
113−
114102unity::shell::launcher::LauncherItemInterface *LauncherModel::get(int index) const
115103{
116104 if (index < 0 || index >= m_list.count()) {
@@ -361,11 +349,13 @@ void LauncherModel::countChanged(const QString &appId, int count)
361349 if (idx >= 0) {
362350 LauncherItem *item = m_list.at(idx);
363351 item->setCount(count);
364− if (item->countVisible()) {
365− setAlerting(item->appId(), true);
352+ QVector<int> changedRoles = {RoleCount};
353+ if (item->countVisible() && !item->alerting() && !item->focused()) {
354+ changedRoles << RoleAlerting;
355+ item->setAlerting(true);
366356 }
367357 m_asAdapter->syncItems(m_list);
368− Q_EMIT dataChanged(index(idx), index(idx), {RoleCount});
358+ Q_EMIT dataChanged(index(idx), index(idx), changedRoles);
369359 }
370360}
371361
@@ -375,10 +365,12 @@ void LauncherModel::countVisibleChanged(const QString &appId, bool countVisible)
375365 if (idx >= 0) {
376366 LauncherItem *item = m_list.at(idx);
377367 item->setCountVisible(countVisible);
378− if (countVisible) {
379− setAlerting(item->appId(), true);
368+ QVector<int> changedRoles = {RoleCount};
369+ if (countVisible && !item->alerting() && !item->focused()) {
370+ changedRoles << RoleAlerting;
371+ item->setAlerting(true);
380372 }
381− Q_EMIT dataChanged(index(idx), index(idx), {RoleCountVisible});
373+ Q_EMIT dataChanged(index(idx), index(idx), changedRoles);
382374
383375 // If countVisible goes to false, and the item is neither pinned nor recent we can drop it
384376 if (!countVisible && !item->pinned() && !item->recent()) {
@@ -498,10 +490,12 @@ void LauncherModel::refresh()
498490
499491void LauncherModel::alert(const QString &appId)
500492{
493+ qDebug() << "alerting for appId" << appId;
501494 int idx = findApplication(appId);
502495 if (idx >= 0) {
503496 LauncherItem *item = m_list.at(idx);
504− setAlerting(item->appId(), true);
497+ if (!item->focused() && !item->alerting())
498+ item->setAlerting(true);
505499 Q_EMIT dataChanged(index(idx), index(idx), {RoleAlerting});
506500 }
507501}
@@ -600,8 +594,14 @@ void LauncherModel::focusedAppIdChanged()
600594 for (int i = 0; i < m_list.count(); ++i) {
601595 LauncherItem *item = m_list.at(i);
602596 if (!item->focused() && item->appId() == appId) {
597+ QVector<int> changedRoles;
598+ changedRoles << RoleFocused;
603599 item->setFocused(true);
604− Q_EMIT dataChanged(index(i), index(i), {RoleFocused});
600+ if (item->alerting()) {
601+ changedRoles << RoleAlerting;
602+ item->setAlerting(false);
603+ }
604+ Q_EMIT dataChanged(index(i), index(i), changedRoles);
605605 } else if (item->focused() && item->appId() != appId) {
606606 item->setFocused(false);
607607 Q_EMIT dataChanged(index(i), index(i), {RoleFocused});