feat: add property installedTime,X-flatpak,X-linglong

Signed-off-by: black-desk <me@black-desk.cn>
This commit is contained in:
black-desk
2023-08-31 16:40:29 +08:00
committed by Comix
parent c99a1b5d6a
commit d1bdab899d
8 changed files with 49 additions and 12 deletions

View File

@ -270,9 +270,9 @@ void ApplicationManager1Service::updateApplication(const QSharedPointer<Applicat
return;
}
auto mtime = getFileModifiedTime(desktopFile.sourceFileRef());
auto mtime = getFileTimeInfo(desktopFile.sourceFileRef());
if (destApp->desktopFileSource().modified(mtime)) {
if (destApp->desktopFileSource().modified(std::get<1>(mtime))) {
auto *newEntry = new (std::nothrow) DesktopEntry{};
if (newEntry == nullptr) {
qCritical() << "new DesktopEntry failed.";

View File

@ -264,6 +264,23 @@ QString ApplicationService::id() const noexcept
return m_desktopSource.desktopId();
}
bool ApplicationService::x_Flatpak() const noexcept
{
auto val = findEntryValue(DesktopFileEntryKey, "X-flatpak", EntryValueType::String);
return val.isNull();
}
bool ApplicationService::x_linglong() const noexcept
{
auto val = findEntryValue(DesktopFileEntryKey, "X-linglong", EntryValueType::String);
return val.isNull();
}
qulonglong ApplicationService::installedTime() const noexcept
{
return m_desktopSource.createTime();
}
qulonglong ApplicationService::lastLaunchedTime() const noexcept
{
return m_lastLaunch;

View File

@ -60,6 +60,15 @@ public:
Q_PROPERTY(QList<QDBusObjectPath> Instances READ instances)
[[nodiscard]] QList<QDBusObjectPath> instances() const noexcept;
Q_PROPERTY(bool X_Flatpak READ x_Flatpak)
[[nodiscard]] bool x_Flatpak() const noexcept;
Q_PROPERTY(bool X_linglong READ x_linglong)
[[nodiscard]] bool x_linglong() const noexcept;
Q_PROPERTY(qulonglong installedTime READ installedTime)
[[nodiscard]] qulonglong installedTime() const noexcept;
[[nodiscard]] QDBusObjectPath findInstance(const QString &instanceId) const;
[[nodiscard]] const QString &getLauncher() const noexcept { return m_launcher; }