KAuth 5.109.0
Signals | Public Slots | Public Member Functions | List of all members
KAuth::ExecuteJob

Job for executing an Action. More...

#include <KAuth/ExecuteJob>

Signals

void newData (const QVariantMap &data)
 Signal emitted by the helper to notify the action's progress.
 
void statusChanged (KAuth::Action::AuthStatus status)
 Signal emitted when the authentication status changes.
 

Public Slots

bool kill (KillVerbosity verbosity=Quietly)
 Attempts to halt the execution of the action associated with this job.
 

Public Member Functions

 ~ExecuteJob () override
 Virtual destructor.
 
Action action () const
 
QVariantMap data () const
 Use this to get the data set in the action by HelperSupport::progressStep(QVariant) or returned at the end of the action.
 
void start () override
 Starts the job asynchronously.
 

Detailed Description

Job for executing an Action.

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.

Since
5.0

Constructor & Destructor Documentation

◆ ~ExecuteJob()

KAuth::ExecuteJob::~ExecuteJob ( )
override

Virtual destructor.

Member Function Documentation

◆ action()

Action KAuth::ExecuteJob::action ( ) const
Returns
the action associated with this job

◆ data()

QVariantMap KAuth::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

◆ kill

bool KAuth::ExecuteJob::kill ( KillVerbosity  verbosity = Quietly)
slot

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).

Returns
Always returns true
See also
HelperSupport::isStopped()
KJob::result
KJob::finished

◆ newData

void KAuth::ExecuteJob::newData ( const QVariantMap &  data)
signal

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.

Parameters
dataThe progress data from the helper

◆ start()

void KAuth::ExecuteJob::start ( )
override

Starts the job asynchronously.

See also
KJob::result
newData
statusChanged

◆ statusChanged

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

Signal emitted when the authentication status changes.

Parameters
statusthe new authentication status