feat: add property Launcher, Orphaned

refactor some method which are related with systemd unit

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe
2023-09-13 16:52:53 +08:00
committed by Comix
parent 23dcd13f10
commit bc7fbfb3a1
14 changed files with 168 additions and 82 deletions

View File

@ -34,10 +34,8 @@ ApplicationService::ApplicationService(DesktopFile source,
ApplicationService::~ApplicationService()
{
for (auto &instance : m_Instances.values()) {
instance->m_Application = QDBusObjectPath{"/"};
auto *ptr = instance.get();
instance.reset(nullptr);
ptr->setParent(qApp); // detach all instances to qApp
orphanedInstances->append(instance);
instance->m_orphaned = true;
}
}
@ -465,9 +463,12 @@ QList<QDBusObjectPath> ApplicationService::instances() const noexcept
return m_Instances.keys();
}
bool ApplicationService::addOneInstance(const QString &instanceId, const QString &application, const QString &systemdUnitPath)
bool ApplicationService::addOneInstance(const QString &instanceId,
const QString &application,
const QString &systemdUnitPath,
const QString &launcher)
{
auto *service = new InstanceService{instanceId, application, systemdUnitPath};
auto *service = new InstanceService{instanceId, application, systemdUnitPath, launcher};
auto *adaptor = new InstanceAdaptor(service);
QString objectPath{m_applicationPath.path() + "/" + instanceId};