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

The FileTransferChannel class represents a Telepathy channel of type FileTransfer. More...

#include <TelepathyQt/FileTransferChannel>

Inherits Tp::Channel.

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

Signals

void stateChanged (Tp::FileTransferState state, Tp::FileTransferStateChangeReason reason)
 
void initialOffsetDefined (qulonglong initialOffset)
 
void transferredBytesChanged (qulonglong count)
 
- Signals inherited from Tp::Channel
void groupFlagsChanged (Tp::ChannelGroupFlags flags, Tp::ChannelGroupFlags added, Tp::ChannelGroupFlags removed)
 
void groupCanAddContactsChanged (bool canAddContacts)
 
void groupCanRemoveContactsChanged (bool canRemoveContacts)
 
void groupCanRescindContactsChanged (bool canRescindContacts)
 
void groupMembersChanged (const Tp::Contacts &groupMembersAdded, const Tp::Contacts &groupLocalPendingMembersAdded, const Tp::Contacts &groupRemotePendingMembersAdded, const Tp::Contacts &groupMembersRemoved, const Tp::Channel::GroupMemberChangeDetails &details)
 
void groupHandleOwnersChanged (const Tp::HandleOwnerMap &owners, const Tp::UIntList &added, const Tp::UIntList &removed)
 
void groupSelfContactChanged ()
 
void conferenceChannelMerged (const Tp::ChannelPtr &channel)
 
void conferenceChannelRemoved (const Tp::ChannelPtr &channel, const Tp::Channel::GroupMemberChangeDetails &details)
 
- Signals inherited from Tp::DBusProxy
void invalidated (Tp::DBusProxy *proxy, const QString &errorName, const QString &errorMessage)
 
- Signals inherited from Tp::Object
void propertyChanged (const QString &propertyName)
 

Public Member Functions

virtual ~FileTransferChannel ()
 
FileTransferState state () const
 
FileTransferStateChangeReason stateReason () const
 
QString fileName () const
 
QString contentType () const
 
qulonglong size () const
 
QString uri () const
 
FileHashType contentHashType () const
 
QString contentHash () const
 
QString description () const
 
QDateTime lastModificationTime () const
 
qulonglong initialOffset () const
 
qulonglong transferredBytes () const
 
PendingOperationcancel ()
 
- Public Member Functions inherited from Tp::Channel
virtual ~Channel ()
 
ConnectionPtr connection () const
 
QVariantMap immutableProperties () const
 
QString channelType () const
 
HandleType targetHandleType () const
 
uint targetHandle () const
 
QString targetId () const
 
ContactPtr targetContact () const
 
bool isRequested () const
 
ContactPtr initiatorContact () const
 
PendingOperationrequestClose ()
 
PendingOperationrequestLeave (const QString &message=QString(), ChannelGroupChangeReason reason=ChannelGroupChangeReasonNone)
 
bool isConference () const
 
Contacts conferenceInitialInviteeContacts () const
 
QList< ChannelPtr > conferenceChannels () const
 
QList< ChannelPtr > conferenceInitialChannels () const
 
QHash< uint, ChannelPtr > conferenceOriginalChannels () const
 
bool supportsConferenceMerging () const
 
PendingOperationconferenceMergeChannel (const ChannelPtr &channel)
 
bool supportsConferenceSplitting () const
 
PendingOperationconferenceSplitChannel ()
 
ChannelGroupFlags groupFlags () const
 
bool groupCanAddContacts () const
 
bool groupCanAddContactsWithMessage () const
 
bool groupCanAcceptContactsWithMessage () const
 
PendingOperationgroupAddContacts (const QList< ContactPtr > &contacts, const QString &message=QString())
 
bool groupCanRescindContacts () const
 
bool groupCanRescindContactsWithMessage () const
 
bool groupCanRemoveContacts () const
 
bool groupCanRemoveContactsWithMessage () const
 
bool groupCanRejectContactsWithMessage () const
 
bool groupCanDepartWithMessage () const
 
PendingOperationgroupRemoveContacts (const QList< ContactPtr > &contacts, const QString &message=QString(), ChannelGroupChangeReason reason=ChannelGroupChangeReasonNone)
 
Contacts groupContacts (bool includeSelfContact=true) const
 
Contacts groupLocalPendingContacts (bool includeSelfContact=true) const
 
Contacts groupRemotePendingContacts (bool includeSelfContact=true) const
 
GroupMemberChangeDetails groupLocalPendingContactChangeInfo (const ContactPtr &contact) const
 
GroupMemberChangeDetails groupSelfContactRemoveInfo () const
 
bool groupAreHandleOwnersAvailable () const
 
HandleOwnerMap groupHandleOwners () const
 
bool groupIsSelfContactTracked () const
 
ContactPtr groupSelfContact () const
 
- Public Member Functions inherited from Tp::StatefulDBusProxy
 StatefulDBusProxy (const QDBusConnection &dbusConnection, const QString &busName, const QString &objectPath, const Feature &featureCore)
 
virtual ~StatefulDBusProxy ()
 
- Public Member Functions inherited from Tp::DBusProxy
 DBusProxy (const QDBusConnection &dbusConnection, const QString &busName, const QString &objectPath, const Feature &featureCore)
 
virtual ~DBusProxy ()
 
QDBusConnection dbusConnection () const
 
QString busName () const
 
QString objectPath () const
 
bool isValid () const
 
QString invalidationReason () const
 
QString invalidationMessage () const
 
- Public Member Functions inherited from Tp::Object
virtual ~Object ()
 
- Public Member Functions inherited from Tp::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
- Public Member Functions inherited from Tp::ReadyObject
 ReadyObject (RefCounted *object, const Feature &featureCore)
 
 ReadyObject (DBusProxy *proxy, const Feature &featureCore)
 
virtual ~ReadyObject ()
 
virtual bool isReady (const Features &features=Features()) const
 
virtual PendingReadybecomeReady (const Features &requestedFeatures=Features())
 
virtual Features requestedFeatures () const
 
virtual Features actualFeatures () const
 
virtual Features missingFeatures () const
 
- Public Member Functions inherited from Tp::OptionalInterfaceFactory< Channel >
 OptionalInterfaceFactory (Channel *this_)
 
 ~OptionalInterfaceFactory ()
 
QStringList interfaces () const
 
bool hasInterface (const QString &name) const
 
Interface * optionalInterface (InterfaceSupportedChecking check=CheckInterfaceSupported) const
 
Interface * interface () const
 

Static Public Member Functions

static FileTransferChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
 
- Static Public Member Functions inherited from Tp::Channel
static ChannelPtr create (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties)
 
- Static Public Member Functions inherited from Tp::StatefulDBusProxy
static QString uniqueNameFrom (const QDBusConnection &bus, const QString &wellKnownOrUnique)
 
static QString uniqueNameFrom (const QDBusConnection &bus, const QString &wellKnownOrUnique, QString &error, QString &message)
 

Static Public Attributes

static const Feature FeatureCore
 
- Static Public Attributes inherited from Tp::Channel
static const Feature FeatureCore
 
static const Feature FeatureConferenceInitialInviteeContacts
 

Protected Slots

void onUriDefined (const QString &uri)
 
- Protected Slots inherited from Tp::Channel
PendingOperationgroupAddSelfHandle ()
 

Protected Member Functions

 FileTransferChannel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature=FileTransferChannel::FeatureCore)
 
SupportedSocketMap availableSocketTypes () const
 
virtual void connectToHost ()
 
bool isConnected () const
 
void setConnected ()
 
bool isFinished () const
 
virtual void setFinished ()
 
- Protected Member Functions inherited from Tp::Channel
 Channel (const ConnectionPtr &connection, const QString &objectPath, const QVariantMap &immutableProperties, const Feature &coreFeature)
 
Client::ChannelInterfacebaseInterface () const
 
bool groupSelfHandleIsLocalPending () const
 
- Protected Member Functions inherited from Tp::DBusProxy
void setBusName (const QString &busName)
 
void invalidate (const QString &reason, const QString &message)
 
void invalidate (const QDBusError &error)
 
- Protected Member Functions inherited from Tp::Object
 Object ()
 
void notify (const char *propertyName)
 
- Protected Member Functions inherited from Tp::ReadyObject
ReadinessHelperreadinessHelper () const
 
- Protected Member Functions inherited from Tp::OptionalInterfaceFactory< Channel >
void setInterfaces (const QStringList &interfaces)
 

Additional Inherited Members

- Public Types inherited from Tp::OptionalInterfaceFactory< Channel >
enum  InterfaceSupportedChecking
 

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

◆ ~FileTransferChannel()

Tp::FileTransferChannel::~FileTransferChannel ( )
virtual

Class destructor.

◆ FileTransferChannel()

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

◆ create()

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.

◆ state()

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()

◆ 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()

◆ fileName()

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.

◆ contentType()

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.

◆ size()

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.

◆ uri()

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()

◆ contentHashType()

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()

◆ 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()

◆ description()

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.

◆ lastModificationTime()

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.

◆ initialOffset()

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()

◆ transferredBytes()

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()

◆ cancel()

PendingOperation * Tp::FileTransferChannel::cancel ( )

Cancel a file transfer.

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

◆ stateChanged

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()

◆ initialOffsetDefined

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()

◆ transferredBytesChanged

void Tp::FileTransferChannel::transferredBytesChanged ( qulonglong  count)
signal

Emitted when the value of transferredBytes() changes.

Parameters
countThe new number of bytes transferred.
See also
transferredBytes()

◆ availableSocketTypes()

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.

◆ connectToHost()

void Tp::FileTransferChannel::connectToHost ( )
protectedvirtual

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()

◆ isConnected()

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()

◆ 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()

◆ isFinished()

bool Tp::FileTransferChannel::isFinished ( ) const
protected

Return whether sending/receiving has finished.

Returns
true if sending/receiving has finished, false otherwise.

◆ setFinished()

void Tp::FileTransferChannel::setFinished ( )
protectedvirtual

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.

◆ onUriDefined

void Tp::FileTransferChannel::onUriDefined ( const QString &  uri)
protectedslot

Member Data Documentation

◆ FeatureCore

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.