@@ -162,22 +162,7 @@ void LauncherModel::pin(const QString &appId, int index)
162162
163163void LauncherModel::requestRemove(const QString &appId)
164164{
165− int index = findApplication(appId);
166− if (index < 0) {
167− return;
168− }
169−
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);
174− return;
175− }
176−
177− beginRemoveRows(QModelIndex(), index, index);
178− m_list.takeAt(index)->deleteLater();
179− endRemoveRows();
180−
165+ unpin(appId);
181166 storeAppList();
182167}
183168
@@ -288,6 +273,24 @@ void LauncherModel::storeAppList()
288273 m_settings->setStoredApplications(appIds);
289274}
290275
276+void LauncherModel::unpin(const QString &appId)
277+{
278+ int index = findApplication(appId);
279+ if (index < 0) {
280+ return;
281+ }
282+
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);
287+ } else {
288+ beginRemoveRows(QModelIndex(), index, index);
289+ m_list.takeAt(index)->deleteLater();
290+ endRemoveRows();
291+ }
292+}
293+
291294int LauncherModel::findApplication(const QString &appId)
292295{
293296 for (int i = 0; i < m_list.count(); ++i) {
@@ -370,7 +373,7 @@ void LauncherModel::refresh()
370373 }
371374
372375 Q_FOREACH (LauncherItem* item, toBeRemoved) {
373− requestRemove(item->appId());
376+ unpin(item->appId());
374377 }
375378
376379 bool changed = toBeRemoved.count() > 0;