libqutim
0.3.2.0
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef CONTACT_H 00027 #define CONTACT_H 00028 00029 #include "buddy.h" 00030 #include <QSet> 00031 00032 namespace qutim_sdk_0_3 00033 { 00034 class Account; 00035 class MetaContact; 00036 class Message; 00037 class ContactPrivate; 00038 00039 typedef QPair<LocalizedString, QVariant> InfoField; 00040 typedef QList<InfoField> InfoFieldList; 00041 00045 class LIBQUTIM_EXPORT Contact : public Buddy 00046 { 00047 Q_OBJECT 00048 Q_DECLARE_PRIVATE(Contact) 00049 Q_PROPERTY(QStringList tags READ tags WRITE setTags NOTIFY tagsChanged) 00050 Q_PROPERTY(bool inList READ isInList WRITE setInList NOTIFY inListChanged) 00051 public: 00057 Contact(Account *account); 00058 Contact(ContactPrivate &d, Account *account); 00062 virtual ~Contact(); 00068 virtual QStringList tags() const; 00074 virtual void setTags(const QStringList &tags) = 0; 00080 virtual bool isInList() const = 0; 00086 virtual void setInList(bool inList) = 0; 00090 void addToList() { setInList(true); } 00094 void removeFromList() { setInList(false); } 00095 virtual ChatUnit *upperUnit(); 00096 protected: 00097 bool event(QEvent *); 00098 signals: 00099 void tagsChanged(const QStringList ¤t, const QStringList &previous); 00100 void inListChanged(bool inList); 00101 private: 00102 friend class MetaContact; 00103 }; 00104 00105 class LIBQUTIM_EXPORT ContactComparator : public QObject 00106 { 00107 Q_OBJECT 00108 Q_CLASSINFO("Service", "ContactComparator") 00109 public: 00110 virtual int compare(Contact *a, Contact *b) = 0; 00111 void startListen(qutim_sdk_0_3::Contact *contact); 00112 void stopListen(qutim_sdk_0_3::Contact *contact); 00113 protected: 00114 virtual void doStartListen(qutim_sdk_0_3::Contact *contact) = 0; 00115 virtual void doStopListen(qutim_sdk_0_3::Contact *contact) = 0; 00116 signals: 00117 void contactChanged(qutim_sdk_0_3::Contact*); 00118 }; 00119 00120 } 00121 00122 Q_DECLARE_METATYPE(qutim_sdk_0_3::Contact*) 00123 Q_DECLARE_METATYPE(QList<qutim_sdk_0_3::Contact*>) 00124 00125 #endif // CONTACT_H 00126