diff --git a/src/libappdata/basic-app-model.cpp b/src/libappdata/basic-app-model.cpp index 0c4662e..16da5ed 100644 --- a/src/libappdata/basic-app-model.cpp +++ b/src/libappdata/basic-app-model.cpp @@ -19,6 +19,7 @@ */ #include "basic-app-model.h" +#include "user-config.h" #include @@ -149,6 +150,7 @@ void BasicAppModel::onAppUpdated(const QVector > void BasicAppModel::onAppDeleted(const QStringList &apps) { for (const auto &appid : apps) { + UserConfig::instance()->removePreInstalledApp(appid); int index = indexOfApp(appid); if (index < 0) { continue; diff --git a/src/libappdata/recently-installed-model.cpp b/src/libappdata/recently-installed-model.cpp index 006fbb8..981a500 100644 --- a/src/libappdata/recently-installed-model.cpp +++ b/src/libappdata/recently-installed-model.cpp @@ -20,6 +20,7 @@ #include "recently-installed-model.h" #include "basic-app-model.h" +#include "user-config.h" #include #include @@ -44,6 +45,10 @@ RecentlyInstalledModel::RecentlyInstalledModel(QObject *parent) : QSortFilterPro bool RecentlyInstalledModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent); + // 是否为预装应用 + if (UserConfig::instance()->isPreInstalledApps(sourceIndex.data(DataEntity::Id).toString())) { + return false; + } // 是否打开过 if (sourceIndex.data(DataEntity::IsLaunched).toInt() != 0) { return false; diff --git a/src/settings/user-config.cpp b/src/settings/user-config.cpp index de211a9..9bc8a52 100644 --- a/src/settings/user-config.cpp +++ b/src/settings/user-config.cpp @@ -111,8 +111,11 @@ bool UserConfig::isPreInstalledApps(const QString &appid) const void UserConfig::removePreInstalledApp(const QString &appid) { - QMutexLocker mutexLocker(&m_mutex); - m_preInstalledApps.remove(appid); + { + QMutexLocker mutexLocker(&m_mutex); + m_preInstalledApps.remove(appid); + } + sync(); } void UserConfig::readConfigFile()