KUpdateLaunchEnvironmentJob Class

Job for updating the launch environment. More...

Header: #include <KUpdateLaunchEnvironmentJob>
CMake: find_package(KF6 REQUIRED COMPONENTS DBusAddons)
target_link_libraries(mytarget PRIVATE KF6::DBusAddons)
Since: 6.0
Inherits: QObject

Public Functions

KUpdateLaunchEnvironmentJob(const QProcessEnvironment &environment)

Signals

void finished()

Detailed Description

This job adds or updates an environment variable in process environment that will be used when a process is launched. This includes:

  • DBus activation
  • Systemd units
  • Plasma-session

Environment variables are sanitized before uploading.

This object deletes itself after completion, similar to KJobs.

Example usage:

QProcessEnvironment newEnv;
newEnv.insert("VARIABLE"_s, "value"_s);
auto job = new KUpdateLaunchEnvironmentJob(newEnv);
QObject::connect(job, &KUpdateLaunchEnvironmentJob::finished, &SomeClass, &SomeClass::someSlot);

Porting from KF5 to KF6:

The class UpdateLaunchEnvironmentJob was renamed to KUpdateLaunchEnvironmentJob.

Member Function Documentation

[explicit] KUpdateLaunchEnvironmentJob::KUpdateLaunchEnvironmentJob(const QProcessEnvironment &environment)

Creates a new job for the given launch environment.

[signal] void KUpdateLaunchEnvironmentJob::finished()

Emitted when the job is finished, before the object is automatically deleted.