~ubuntu-branches/ubuntu/karmic/psi/karmic

« back to all changes in this revision

Viewing changes to src/vcardfactory.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-04-14 18:57:30 UTC
  • mfrom: (2.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080414185730-528re3zp0m2hdlhi
Tags: 0.11-8
* added CONFIG -= link_prl to .pro files and removed dependencies
  which are made unnecessary by this change
* Fix segfault when closing last chat tab with qt4.4
  (This is from upstream svn, rev. 1101) (Closes: Bug#476122)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef VCARDFACTORY_H
22
22
#define VCARDFACTORY_H
23
23
 
24
 
#include <qobject.h>
25
 
 
26
 
#include "im.h"
27
 
#include "xmpp_vcard.h"
28
 
#include "xmpp_tasks.h"
29
 
 
 
24
#include <QObject>
 
25
#include <QMap>
 
26
#include <QStringList>
 
27
 
 
28
namespace XMPP {
 
29
        class VCard;
 
30
        class Jid;
 
31
        class Task;
 
32
        class JT_VCard;
 
33
}
30
34
using namespace XMPP;
31
35
 
32
 
class VCardFactory
 
36
class VCardFactory : public QObject
33
37
{
 
38
        Q_OBJECT
 
39
        
34
40
public:
35
 
        // call this, when you need a cached vCard
36
 
        static const VCard *vcard(const Jid &);
37
 
 
38
 
        // call this when you need to update vCard in cache
39
 
        static void setVCard(const Jid &, const VCard &);
40
 
 
41
 
        // call this when you need to retrieve fresh vCard from server (and store it in cache afterwards)
42
 
        static JT_VCard *getVCard(const Jid &, Task *rootTask, const QObject *, const char *slot, bool cacheVCard = true);
43
 
 
44
 
        // Register for updates to vcard changes
45
 
        static void registerVCardChanged(const QObject*, const char* slot);
 
41
        static VCardFactory* instance();
 
42
        const VCard *vcard(const Jid &);
 
43
        void setVCard(const Jid &, const VCard &);
 
44
        JT_VCard *getVCard(const Jid &, Task *rootTask, const QObject *, const char *slot, bool cacheVCard = true);
 
45
        
 
46
signals:
 
47
        void vcardChanged(const Jid&);
 
48
        
 
49
protected:
 
50
        void checkLimit(QString jid, VCard *vcard);
 
51
        
 
52
private slots:
 
53
        void taskFinished();
 
54
        
 
55
private:
 
56
        VCardFactory();
 
57
        ~VCardFactory();
 
58
        
 
59
        static VCardFactory* instance_;
 
60
        const int dictSize_;
 
61
        QStringList vcardList_;
 
62
        QMap<QString,VCard*> vcardDict_;
46
63
};
47
64
 
48
65
#endif