feat: AM loader实现启动freedesktop类型应用
AM loader可以正常启动freedesktop类型应用了 Log: AM loader实现启动freedesktop类型应用 Task: https://pms.uniontech.com/task-view-108539.html Influence: AM loader Change-Id: If56835e638ca38ed53bcc7a0dddeca47e05cc8ba
This commit is contained in:
@ -68,8 +68,9 @@ public:
|
||||
emit q_ptr->taskFinished(p->exitCode());
|
||||
}
|
||||
#else
|
||||
qInfo() << "app manager load service:" << QString("org.desktopspec.application.instance@%1.service").arg(m_id);
|
||||
QDBusInterface systemd("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager");
|
||||
QDBusReply<void> reply = systemd.call("StartUnit", QString("org.deskspec.application.instance@%1.service").arg(m_id), "replace-irreversibly");
|
||||
QDBusReply<void> reply = systemd.call("StartUnit", QString("org.desktopspec.application.instance@%1.service").arg(m_id), "replace-irreversibly");
|
||||
if (!reply.isValid()) {
|
||||
qInfo() << reply.error();
|
||||
q_ptr->deleteLater();
|
||||
@ -82,7 +83,7 @@ public:
|
||||
#ifdef LOADER_PATH
|
||||
#else
|
||||
QDBusInterface systemd("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager");
|
||||
qInfo() << systemd.call("StopUnit", QString("org.deskspec.application.instance@%1.service").arg(m_id), "replace-irreversibly");
|
||||
qInfo() << systemd.call("StopUnit", QString("org.desktopspec.application.instance@%1.service").arg(m_id), "replace-irreversibly");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -146,6 +147,7 @@ Methods::Task ApplicationInstance::taskInfo() const
|
||||
Methods::Task task;
|
||||
task.id = d->m_id;
|
||||
task.runId = d->application->id();
|
||||
task.filePath = d->application->filePath();
|
||||
task.date = QString::number(startuptime());
|
||||
task.arguments = m_files;
|
||||
|
||||
|
@ -90,8 +90,11 @@ void ApplicationManagerPrivate::recvClientData(int socket, const std::vector<cha
|
||||
result.state = false;
|
||||
// std::lock_guard<std::mutex> lock(task_mutex);
|
||||
for (auto it = tasks.begin(); it != tasks.end(); ++it) {
|
||||
result.state = true;
|
||||
result.hash = QString::fromStdString(it->first);
|
||||
if (registe.hash == QString::fromStdString(it->first)) {
|
||||
result.state = true;
|
||||
result.hash = registe.hash;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Methods::toJson(tmpArray, result);
|
||||
write(socket, tmpArray.toStdString());
|
||||
@ -199,6 +202,7 @@ QList<QDBusObjectPath> ApplicationManager::GetInstances(const QString &id)
|
||||
*/
|
||||
QDBusObjectPath ApplicationManager::Launch(const QString &id, QStringList files)
|
||||
{
|
||||
qInfo() << "Launch " << id;
|
||||
Q_D(ApplicationManager);
|
||||
if (!d->checkDMsgUid())
|
||||
return {};
|
||||
|
@ -90,6 +90,11 @@ int main(int argc, char *argv[])
|
||||
QDBusConnection::sessionBus().registerObject(app->path().path(), "org.desktopspec.Application", app.get());
|
||||
}
|
||||
|
||||
for (const QSharedPointer<Application> &app : apps) {
|
||||
qInfo() << "appId - " << app->id();
|
||||
qInfo() << "appFilePath - " << app->filePath();
|
||||
}
|
||||
|
||||
ApplicationManager::instance()->addApplication(apps);
|
||||
|
||||
ApplicationManager::instance()->launchAutostartApps();
|
||||
|
Reference in New Issue
Block a user