Skip to content

Commit

Permalink
feat: API to check if a package is dummy package
Browse files Browse the repository at this point in the history
支持使用 AppStream 的自定义字段(DDE:is_dummy_package)声明虚拟占位包。

Log:
  • Loading branch information
BLumia committed Sep 25, 2024
1 parent ce005d0 commit 3219df9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions desktopintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ bool DesktopIntegration::appIsCompulsoryForDesktop(const QString &desktopId)
return false;
}

bool DesktopIntegration::appIsDummyPackage(const QString &desktopId)
{
#ifdef NO_APPSTREAM_QT
Q_UNUSED(desktopId)
#else
AppStream::Pool pool;
// qDebug() << pool.flags();
pool.load();

const AppStream::ComponentBox components = pool.componentsByLaunchable(AppStream::Launchable::KindDesktopId, desktopId);
for (const AppStream::Component & component : components) {
return component.customValue("DDE::is_dummy_package") == "true";
}
#endif

return false;
}

Qt::ArrowType DesktopIntegration::dockPosition() const
{
return m_dockIntegration->direction();
Expand Down
1 change: 1 addition & 0 deletions desktopintegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class DesktopIntegration : public QObject
Q_INVOKABLE static void showFolder(enum QStandardPaths::StandardLocation location);
Q_INVOKABLE static void showUrl(const QString & url);
Q_INVOKABLE bool appIsCompulsoryForDesktop(const QString & desktopId);
Q_INVOKABLE bool appIsDummyPackage(const QString & desktopId);
// TODO: async get wallpaper?

Qt::ArrowType dockPosition() const;
Expand Down

0 comments on commit 3219df9

Please sign in to comment.