fix: remove displayName and export name/genericName

issue: https://github.com/linuxdeepin/developer-center/issues/5765

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe 2023-09-27 16:19:12 +08:00 committed by black-desk
parent 2795203b23
commit f233279466
3 changed files with 37 additions and 8 deletions

View File

@ -56,7 +56,15 @@
<annotation name="org.qtproject.QtDBus.QtTypeName" value="PropMap"/>
</property>
<property name="DisplayName" type="a{ss}" access="read">
<property name="Name" type="a{ss}" access="read">
<annotation
name="org.freedesktop.DBus.Description"
value="The meaning of this property's type is same as which in ActionName."
/>
<annotation name="org.qtproject.QtDBus.QtTypeName" value="PropMap"/>
</property>
<property name="GenericName" type="a{ss}" access="read">
<annotation
name="org.freedesktop.DBus.Description"
value="The meaning of this property's type is same as which in ActionName."

View File

@ -361,11 +361,27 @@ PropMap ApplicationService::actionName() const noexcept
return ret;
}
PropMap ApplicationService::displayName() const noexcept
PropMap ApplicationService::name() const noexcept
{
PropMap ret;
auto value = std::move(m_entry->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();

View File

@ -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();