class Job

The base class for all jobs. More...

Full nameKIO::Job
Definition#include <jobclasses.h>
InheritsQObject (qt)
Inherited byCopyJob, DeleteJob, FileCopyJob, ListJob, MimetypeJob, SimpleJob, StatJob, TransferJob
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Signals

Protected Methods

Protected Slots

Protected Members


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( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) ); (other connects, specific to the job)

And slotResult is usually at least:

if ( job->error() ) job->showErrorDialog( this or 0L );

void  kill ()

[virtual]

Abort job This kills all subjobs and deletes the job

int  error ()

Returns: the error code for this job, 0 if no error Error codes are defined in KIO::Error. Only call this method from the slot connected to result.

const QString &  errorText ()

Returns: a string to help understand the error, usually the url related to the error. Only call if error is not 0. This is really internal, better use errorString or errorDialog.

QString  errorString ()

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 KIO::ErrorDialog.

void  showErrorDialog ( QWidget * parent = 0L )

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:
parentthe parent widget for the dialog box

void  result ( KIO::Job *job )

[signal]

Emitted when the job is finished, in any case (completed, canceled, failed...). Use error to know the result.

void  totalSize ( KIO::Job *, unsigned long size )

[signal]

Progress signals

void  copyingFile ( KIO::Job *, const KURL& from, const KURL& to )

[signal]

Status signals

void  slotResult ( KIO::Job *job )

[protected virtual slot]

Called whenever a subjob finishes. Default implementation checks for errors and propagates to parent job, then calls removeSubjob. Override if you don't want subjobs errors to be propagated.

void  addSubjob ( Job *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.

void  removeSubjob ( Job *job )

[protected virtual]

Mark a sub job as beeing done. If it's the last to wait on the job will emit a result - jobs with two steps might want to override slotResult in order to avoid calling this method.


Generated by: dfaure@faure on Sun Mar 26 14:24:43 2000, using kdoc 2.0a35.