on xenial help sign in
forrow the inline comments
832a6f6handsome_feng
plugins/Unity/Launcher/launchermodel.cpp+8−7
@@ -473,14 +473,15 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
473 int itemIndex = findApplication(app->appId());
473 int itemIndex = findApplication(app->appId());
474 if (itemIndex != -1) {
474 if (itemIndex != -1) {
475 LauncherItem *item = m_list.at(itemIndex);
475 LauncherItem *item = m_list.at(itemIndex);
476+ QVector<int> roles;
476 if (!item->recent()) {
477 if (!item->recent()) {
477 item->setRecent(true);
478 item->setRecent(true);
478 m_asAdapter->syncItems(m_list);
479 m_asAdapter->syncItems(m_list);
479− Q_EMIT dataChanged(index(itemIndex), index(itemIndex), QVector<int>() << RoleRecent);
480+ roles << RoleRecent;
480 }
481 }
481 item->setRunning(true);
482 item->setRunning(true);
482− Q_EMIT dataChanged(index(itemIndex), index(itemIndex), QVector<int>() << RoleRunning);
483+ roles << RoleRunning;
483− // Shall we paint some running/recent app highlight? If yes, do it here.
484+ Q_EMIT dataChanged(index(itemIndex), index(itemIndex), roles);
484 } else {
485 } else {
485 LauncherItem *item = new LauncherItem(app->appId(), app->name(), app->icon().toString(), this);
486 LauncherItem *item = new LauncherItem(app->appId(), app->name(), app->icon().toString(), this);
486 item->setRecent(true);
487 item->setRecent(true);
@@ -507,15 +508,15 @@ void LauncherModel::applicationRemoved(const QModelIndex &parent, int row)
507 }
508 }
508
509
509 if (appIndex > -1) {
510 if (appIndex > -1) {
510− LauncherItem *item = m_list.at(appIndex);
511− item->setRunning(false);
512− Q_EMIT dataChanged(index(appIndex), index(appIndex), QVector<int>() << RoleRunning);
513−
514 if (!m_list.at(appIndex)->pinned()) {
511 if (!m_list.at(appIndex)->pinned()) {
515 beginRemoveRows(QModelIndex(), appIndex, appIndex);
512 beginRemoveRows(QModelIndex(), appIndex, appIndex);
516 m_list.takeAt(appIndex)->deleteLater();
513 m_list.takeAt(appIndex)->deleteLater();
517 endRemoveRows();
514 endRemoveRows();
518 m_asAdapter->syncItems(m_list);
515 m_asAdapter->syncItems(m_list);
516+ } else {
517+ LauncherItem *item = m_list.at(appIndex);
518+ item->setRunning(false);
519+ Q_EMIT dataChanged(index(appIndex), index(appIndex), QVector<int>() << RoleRunning);
519 }
520 }
520 }
521 }
521}
522}