TpPrototype::AvatarManager Class Reference
[Connection Management]

#include <TelepathyQt4/Prototype/AvatarManager.h>

Collaboration diagram for TpPrototype::AvatarManager:

Collaboration graph
[legend]

List of all members.

Classes

struct  Avatar
struct  AvatarRequirements

Signals

void signalAvatarChanged (TpPrototype::Contact *contact)
void signalOwnAvatarChanged (TpPrototype::AvatarManager::Avatar avatar)

Public Member Functions

bool isValid ()
TpPrototype::Connectionconnection ()
bool setAvatar (const TpPrototype::AvatarManager::Avatar &newValue)
void requestAvatar ()
AvatarRequirements avatarRequirements ()
void avatarForContactList (const QList< QPointer< Contact > > &contacts)

Protected Slots

void slotAvatarUpdated (uint contact, const QString &newAvatarToken)
void slotAvatarRetrieved (uint contact, const QString &token, const QByteArray &avatar, const QString &type)

Protected Member Functions

 AvatarManager (TpPrototype::Connection *connection, Telepathy::Client::ConnectionInterface *interface, QObject *parent=NULL)
 ~AvatarManager ()

Friends

class Connection
class ConnectionPrivate


Detailed Description

This class manages avatar information for one connection. Whenever a contact avatar changes, the signal signalAvatarChanged() is emitted. This signal provides the related contact object obtained from the ContactManager. In order to keep the contacts updated, you just have to instantiate this class (by requesting the object with Connection::avatarManager()) and initialize the list of contacts once (by calling avatarForContactList() ). After this point, the avatar of the contact is updated automatically if a change is signalled by the backend.
See also:
Connection

Constructor & Destructor Documentation

AvatarManager::AvatarManager ( TpPrototype::Connection connection,
Telepathy::Client::ConnectionInterface interface,
QObject *  parent = NULL 
) [protected]

Constructor. The capabilities manager cannot be instantiated directly. Use Connection::AvatarManager() for it!

AvatarManager::~AvatarManager (  )  [protected]


Member Function Documentation

void AvatarManager::avatarForContactList ( const QList< QPointer< Contact > > &  contacts  ) 

Get the avatar for a list of contacts. The avatars can be requested from the contact object. Info: The signal signalAvatarChanged() is called asynchonously after this call for every contact in this list.

Parameters:
List of contacts to request the avatars from.
See also:
signalAvatarChanged()

References TpPrototype::Contact::telepathyHandle().

Referenced by slotAvatarUpdated().

TpPrototype::AvatarManager::AvatarRequirements AvatarManager::avatarRequirements (  ) 

TpPrototype::Connection * AvatarManager::connection (  ) 

Returns the connection that belongs to this capabilities information.

Returns:
The connection object

bool AvatarManager::isValid (  ) 

Validity. Do not access any methods if the object is invalid!

void AvatarManager::requestAvatar (  ) 

Request local Avatar. Requests the avatar of the account that belongs to this connection. Info: The signal signalOwnAvatarChanged() is called asynchonously after this call.

References TpPrototype::ConnectionFacade::instance(), and TpPrototype::ConnectionFacade::selfHandleForConnectionInterface().

bool AvatarManager::setAvatar ( const TpPrototype::AvatarManager::Avatar newValue  ) 

Set local Avatar. This function sets the capabilites of the account that belongs to this connection.

Parameters:
newValue The new avatar. The content of token is ignored.
Returns:
true if setting was successful

References TpPrototype::AvatarManager::AvatarManager::Avatar::avatar, and TpPrototype::AvatarManager::AvatarManager::Avatar::mimeType.

void TpPrototype::AvatarManager::signalAvatarChanged ( TpPrototype::Contact contact  )  [signal]

The avatar of a contact was changed. This signal is emitted when any of the known contacts changed its avatar.

Referenced by slotAvatarRetrieved().

void TpPrototype::AvatarManager::signalOwnAvatarChanged ( TpPrototype::AvatarManager::Avatar  avatar  )  [signal]

My avatar was changed. This signal is emmitted if the local avatar was changed.

Referenced by slotAvatarRetrieved().

void AvatarManager::slotAvatarRetrieved ( uint  contact,
const QString &  token,
const QByteArray &  avatar,
const QString &  type 
) [protected, slot]

void AvatarManager::slotAvatarUpdated ( uint  contact,
const QString &  newAvatarToken 
) [protected, slot]


Friends And Related Function Documentation

friend class Connection [friend]

friend class ConnectionPrivate [friend]


Generated on Thu Mar 5 18:52:14 2009 for TelepathyQt4-0.1.1 by  doxygen 1.5.8