@@ -162,22 +162,7 @@ void LauncherModel::pin(const QString &appId, int index)
163void LauncherModel::requestRemove(const QString &appId)
163void LauncherModel::requestRemove(const QString &appId)
165− int index = findApplication(appId);
165+ unpin(appId);
170− if (m_appManager->findApplication(appId)) {
171− m_list.at(index)->setPinned(false);
172− QModelIndex modelIndex = this->index(index);
173− Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
177− beginRemoveRows(QModelIndex(), index, index);
178− m_list.takeAt(index)->deleteLater();
181 storeAppList();
166 storeAppList();
@@ -288,6 +273,24 @@ void LauncherModel::storeAppList()
288 m_settings->setStoredApplications(appIds);
273 m_settings->setStoredApplications(appIds);
276+void LauncherModel::unpin(const QString &appId)
278+ int index = findApplication(appId);
283+ if (m_appManager->findApplication(appId)) {
284+ m_list.at(index)->setPinned(false);
285+ QModelIndex modelIndex = this->index(index);
286+ Q_EMIT dataChanged(modelIndex, modelIndex, QVector<int>() << RolePinned);
288+ beginRemoveRows(QModelIndex(), index, index);
289+ m_list.takeAt(index)->deleteLater();
291int LauncherModel::findApplication(const QString &appId)
294int LauncherModel::findApplication(const QString &appId)
293 for (int i = 0; i < m_list.count(); ++i) {
296 for (int i = 0; i < m_list.count(); ++i) {
@@ -370,7 +373,7 @@ void LauncherModel::refresh()
372 Q_FOREACH (LauncherItem* item, toBeRemoved) {
375 Q_FOREACH (LauncherItem* item, toBeRemoved) {
373− requestRemove(item->appId());
376+ unpin(item->appId());
376 bool changed = toBeRemoved.count() > 0;
379 bool changed = toBeRemoved.count() > 0;