KDE 4.7 PyKDE API Reference

- KDE's Python API

# TransferJob Class Reference

`from PyKDE4.kio import *`

Inherits: KIO.SimpleJob → KIO.Job → KCompositeJob → KJob → QObject
Namespace: KIO

## Detailed Description

The transfer job pumps data into and/or out of a Slave. Data is sent to the slave on request of the slave ( dataReq). If data coming from the slave can not be handled, the reading of data from the slave should be suspended.

## Signals
| canResume (KIO.Job job, long offset)
| data (KIO.Job job, QByteArray data)
| dataReq (KIO.Job job, QByteArray data)
| mimetype (KIO.Job job, QString type)
| permanentRedirection (KIO.Job job, KUrl fromUrl, KUrl toUrl)
| redirection (KIO.Job job, KUrl url)
## Methods
| __init__ (self)
bool | doResume (self)
bool | isErrorPage (self)
QString | mimetype (self)
bool | reportDataSent (self)
| sendAsyncData (self, QByteArray data)
| setAsyncDataEnabled (self, bool enabled)
| setModificationTime (self, QDateTime mtime)
| setReportDataSent (self, bool enabled)
| setTotalSize (self, long bytes)
| slotData (self, QByteArray data)
| slotDataReq (self)
| slotFinished (self)
| slotMetaData (self, KIO.MetaData _metaData)
| slotMimetype (self, QString mimetype)
| slotRedirection (self, KUrl url)
| slotResult (self, KJob job)

## Signal Documentation

canResume | ( | KIO.Job | job,
|  | long | offset
| ) |  |  |

Internal:
  Emitted if the "put" job found an existing partial file (in which case offset is the size of that file) and emitted by the "get" job if it supports resuming to the given offset - in this case offset is unused)

Signal syntax:
  `QObject.connect(source, SIGNAL("canResume(KIO::Job*, KIO::filesize_t)"), target_slot)`

data | ( | KIO.Job | job,
|  | QByteArray | data
| ) |  |  |

Data from the slave has arrived.

Parameters:

  | job | the job that emitted this signal
  | data | data received from the slave.

End of data (EOD) has been reached if data.size() == 0, however, you should not be certain of data.size() == 0 ever happening (e.g. in case of an error), so you should rely on result() instead.

Signal syntax:
  `QObject.connect(source, SIGNAL("data(KIO::Job*, const QByteArray&)"), target_slot)`

dataReq | ( | KIO.Job | job,
|  | QByteArray | data
| ) |  |  |

Request for data. Please note, that you shouldn't put too large chunks of data in it as this requires copies within the frame work, so you should rather split the data you want to pass here in reasonable chunks (about 1MB maximum)

Parameters:

  | job | the job that emitted this signal
  | data | buffer to fill with data to send to the slave. An empty buffer indicates end of data. (EOD)

Signal syntax:
  `QObject.connect(source, SIGNAL("dataReq(KIO::Job*, QByteArray&)"), target_slot)`

mimetype | ( | KIO.Job | job,
|  | QString | type
| ) |  |  |

Mimetype determined.

Parameters:

  | job | the job that emitted this signal
  | type | the mime type

Signal syntax:
  `QObject.connect(source, SIGNAL("mimetype(KIO::Job*, const QString&)"), target_slot)`

permanentRedirection | ( | KIO.Job | job,
|  | KUrl | fromUrl,
|  | KUrl | toUrl
| ) |  |  |

Signals a permanent redirection. The redirection itself is handled internally.

Parameters:

  | job | the job that emitted this signal
  | fromUrl | the original URL
  | toUrl | the new URL

Signal syntax:
  `QObject.connect(source, SIGNAL("permanentRedirection(KIO::Job*, const KUrl&, const KUrl&)"), target_slot)`

redirection | ( | KIO.Job | job,
|  | KUrl | url
| ) |  |  |

Signals a redirection. Use to update the URL shown to the user. The redirection itself is handled internally.

Parameters:

  | job | the job that emitted this signal
  | url | the new URL

Signal syntax:
  `QObject.connect(source, SIGNAL("redirection(KIO::Job*, const KUrl&)"), target_slot)`

## Method Documentation

__init__ | ( |  | self ) |

bool doResume | ( |  | self ) |

Reimplemented for internal reasons

bool isErrorPage | ( |  | self ) |

Checks whether we got an error page. This currently only happens with HTTP urls. Call this from your slot connected to result().

Returns:
  true if we got an (HTML) error page from the server instead of what we asked for.

QString mimetype | ( |  | self ) |

Mimetype determined.

Parameters:

  | job | the job that emitted this signal
  | type | the mime type

bool reportDataSent | ( |  | self ) |

Returns whether the job reports the amount of data that has been sent (true), or whether the job reports the amount of data that has been received (false)

Deprecated:
  not needed, this is false for KIO.get and true for KIO.put, automatically since KDE-4.2.1 (and not useful as public API)

sendAsyncData | ( | self, |
|  | QByteArray | data
| ) |  |  |

Provide data to the job when async data is enabled. Should be called exactly once after receiving a dataReq signal Sending an empty block indicates end of data.

setAsyncDataEnabled | ( | self, |
|  | bool | enabled
| ) |  |  |

Enable the async data mode. When async data is enabled, data should be provided to the job by calling sendAsyncData() instead of returning data in the dataReq() signal.

setModificationTime | ( | self, |
|  | QDateTime | mtime
| ) |  |  |

Sets the modification time of the file to be created (by KIO.put) Note that some kioslaves might ignore this.

setReportDataSent | ( | self, |
|  | bool | enabled
| ) |  |  |

When enabled, the job reports the amount of data that has been sent, instead of the amount of data that that has been received.

See also:
  slotProcessedSize

See also:
  slotSpeed

Deprecated:
  not needed, this is false for KIO.get and true for KIO.put, automatically since KDE-4.2.1

setTotalSize | ( | self, |
|  | long | bytes
| ) |  |  |

Set the total size of data that we are going to send in a put job. Helps getting proper progress information.

Since:
  4.2.1

slotData | ( | self, |
|  | QByteArray | data
| ) |  |  |

slotDataReq | ( |  | self ) |

slotFinished | ( |  | self ) |

slotMetaData | ( | self, |
|  | KIO.MetaData | _metaData
| ) |  |  |

slotMimetype | ( | self, |
|  | QString | mimetype
| ) |  |  |

slotRedirection | ( | self, |
|  | KUrl | url
| ) |  |  |

slotResult | ( | self, |
|  | KJob | job
| ) |  |  |

Called when m_subJob finishes.

Parameters:

  | job | the job that finished