KPIM::ProgressManager Class Reference
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. More...
#include <progressmanager.h>
Inheritance diagram for KPIM::ProgressManager:


Public Slots | |
void | slotStandardCancelHandler (ProgressItem *item) |
void | slotAbortAll () |
Signals | |
void | progressItemAdded (ProgressItem *) |
void | progressItemProgress (ProgressItem *, unsigned int) |
void | progressItemCompleted (ProgressItem *) |
void | progressItemCanceled (ProgressItem *) |
void | progressItemStatus (ProgressItem *, const QString &) |
void | progressItemLabel (ProgressItem *, const QString &) |
void | progressItemUsesCrypto (ProgressItem *, bool) |
void | showProgressDialog () |
Public Member Functions | |
bool | isEmpty () const |
ProgressItem * | singleItem () const |
Static Public Member Functions | |
static ProgressManager * | instance () |
static QString | getUniqueID () |
static ProgressItem * | createProgressItem (const QString &label) |
static ProgressItem * | createProgressItem (ProgressItem *parent, const QString &id, const QString &label, const QString &status=QString::null, bool canBeCanceled=true, bool usesCrypto=false) |
static ProgressItem * | createProgressItem (const QString &parent, const QString &id, const QString &label, const QString &status=QString::null, bool canBeCanceled=true, bool usesCrypto=false) |
static ProgressItem * | createProgressItem (const QString &id, const QString &label, const QString &status=QString::null, bool canBeCanceled=true, bool usesCrypto=false) |
static void | emitShowProgressDialog () |
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() statics to acquire an item and then call ->setProgress( int percent ) on it everytime 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.
Definition at line 239 of file progressmanager.h.
Member Function Documentation
|
Definition at line 135 of file progressmanager.cpp. Referenced by createProgressItem(), and emitShowProgressDialog(). |
|
Use this to aquire a unique id number which can be used to discern an operation from all others going on at the same time. Use that number as the id string for your progressItem to ensure it is unique.
Definition at line 258 of file progressmanager.h. Referenced by createProgressItem(). |
|
Creates a ProgressItem with a unique id and the given label. This is the simplest way to aquire a progress item. It will not have a parent and will be set to be cancellable and not using crypto. Definition at line 265 of file progressmanager.h. References getUniqueID(), and instance(). |
|
Creates a new progressItem with the given parent, id, label and initial status.
Definition at line 284 of file progressmanager.h. References instance(). |
|
Use this version if you have the id string of the parent and want to add a subjob to it.
Definition at line 298 of file progressmanager.h. References instance(). |
|
Version without a parent.
Definition at line 311 of file progressmanager.h. References instance(). |
|
Definition at line 324 of file progressmanager.h. |
|
Definition at line 210 of file progressmanager.cpp. |
|
Ask all listeners to show the progress dialog, because there is something that wants to be shown.
Definition at line 336 of file progressmanager.h. References instance(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Emitted when an operation requests the listeners to be shown. Use emitShowProgressDialog() to trigger it. |
|
Calls setCompleted() on the item, to make sure it goes away. Provided for convenience.
Definition at line 205 of file progressmanager.cpp. |
|
Aborts all running jobs. Bound to "Esc" Definition at line 225 of file progressmanager.cpp. |
The documentation for this class was generated from the following files: