QXmppTransferJob Class Reference

The QXmppTransferJob class represents a single file transfer job. More...

`#include <QXmppTransferManager.h>`

Inheritance diagram for QXmppTransferJob:
[legend]
Collaboration diagram for QXmppTransferJob:
[legend]

## Public Types

enum | Direction { IncomingDirection, OutgoingDirection }
| This enum is used to describe the direction of a transfer job. More...
enum | Error { NoError = 0, AbortError, FileAccessError, FileCorruptError, ProtocolError }
| This enum is used to describe the type of error encountered by a transfer job. More...
enum | Method { NoMethod = 0, InBandMethod = 1, SocksMethod = 2, AnyMethod = 3 }
| This enum is used to describe a transfer method. More...
enum | State { OfferState = 0, StartState = 1, TransferState = 2, FinishedState = 3 }
| This enum is used to describe the state of a transfer job. More...

## Public Slots

void | abort ()
void | accept (const QString &filePath)
void | accept (QIODevice *output)

## Signals

void | error (QXmppTransferJob::Error error)
void | finished ()
void | localFileUrlChanged (const QUrl &localFileUrl)
| This signal is emitted when the local file URL changes.
void | progress (qint64 done, qint64 total)
| This signal is emitted to indicate the progress of this transfer job.
void | stateChanged (QXmppTransferJob::State state)
| This signal is emitted when the transfer job changes state.
Signals inherited from QXmppLoggable
void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Public Member Functions

QXmppTransferJob::Direction | direction () const
QXmppTransferJob::Error | error () const
QString | jid () const
QXmppTransferJob::Method | method () const
QString | sid () const
qint64 | speed () const
QXmppTransferJob::State | state () const
QXmppTransferFileInfo | fileInfo () const
QUrl | localFileUrl () const
void | setLocalFileUrl (const QUrl &localFileUrl)
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=0)

## Properties

Direction | direction
QUrl | localFileUrl
QString | jid
Method | method
State | state
QString | fileName
qint64 | fileSize

## Friends

class | QXmppTransferManager
class | QXmppTransferManagerPrivate
class | QXmppTransferIncomingJob
class | QXmppTransferOutgoingJob

## Additional Inherited Members

Protected Member Functions inherited from QXmppLoggable
void | debug (const QString &message)
void | info (const QString &message)
void | warning (const QString &message)
void | logReceived (const QString &message)
void | logSent (const QString &message)

## Detailed Description

The QXmppTransferJob class represents a single file transfer job.

See also
  QXmppTransferManager

## Member Enumeration Documentation

## Direction

enum QXmppTransferJob::Direction

This enum is used to describe the direction of a transfer job.

Enumerator
IncomingDirection | The file is being received.
OutgoingDirection | The file is being sent.

## Error

enum QXmppTransferJob::Error

This enum is used to describe the type of error encountered by a transfer job.

Enumerator
NoError | No error occurred.
AbortError | The file transfer was aborted.
FileAccessError | An error was encountered trying to access a local file.
FileCorruptError | The file is corrupt: the file size or hash do not match.
ProtocolError | An error was encountered in the file transfer protocol.

## Method

enum QXmppTransferJob::Method

This enum is used to describe a transfer method.

Enumerator
NoMethod | No transfer method.
InBandMethod | XEP-0047: In-Band Bytestreams
SocksMethod | XEP-0065: SOCKS5 Bytestreams
AnyMethod | Any supported transfer method.

## State

enum QXmppTransferJob::State

This enum is used to describe the state of a transfer job.

Enumerator
OfferState | The transfer is being offered to the remote party.
StartState | The transfer is being connected.
TransferState | The transfer is ongoing.
FinishedState | The transfer is finished.

## Member Function Documentation

## abort

void QXmppTransferJob::abort | ( |  | ) |

slot

Call this method if you wish to abort on ongoing transfer job.

## accept [1/2]

void QXmppTransferJob::accept | ( | const QString & | filePath | ) |

slot

Call this method if you wish to accept an incoming transfer job.

## accept [2/2]

void QXmppTransferJob::accept | ( | QIODevice * | iodevice | ) |

slot

Call this method if you wish to accept an incoming transfer job.

## error() [1/2]

QXmppTransferJob::Error QXmppTransferJob::error | ( |  | ) | const

Returns the last error that was encountered.

## error [2/2]

void QXmppTransferJob::error | ( | QXmppTransferJob::Error | error | ) |

signal

This signal is emitted when an error is encountered while processing the transfer job.

## fileInfo()

QXmppTransferFileInfo QXmppTransferJob::fileInfo | ( |  | ) | const

Returns meta-data about the file being transferred.

## finished

void QXmppTransferJob::finished | ( |  | ) |

signal

This signal is emitted when the transfer job is finished.

You can determine if the job completed successfully by testing whether error() returns QXmppTransferJob::NoError.

Note: Do not delete the job in the slot connected to this signal, instead use deleteLater().

## setLocalFileUrl()

void QXmppTransferJob::setLocalFileUrl | ( | const QUrl & | localFileUrl | ) |

Sets the local file URL.

Note
  You do not need to call this method if you called accept() with a file path.

## sid()

QString QXmppTransferJob::sid | ( |  | ) | const

Returns the job's session identifier.

## speed()

qint64 QXmppTransferJob::speed | ( |  | ) | const

Returns the job's transfer speed in bytes per second.

If the transfer has not started yet or is already finished, returns 0.

## Property Documentation

## direction

QXmppTransferJob::Direction QXmppTransferJob::direction

read

Returns the job's transfer direction.

## jid

QString QXmppTransferJob::jid

read

Returns the remote party's JID.

## localFileUrl

QUrl QXmppTransferJob::localFileUrl

read write

Returns the local file URL.

## method

QXmppTransferJob::Method QXmppTransferJob::method

read

Returns the job's transfer method.

## state

QXmppTransferJob::State QXmppTransferJob::state

read

Returns the job's state.

The documentation for this class was generated from the following files:

- QXmppTransferManager.h
- QXmppTransferManager.cpp