• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

KIO::Job

KIO::Job Class Reference

The base class for all jobs. More...

#include <jobclasses.h>

Inheritance diagram for KIO::Job:
KCompositeJob KJob QObject KIO::ChmodJob KIO::CopyJob KIO::DeleteJob KIO::DirectorySizeJob KIO::FileCopyJob KIO::MetaInfoJob KIO::PreviewJob KIO::SimpleJob

List of all members.

Signals

void canceled (KJob *job)
void connected (KIO::Job *job)

Public Member Functions

void addMetaData (const QMap< QString, QString > &values)
void addMetaData (const QString &key, const QString &value)
QStringList detailedErrorStrings (const KUrl *reqUrl=0L, int method=-1) const
QString errorString () const
bool isInteractive () const
void mergeMetaData (const QMap< QString, QString > &values)
MetaData metaData () const
MetaData outgoingMetaData () const
Job * parentJob () const
QString queryMetaData (const QString &key)
void setMetaData (const KIO::MetaData &metaData)
void setParentJob (Job *parentJob)
KDE_DEPRECATED void showErrorDialog (QWidget *parent=0)
void start ()
JobUiDelegate * ui () const
virtual ~Job ()

Protected Member Functions

virtual bool addSubjob (KJob *job)
virtual bool doKill ()
virtual bool doResume ()
virtual bool doSuspend ()
 Job (JobPrivate &dd)
 Job ()
virtual bool removeSubjob (KJob *job)

Detailed Description

The base class for all jobs.

For all jobs created in an application, the code looks like

   KIO::Job * job = KIO::someoperation( some parameters );
   connect( job, SIGNAL( result( KJob * ) ),
            this, SLOT( slotResult( KJob * ) ) );

(other connects, specific to the job)

And slotResult is usually at least:

  if ( job->error() )
      job->ui()->showErrorDialog();
See also:
KIO::Scheduler

Definition at line 95 of file jobclasses.h.


Constructor & Destructor Documentation

Job::Job (  )  [protected]

Definition at line 79 of file job.cpp.

Job::Job ( JobPrivate &  dd  )  [protected]

Definition at line 84 of file job.cpp.

Job::~Job (  )  [virtual]

Definition at line 89 of file job.cpp.


Member Function Documentation

void Job::addMetaData ( const QMap< QString, QString > &  values  ) 

Add key/value pairs to the meta data that is sent to the slave.

If a certain key already existed, it will be overridden.

Parameters:
values the meta data to add
See also:
setMetaData()
mergeMetaData()

Definition at line 270 of file job.cpp.

void Job::addMetaData ( const QString &  key,
const QString &  value 
)

Add key/value pair to the meta data that is sent to the slave.

Parameters:
key the key of the meta data
value the value of the meta data
See also:
setMetaData()
mergeMetaData()

Definition at line 265 of file job.cpp.

bool Job::addSubjob ( KJob *  job  )  [protected, virtual]

Add a job that has to be finished before a result is emitted.

This has obviously to be called before the finish signal is emitted by the slave.

Parameters:
job the subjob to add

Reimplemented from KCompositeJob.

Definition at line 98 of file job.cpp.

void KIO::Job::canceled ( KJob *  job  )  [signal]
Deprecated:
. Don't use ! Emitted when the job is canceled. Signal result() is emitted as well, and error() is, in this case, ERR_USER_CANCELED.
Parameters:
job the job that emitted this signal
void KIO::Job::connected ( KIO::Job *  job  )  [signal]

Emitted when the slave successfully connected to the host.

There is no guarantee the slave will send this, and this is currently unused (in the applications).

Parameters:
job the job that emitted this signal
QStringList KIO::Job::detailedErrorStrings ( const KUrl *  reqUrl = 0L,
int  method = -1 
) const

Converts an error code and a non-i18n error message into i18n strings suitable for presentation in a detailed error message box.

Parameters:
reqUrl the request URL that generated this error message
method the method that generated this error message (unimplemented)
Returns:
the following strings: caption, error + description, causes+solutions

Definition at line 414 of file global.cpp.

bool Job::doKill (  )  [protected, virtual]

Abort this job.

This kills all subjobs and deletes the job.

Reimplemented from KJob.

Reimplemented in KIO::SimpleJob.

Definition at line 178 of file job.cpp.

bool Job::doResume (  )  [protected, virtual]

Resume this job.

See also:
suspend

Reimplemented from KJob.

Reimplemented in KIO::SimpleJob, KIO::TransferJob, and KIO::FileCopyJob.

Definition at line 199 of file job.cpp.

bool Job::doSuspend (  )  [protected, virtual]

Suspend this job.

See also:
resume

Reimplemented from KJob.

Reimplemented in KIO::CopyJob, KIO::SimpleJob, and KIO::FileCopyJob.

Definition at line 189 of file job.cpp.

QString KIO::Job::errorString (  )  const [virtual]

Converts an error code and a non-i18n error message into an error message in the current language.

The low level (non-i18n) error message (usually a url) is put into the translated error message using 1.

Example for errid == ERR_CANNOT_OPEN_FOR_READING:

   i18n( "Could not read\n%1" ).arg( errortext );

Use this to display the error yourself, but for a dialog box use Job::showErrorDialog. Do not call it if error() is not 0.

Returns:
the error message and if there is no error, a message telling the user that the app is broken, so check with error() whether there is an error

Reimplemented from KJob.

Definition at line 157 of file global.cpp.

bool Job::isInteractive (  )  const

Returns whether the user should be asked about things when the job is unsure, like whether to overwrite existing files etc.

Returns:
true if user interactions are enabled (true by default), false if setUiDelegate(0) was called.
See also:
setUiDelegate()

Definition at line 231 of file job.cpp.

void Job::mergeMetaData ( const QMap< QString, QString > &  values  ) 

Add key/value pairs to the meta data that is sent to the slave.

If a certain key already existed, it will remain unchanged.

Parameters:
values the meta data to merge
See also:
setMetaData()
addMetaData()

Definition at line 278 of file job.cpp.

MetaData Job::metaData (  )  const

Get meta data received from the slave.

(Valid when first data is received and/or slave is finished)

Returns:
the job's meta data

Definition at line 249 of file job.cpp.

MetaData Job::outgoingMetaData (  )  const

For internal use only.

. For the scheduler. Do not use.

Definition at line 288 of file job.cpp.

Job * Job::parentJob (  )  const

Returns the parent job, if there is one.

Returns:
the parent job, or 0 if there is none
See also:
setParentJob

Definition at line 244 of file job.cpp.

QString Job::queryMetaData ( const QString &  key  ) 

Query meta data received from the slave.

(Valid when first data is received and/or slave is finished)

Parameters:
key the key of the meta data to retrieve
Returns:
the value of the meta data, or QString() if the key does not exist

Definition at line 254 of file job.cpp.

bool Job::removeSubjob ( KJob *  job  )  [protected, virtual]

Mark a sub job as being done.

KDE4 change: this doesn't terminate the parent job anymore, call emitResult to do that.

Parameters:
job the subjob to remove

Reimplemented from KCompositeJob.

Definition at line 121 of file job.cpp.

void Job::setMetaData ( const KIO::MetaData &  metaData  ) 

Set meta data to be sent to the slave, replacing existing meta data.

Parameters:
metaData the meta data to set
See also:
addMetaData()
mergeMetaData()

Definition at line 259 of file job.cpp.

void Job::setParentJob ( Job *  parentJob  ) 

Set the parent Job.

One example use of this is when FileCopyJob calls RenameDialog::open, it must pass the correct progress ID of the parent CopyJob (to hide the progress dialog). You can set the parent job only once. By default a job does not have a parent job.

Parameters:
parentJob the new parent job

Definition at line 236 of file job.cpp.

void Job::showErrorDialog ( QWidget *  parent = 0  ) 

Display a dialog box to inform the user of the error given by this job.

Only call if error is not 0, and only in the slot connected to result.

Parameters:
parent the parent widget for the dialog box, can be 0 for top-level
Deprecated:
you should use job->ui()->setWindow(parent) and job->ui()->showErrorMessage() instead

Definition at line 218 of file job.cpp.

void KIO::Job::start (  )  [inline, virtual]

Implements KJob.

Definition at line 104 of file jobclasses.h.

JobUiDelegate * Job::ui (  )  const

Retrieves the UI delegate of this job.

This method is basically a convenience for static_cast<KIO::JobUiDelegate*>(uiDelegate()).

Returns:
the delegate used by the job to communicate with the UI

Definition at line 93 of file job.cpp.


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

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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