diff --git a/debian/control b/debian/control index 306c26b3c..3a61f09ce 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: Deepin Packages Builder Build-Depends: debhelper-compat (= 13), cmake, - dde-application-manager-api (>> 1.2.51), + dde-application-manager-api (>= 1.2.48), dde-api-dev (>> 6.0.39), dde-tray-loader-dev (> 2.0.24), extra-cmake-modules, @@ -82,6 +82,7 @@ Depends: qml6-module-qtquick-layouts, qml6-module-qtquick-window, qt6-wayland (>= 6.8), + dde-application-manager (>> 1.2.51), ${misc:Depends}, ${shlibs:Depends}, Breaks: diff --git a/panels/dock/dockdbusproxy.cpp b/panels/dock/dockdbusproxy.cpp index b321df5f4..ecad8a9af 100644 --- a/panels/dock/dockdbusproxy.cpp +++ b/panels/dock/dockdbusproxy.cpp @@ -81,9 +81,11 @@ DockDBusProxy::DockDBusProxy(DockPanel* parent) timer->stop(); timer->deleteLater(); connect(m_trayApplet, SIGNAL(pluginsChanged()), this, SIGNAL(pluginsChanged())); - QTimer::singleShot(3000, this, [this]() { - logInitialPluginState(); + // Trigger a debounced log on each change, and also schedule one immediately after first load + connect(this, &DockDBusProxy::pluginsChanged, this, [this]() { + scheduleDebouncedLog(); }); + scheduleDebouncedLog(); } }); timer->start(); @@ -301,6 +303,20 @@ void DockDBusProxy::logCurrentVisiblePluginList(const QString &changedItemKey, b #endif } +// Restart the timer on every pluginsChanged; only log after the list stays stable for 2s +void DockDBusProxy::scheduleDebouncedLog() +{ + if (!m_debounceTimer) { + m_debounceTimer = new QTimer(this); + m_debounceTimer->setSingleShot(true); + m_debounceTimer->setInterval(2000); + connect(m_debounceTimer, &QTimer::timeout, this, [this]() { + logInitialPluginState(); + }); + } + m_debounceTimer->start(); +} + void DockDBusProxy::ReloadPlugins() { parent()->ReloadPlugins(); diff --git a/panels/dock/dockdbusproxy.h b/panels/dock/dockdbusproxy.h index 455c26fc1..d2bd1b8dd 100644 --- a/panels/dock/dockdbusproxy.h +++ b/panels/dock/dockdbusproxy.h @@ -91,8 +91,12 @@ class DockDBusProxy final: public QObject, public QDBusContext void updateDockPluginsVisible(const QVariantMap &pluginsVisible); void logInitialPluginState(); void logCurrentVisiblePluginList(const QString &changedItemKey = QString(), bool changedVisible = true); + // Debounce logging the initial plugin list, as it may change asynchronously right after load + void scheduleDebouncedLog(); DS_NAMESPACE::DAppletProxy *m_oldDockApplet; DS_NAMESPACE::DAppletProxy *m_trayApplet; + // Debounce timer to ensure the plugin list has stabilized before logging + QTimer *m_debounceTimer = nullptr; }; }