• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

libkdepim

  • KPIM
  • ProgressManager
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
KPIM::ProgressManager Class Reference

#include <progressmanager.h>

Inheritance diagram for KPIM::ProgressManager:
Inheritance graph
[legend]

Public Slots

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

Signals

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

Public Member Functions

virtual ~ProgressManager ()
 
bool isEmpty () const
 
ProgressItem * singleItem () const
 

Static Public Member Functions

static ProgressItem * createProgressItem (const QString &label)
 
static ProgressItem * createProgressItem (ProgressItem *parent, const QString &id, const QString &label, const QString &status=QString(), bool canBeCanceled=true, bool usesCrypto=false)
 
static ProgressItem * createProgressItem (const QString &parent, const QString &id, const QString &label, const QString &status=QString(), bool canBeCanceled=true, bool usesCrypto=false)
 
static ProgressItem * createProgressItem (const QString &id, const QString &label, const QString &status=QString(), bool canBeCanceled=true, bool usesCrypto=false)
 
static ProgressItem * createProgressItem (ProgressItem *parent, const Akonadi::AgentInstance &agent, const QString &id, const QString &label, const QString &status=QString(), bool canBeCanceled=true, bool usesCrypto=false)
 
static void emitShowProgressDialog ()
 
static QString getUniqueID ()
 
static ProgressManager * instance ()
 

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 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.

Definition at line 278 of file progressmanager.h.

Constructor & Destructor Documentation

KPIM::ProgressManager::~ProgressManager ( )
virtual

Definition at line 157 of file progressmanager.cpp.

Member Function Documentation

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

Creates a ProgressItem with a unique id and the given label.

This is the simplest way to acquire a progress item. It will not have a parent and will be set to be cancellable and not using crypto.

Definition at line 309 of file progressmanager.h.

static ProgressItem* KPIM::ProgressManager::createProgressItem ( ProgressItem *  parent,
const QString &  id,
const QString &  label,
const QString &  status = QString(),
bool  canBeCanceled = true,
bool  usesCrypto = false 
)
inlinestatic

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

Parameters
parentSpecify an already existing item as the parent of this one.
idUsed to identify this operation for cancel and progress info.
labelThe text to be displayed by progress handlers
statusAdditional text to be displayed for the item.
canBeCanceledcan the user cancel this operation?
usesCryptodoes the operation use secure transports (SSL) Cancelling the parent will cancel the children as well (if they can be canceled) and ongoing children prevent parents from finishing.
Returns
The ProgressItem representing the operation.

Definition at line 329 of file progressmanager.h.

static ProgressItem* KPIM::ProgressManager::createProgressItem ( const QString &  parent,
const QString &  id,
const QString &  label,
const QString &  status = QString(),
bool  canBeCanceled = true,
bool  usesCrypto = false 
)
inlinestatic

Use this version if you have the id string of the parent and want to add a subjob to it.

Definition at line 344 of file progressmanager.h.

static ProgressItem* KPIM::ProgressManager::createProgressItem ( const QString &  id,
const QString &  label,
const QString &  status = QString(),
bool  canBeCanceled = true,
bool  usesCrypto = false 
)
inlinestatic

Version without a parent.

Definition at line 358 of file progressmanager.h.

static ProgressItem* KPIM::ProgressManager::createProgressItem ( ProgressItem *  parent,
const Akonadi::AgentInstance &  agent,
const QString &  id,
const QString &  label,
const QString &  status = QString(),
bool  canBeCanceled = true,
bool  usesCrypto = false 
)
inlinestatic

Version for Akonadi agents.

This connects all the proper signals so that you do not have to worry about updating the progress or reacting to progressItemCanceled().

Definition at line 373 of file progressmanager.h.

static void KPIM::ProgressManager::emitShowProgressDialog ( )
inlinestatic

Ask all listeners to show the progress dialog, because there is something that wants to be shown.

Definition at line 406 of file progressmanager.h.

static QString KPIM::ProgressManager::getUniqueID ( )
inlinestatic

Use this to acquire 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 299 of file progressmanager.h.

ProgressManager * KPIM::ProgressManager::instance ( )
static
Returns
The singleton instance of this class.

Definition at line 159 of file progressmanager.cpp.

bool KPIM::ProgressManager::isEmpty ( ) const
inline
Returns
true when there are no more progress items.

Definition at line 388 of file progressmanager.h.

void KPIM::ProgressManager::progressItemAdded ( KPIM::ProgressItem *  )
signal
See also
ProgressItem::progressItemAdded()
void KPIM::ProgressManager::progressItemCanceled ( KPIM::ProgressItem *  )
signal
See also
ProgressItem::progressItemCanceled()
void KPIM::ProgressManager::progressItemCompleted ( KPIM::ProgressItem *  )
signal
See also
ProgressItem::progressItemCompleted()
void KPIM::ProgressManager::progressItemLabel ( KPIM::ProgressItem *  ,
const QString &   
)
signal
See also
ProgressItem::progressItemLabel()
void KPIM::ProgressManager::progressItemProgress ( KPIM::ProgressItem *  ,
unsigned  int 
)
signal
See also
ProgressItem::progressItemProgress()
void KPIM::ProgressManager::progressItemStatus ( KPIM::ProgressItem *  ,
const QString &   
)
signal
See also
ProgressItem::progressItemStatus()
void KPIM::ProgressManager::progressItemUsesBusyIndicator ( KPIM::ProgressItem *  ,
bool   
)
signal
See also
ProgressItem::progressItemUsesBusyIndicator
void KPIM::ProgressManager::progressItemUsesCrypto ( KPIM::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.

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. Since this is used to calculate the overall progress, it will also return 0 if there is an item which uses a busy indicator, since that will invalidate the overall progress.

Definition at line 236 of file progressmanager.cpp.

void KPIM::ProgressManager::slotAbortAll ( )
slot

Aborts all running jobs.

Bound to "Esc"

Definition at line 259 of file progressmanager.cpp.

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

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

Provided for convenience.

Parameters
itemthe canceled item.

Definition at line 231 of file progressmanager.cpp.


The documentation for this class was generated from the following files:
  • progressmanager.h
  • progressmanager.cpp
  • progressmanager_akonadiagent.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdepim

Skip menu "libkdepim"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal