fix: missing package parsed when ReloadApplicaitons
Restart timer to merge directory changed and dpkg hook event. Reload applications when called from dbus. issue: https://github.com/linuxdeepin/developer-center/issues/7830
This commit is contained in:
parent
5080e9b5de
commit
8851263925
@ -25,8 +25,9 @@ ApplicationManager1Service::ApplicationManager1Service(std::unique_ptr<Identifie
|
|||||||
, m_storage(std::move(storage))
|
, m_storage(std::move(storage))
|
||||||
{
|
{
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
m_reloadTimer.setInterval(1s);
|
m_reloadTimer.setInterval(50);
|
||||||
connect(&m_reloadTimer, &QTimer::timeout, [this] { m_reloadTimer.stop(); });
|
m_reloadTimer.setSingleShot(true);
|
||||||
|
connect(&m_reloadTimer, &QTimer::timeout, this, &ApplicationManager1Service::doReloadApplications);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationManager1Service::initService(QDBusConnection &connection) noexcept
|
void ApplicationManager1Service::initService(QDBusConnection &connection) noexcept
|
||||||
@ -613,12 +614,16 @@ void ApplicationManager1Service::updateApplication(const QSharedPointer<Applicat
|
|||||||
|
|
||||||
void ApplicationManager1Service::ReloadApplications()
|
void ApplicationManager1Service::ReloadApplications()
|
||||||
{
|
{
|
||||||
if (m_reloadTimer.isActive()) {
|
if (calledFromDBus() && !m_reloadTimer.isActive()) {
|
||||||
qInfo() << "reloadTimer is running, ignore...";
|
doReloadApplications();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_reloadTimer.start();
|
m_reloadTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplicationManager1Service::doReloadApplications()
|
||||||
|
{
|
||||||
|
qInfo() << "reload applications.";
|
||||||
|
|
||||||
auto desktopFileDirs = getDesktopFileDirs();
|
auto desktopFileDirs = getDesktopFileDirs();
|
||||||
desktopFileDirs.append(getAutoStartDirs()); // detect autostart apps add/remove/update
|
desktopFileDirs.append(getAutoStartDirs()); // detect autostart apps add/remove/update
|
||||||
|
@ -66,6 +66,8 @@ Q_SIGNALS:
|
|||||||
void InterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces);
|
void InterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces);
|
||||||
void listChanged();
|
void listChanged();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void doReloadApplications();
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Identifier> m_identifier;
|
std::unique_ptr<Identifier> m_identifier;
|
||||||
std::weak_ptr<ApplicationManager1Storage> m_storage;
|
std::weak_ptr<ApplicationManager1Storage> m_storage;
|
||||||
|
Loading…
Reference in New Issue
Block a user