Skip to content

Commit

Permalink
fix: launcher application item not updating
Browse files Browse the repository at this point in the history
The refresh slot function was not successfully connected

Issue: linuxdeepin/developer-center#8968
  • Loading branch information
mhduiy authored and kegechen committed Jun 13, 2024
1 parent 3d115c8 commit b637558
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/models/appsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static void updateAppItemFromAM(AppItem *appItem)
AppsModel::AppsModel(QObject *parent)
: QStandardItemModel(parent)
, m_dconfig(DConfig::create("dde-launchpad", "org.deepin.dde.launchpad.appsmodel"))
, m_tmUpdateCache(new QTimer(this))
{
Q_ASSERT_X(m_dconfig->isValid(), "DConfig", "DConfig file is missing or invalid");
m_excludedAppIdList = m_dconfig->value("excludeAppIdList", QStringList{}).toStringList();
Expand All @@ -60,6 +61,9 @@ AppsModel::AppsModel(QObject *parent)
Q_ASSERT(duplicatedItems.isEmpty());
qDebug() << rowCount();

m_tmUpdateCache->setInterval(1000);
m_tmUpdateCache->setSingleShot(true);

if (AppMgr::instance()->isValid()) {
connect(AppMgr::instance(), &AppMgr::changed, m_tmUpdateCache, qOverload<>(&QTimer::start));
connect(AppMgr::instance(), &AppMgr::itemDataChanged, this, [this](const QString &id) {
Expand All @@ -72,10 +76,6 @@ AppsModel::AppsModel(QObject *parent)
});
}

m_tmUpdateCache = new QTimer(this);
m_tmUpdateCache->setInterval(1000);
m_tmUpdateCache->setSingleShot(true);

m_fwIconCache = new DFileWatcherManager(this);
const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
const QString suffix("/icons/hicolor/icon-theme.cache");
Expand Down

0 comments on commit b637558

Please sign in to comment.