diff --git a/src/appdata/plugin/all-app-data-provider.cpp b/src/appdata/plugin/all-app-data-provider.cpp index a75f8a2..9ba77c9 100644 --- a/src/appdata/plugin/all-app-data-provider.cpp +++ b/src/appdata/plugin/all-app-data-provider.cpp @@ -136,6 +136,21 @@ void AllAppDataProvider::mergeData(QVector &data) data.append(m_appData); } +void AllAppDataProvider::updateData(const QList &apps) +{ + QMutexLocker locker(&m_mutex); + for (const DataEntity & app : apps) { + for (DataEntity & appdata : m_appData) { + if (appdata.id() == app.id()) { + appdata = app; + setRecentState(appdata); + break; + } + } + } + std::sort(m_appData.begin(), m_appData.end(), appDataSort); +} + bool AllAppDataProvider::appDataSort(const DataEntity &a, const DataEntity &b) { if ((a.top() != 0) && (b.top() != 0)) { @@ -221,8 +236,7 @@ void AllAppDataProvider::removeApps(QStringList &idList) void AllAppDataProvider::onAppUpdated(const QList& apps) { - Q_UNUSED(apps); - reloadAppData(); + updateData(apps); sendData(); } diff --git a/src/appdata/plugin/all-app-data-provider.h b/src/appdata/plugin/all-app-data-provider.h index 4e81c1f..8b5f190 100644 --- a/src/appdata/plugin/all-app-data-provider.h +++ b/src/appdata/plugin/all-app-data-provider.h @@ -52,6 +52,7 @@ private: void reloadAppData(); void reloadFolderData(); void mergeData(QVector &data); + void updateData(const QList& apps); static bool appDataSort(const DataEntity &a, const DataEntity &b); static void setRecentState(DataEntity &app);