diff --git a/src/appdata/plugin/all-app-data-provider.cpp b/src/appdata/plugin/all-app-data-provider.cpp index 736a1b8..b11d846 100644 --- a/src/appdata/plugin/all-app-data-provider.cpp +++ b/src/appdata/plugin/all-app-data-provider.cpp @@ -151,6 +151,22 @@ void AllAppDataProvider::updateData(const QList &apps) std::sort(m_appData.begin(), m_appData.end(), appDataSort); } +void AllAppDataProvider::updateFolderData(QStringList &idList) +{ + QList folders = AppFolderHelper::instance()->folderData(); + if (folders.isEmpty()) { + return; + } + for (const auto &folder : folders) { + for (const auto &app : folder.getApps()) { + if (idList.contains(app)) { + AppFolderHelper::instance()->removeAppFromFolder(app, folder.getId()); + } + } + } + AppFolderHelper::instance()->forceSync(); +} + bool AllAppDataProvider::appDataSort(const DataEntity &a, const DataEntity &b) { if ((a.top() != 0) && (b.top() != 0)) { @@ -236,6 +252,7 @@ void AllAppDataProvider::onAppDeleted(QStringList idList) { removeApps(idList); reloadFolderData(); + updateFolderData(idList); sendData(); } diff --git a/src/appdata/plugin/all-app-data-provider.h b/src/appdata/plugin/all-app-data-provider.h index 90ef01a..083d174 100644 --- a/src/appdata/plugin/all-app-data-provider.h +++ b/src/appdata/plugin/all-app-data-provider.h @@ -53,6 +53,7 @@ private: void reloadFolderData(); void mergeData(QVector &data); void updateData(const QList& apps); + void updateFolderData(QStringList& idList); static bool appDataSort(const DataEntity &a, const DataEntity &b); static void setRecentState(DataEntity &app); static bool letterSort(const QString &a, const QString &b);