TransferJob Class Reference
from PyKDE4.kio import *
Inherits: KIO.SimpleJob → KIO.Job → KCompositeJob → KJob → QObject
Subclasses: KIO.DavJob, KIO.MimetypeJob, KIO.MultiGetJob, KIO.SpecialJob
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, KIO.filesize_t 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, TransferJobPrivate dd) | |
__init__ (self) | |
canResume (self, KIO.Job job, KIO.filesize_t offset) | |
data (self, KIO.Job job, QByteArray data) | |
dataReq (self, KIO.Job job, QByteArray data) | |
bool | doResume (self) |
bool | isErrorPage (self) |
QString | mimetype (self) |
mimetype (self, KIO.Job job, QString type) | |
permanentRedirection (self, KIO.Job job, KUrl fromUrl, KUrl toUrl) | |
redirection (self, KIO.Job job, KUrl url) | |
bool | reportDataSent (self) |
sendAsyncData (self, QByteArray data) | |
setAsyncDataEnabled (self, bool enabled) | |
setModificationTime (self, QDateTime mtime) | |
setReportDataSent (self, bool enabled) | |
setTotalSize (self, KIO.filesize_t 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) |
Method Documentation
__init__ | ( | self, | ||
TransferJobPrivate | dd | |||
) |
__init__ | ( | self ) |
canResume | ( | self, | ||
KIO.Job | job, | |||
KIO.filesize_t | 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(Job*, filesize_t)"), target_slot)
data | ( | self, | ||
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(Job*, const QByteArray&)"), target_slot)
dataReq | ( | self, | ||
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(Job*, QByteArray&)"), target_slot)
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 ) |
Call this in the slot connected to result, and only after making sure no error happened.
- Returns:
- the mimetype of the URL
Mimetype determined.
- Parameters:
-
job the job that emitted this signal type the mime type
- Signal syntax:
QObject.connect(source, SIGNAL("mimetype(Job*, const QString&)"), target_slot)
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(Job*, const KUrl&, const KUrl&)"), target_slot)
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(Job*, const KUrl&)"), target_slot)
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, | ||
KIO.filesize_t | 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