| Home · All Classes · All Namespaces · Modules · Functions · Files

# Tp::FileTransferChannel Class Reference
[Channel proxies]

The FileTransferChannel class provides an object representing a Telepathy channel of type FileTransfer. More...

`#include <TelepathyQt4/FileTransferChannel>`

Inherits Tp::Channel.

Inherited by Tp::IncomingFileTransferChannel, and Tp::OutgoingFileTransferChannel.

List of all members.

## Signals

- void stateChanged (Tp::FileTransferState state, Tp::FileTransferStateChangeReason reason)
- void initialOffsetDefined (qulonglong initialOffset)
- void transferredBytesChanged (qulonglong count)

## Public Member Functions

- virtual ~FileTransferChannel ()
- FileTransferState state () const
- FileTransferStateChangeReason stateReason () const
- QString fileName () const
- QString contentType () const
- qulonglong size () const
- FileHashType contentHashType () const
- QString contentHash () const
- QString description () const
- QDateTime lastModificationTime () const
- qulonglong initialOffset () const
- qulonglong transferredBytes () const
- PendingOperation * cancel ()

## Static Public Member Functions

- static FileTransferChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)

## Static Public Attributes

- static const Feature FeatureCore

## Protected Member Functions

- FileTransferChannel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
- SupportedSocketMap availableSocketTypes () const
- virtual void connectToHost ()
- bool isConnected () const
- void setConnected ()
- bool isFinished () const
- virtual void setFinished ()

## Detailed Description

The FileTransferChannel class provides an object representing a Telepathy channel of type FileTransfer.

For more specialized file transfer classes, please refer to OutgoingFileTransferChannel and IncomingFileTransferChannel.

## Constructor & Destructor Documentation

Tp::FileTransferChannel::~FileTransferChannel | ( |  | ) | `[virtual]`

Class destructor.

Tp::FileTransferChannel::FileTransferChannel | ( | const ConnectionPtr & | connection,
|  | const QString & | objectPath,
|  | const QVariantMap & | immutableProperties |
| ) |  |  | `[protected]`

Construct a new file transfer channel associated with the given objectPath on the same service as the given connection.

Parameters:

  | connection | Connection owning this channel, and specifying the service.
  | objectPath | Path to the object on the service.
  | immutableProperties | The immutable properties of the channel.

## Member Function Documentation

FileTransferChannelPtr Tp::FileTransferChannel::create | ( | const ConnectionPtr & | connection,
|  | const QString & | objectPath,
|  | const QVariantMap & | immutableProperties |
| ) |  |  | `[static]`

Create a new FileTransferChannel object.

Parameters:

  | connection | Connection owning this channel, and specifying the service.
  | objectPath | The object path of this channel.
  | immutableProperties | The immutable properties of this channel.

Returns:
  A StreamedMediaChannelPtr object pointing to the newly created StreamedMediaChannel object.

Reimplemented from Tp::Channel.

Reimplemented in Tp::IncomingFileTransferChannel, and Tp::OutgoingFileTransferChannel.

FileTransferState Tp::FileTransferChannel::state | ( |  | ) | const

Return the state of the file transfer as described by the FileTransferState enum.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The state of the file transfer.

FileTransferStateChangeReason Tp::FileTransferChannel::stateReason | ( |  | ) | const

Return the for the state change as described by the FileTransferStateChangeReason enum.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The reason for the state change.

QString Tp::FileTransferChannel::fileName | ( |  | ) | const

Return the name of the file on the sender's side. This is given as a suggested filename for the receiver. This cannot change once the channel has been created.

This property should be the basename of the file being sent. For example, if the sender sends the file /home/user/monkey.pdf then this property should be set to monkey.pdf.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  Suggested filename for the receiver.

QString Tp::FileTransferChannel::contentType | ( |  | ) | const

Return the file's MIME type. This cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The file's MIME type.

qulonglong Tp::FileTransferChannel::size | ( |  | ) | const

The size of the file. This cannot change once the channel has been created.

Note that the size is not guaranteed to be exactly right for incoming files. This is merely a hint and should not be used to know when the transfer finished.

For unknown sizes the return value can be UINT64_MAX.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The size of the file.

FileHashType Tp::FileTransferChannel::contentHashType | ( |  | ) | const

Return the type of the contentHash().

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The type of the contentHash().

See also:
  contentHash()

QString Tp::FileTransferChannel::contentHash | ( |  | ) | const

Return the hash of the contents of the file transfer, of type described in the value of the contentHashType().

Its value MUST correspond to the appropriate type of the contentHashType(). If the contentHashType() is set to FileHashTypeNone, then the returned value is an empty string.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  Hash of the contents of the file transfer.

See also:
  contentHashType()

QString Tp::FileTransferChannel::description | ( |  | ) | const

Return the description of the file transfer. This cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The description of the file transfer.

QDateTime Tp::FileTransferChannel::lastModificationTime | ( |  | ) | const

Return the last modification time of the file being transferred. This cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The last modification time of the file being transferred.

qulonglong Tp::FileTransferChannel::initialOffset | ( |  | ) | const

Return the offset in bytes from which the file will be sent.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  The offset in bytes from where the file should be sent.

qulonglong Tp::FileTransferChannel::transferredBytes | ( |  | ) | const

Return the number of bytes that have been transferred. This will be updated as the file transfer continues.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  Number of bytes that have been transferred.

See also:
  transferredBytesChanged()

PendingOperation * Tp::FileTransferChannel::cancel | ( |  | ) |

Cancel a file transfer.

Returns:
  A PendingOperation object which will emit PendingOperation::finished when the call has finished.

void Tp::FileTransferChannel::stateChanged | ( | Tp::FileTransferState | state,
|  | Tp::FileTransferStateChangeReason | reason |
| ) |  |  | `[signal]`

void Tp::FileTransferChannel::initialOffsetDefined | ( | qulonglong | initialOffset | ) | `[signal]`

void Tp::FileTransferChannel::transferredBytesChanged | ( | qulonglong | count | ) | `[signal]`

SupportedSocketMap Tp::FileTransferChannel::availableSocketTypes | ( |  | ) | const`[protected]`

Return a mapping from address types (members of SocketAddressType) to arrays of access-control type (members of SocketAccessControl) that the connection manager supports for sockets with that address type. For simplicity, if a CM supports offering a particular type of file transfer, it is assumed to support accepting it. All connection Managers support at least SocketAddressTypeIPv4.

This method requires FileTransferChannel::FeatureCore to be enabled.

Returns:
  A mapping from address types to arrays of access-control type.

See also:
  transferredBytesChanged()

void Tp::FileTransferChannel::connectToHost | ( |  | ) | `[protected, virtual]`

Protected virtual method called when the state becomes FileTransferStateOpen.

Specialized classes should reimplement this method and call setConnected() when the connection is established.

See also:
  setConnected()

bool Tp::FileTransferChannel::isConnected | ( |  | ) | const`[protected]`

Return whether a connection has been established.

Returns:
  Whether a connection has been established.

See also:
  setConnected()

void Tp::FileTransferChannel::setConnected | ( |  | ) | `[protected]`

Indicate whether a connection has been established.

Specialized classes that reimplement connectToHost() must call this method once the connection has been established or setFinished() if an error occurred.

See also:
  isConnected(), connectToHost(), setFinished()

bool Tp::FileTransferChannel::isFinished | ( |  | ) | const`[protected]`

Return whether sending/receiving has finished.

Returns:
  Whether sending/receiving has finished.

void Tp::FileTransferChannel::setFinished | ( |  | ) | `[protected, virtual]`

Protected virtual method called when an error occurred and the transfer should finish.

Specialized classes should reimplement this method and close the IO devices and do all the needed cleanup.

Note that for specialized classes that reimplement connectToHost() and set isConnected() to true, the state will not change to FileTransferStateCompleted once the state change is received.

When finished sending/receiving the specialized class MUST call this method and then the state will change to the latest pending state.

## Member Data Documentation

const Feature Tp::FileTransferChannel::FeatureCore`[static]`

Feature representing the core that needs to become ready to make the FileTransferChannel object usable.

Note that this feature must be enabled in order to use most FileTransferChannel methods. See specific methods documentation for more details.

When calling isReady(), becomeReady(), this feature is implicitly added to the requested features.

Reimplemented from Tp::Channel.

Reimplemented in Tp::IncomingFileTransferChannel, and Tp::OutgoingFileTransferChannel.