kopete/libkopete
kopeteavatarmanager.h
Go to the documentation of this file.00001 /* 00002 kopeteavatarmanager.h - Global avatar manager 00003 00004 Copyright (c) 2007 by Michaƫl Larouche <larouche@kde.org> 00005 00006 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org> 00007 00008 ************************************************************************* 00009 * * 00010 * This library is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU Lesser General Public * 00012 * License as published by the Free Software Foundation; either * 00013 * version 2 of the License, or (at your option) any later version. * 00014 * * 00015 ************************************************************************* 00016 */ 00017 #ifndef KOPETE_AVATARMANAGER_H 00018 #define KOPETE_AVATARMANAGER_H 00019 00020 #include <QtCore/QObject> 00021 #include <QtCore/QList> 00022 #include <QtGui/QImage> 00023 #include <kjob.h> 00024 #include "kopete_export.h" 00025 00026 class QImage; 00027 00028 namespace Kopete 00029 { 00030 00031 class Contact; 00106 class KOPETE_EXPORT AvatarManager : public QObject 00107 { 00108 Q_OBJECT 00109 public: 00113 enum AvatarCategoryType 00114 { 00115 User=1, 00116 Contact, 00117 All = User | Contact 00118 }; 00119 Q_DECLARE_FLAGS(AvatarCategory, AvatarCategoryType) 00120 00121 00127 typedef struct AvatarEntry 00128 { 00129 QString name; 00130 QString path; 00131 QImage image; 00132 Kopete::Contact *contact; 00133 AvatarManager::AvatarCategory category; 00134 } AvatarEntry; 00135 00136 public: 00141 ~AvatarManager(); 00142 00147 static AvatarManager *self(); 00148 00149 Q_SIGNALS: 00159 void avatarAdded(Kopete::AvatarManager::AvatarEntry newEntry); 00160 00170 void avatarRemoved(Kopete::AvatarManager::AvatarEntry entryRemoved); 00171 00172 public Q_SLOTS: 00181 Kopete::AvatarManager::AvatarEntry add(Kopete::AvatarManager::AvatarEntry newEntry); 00182 00187 bool remove(Kopete::AvatarManager::AvatarEntry entryToRemove); 00188 00189 private: 00195 AvatarManager(QObject *parent = 0); 00196 00197 private: 00198 static AvatarManager *s_self; 00199 00200 class Private; 00201 Private * const d; 00202 }; 00203 00204 Q_DECLARE_OPERATORS_FOR_FLAGS(Kopete::AvatarManager::AvatarCategory) 00205 00206 00233 // TODO: Use new Kopete::Task or KCompositeJob 00234 class KOPETE_EXPORT AvatarQueryJob : public KJob 00235 { 00236 Q_OBJECT 00237 public: 00238 AvatarQueryJob(QObject *parent = 0); 00239 ~AvatarQueryJob(); 00240 00246 void setQueryFilter(Kopete::AvatarManager::AvatarCategory category); 00247 00251 virtual void start(); 00252 00257 QList<Kopete::AvatarManager::AvatarEntry> avatarList() const; 00258 00259 private: 00260 class Private; 00261 Private * const d; 00262 }; 00263 00264 } 00265 00266 #endif
KDE 4.2 API Reference