Pages
API Documentation
On this page

KJobUiDelegate Class

The base class for all KJob UI delegate. More...

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

List of all members, including inherited members

Public Types

Public Functions

Public Slots

Protected Functions

Detailed Description

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

enum KJobUiDelegate::Flag

flags KJobUiDelegate::Flags

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

Constant Value Description
KJobUiDelegate::AutoHandlingDisabled 0 No automatic handling (default)
KJobUiDelegate::AutoErrorHandlingEnabled 1 Equivalent to setAutoErrorHandlingEnabled(true)
KJobUiDelegate::AutoWarningHandlingEnabled 2 Equivalent to setAutoWarningHandlingEnabled(true)
KJobUiDelegate::AutoHandlingEnabled `AutoErrorHandlingEnabled AutoWarningHandlingEnabled`

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

Member Function Documentation

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

Constructs a new KJobUiDelegate with a flags argument.

flags allows to enable automatic error/warning handling

bool KJobUiDelegate::isAutoErrorHandlingEnabled() const

Returns whether automatic error handling is enabled or disabled.

See also setAutoErrorHandlingEnabled()

bool KJobUiDelegate::isAutoWarningHandlingEnabled() const

Returns whether automatic warning handling is enabled or disabled.

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.

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.

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.

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

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.