From 0f47953a4fab34ca3363df0799ca78df796210ad Mon Sep 17 00:00:00 2001 From: zhangkun Date: Thu, 5 Mar 2026 16:14:14 +0800 Subject: [PATCH] feat: add DesktopSourcePath property to Application DBus interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Added new DBus property "DesktopSourcePath" to expose the source path of desktop files 2. Extended the ApplicationService class with getter method and change signal 3. Updated DBus XML interface definition to include the new property 4. The property provides read-only access to the desktop file source path for external applications feat: 为应用DBus接口添加DesktopSourcePath属性 1. 新增DBus属性"DesktopSourcePath"以暴露桌面文件的源路径 2. 扩展ApplicationService类,添加获取方法和变更信号 3. 更新DBus XML接口定义以包含新属性 4. 该属性为外部应用提供对桌面文件源路径的只读访问 PMS: BUG-351621 --- .../org.desktopspec.ApplicationManager1.Application.xml | 1 + src/dbus/applicationservice.cpp | 6 ++++++ src/dbus/applicationservice.h | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/api/dbus/org.desktopspec.ApplicationManager1.Application.xml b/api/dbus/org.desktopspec.ApplicationManager1.Application.xml index 135a647b..a3515a0b 100644 --- a/api/dbus/org.desktopspec.ApplicationManager1.Application.xml +++ b/api/dbus/org.desktopspec.ApplicationManager1.Application.xml @@ -174,6 +174,7 @@ + diff --git a/src/dbus/applicationservice.cpp b/src/dbus/applicationservice.cpp index 61b45ccb..539703da 100644 --- a/src/dbus/applicationservice.cpp +++ b/src/dbus/applicationservice.cpp @@ -718,6 +718,11 @@ QString ApplicationService::X_CreatedBy() const noexcept return findEntryValue(DesktopFileEntryKey, "X-Created-By", EntryValueType::String).toString(); } +QString ApplicationService::desktopSourcePath() const noexcept +{ + return m_desktopSource.sourcePath(); +} + bool ApplicationService::terminal() const noexcept { auto val = findEntryValue(DesktopFileEntryKey, "Terminal", EntryValueType::String); @@ -1096,6 +1101,7 @@ void ApplicationService::resetEntry(DesktopEntry *newEntry) noexcept emit xDeepinCreatedByChanged(); emit execsChanged(); emit xCreatedByChanged(); + emit desktopSourcePathChanged(); } enum class SpliterState : uint8_t { Normal, InSingleQuote, InDoubleQuotes }; diff --git a/src/dbus/applicationservice.h b/src/dbus/applicationservice.h index ebbac183..32412d51 100644 --- a/src/dbus/applicationservice.h +++ b/src/dbus/applicationservice.h @@ -119,6 +119,9 @@ class ApplicationService : public QObject, protected QDBusContext Q_PROPERTY(QString X_CreatedBy READ X_CreatedBy NOTIFY xCreatedByChanged) [[nodiscard]] QString X_CreatedBy() const noexcept; + Q_PROPERTY(QString DesktopSourcePath READ desktopSourcePath NOTIFY desktopSourcePathChanged) + [[nodiscard]] QString desktopSourcePath() const noexcept; + [[nodiscard]] QDBusObjectPath findInstance(const QString &instanceId) const; [[nodiscard]] const QString &getLauncher() const noexcept { return m_launcher; } @@ -179,6 +182,7 @@ public Q_SLOTS: void xDeepinCreatedByChanged(); void execsChanged(); void xCreatedByChanged(); + void desktopSourcePathChanged(); private: friend class ApplicationManager1Service;