修复卸载应用组中应用出错的问题

This commit is contained in:
youdiansaodongxi 2023-05-16 14:31:41 +08:00 committed by He Sir
parent b2fc1ad387
commit aabf9bd747
2 changed files with 18 additions and 0 deletions

View File

@ -151,6 +151,22 @@ void AllAppDataProvider::updateData(const QList<DataEntity> &apps)
std::sort(m_appData.begin(), m_appData.end(), appDataSort);
}
void AllAppDataProvider::updateFolderData(QStringList &idList)
{
QList<Folder> 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();
}

View File

@ -53,6 +53,7 @@ private:
void reloadFolderData();
void mergeData(QVector<DataEntity> &data);
void updateData(const QList<DataEntity>& 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);