libkdepim Library API Documentation

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:

QObject List of all members.

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

ProgressManagerinstance ()
QString getUniqueID ()
ProgressItem * createProgressItem (const QString &label)
ProgressItem * createProgressItem (ProgressItem *parent, const QString &id, const QString &label, const QString &status=QString::null, bool canBeCanceled=true, bool usesCrypto=false)
ProgressItem * createProgressItem (const QString &parent, const QString &id, const QString &label, const QString &status=QString::null, bool canBeCanceled=true, bool usesCrypto=false)
ProgressItem * createProgressItem (const QString &id, const QString &label, const QString &status=QString::null, bool canBeCanceled=true, bool usesCrypto=false)
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

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

Returns:
The singleton instance of this class.

Definition at line 135 of file progressmanager.cpp.

Referenced by createProgressItem(), and emitShowProgressDialog().

QString KPIM::ProgressManager::getUniqueID  )  [inline, static]
 

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.

Returns:

Definition at line 258 of file progressmanager.h.

Referenced by createProgressItem().

ProgressItem* KPIM::ProgressManager::createProgressItem const QString label  )  [inline, static]
 

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 createProgressItem(), createProgressItemImpl(), getUniqueID(), and instance().

Referenced by createProgressItem().

ProgressItem* KPIM::ProgressManager::createProgressItem ProgressItem *  parent,
const QString id,
const QString label,
const QString status = QString::null,
bool  canBeCanceled = true,
bool  usesCrypto = false
[inline, static]
 

Creates a new progressItem with the given parent, id, label and initial status.

Parameters:
parent Specify an already existing item as the parent of this one.
id Used to identify this operation for cancel and progress info.
label The text to be displayed by progress handlers
status Additional text to be displayed for the item.
canBeCanceled can the user cancel this operation?
usesCrypto does the operation use secure transports (SSL) Cancelling the parent will cancel the children as well (if they can be cancelled) and ongoing children prevent parents from finishing.
Returns:
The ProgressItem representing the operation.

Definition at line 284 of file progressmanager.h.

References createProgressItemImpl(), and instance().

ProgressItem* KPIM::ProgressManager::createProgressItem const QString parent,
const QString id,
const QString label,
const QString status = QString::null,
bool  canBeCanceled = true,
bool  usesCrypto = false
[inline, static]
 

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 createProgressItemImpl(), and instance().

ProgressItem* KPIM::ProgressManager::createProgressItem const QString id,
const QString label,
const QString status = QString::null,
bool  canBeCanceled = true,
bool  usesCrypto = false
[inline, static]
 

Version without a parent.

Definition at line 311 of file progressmanager.h.

References createProgressItemImpl(), and instance().

bool KPIM::ProgressManager::isEmpty  )  const [inline]
 

Returns:
true when there is no more progress item

Definition at line 324 of file progressmanager.h.

ProgressItem * KPIM::ProgressManager::singleItem  )  const
 

Returns:
the only top level progressitem when there's only one. Returns 0 if there is no item, or more than one top level item.

Definition at line 210 of file progressmanager.cpp.

void KPIM::ProgressManager::emitShowProgressDialog  )  [inline, static]
 

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 emitShowProgressDialogImpl(), and instance().

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

See also:
ProgressItem::progressItemAdded()

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

See also:
ProgressItem::progressItemProgress()

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

See also:
ProgressItem::progressItemCompleted()

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

See also:
ProgressItem::progressItemCanceled()

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

See also:
ProgressItem::progressItemStatus()

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

See also:
ProgressItem::progressItemLabel()

void KPIM::ProgressManager::progressItemUsesCrypto ProgressItem *  ,
bool 
[signal]
 

See also:
ProgressItem::progressItemUsesCrypto()

void KPIM::ProgressManager::showProgressDialog  )  [signal]
 

Emitted when an operation requests the listeners to be shown.

Use emitShowProgressDialog() to trigger it.

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

Calls setCompleted() on the item, to make sure it goes away.

Provided for convenience.

Parameters:
item the canceled item.

Definition at line 205 of file progressmanager.cpp.

void KPIM::ProgressManager::slotAbortAll  )  [slot]
 

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:
KDE Logo
This file is part of the documentation for libkdepim Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:30 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003