AkonadiBackend.h 1.21 KB
Newer Older
1
2
3
4
#ifndef AKONADI_BACKEND_H
#define AKONADI_BACKEND_H

#include <QObject>
5
6
7
8
9
10
11
#include <akonadi/session.h>
#include <akonadi/collectionmodel.h>
#include <kabc/addressee.h>
#include <kabc/addresseelist.h>

class Contact;

12
13
14
15
namespace KABC {
   class Addressee;
}

16
typedef QList<Contact*> ContactList;
17
18

class AkonadiBackend : public QObject {
19
   Q_OBJECT
20
public:
21
22
23
24
25
   static   AkonadiBackend* getInstance();
   Contact* getContactByPhone ( QString phoneNumber );
   Contact* getContactByUid   ( QString uid         );
   void     editContact       ( Contact* contact    );
   void     addNewContact     ( Contact* contact    );
26
27
28
29
30
private:
   AkonadiBackend(QObject* parent);
   virtual ~AkonadiBackend();
   
   //Attributes
31
32
33
34
35
36
   static AkonadiBackend*         m_pInstance       ;
   Akonadi::Session*              m_pSession        ;
   Akonadi::Collection            m_pCollection     ;
   QHash<QString,Contact*>        m_pContactByPhone ;
   QHash<QString,Contact*>        m_pContactByUid   ;
   QHash<QString,KABC::Addressee> m_pAddrHash       ;
37
38
39
40
41
42
public slots:
   ContactList update();
   ContactList update(Akonadi::Collection collection);
   void collectionsReceived( const Akonadi::Collection::List& );
signals:
   void collectionChanged();
43
44
45
};

#endif