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

knode

KNJobData Class Reference

#include <knjobdata.h>

Inheritance diagram for KNJobData:

Inheritance graph
[legend]

List of all members.


Detailed Description

Abstract base class for all KNode internal jobs.

This class takes care of:

  • progress/status reporting and user interaction (cancellation).
  • error handling/reporting.
  • easy handling of associated KIO jobs. To imlpement a new job class, you need to sub-class this class and implement the execute() method.

Definition at line 90 of file knjobdata.h.


Public Types

enum  jobType {
  JTLoadGroups = 1, JTFetchGroups, JTfetchNewHeaders, JTfetchArticle,
  JTpostArticle, JTmail, JTfetchSource
}

Signals

void finished (KNJobData *)

Public Member Functions

KNServerInfo * account () const
void cancel ()
bool canceled () const
void createProgressItem ()
KNJobItem * data () const
int error () const
QString errorString () const
virtual void execute ()=0
 KNJobData (jobType t, KNJobConsumer *c, KNServerInfo *a, KNJobItem *i)
void notifyConsumer ()
void prepareForExecution ()
KPIM::ProgressItem * progressItem () const
void setComplete ()
void setError (int err, const QString &errMsg)
void setProgress (unsigned int progress)
void setStatus (const QString &msg)
bool success () const
jobType type () const
 ~KNJobData ()

Protected Member Functions

KUrl baseUrl () const
void emitFinished ()
void setupKIOJob (KIO::Job *job)
void setupKJob (KJob *job)

Protected Attributes

KNServerInfo * a_ccount
KNJobConsumer * c_onsumer
KNJobItem * d_ata
bool mCanceled
int mError
QString mErrorString
KJob * mJob
KPIM::ProgressItem * mProgressItem
jobType t_ype

Member Enumeration Documentation

enum KNJobData::jobType

Enumerator:
JTLoadGroups 
JTFetchGroups 
JTfetchNewHeaders 
JTfetchArticle 
JTpostArticle 
JTmail 
JTfetchSource 

Definition at line 98 of file knjobdata.h.


Constructor & Destructor Documentation

KNJobData::KNJobData ( jobType  t,
KNJobConsumer *  c,
KNServerInfo *  a,
KNJobItem *  i 
)

Definition at line 65 of file knjobdata.cpp.

KNJobData::~KNJobData (  ) 

Definition at line 78 of file knjobdata.cpp.


Member Function Documentation

KNServerInfo* KNJobData::account (  )  const [inline]

Definition at line 111 of file knjobdata.h.

KUrl KNJobData::baseUrl (  )  const [protected]

Returns a correctly set up KUrl according to the encryption and authentication settings for KIO slave operations.

Definition at line 173 of file knjobdata.cpp.

void KNJobData::cancel (  ) 

Cancels this job.

If the job is currently active, this cancels the associated KIO job and emits the finished signal.

Definition at line 93 of file knjobdata.cpp.

bool KNJobData::canceled (  )  const [inline]

Returns true if the job has been canceled by the user.

Definition at line 121 of file knjobdata.h.

void KNJobData::createProgressItem (  ) 

Creates a KPIM::ProgressItem for this job.

Definition at line 137 of file knjobdata.cpp.

KNJobItem* KNJobData::data (  )  const [inline]

Definition at line 112 of file knjobdata.h.

void KNJobData::emitFinished (  )  [protected]

Emits the finished() signal via a single-shot timer.

Definition at line 108 of file knjobdata.cpp.

int KNJobData::error (  )  const [inline]

Returns the error code (see KIO::Error).

Definition at line 115 of file knjobdata.h.

QString KNJobData::errorString (  )  const [inline]

Returns the error message.

Definition at line 117 of file knjobdata.h.

virtual void KNJobData::execute (  )  [pure virtual]

Performs the actual operation of a job, needs to be reimplemented for every job.

Note that a job might be executed multiple times e.g. in case of an authentication error.

Implemented in KNode::MailSendJob, KNode::GroupListJob, KNode::GroupLoadJob, KNode::ArticleListJob, KNode::ArticleFetchJob, and KNode::ArticlePostJob.

void KNJobData::finished ( KNJobData *   )  [signal]

Emitted when a job has been finished.

It's recommended to to emit it via emitFinished().

void KNJobData::notifyConsumer (  ) 

Definition at line 84 of file knjobdata.cpp.

void KNJobData::prepareForExecution (  )  [inline]

Definition at line 135 of file knjobdata.h.

KPIM::ProgressItem* KNJobData::progressItem (  )  const [inline]

Returns the progress item for this job.

Definition at line 146 of file knjobdata.h.

void KNJobData::setComplete (  )  [inline]

Tells the progress item to indicate that the job has finished if available.

This causes the destruction of the progress item.

Definition at line 161 of file knjobdata.h.

void KNJobData::setError ( int  err,
const QString &  errMsg 
)

Set job error information.

Parameters:
err The error code (see KIO::Error).
errMsg A translated error message.

Definition at line 189 of file knjobdata.cpp.

void KNJobData::setProgress ( unsigned int  progress  )  [inline]

Set the progress value of the progress item if available.

Parameters:
progress The new progress value.

Definition at line 157 of file knjobdata.h.

void KNJobData::setStatus ( const QString &  msg  )  [inline]

Set the status message of the progress item if available.

Parameters:
msg The new status message.

Definition at line 153 of file knjobdata.h.

void KNJobData::setupKIOJob ( KIO::Job *  job  )  [protected]

Sets TLS metadata and connects the given KIO job to the progress item.

Parameters:
job The KIO job to setup.

Definition at line 124 of file knjobdata.cpp.

void KNJobData::setupKJob ( KJob *  job  )  [protected]

Connects progress signals.

Parameters:
job The KJob to setup.

Definition at line 113 of file knjobdata.cpp.

bool KNJobData::success (  )  const [inline]

Returns true if the job finished successfully.

Definition at line 119 of file knjobdata.h.

jobType KNJobData::type (  )  const [inline]

Definition at line 109 of file knjobdata.h.


Member Data Documentation

KNServerInfo* KNJobData::a_ccount [protected]

Definition at line 192 of file knjobdata.h.

KNJobConsumer* KNJobData::c_onsumer [protected]

Definition at line 199 of file knjobdata.h.

KNJobItem* KNJobData::d_ata [protected]

Definition at line 191 of file knjobdata.h.

bool KNJobData::mCanceled [protected]

Cancel status flag.

Definition at line 198 of file knjobdata.h.

int KNJobData::mError [protected]

The job error code (see KIO::Error).

Definition at line 194 of file knjobdata.h.

QString KNJobData::mErrorString [protected]

The error message.

Definition at line 196 of file knjobdata.h.

KJob* KNJobData::mJob [protected]

An associated KJob.

Definition at line 201 of file knjobdata.h.

KPIM::ProgressItem* KNJobData::mProgressItem [protected]

The progress item representing this job to the user.

Definition at line 203 of file knjobdata.h.

jobType KNJobData::t_ype [protected]

Definition at line 190 of file knjobdata.h.


The documentation for this class was generated from the following files:
  • knjobdata.h
  • knjobdata.cpp

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal