mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
cleanup not found favorites
This commit is contained in:
parent
13500ee9e2
commit
daebf5ae60
2 changed files with 16 additions and 2 deletions
|
|
@ -121,6 +121,7 @@ void ApplicationListModel::loadApplications()
|
||||||
|
|
||||||
QMap<int, ApplicationData> orderedList;
|
QMap<int, ApplicationData> orderedList;
|
||||||
QList<ApplicationData> unorderedList;
|
QList<ApplicationData> unorderedList;
|
||||||
|
QSet<QString> foundFavorites;
|
||||||
|
|
||||||
// Iterate over all entries in the group
|
// Iterate over all entries in the group
|
||||||
while (!subGroupList.isEmpty()) {
|
while (!subGroupList.isEmpty()) {
|
||||||
|
|
@ -159,6 +160,7 @@ void ApplicationListModel::loadApplications()
|
||||||
|
|
||||||
if (m_favorites.contains(data.storageId)) {
|
if (m_favorites.contains(data.storageId)) {
|
||||||
data.location = Favorites;
|
data.location = Favorites;
|
||||||
|
foundFavorites.insert(data.storageId);
|
||||||
} else if (m_desktopItems.contains(data.storageId)) {
|
} else if (m_desktopItems.contains(data.storageId)) {
|
||||||
data.location = Desktop;
|
data.location = Desktop;
|
||||||
}
|
}
|
||||||
|
|
@ -186,6 +188,18 @@ void ApplicationListModel::loadApplications()
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
emit countChanged();
|
emit countChanged();
|
||||||
|
|
||||||
|
bool favChanged = false;
|
||||||
|
for (const auto &item : m_favorites) {
|
||||||
|
if (!foundFavorites.contains(item)) {
|
||||||
|
favChanged = true;
|
||||||
|
m_favorites.removeAll(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (favChanged) {
|
||||||
|
m_homeScreen->config().writeEntry("Favorites", m_favorites);
|
||||||
|
emit favoriteCountChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ApplicationListModel::data(const QModelIndex &index, int role) const
|
QVariant ApplicationListModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
applet.wallpaperPlugin = 'org.kde.image'
|
applet.wallpaperPlugin = 'org.kde.image'
|
||||||
applet.writeConfig("AppOrder", ["org.kde.phone.dialer.desktop", "org.kde.mobile.angelfish.desktop", "org.kde.phone.calindori.desktop", "org.kde.mobile.camera.desktop"])
|
applet.writeConfig("AppOrder", ["org.kde.phone.dialer.desktop", "org.kde.phonebook.desktop", "org.kde.mobile.angelfish.desktop", "org.kde.mobile.camera.desktop"])
|
||||||
applet.writeConfig("Favorites", ["org.kde.phone.dialer.desktop", "org.kde.mobile.angelfish.desktop", "org.kde.phone.calindori.desktop", "org.kde.mobile.camera.desktop"])
|
applet.writeConfig("Favorites", ["org.kde.phone.dialer.desktop", "org.kde.phonebook.desktop", "org.kde.mobile.angelfish.desktop", "org.kde.mobile.camera.desktop"])
|
||||||
applet.reloadConfig()
|
applet.reloadConfig()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue