feat: support application hooks

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe
2023-10-07 15:15:08 +08:00
committed by Comix
parent f233279466
commit fb0fc0a8ee
13 changed files with 317 additions and 56 deletions

View File

@ -180,6 +180,10 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL
}
}
optionsMap.remove("_hooks"); // this is internal property, user shouldn't pass it to Application Manager
if (const auto &hooks = parent()->applicationHooks(); !hooks.isEmpty()) {
optionsMap.insert("_hooks", hooks);
}
auto cmds = generateCommand(optionsMap);
auto [bin, execCmds, res] = unescapeExec(execStr, fields);
@ -190,7 +194,7 @@ QDBusObjectPath ApplicationService::Launch(const QString &action, const QStringL
}
cmds.append(std::move(execCmds));
auto &jobManager = static_cast<ApplicationManager1Service *>(parent())->jobManager();
auto &jobManager = parent()->jobManager();
return jobManager.addJob(
m_applicationPath.path(),
[this, binary = std::move(bin), commands = std::move(cmds)](const QVariant &variantValue) mutable -> QVariant {