@@ -82,9 +82,14 @@ QVariant LauncherModel::data(const QModelIndex &index, int role) const
8282 return item->progress();
8383 case RoleFocused:
8484 return item->focused();
85+ case RoleRunning:
86+ return item->running();
87+ default:
88+ qWarning() << Q_FUNC_INFO << "missing role, implement me";
89+ return QVariant();
8590 }
8691
87− return QVariant();
92+ return LauncherModelInterface::data(index, role);
8893}
8994
9095unity::shell::launcher::LauncherItemInterface *LauncherModel::get(int index) const
@@ -134,7 +139,7 @@ void LauncherModel::pin(const QString &appId, int index)
134139 if (index == -1 || index == currentIndex) {
135140 m_list.at(currentIndex)->setPinned(true);
136141 QModelIndex modelIndex = this->index(currentIndex);
137− Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
142+ Q_EMIT dataChanged(modelIndex, modelIndex, {RolePinned});
138143 } else {
139144 move(currentIndex, index);
140145 // move() will store the list to the backend itself, so just exit at this point.
@@ -147,7 +152,7 @@ void LauncherModel::pin(const QString &appId, int index)
147152
148153 DesktopFileHandler desktopFile(appId);
149154 if (!desktopFile.isValid()) {
150− qWarning() << "Can't pin this application, there is no .destkop file available.";
155+ qWarning() << "Can't pin this application, there is no .desktop file available.";
151156 return;
152157 }
153158
@@ -172,7 +177,7 @@ void LauncherModel::requestRemove(const QString &appId)
172177
173178void LauncherModel::quickListActionInvoked(const QString &appId, int actionIndex)
174179{
175− int index = findApplication(appId);
180+ const int index = findApplication(appId);
176181 if (index < 0) {
177182 return;
178183 }
@@ -273,6 +278,7 @@ bool LauncherModel::onlyPinned() const
273278
274279void LauncherModel::setOnlyPinned(bool onlyPinned) {
275280 Q_UNUSED(onlyPinned);
281+ // FIXME implement showing only pinned apps
276282 qWarning() << "This launcher implementation does not support showing only pinned apps";
277283}
278284
@@ -299,7 +305,7 @@ void LauncherModel::unpin(const QString &appId)
299305 if (m_list.at(index)->pinned()) {
300306 m_list.at(index)->setPinned(false);
301307 QModelIndex modelIndex = this->index(index);
302− Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
308+ Q_EMIT dataChanged(modelIndex, modelIndex, {RolePinned});
303309 }
304310 } else {
305311 beginRemoveRows(QModelIndex(), index, index);
@@ -325,7 +331,7 @@ void LauncherModel::progressChanged(const QString &appId, int progress)
325331 if (idx >= 0) {
326332 LauncherItem *item = m_list.at(idx);
327333 item->setProgress(progress);
328− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleProgress);
334+ Q_EMIT dataChanged(index(idx), index(idx), {RoleProgress});
329335 }
330336}
331337
@@ -335,7 +341,7 @@ void LauncherModel::countChanged(const QString &appId, int count)
335341 if (idx >= 0) {
336342 LauncherItem *item = m_list.at(idx);
337343 item->setCount(count);
338− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
344+ Q_EMIT dataChanged(index(idx), index(idx), {RoleCount});
339345 m_asAdapter->syncItems(m_list);
340346 }
341347}
@@ -346,7 +352,7 @@ void LauncherModel::countVisibleChanged(const QString &appId, int countVisible)
346352 if (idx >= 0) {
347353 LauncherItem *item = m_list.at(idx);
348354 item->setCountVisible(countVisible);
349− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCountVisible);
355+ Q_EMIT dataChanged(index(idx), index(idx), {RoleCountVisible});
350356
351357 // If countVisible goes to false, and the item is neither pinned nor recent we can drop it
352358 if (!countVisible && !item->pinned() && !item->recent()) {
@@ -388,7 +394,7 @@ void LauncherModel::refresh()
388394 item->setName(desktopFile.displayName());
389395 item->setIcon(desktopFile.icon());
390396 item->setPinned(item->pinned()); // update pinned text if needed
391− Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleName << RoleIcon);
397+ Q_EMIT dataChanged(index(idx), index(idx), {RoleName, RoleIcon});
392398 }
393399 }
394400
@@ -475,12 +481,13 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
475481 if (!item->recent()) {
476482 item->setRecent(true);
477483 m_asAdapter->syncItems(m_list);
478− Q_EMIT dataChanged(index(itemIndex), index(itemIndex), QVector<int>() << RoleRecent);
484+ Q_EMIT dataChanged(index(itemIndex), index(itemIndex), {RoleRecent});
479485 }
480− // Shall we paint some running/recent app highlight? If yes, do it here.
486+ // TODO Shall we paint some running/recent app highlight? If yes, do it here.
481487 } else {
482488 LauncherItem *item = new LauncherItem(app->appId(), app->name(), app->icon().toString(), this);
483489 item->setRecent(true);
490+ item->setRunning(true);
484491 item->setFocused(app->focused());
485492
486493 beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
@@ -502,7 +509,15 @@ void LauncherModel::applicationRemoved(const QModelIndex &parent, int row)
502509 }
503510 }
504511
505− if (appIndex > -1 && !m_list.at(appIndex)->pinned()) {
512+ if (appIndex < 0) {
513+ qWarning() << Q_FUNC_INFO << "appIndex not found";
514+ return;
515+ }
516+
517+ LauncherItem * item = m_list.at(appIndex);
518+ item->setRunning(false);
519+
520+ if (!item->pinned()) {
506521 beginRemoveRows(QModelIndex(), appIndex, appIndex);
507522 m_list.takeAt(appIndex)->deleteLater();
508523 endRemoveRows();
@@ -517,10 +532,10 @@ void LauncherModel::focusedAppIdChanged()
517532 LauncherItem *item = m_list.at(i);
518533 if (!item->focused() && item->appId() == appId) {
519534 item->setFocused(true);
520− Q_EMIT dataChanged(index(i), index(i), QVector<int>() << RoleFocused);
535+ Q_EMIT dataChanged(index(i), index(i), {RoleFocused});
521536 } else if (item->focused() && item->appId() != appId) {
522537 item->setFocused(false);
523− Q_EMIT dataChanged(index(i), index(i), QVector<int>() << RoleFocused);
538+ Q_EMIT dataChanged(index(i), index(i), {RoleFocused});
524539 }
525540 }
526541}