KPIM::ProgressManager Class

Header: #include <KPIM/ProgressManager>
CMake: find_package(KPim6Libkdepim REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::Libkdepim)
Inherits: QObject

Public Functions

virtual ~ProgressManager() override
bool isEmpty() const
KPIM::ProgressItem *progressItem(const QString &id) const
KPIM::ProgressItem *singleItem() const

Public Slots

void slotAbortAll()
void slotStandardCancelHandler(KPIM::ProgressItem *item)

Signals

void progressItemAdded(KPIM::ProgressItem *)
void progressItemCanceled(KPIM::ProgressItem *)
void progressItemCompleted(KPIM::ProgressItem *)
void progressItemCryptoStatus(KPIM::ProgressItem *, KPIM::ProgressItem::CryptoStatus)
void progressItemLabel(KPIM::ProgressItem *, const QString &)
void progressItemProgress(KPIM::ProgressItem *, unsigned int)
void progressItemStatus(KPIM::ProgressItem *, const QString &)
void progressItemUsesBusyIndicator(KPIM::ProgressItem *, bool)
void showProgressDialog()

Static Public Members

KPIM::ProgressItem *createProgressItem(const QString &label)
KPIM::ProgressItem *createProgressItem(unsigned int progressType, const QString &label)
KPIM::ProgressItem *createProgressItem(const QString &id, const QString &label, const QString &status = QString(), bool canBeCanceled = true, KPIM::ProgressItem::CryptoStatus cryptoStatus = KPIM::ProgressItem::Unencrypted)
KPIM::ProgressItem *createProgressItem(KPIM::ProgressItem *parent, const QString &id, const QString &label, const QString &status = QString(), bool canBeCanceled = true, KPIM::ProgressItem::CryptoStatus cryptoStatus = KPIM::ProgressItem::Unencrypted)
KPIM::ProgressItem *createProgressItem(const QString &parent, const QString &id, const QString &label, const QString &status = QString(), bool canBeCanceled = true, KPIM::ProgressItem::CryptoStatus cryptoStatus = KPIM::ProgressItem::Unencrypted)
void emitShowProgressDialog()
QString getUniqueID()
KPIM::ProgressManager *instance()

Private Slots

void slotTransactionCompleted(KPIM::ProgressItem *item)

Detailed Description

The ProgressManager singleton keeps track of all ongoing transactions and notifies observers (progress dialogs) when their progress percent value changes, when they are completed (by their owner), and when they are canceled. Each ProgressItem emits those signals individually and the singleton broadcasts them. Use the ::createProgressItem() statistics to acquire an item and then call ->setProgress( int percent ) on it every time you want to update the item and ->setComplete() when the operation is done. This will delete the item. Connect to the item's progressItemCanceled() signal to be notified when the user cancels the transaction using one of the observing progress dialogs or by calling item->cancel() in some other way. The owner is responsible for calling setComplete() on the item, even if it is canceled. Use the standardCancelHandler() slot if that is all you want to do on cancel.

Note that if you request an item with a certain id and there is already one with that id, there will not be a new one created but the existing one will be returned. This is convenient for accessing items that are needed regularly without the to store a pointer to them or to add child items to parents by id.

Member Function Documentation

[override virtual noexcept] ProgressManager::~ProgressManager()

Destructor for ProgressManager.

[static] KPIM::ProgressItem *ProgressManager::createProgressItem(const QString &label)

Creates a simple progress item with a unique ID. label the user-visible label for the item Returns the created ProgressItem

[static] KPIM::ProgressItem *ProgressManager::createProgressItem(unsigned int progressType, const QString &label)

Creates a simple progress item with a unique ID. progressType the type of progress item label the user-visible label for the item Returns the created ProgressItem

[static] KPIM::ProgressItem *ProgressManager::createProgressItem(const QString &id, const QString &label, const QString &status = QString(), bool canBeCanceled = true, KPIM::ProgressItem::CryptoStatus cryptoStatus = KPIM::ProgressItem::Unencrypted)

Version without a parent.

[static] KPIM::ProgressItem *ProgressManager::createProgressItem(KPIM::ProgressItem *parent, const QString &id, const QString &label, const QString &status = QString(), bool canBeCanceled = true, KPIM::ProgressItem::CryptoStatus cryptoStatus = KPIM::ProgressItem::Unencrypted)

Creates a progress item with specified parent and properties. parent the parent ProgressItem (or nullptr for top-level) id the unique identifier for this operation label the user-visible label status optional status message canBeCanceled whether the user can cancel this operation cryptoStatus the encryption status of this operation Returns the created ProgressItem

[static] KPIM::ProgressItem *ProgressManager::createProgressItem(const QString &parent, const QString &id, const QString &label, const QString &status = QString(), bool canBeCanceled = true, KPIM::ProgressItem::CryptoStatus cryptoStatus = KPIM::ProgressItem::Unencrypted)

Creates a progress item as a child of an item identified by parent ID. parent the ID of the parent ProgressItem id the unique identifier for this operation label the user-visible label status optional status message canBeCanceled whether the user can cancel this operation cryptoStatus the encryption status of this operation Returns the created ProgressItem

[static] void ProgressManager::emitShowProgressDialog()

Requests all listeners to show the progress dialog.

[static] QString ProgressManager::getUniqueID()

Generates a unique ID string for a new progress item. Returns a unique ID string

[static] KPIM::ProgressManager *ProgressManager::instance()

Returns the singleton instance of ProgressManager. Returns the ProgressManager instance

bool ProgressManager::isEmpty() const

Checks if there are any active progress items. Returns true if no progress items are active, false otherwise

KPIM::ProgressItem *ProgressManager::progressItem(const QString &id) const

Retrieves a progress item by its ID. id the unique identifier of the item Returns the ProgressItem with the given ID, or nullptr if not found

[signal] void ProgressManager::progressItemAdded(KPIM::ProgressItem *)

Signal emitted when a new progress item is added. item the ProgressItem that was added

[signal] void ProgressManager::progressItemCanceled(KPIM::ProgressItem *)

Signal emitted when a progress item is canceled. item the canceled ProgressItem

[signal] void ProgressManager::progressItemCompleted(KPIM::ProgressItem *)

Signal emitted when a progress item is completed. item the completed ProgressItem (will be deleted after signal processing)

[signal] void ProgressManager::progressItemCryptoStatus(KPIM::ProgressItem *, KPIM::ProgressItem::CryptoStatus)

Signal emitted when the crypto status of an item changes. item the ProgressItem with updated crypto status cryptoStatus the new crypto status

[signal] void ProgressManager::progressItemLabel(KPIM::ProgressItem *, const QString &)

Signal emitted when the label of an item changes. item the ProgressItem with updated label label the new label

[signal] void ProgressManager::progressItemProgress(KPIM::ProgressItem *, unsigned int)

Signal emitted when the progress value of an item changes. item the ProgressItem with updated progress progress the new progress value

[signal] void ProgressManager::progressItemStatus(KPIM::ProgressItem *, const QString &)

Signal emitted when the status message of an item changes. item the ProgressItem with updated status status the new status message

[signal] void ProgressManager::progressItemUsesBusyIndicator(KPIM::ProgressItem *, bool)

Signal emitted when the busy indicator setting of an item changes. item the ProgressItem value true if using a busy indicator, false otherwise

[signal] void ProgressManager::showProgressDialog()

Signal emitted when an operation requests to be shown.

KPIM::ProgressItem *ProgressManager::singleItem() const

Returns the single top-level progress item if there is only one. Returns the single ProgressItem, or nullptr if none or more than one top-level item exists

[slot] void ProgressManager::slotAbortAll()

Aborts all running progress items.

[slot] void ProgressManager::slotStandardCancelHandler(KPIM::ProgressItem *item)

Convenience slot that cancels and completes a progress item. item the ProgressItem to cancel and complete

[private slot] void ProgressManager::slotTransactionCompleted(KPIM::ProgressItem *item)