libqutim  0.3.1.0
contact.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef CONTACT_H
27 #define CONTACT_H
28 
29 #include "buddy.h"
30 #include <QSet>
31 
32 namespace qutim_sdk_0_3
33 {
34 class Account;
35 class MetaContact;
36 class Message;
37 class ContactPrivate;
38 
39 typedef QPair<LocalizedString, QVariant> InfoField;
40 typedef QList<InfoField> InfoFieldList;
41 
46 {
47  Q_OBJECT
48  Q_DECLARE_PRIVATE(Contact)
49  Q_PROPERTY(QStringList tags READ tags WRITE setTags NOTIFY tagsChanged)
50  Q_PROPERTY(bool inList READ isInList WRITE setInList NOTIFY inListChanged)
51 public:
57  Contact(Account *account);
58  Contact(ContactPrivate &d, Account *account);
62  virtual ~Contact();
68  virtual QStringList tags() const;
74  virtual void setTags(const QStringList &tags) = 0;
80  virtual bool isInList() const = 0;
86  virtual void setInList(bool inList) = 0;
90  void addToList() { setInList(true); }
94  void removeFromList() { setInList(false); }
95  virtual ChatUnit *upperUnit();
96 protected:
97  bool event(QEvent *);
98 signals:
99  void tagsChanged(const QStringList &current, const QStringList &previous);
100  void inListChanged(bool inList);
101 private:
102  friend class MetaContact;
103 };
104 
105 class LIBQUTIM_EXPORT ContactComparator : public QObject
106 {
107  Q_OBJECT
108  Q_CLASSINFO("Service", "ContactComparator")
109 public:
110  virtual int compare(Contact *a, Contact *b) = 0;
111  void startListen(qutim_sdk_0_3::Contact *contact);
112  void stopListen(qutim_sdk_0_3::Contact *contact);
113 protected:
114  virtual void doStartListen(qutim_sdk_0_3::Contact *contact) = 0;
115  virtual void doStopListen(qutim_sdk_0_3::Contact *contact) = 0;
116 signals:
117  void contactChanged(qutim_sdk_0_3::Contact*);
118 };
119 
120 }
121 
123 Q_DECLARE_METATYPE(QList<qutim_sdk_0_3::Contact*>)
124 
125 #endif // CONTACT_H
126 

Generated by Doxygen