KCompositeJob Class

Header: #include <KCompositeJob>
CMake: find_package(KF6 REQUIRED COMPONENTS CoreAddons)
target_link_libraries(mytarget PRIVATE KF6::CoreAddons)
Inherits: KJob

Public Functions

KCompositeJob(QObject *parent = nullptr)

Protected Functions

virtual bool addSubjob(KJob *job)
void clearSubjobs()
bool hasSubjobs() const
virtual bool removeSubjob(KJob *job)
const QList<KJob *> &subjobs() const

Protected Slots

virtual void slotInfoMessage(KJob *job, const QString &message)
virtual void slotResult(KJob *job)

Detailed Description

The base class for all jobs able to be composed of one or more subjobs.

Member Function Documentation

[explicit] KCompositeJob::KCompositeJob(QObject *parent = nullptr)

Creates a new KCompositeJob object.

parent the parent QObject

[virtual protected] bool KCompositeJob::addSubjob(KJob *job)

Add a job that has to be finished before a result is emitted. This has obviously to be called before the result has been emitted by the job.

Note that the composite job takes ownership of job

job the subjob to add

Returns true if the job has been added correctly, false otherwise

[protected] void KCompositeJob::clearSubjobs()

Clears the list of subjobs.

Note that this will *not* delete the subjobs. Ownership of the subjobs is passed on to the caller.

[protected] bool KCompositeJob::hasSubjobs() const

Checks if this job has subjobs running.

Returns true if we still have subjobs running, false otherwise

[virtual protected] bool KCompositeJob::removeSubjob(KJob *job)

Mark a sub job as being done.

The ownership of job is passed on to the caller.

job the subjob to remove

Returns true if the job has been removed correctly, false otherwise

[virtual protected slot] void KCompositeJob::slotInfoMessage(KJob *job, const QString &message)

Forward signal from subjob.

job the subjob

message the info message

See also infoMessage().

[virtual protected slot] void KCompositeJob::slotResult(KJob *job)

Called whenever a subjob finishes. Default implementation checks for errors and propagates to parent job, and in all cases it calls removeSubjob.

job the subjob

[protected] const QList<KJob *> &KCompositeJob::subjobs() const

Retrieves the list of the subjobs.

Returns the full list of sub jobs