fix(libappdata): 第一次启动时不显示最近安装应用
This commit is contained in:
parent
b355c27af6
commit
c0639b8845
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "basic-app-model.h"
|
||||
#include "user-config.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -149,6 +150,7 @@ void BasicAppModel::onAppUpdated(const QVector<QPair<DataEntity, QVector<int> >
|
|||
void BasicAppModel::onAppDeleted(const QStringList &apps)
|
||||
{
|
||||
for (const auto &appid : apps) {
|
||||
UserConfig::instance()->removePreInstalledApp(appid);
|
||||
int index = indexOfApp(appid);
|
||||
if (index < 0) {
|
||||
continue;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "recently-installed-model.h"
|
||||
#include "basic-app-model.h"
|
||||
#include "user-config.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue