Skip to content

Commit aaed2e0

Browse files
mhduiydeepin-bot[bot]
authored andcommitted
feat: add DesktopSourcePath property to Application DBus interface
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
1 parent 28f532a commit aaed2e0

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

api/dbus/org.desktopspec.ApplicationManager1.Application.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
</property>
175175

176176
<property name="X_CreatedBy" type="s" access="read"/>
177+
<property name="DesktopSourcePath" type="s" access="read"/>
177178

178179
<method name="SendToDesktop">
179180
<arg type="b" name="success" direction="out"/>

src/dbus/applicationservice.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,11 @@ QString ApplicationService::X_CreatedBy() const noexcept
718718
return findEntryValue(DesktopFileEntryKey, "X-Created-By", EntryValueType::String).toString();
719719
}
720720

721+
QString ApplicationService::desktopSourcePath() const noexcept
722+
{
723+
return m_desktopSource.sourcePath();
724+
}
725+
721726
bool ApplicationService::terminal() const noexcept
722727
{
723728
auto val = findEntryValue(DesktopFileEntryKey, "Terminal", EntryValueType::String);
@@ -1096,6 +1101,7 @@ void ApplicationService::resetEntry(DesktopEntry *newEntry) noexcept
10961101
emit xDeepinCreatedByChanged();
10971102
emit execsChanged();
10981103
emit xCreatedByChanged();
1104+
emit desktopSourcePathChanged();
10991105
}
11001106

11011107
enum class SpliterState : uint8_t { Normal, InSingleQuote, InDoubleQuotes };

src/dbus/applicationservice.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ class ApplicationService : public QObject, protected QDBusContext
119119
Q_PROPERTY(QString X_CreatedBy READ X_CreatedBy NOTIFY xCreatedByChanged)
120120
[[nodiscard]] QString X_CreatedBy() const noexcept;
121121

122+
Q_PROPERTY(QString DesktopSourcePath READ desktopSourcePath NOTIFY desktopSourcePathChanged)
123+
[[nodiscard]] QString desktopSourcePath() const noexcept;
124+
122125
[[nodiscard]] QDBusObjectPath findInstance(const QString &instanceId) const;
123126

124127
[[nodiscard]] const QString &getLauncher() const noexcept { return m_launcher; }
@@ -179,6 +182,7 @@ public Q_SLOTS:
179182
void xDeepinCreatedByChanged();
180183
void execsChanged();
181184
void xCreatedByChanged();
185+
void desktopSourcePathChanged();
182186

183187
private:
184188
friend class ApplicationManager1Service;

0 commit comments

Comments
 (0)