~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/klib/akonadibackend.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 *   Copyright (C) 2009-2013 by Savoir-Faire Linux                          *
 
2
 *   Copyright (C) 2009-2014 by Savoir-Faire Linux                          *
3
3
 *   Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>          *
4
4
 *            Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
5
 *                                                                          *
20
20
#ifndef AKONADI_BACKEND_H
21
21
#define AKONADI_BACKEND_H
22
22
 
23
 
#include "../lib/contactbackend.h"
24
 
#include "../lib/callmodel.h"
 
23
#include <QtCore/QPointer>
 
24
 
 
25
#include "../lib/abstractcontactbackend.h"
25
26
#include "../lib/typedefs.h"
26
27
#include <akonadi/collectionmodel.h>
 
28
#include <kabc/phonenumber.h>
 
29
#include <akonadi/item.h>
27
30
 
28
31
//Qt
29
32
class QObject;
31
34
//KDE
32
35
namespace KABC {
33
36
   class Addressee    ;
 
37
   class PhoneNumber  ;
34
38
}
35
39
 
36
40
namespace Akonadi {
37
 
   class Session        ;
38
 
   class Collection     ;
39
 
   class Item           ;
 
41
   class Session           ;
 
42
   class Collection        ;
 
43
   class CollectionFetchJob;
 
44
   class Monitor           ;
40
45
}
41
46
 
42
47
//SFLPhone
43
48
class Contact;
44
49
 
45
50
///AkonadiBackend: Implement a backend for Akonadi
46
 
class LIB_EXPORT AkonadiBackend : public ContactBackend {
 
51
class LIB_EXPORT AkonadiBackend : public AbstractContactBackend {
47
52
   Q_OBJECT
48
53
public:
49
 
   static   ContactBackend* getInstance();
50
 
   Contact* getContactByPhone ( const QString& phoneNumber ,bool resolveDNS = false, Account* a=nullptr);
 
54
   static   AbstractContactBackend* instance();
 
55
//    Contact* getContactByPhone ( const QString& phoneNumber ,bool resolveDNS = false, Account* a=nullptr);
51
56
   Contact* getContactByUid   ( const QString& uid                                                     );
52
57
   void     editContact       ( Contact*       contact , QWidget* parent = 0                           );
53
58
   void     addNewContact     ( Contact*       contact , QWidget* parent = 0                           );
54
59
   virtual void addPhoneNumber( Contact*       contact , QString  number, QString type                 );
55
 
   
 
60
 
56
61
   virtual void     editContact   ( Contact*   contact                                                 );
57
62
   virtual void     addNewContact ( Contact*   contact                                                 );
58
63
   virtual ~AkonadiBackend        (                                                                    );
59
64
 
 
65
   virtual const ContactList& getContactList() const;
 
66
 
60
67
private:
61
68
   //Singleton constructor
62
69
   explicit AkonadiBackend(QObject* parent);
64
71
   //Attributes
65
72
   static AkonadiBackend*         m_pInstance  ;
66
73
   Akonadi::Session*              m_pSession   ;
67
 
   Akonadi::Collection            m_Collection ;
 
74
   Akonadi::Monitor*              m_pMonitor   ;
68
75
   QHash<QString,KABC::Addressee> m_AddrHash   ;
69
76
   QHash<QString,Akonadi::Item>   m_ItemHash   ;
70
77
   ContactList                    m_pContacts  ;
 
78
   QPointer<Akonadi::CollectionFetchJob>   m_pJob;
 
79
 
 
80
   //Helper
 
81
   KABC::PhoneNumber::Type nameToType(const QString& name);
 
82
   Contact* addItem(Akonadi::Item item, bool ignoreEmpty = false);
 
83
   void fillContact(Contact* c, const KABC::Addressee& addr) const;
71
84
 
72
85
protected:
73
86
   ContactList update_slot();
75
88
public Q_SLOTS:
76
89
   ContactList update(Akonadi::Collection collection);
77
90
   void collectionsReceived( const Akonadi::Collection::List& );
 
91
private Q_SLOTS:
 
92
   void slotItemAdded(Akonadi::Item item,Akonadi::Collection coll);
 
93
   void slotItemChanged (const Akonadi::Item &item, const QSet< QByteArray > &partIdentifiers);
 
94
   void slotItemRemoved (const Akonadi::Item &item);
78
95
};
79
96
 
80
97
#endif