• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • Kopete
  • AvatarManager
Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
Kopete::AvatarManager Class Reference

#include <kopeteavatarmanager.h>

Inheritance diagram for Kopete::AvatarManager:
Inheritance graph
[legend]

Classes

struct  AvatarEntry
 

Public Types

enum  AvatarCategoryType { User =1, Contact, All = User | Contact }
 
typedef struct
Kopete::AvatarManager::AvatarEntry 
AvatarEntry
 

Public Slots

Kopete::AvatarManager::AvatarEntry add (Kopete::AvatarManager::AvatarEntry newEntry)
 
bool exists (Kopete::AvatarManager::AvatarEntry avatarToCheck)
 
bool exists (const QString &avatarName)
 
bool remove (Kopete::AvatarManager::AvatarEntry entryToRemove)
 

Signals

void avatarAdded (Kopete::AvatarManager::AvatarEntry newEntry)
 
void avatarRemoved (Kopete::AvatarManager::AvatarEntry entryRemoved)
 

Public Member Functions

 ~AvatarManager ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static AvatarManager * self ()
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Manage the avatar storage.

AvatarManager is a class that manage avatar storage. It can manage the user defined avatar and avatar received from contacts.

It can also list the available avatars and filter it on the categery, like User or Contact.

Avatar Directory Layout

AvatarManager use Kopete user application directory to actually store avatars on disk.

The directory is in $KDEHOME/share/apps/kopete/avatars/

Sub-directory User store user defined avatars. It keep track of each avatar change so you can go back to a previous avatar you had.

Sub-directory Contacts store avatar received from contacts. Avatars are managed by account to avoid conflict of avatars between multiple contacts having the same ID. For example, an user can have the same ID for MSN and Jabber but use a different avatar for each account.

Avatar management

Listing avatar

If you want to list only an avatar category, use Kopete::AvatarQueryJob

Adding an avatar

Use the add() method to add an new avatar. For an avatar received from a contact, you should use the contactId for the name. You can either specify a image path or a QImage. AvatarManager will save the QImage on disk. When adding an avatar for Contact category, the "contact" entry need to be filled with a pointer to a Kopete::Contact instance.

Kopete::AvatarManager::AvatarEntry newEntry;
newEntry.name = "A new avatar"
newEntry.image = avatarImage;
newEntry.contact = this;
newEntry.category = Kopete::AvatarManager::Contact;
Kopete::AvatarManager::self()->add(newEntry);

If the operation has failed, the resulting AvatarEntry path will be empty. The following code is a good way to test the success of add() method:

if( !resultEntry.path.isEmpty() )
{
// Set avatar on server
}

Removing an avatar

To remove an avatar, create a new AvatarEntry struct and pass the avatar path to the struct, it will be used to identify which avatar to remove.

Then just use the remove() method.

Kopete::AvatarManager::AvatarEntry entryToRemove;
entryToRemove.path = imagePath;
Kopete::AvatarManager::self()->remove(entryToRemove);

Updating an avatar

Adding an avatar with the same name will update the previous avatar.

Author
Michaël Larouche larou.nosp@m.che@.nosp@m.kde.o.nosp@m.rg

Definition at line 106 of file kopeteavatarmanager.h.

Member Typedef Documentation

typedef struct Kopete::AvatarManager::AvatarEntry Kopete::AvatarManager::AvatarEntry

A single entry in AvatarManager.

Author
Michaël Larouche larou.nosp@m.che@.nosp@m.kde.o.nosp@m.rg
See also
Kopete::AvatarManager

Member Enumeration Documentation

enum Kopete::AvatarManager::AvatarCategoryType

Available avatar category.

Enumerator
User 

User defined avatar.

Contact 

Avatar from a contact.

All 

Only used to list all category.

Definition at line 113 of file kopeteavatarmanager.h.

Constructor & Destructor Documentation

Kopete::AvatarManager::~AvatarManager ( )

Destructor

Definition at line 93 of file kopeteavatarmanager.cpp.

Member Function Documentation

Kopete::AvatarManager::AvatarEntry Kopete::AvatarManager::add ( Kopete::AvatarManager::AvatarEntry  newEntry)
slot

Add an new avatar to the storage.

No need to scale the image, add() will do it for you.

Parameters
newEntryNew avatar entry
Returns
a new AvatarEntry struct. If the adding failed, the path is null.

Definition at line 99 of file kopeteavatarmanager.cpp.

void Kopete::AvatarManager::avatarAdded ( Kopete::AvatarManager::AvatarEntry  newEntry)
signal

An avatar was added into the storage.

Listen to this signal if you want to get notified of new avatar added to the storage. It is used to update the AvatarSelectorWidget lists.

Parameters
newEntrynew avatar added into the storage.
void Kopete::AvatarManager::avatarRemoved ( Kopete::AvatarManager::AvatarEntry  entryRemoved)
signal

An avatar was removed from storage.

Listen to this signal if you want to get notified of avatar being removed from storage. It is used to update the AvatarSelectorWidget lists.

Parameters
entryRemovedavatar being remove from storage.
bool Kopete::AvatarManager::exists ( Kopete::AvatarManager::AvatarEntry  avatarToCheck)
slot

Check if an avatar exists.

Parameters
entryToCheckAvatar entry to check

Definition at line 283 of file kopeteavatarmanager.cpp.

bool Kopete::AvatarManager::exists ( const QString &  avatarName)
slot

Check if an avatar exists by his name.

Parameters
avatarNameAvatar entry to check

Definition at line 290 of file kopeteavatarmanager.cpp.

bool Kopete::AvatarManager::remove ( Kopete::AvatarManager::AvatarEntry  entryToRemove)
slot

Remove an avatar from the storage.

Parameters
entryToRemoveAvatar entry to remove

Definition at line 252 of file kopeteavatarmanager.cpp.

AvatarManager * Kopete::AvatarManager::self ( )
static

Get the only instance of AvatarManager.

Returns
AvatarManager single instance

Definition at line 51 of file kopeteavatarmanager.cpp.


The documentation for this class was generated from the following files:
  • kopeteavatarmanager.h
  • kopeteavatarmanager.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal