KJobUiDelegate Class

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

Public Types

(since 5.70) enum Flag { AutoHandlingDisabled, AutoErrorHandlingEnabled, AutoWarningHandlingEnabled, AutoHandlingEnabled }
flags Flags

Public Functions

(since 5.70) KJobUiDelegate(KJobUiDelegate::Flags flags = {KJobUiDelegate::AutoHandlingDisabled})
bool isAutoErrorHandlingEnabled() const
bool isAutoWarningHandlingEnabled() const
void setAutoErrorHandlingEnabled(bool enable)
void setAutoWarningHandlingEnabled(bool enable)
virtual void showErrorMessage()

Protected Functions

KJob *job() const
virtual bool setJob(KJob *job)

Detailed Description

The base class for all KJob UI delegate.

A UI delegate is responsible for the events of a job and provides a UI for them (an error message box or warning etc.).

See also KJob.

Member Type Documentation

[since 5.70] enum KJobUiDelegate::Flag
flags KJobUiDelegate::Flags

Flags for the constructor, to enable automatic handling of errors and/or warnings

ConstantValueDescription
KJobUiDelegate::AutoHandlingDisabled0No automatic handling (default)
KJobUiDelegate::AutoErrorHandlingEnabled1Equivalent to setAutoErrorHandlingEnabled(true)
KJobUiDelegate::AutoWarningHandlingEnabled2Equivalent to setAutoWarningHandlingEnabled(true)
KJobUiDelegate::AutoHandlingEnabledAutoErrorHandlingEnabled | AutoWarningHandlingEnabledEnables both error and warning handling

This enum was introduced in 5.70.

The Flags type is a typedef for QFlags<Flag>. It stores an OR combination of Flag values.

See also Flags.

Member Function Documentation

[explicit, since 5.70] KJobUiDelegate::KJobUiDelegate(KJobUiDelegate::Flags flags = {KJobUiDelegate::AutoHandlingDisabled})

Constructs a new KJobUiDelegate with a flags argument. flags allows to enable automatic error/warning handling

This function was introduced in 5.70.

bool KJobUiDelegate::isAutoErrorHandlingEnabled() const

Returns whether automatic error handling is enabled or disabled. See also setAutoErrorHandlingEnabled . Returns true if automatic error handling is enabled

See also setAutoErrorHandlingEnabled().

bool KJobUiDelegate::isAutoWarningHandlingEnabled() const

Returns whether automatic warning handling is enabled or disabled. See also setAutoWarningHandlingEnabled .

See also setAutoWarningHandlingEnabled().

[protected] KJob *KJobUiDelegate::job() const

Retrieves the current job this UI delegate is attached to.

Returns the current job this UI delegate is attached to, or nullptr if this UI delegate is not tracking any job

See also setJob().

void KJobUiDelegate::setAutoErrorHandlingEnabled(bool enable)

Enable or disable the automatic error handling. When automatic error handling is enabled and an error occurs, then showErrorDialog() is called, right before the emission of the result signal.

The default is false.

See also isAutoErrorHandlingEnabled , showErrorDialog

enable enable or disable automatic error handling

See also isAutoErrorHandlingEnabled().

void KJobUiDelegate::setAutoWarningHandlingEnabled(bool enable)

Enable or disable the automatic warning handling. When automatic warning handling is enabled and an error occurs, then a message box is displayed with the warning message

The default is true.

See also isAutoWarningHandlingEnabled , showErrorDialog

enable enable or disable automatic warning handling

See also isAutoWarningHandlingEnabled().

[virtual protected] bool KJobUiDelegate::setJob(KJob *job)

Attach this UI delegate to a job. Once attached it'll track the job events.

Returns true if this UI delegate was successfully attached to job, false otherwise

Note: if this UI delegate is already attached to a job, calling this method will return false.

See also job().

[virtual] void KJobUiDelegate::showErrorMessage()

Display to the user the error given by this job. The default implementation uses qWarning(). Subclasses reimplement this to use something more user-visible such as a message box.

Only call this method if error is not 0, and only in the slot connected to result.