Home · All Classes · All Namespaces · Modules · Functions · Files
Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Slots | Protected Member Functions
Tp::FileTransferChannel Class Reference

The FileTransferChannel class represents 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

Public Member Functions

Static Public Member Functions

Static Public Attributes

Protected Slots

Protected Member Functions


Detailed Description

The FileTransferChannel class represents a Telepathy channel of type FileTransfer.

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

For more details, please refer to Telepathy specification.

See Asynchronous Object Model, Shared Pointer Usage


Constructor & Destructor Documentation

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

Class destructor.

Tp::FileTransferChannel::FileTransferChannel ( const ConnectionPtr &  connection,
const QString objectPath,
const QVariantMap &  immutableProperties,
const Feature coreFeature = FileTransferChannel::FeatureCore 
) [protected]

Construct a new FileTransferChannel object.

Parameters:
connectionConnection owning this channel, and specifying the service.
objectPathThe channel object path.
immutablePropertiesThe channel immutable properties.
coreFeatureThe core feature of the channel type, if any. The corresponding introspectable should depend on FileTransferChannel::FeatureCore.

Member Function Documentation

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

Create a new FileTransferChannel object.

Parameters:
connectionConnection owning this channel, and specifying the service.
objectPathThe channel object path.
immutablePropertiesThe channel immutable properties.
Returns:
A FileTransferChannelPtr object pointing to the newly created FileTransferChannel 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 FileTransferState.

Change notification is via the stateChanged() signal.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The state as FileTransferState.
See also:
stateReason()
FileTransferStateChangeReason Tp::FileTransferChannel::stateReason ( ) const

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

Change notification is via the stateChanged() signal.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The state reason as FileTransferStateChangeReason.
See also:
state()
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 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 property cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The suggested filename for the receiver.
QString Tp::FileTransferChannel::contentType ( ) const

Return the file's MIME type.

This property cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The file's MIME type.
qulonglong Tp::FileTransferChannel::size ( ) const

Return the size of the file.

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 property cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The file size.
QString Tp::FileTransferChannel::uri ( ) const

Return the URI of the file.

On outgoing file transfers, this property cannot change after the channel is requested. For incoming file transfers, this property may be set by the channel handler before calling AcceptFile to inform observers where the incoming file will be saved. When the URI property is set, the signal IncomingFileTransferChannel::uriDefined() is emitted.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The file uri.
See also:
IncomingFileTransferChannel::uriDefined()
FileHashType Tp::FileTransferChannel::contentHashType ( ) const

Return the type of the contentHash().

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The content hash type as FileHashType.
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 ready.

Returns:
The hash of the contents.
See also:
contentHashType()
QString Tp::FileTransferChannel::description ( ) const

Return the description of the file transfer.

This property cannot change once the channel has been created.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The description.
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 ready.

Returns:
The file modification time as QDateTime.
qulonglong Tp::FileTransferChannel::initialOffset ( ) const

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

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The offset in bytes.
See also:
initialOffsetDefined()
qulonglong Tp::FileTransferChannel::transferredBytes ( ) const

Return the number of bytes that have been transferred.

Change notification is via the transferredBytesChanged() signal.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The number of bytes.
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]

Emitted when the value of state() changes.

Parameters:
stateThe new state of this file transfer channel.
reasonThe reason for the change of state.
See also:
state()
void Tp::FileTransferChannel::initialOffsetDefined ( qulonglong  initialOffset) [signal]

Emitted when the initial offset for the file transfer is defined.

Parameters:
initialOffsetThe new initial offset for the file transfer.
See also:
initialOffset()
void Tp::FileTransferChannel::transferredBytesChanged ( qulonglong  count) [signal]

Emitted when the value of transferredBytes() changes.

Parameters:
countThe new number of bytes transferred.
See also:
transferredBytes()
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 CM 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 CMs support at least SocketAddressTypeIPv4.

This method requires FileTransferChannel::FeatureCore to be ready.

Returns:
The available socket types as a map from address types to arrays of access-control type.
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:
true if the connections has been established, false otherwise.
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:
true if sending/receiving has finished, false otherwise.
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.

void Tp::FileTransferChannel::onUriDefined ( const QString uri) [protected, slot]

Member Data Documentation

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.


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.6.5