# class Job

###

Module | kio
Namespace | KIO
Class | Job
Inherits | KCompositeJob

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

### methods

- Job ( )

  returns ctor

- Job (dd)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  dd | JobPrivate |

- addMetaData (key, value)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  key | QString |
  value | QString |

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

  key - the key of the meta data

  value - the value of the meta data

  See also setMetaData()

  See also mergeMetaData()

- addMetaData (values)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  values | QMap<QString,QString> |

  Add key/value pairs to the meta data that is sent to the slave. If a certain key already existed, it will be overridden.

  values - the meta data to add

  See also setMetaData()

  See also mergeMetaData()

- addSubjob (job)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

  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.

  job - the subjob to add

- canceled (job)

  returns Nothing
  SIGNAL ("canceled (KJob*)")

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

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

  job - the job that emitted this signal

- connected (job)

  returns Nothing
  SIGNAL ("connected (Job*)")

  Argument | Type | Default
  --- | --- | ---
  job | KIO.Job |

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

  job - the job that emitted this signal

- detailedErrorStrings (reqUrl, method)

  returns QStringList

  Argument | Type | Default
  --- | --- | ---
  reqUrl | KUrl | 0
  method | int | -1

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

  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

- doKill ( )

  returns bool

  Abort this job. This kills all subjobs and deletes the job.

- doResume ( )

  returns bool

  Resume this job

  See also suspend

- doSuspend ( )

  returns bool

  Suspend this job

  See also resume

- errorString ( )

  returns QString

  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

- isInteractive ( )

  returns bool

  Returns whether message display is enabled or disabled. See also setInteractive . Returns true if message display is enabled

  See also setInteractive()

- mergeMetaData (values)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  values | QMap<QString,QString> |

  Add key/value pairs to the meta data that is sent to the slave. If a certain key already existed, it will remain unchanged.

  values - the meta data to merge

  See also setMetaData()

  See also addMetaData()

- metaData ( )

  returns KIO.MetaData

  Get meta data received from the slave. (Valid when first data is received and/or slave is finished) Returns the job's meta data

- outgoingMetaData ( )

  returns KIO.MetaData

  @internal. For the scheduler. Do not use.

- parentJob ( )

  returns KIO.Job

  Returns the parent job, if there is one. Returns the parent job, or 0 if there is none

  See also setParentJob

- queryMetaData (key)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  key | QString |

  Query meta data received from the slave. (Valid when first data is received and/or slave is finished)

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

- removeSubjob (job)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  job | KJob |

  Mark a sub job as being done.

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

  job - the subjob to remove

- setMetaData (metaData)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  metaData | KIO.MetaData |

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

  metaData - the meta data to set

  See also addMetaData()

  See also mergeMetaData()

- setParentJob (parentJob)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  parentJob | KIO.Job |

  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.

  parentJob - the new parent job

- showErrorDialog (parent)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 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.

  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

- start ( )

  returns Nothing

- ui ( )

  returns KIO.JobUiDelegate

  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