kopete/libkopete
#include <kopeteavatarmanager.h>

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 () | |
Static Public Member Functions | |
static AvatarManager * | self () |
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.
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:
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.
Updating an avatar
Adding an avatar with the same name will update the previous avatar.
Definition at line 106 of file kopeteavatarmanager.h.
Member Typedef Documentation
A single entry in AvatarManager.
- See also
- Kopete::AvatarManager
Member Enumeration Documentation
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
|
slot |
Add an new avatar to the storage.
No need to scale the image, add() will do it for you.
- Parameters
-
newEntry New avatar entry
- Returns
- a new AvatarEntry struct. If the adding failed, the path is null.
Definition at line 99 of file kopeteavatarmanager.cpp.
|
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
-
newEntry new avatar added into the storage.
|
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
-
entryRemoved avatar being remove from storage.
|
slot |
Check if an avatar exists.
- Parameters
-
entryToCheck Avatar entry to check
Definition at line 283 of file kopeteavatarmanager.cpp.
|
slot |
Check if an avatar exists by his name.
- Parameters
-
avatarName Avatar entry to check
Definition at line 290 of file kopeteavatarmanager.cpp.
|
slot |
Remove an avatar from the storage.
- Parameters
-
entryToRemove Avatar entry to remove
Definition at line 252 of file kopeteavatarmanager.cpp.
|
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:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.