From f233279466fa67bceb026ebd06b81fd9a7708442 Mon Sep 17 00:00:00 2001 From: ComixHe Date: Wed, 27 Sep 2023 16:19:12 +0800 Subject: [PATCH] fix: remove displayName and export name/genericName issue: https://github.com/linuxdeepin/developer-center/issues/5765 Signed-off-by: ComixHe --- ...opspec.ApplicationManager1.Application.xml | 10 +++++++- src/dbus/applicationservice.cpp | 25 ++++++++++++++++--- src/dbus/applicationservice.h | 10 +++++--- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/api/dbus/org.desktopspec.ApplicationManager1.Application.xml b/api/dbus/org.desktopspec.ApplicationManager1.Application.xml index 44e92a5..e2e7ee2 100644 --- a/api/dbus/org.desktopspec.ApplicationManager1.Application.xml +++ b/api/dbus/org.desktopspec.ApplicationManager1.Application.xml @@ -56,7 +56,15 @@ - + + + + + + value(DesktopFileEntryKey, "Name")).value(); - ret.insert(QString{"Name"}, {std::move(value)}); + auto value = m_entry->value(DesktopFileEntryKey, "Name"); + if (!value) { + return ret; + } + + ret.insert(QString{"Name"}, {std::move(value).value()}); + return ret; +} + +PropMap ApplicationService::genericName() const noexcept +{ + PropMap ret; + auto value = m_entry->value(DesktopFileEntryKey, "GenericName"); + if (!value) { + return ret; + } + + ret.insert(QString{"GenericName"}, {std::move(value).value()}); return ret; } @@ -542,7 +558,8 @@ void ApplicationService::resetEntry(DesktopEntry *newEntry) noexcept emit instanceChanged(); emit lastLaunchedTimeChanged(); emit iconsChanged(); - emit displayNameChanged(); + emit nameChanged(); + emit genericNameChanged(); emit actionNameChanged(); emit actionsChanged(); emit categoriesChanged(); diff --git a/src/dbus/applicationservice.h b/src/dbus/applicationservice.h index e13cc0b..cc98ca6 100644 --- a/src/dbus/applicationservice.h +++ b/src/dbus/applicationservice.h @@ -47,8 +47,11 @@ public: Q_PROPERTY(QString ID READ id CONSTANT) [[nodiscard]] QString id() const noexcept; - Q_PROPERTY(PropMap DisplayName READ displayName NOTIFY displayNameChanged) - [[nodiscard]] PropMap displayName() const noexcept; + Q_PROPERTY(PropMap Name READ name NOTIFY nameChanged) + [[nodiscard]] PropMap name() const noexcept; + + Q_PROPERTY(PropMap GenericName READ genericName NOTIFY genericNameChanged) + [[nodiscard]] PropMap genericName() const noexcept; Q_PROPERTY(PropMap Icons READ icons NOTIFY iconsChanged) [[nodiscard]] PropMap icons() const noexcept; @@ -120,7 +123,8 @@ Q_SIGNALS: void instanceChanged(); void lastLaunchedTimeChanged(); void iconsChanged(); - void displayNameChanged(); + void nameChanged(); + void genericNameChanged(); void actionNameChanged(); void actionsChanged(); void categoriesChanged();