KAuth::ExecuteJob Class

class KAuth::ExecuteJob

Job for executing an Action. More...

Header: #include <KAuth/ExecuteJob>
CMake: find_package(KF6 REQUIRED COMPONENTS Auth)
target_link_libraries(mytarget PRIVATE KF6::AuthCore)
Since: 5.0
Inherits: KJob

Public Functions

KAuth::Action action() const
QVariantMap data() const

Reimplemented Public Functions

virtual void start() override

Public Slots

bool kill(KJob::KillVerbosity verbosity = Quietly)

Signals

void newData(const QVariantMap &data)
void statusChanged(KAuth::Action::AuthStatus status)

Detailed Description

To run the action synchonously use KJob::exec() and check the return code for success.

For longer tasks connect KJob::result(KJob*) and any other signals such as percent(KJob*, unsigned long) and newData(const QVariantMap &) then run start().

To check for authentiation success or problems connect to statusChanged(KAuth::Action::AuthStatus status) signal.

Use data() to get the return result of the action.

Member Function Documentation

KAuth::Action ExecuteJob::action() const

Returns the action associated with this job

QVariantMap ExecuteJob::data() const

Use this to get the data set in the action by HelperSupport::progressStep(QVariant) or returned at the end of the action.

This function is particularly useful once the job has completed. During execution, simply read the data in the newData() signal.

Returns the data set by the helper

See also ExecuteJob::newData.

[slot] bool ExecuteJob::kill(KJob::KillVerbosity verbosity = Quietly)

Attempts to halt the execution of the action associated with this job. You should listen to the finished and result signals to work out whether halting was successful (as long running operations can also take time to shut down cleanly). Always returns true

See also HelperSupport::isStopped(), KJob::result, and KJob::finished.

[signal] void ExecuteJob::newData(const QVariantMap &data)

Signal emitted by the helper to notify the action's progress

This signal is emitted every time the helper's code calls the HelperSupport::progressStep(QVariantMap) method. This is useful to let the helper notify the execution status of a long action, also providing some data, for example if you want to achieve some sort of progressive loading. The meaning of the data passed here is totally application-dependent. If you only need to pass some percentage, you can use the other signal that pass an int.

data The progress data from the helper

[override virtual] void ExecuteJob::start()

Reimplements: KJob::start().

Starts the job asynchronously.

See also KJob::result, newData, and statusChanged.

[signal] void ExecuteJob::statusChanged(KAuth::Action::AuthStatus status)

Signal emitted when the authentication status changes status the new authentication status