fix(libappdata): 第一次启动时不显示最近安装应用
This commit is contained in:
parent
b355c27af6
commit
c0639b8845
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "basic-app-model.h"
|
#include "basic-app-model.h"
|
||||||
|
#include "user-config.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
@ -149,6 +150,7 @@ void BasicAppModel::onAppUpdated(const QVector<QPair<DataEntity, QVector<int> >
|
||||||
void BasicAppModel::onAppDeleted(const QStringList &apps)
|
void BasicAppModel::onAppDeleted(const QStringList &apps)
|
||||||
{
|
{
|
||||||
for (const auto &appid : apps) {
|
for (const auto &appid : apps) {
|
||||||
|
UserConfig::instance()->removePreInstalledApp(appid);
|
||||||
int index = indexOfApp(appid);
|
int index = indexOfApp(appid);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "recently-installed-model.h"
|
#include "recently-installed-model.h"
|
||||||
#include "basic-app-model.h"
|
#include "basic-app-model.h"
|
||||||
|
#include "user-config.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
@ -44,6 +45,10 @@ RecentlyInstalledModel::RecentlyInstalledModel(QObject *parent) : QSortFilterPro
|
||||||
bool RecentlyInstalledModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
bool RecentlyInstalledModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
|
||||||
{
|
{
|
||||||
QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
|
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) {
|
if (sourceIndex.data(DataEntity::IsLaunched).toInt() != 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -111,8 +111,11 @@ bool UserConfig::isPreInstalledApps(const QString &appid) const
|
||||||
|
|
||||||
void UserConfig::removePreInstalledApp(const QString &appid)
|
void UserConfig::removePreInstalledApp(const QString &appid)
|
||||||
{
|
{
|
||||||
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
m_preInstalledApps.remove(appid);
|
m_preInstalledApps.remove(appid);
|
||||||
|
}
|
||||||
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserConfig::readConfigFile()
|
void UserConfig::readConfigFile()
|
||||||
|
|
Loading…
Reference in New Issue