2023-07-10 10:18:33 +08:00
|
|
|
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
#include "applicationmanager1service.h"
|
2023-07-17 14:49:35 +08:00
|
|
|
#include "applicationmanager1adaptor.h"
|
|
|
|
#include "applicationadaptor.h"
|
|
|
|
#include "global.h"
|
2023-07-10 10:18:33 +08:00
|
|
|
|
2023-07-17 14:49:35 +08:00
|
|
|
ApplicationManager1Service::~ApplicationManager1Service() = default;
|
|
|
|
|
|
|
|
ApplicationManager1Service::ApplicationManager1Service() = default;
|
2023-07-10 10:18:33 +08:00
|
|
|
|
2023-07-17 14:49:35 +08:00
|
|
|
QList<QDBusObjectPath> ApplicationManager1Service::list() const { return m_applicationList.keys(); }
|
2023-07-10 10:18:33 +08:00
|
|
|
|
2023-07-17 14:49:35 +08:00
|
|
|
bool ApplicationManager1Service::removeOneApplication(const QDBusObjectPath &application)
|
2023-07-10 10:18:33 +08:00
|
|
|
{
|
2023-07-17 14:49:35 +08:00
|
|
|
return m_applicationList.remove(application) != 0;
|
2023-07-10 10:18:33 +08:00
|
|
|
}
|
|
|
|
|
2023-07-17 14:49:35 +08:00
|
|
|
void ApplicationManager1Service::removeAllApplication() { m_applicationList.clear(); }
|
|
|
|
|
2023-07-10 10:18:33 +08:00
|
|
|
QDBusObjectPath ApplicationManager1Service::Application(const QString &id)
|
|
|
|
{
|
|
|
|
// TODO: impl
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ApplicationManager1Service::Identify(const QDBusUnixFileDescriptor &pidfd,
|
|
|
|
QDBusObjectPath &application,
|
|
|
|
QDBusObjectPath &application_instance)
|
|
|
|
{
|
|
|
|
// TODO: impl
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
QDBusObjectPath ApplicationManager1Service::Launch(const QString &id,
|
2023-07-17 14:49:35 +08:00
|
|
|
const QString &actions,
|
2023-07-10 10:18:33 +08:00
|
|
|
const QStringList &fields,
|
|
|
|
const QVariantMap &options)
|
|
|
|
{
|
2023-07-17 14:49:35 +08:00
|
|
|
// TODO: impl reset of Launch
|
|
|
|
QString objectPath;
|
|
|
|
if (id.contains('.')) {
|
|
|
|
objectPath = id.split('.').first();
|
|
|
|
}
|
|
|
|
objectPath.prepend(DDEApplicationManager1ApplicationObjectPath);
|
|
|
|
QSharedPointer<ApplicationService> app{new ApplicationService{id}};
|
|
|
|
auto *ptr = app.data();
|
|
|
|
if (registerObjectToDbus<decltype(ptr), ApplicationAdaptor>(ptr, objectPath, getDBusInterface<ApplicationAdaptor>())) {
|
|
|
|
QDBusObjectPath path{objectPath};
|
|
|
|
m_applicationList.insert(path, app);
|
|
|
|
return path;
|
|
|
|
}
|
2023-07-10 10:18:33 +08:00
|
|
|
return {};
|
|
|
|
}
|