From aabf9bd747e29fe11036e2cf322f85c8528ca51e Mon Sep 17 00:00:00 2001 From: youdiansaodongxi Date: Tue, 16 May 2023 14:31:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=B8=E8=BD=BD=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E4=B8=AD=E5=BA=94=E7=94=A8=E5=87=BA=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/appdata/plugin/all-app-data-provider.cpp | 17 +++++++++++++++++ src/appdata/plugin/all-app-data-provider.h | 1 + 2 files changed, 18 insertions(+) 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);