mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
[7021] Add contact abstraction support
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
|
||||
AkonadiBackend* AkonadiBackend::m_pInstance = 0;
|
||||
|
||||
AkonadiBackend::AkonadiBackend(QObject* parent) : QObject(parent)
|
||||
AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent)
|
||||
{
|
||||
//QTimer::singleShot( 0, this, SLOT( delayedInit() ) );
|
||||
m_pSession = new Akonadi::Session( "SFLPhone::instance" );
|
||||
@ -34,7 +34,7 @@ AkonadiBackend::~AkonadiBackend()
|
||||
|
||||
}
|
||||
|
||||
AkonadiBackend* AkonadiBackend::getInstance()
|
||||
ContactBackend* AkonadiBackend::getInstance()
|
||||
{
|
||||
if (m_pInstance == NULL) {
|
||||
m_pInstance = new AkonadiBackend(0);
|
||||
@ -95,7 +95,7 @@ ContactList AkonadiBackend::update(Akonadi::Collection collection)
|
||||
return contacts;
|
||||
}
|
||||
|
||||
ContactList AkonadiBackend::update()
|
||||
ContactList AkonadiBackend::update_slot()
|
||||
{
|
||||
return update(m_pCollection);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <akonadi/collectionmodel.h>
|
||||
#include <kabc/addressee.h>
|
||||
#include <kabc/addresseelist.h>
|
||||
#include <lib/ContactBackend.h>
|
||||
|
||||
class Contact;
|
||||
|
||||
@ -15,10 +16,10 @@ namespace KABC {
|
||||
|
||||
typedef QList<Contact*> ContactList;
|
||||
|
||||
class AkonadiBackend : public QObject {
|
||||
class AkonadiBackend : public ContactBackend {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static AkonadiBackend* getInstance();
|
||||
static ContactBackend* getInstance();
|
||||
Contact* getContactByPhone ( QString phoneNumber );
|
||||
Contact* getContactByUid ( QString uid );
|
||||
void editContact ( Contact* contact );
|
||||
@ -31,11 +32,10 @@ private:
|
||||
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 ;
|
||||
protected:
|
||||
ContactList update_slot();
|
||||
public slots:
|
||||
ContactList update();
|
||||
ContactList update(Akonadi::Collection collection);
|
||||
void collectionsReceived( const Akonadi::Collection::List& );
|
||||
signals:
|
||||
|
@ -21,8 +21,6 @@ set(GENERIC_LIB_VERSION "0.9.8")
|
||||
|
||||
INCLUDE_DIRECTORIES ( ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
|
||||
|
||||
#File to compile
|
||||
set( qtsflphone_LIB_SRCS
|
||||
Call.cpp
|
||||
@ -30,6 +28,7 @@ set( qtsflphone_LIB_SRCS
|
||||
AccountList.cpp
|
||||
CallModel.cpp
|
||||
Contact.cpp
|
||||
ContactBackend.cpp
|
||||
Item.cpp
|
||||
configurationmanager_interface_singleton.cpp
|
||||
callmanager_interface_singleton.cpp
|
||||
@ -98,7 +97,8 @@ set( qtsflphone_LIB_HDRS
|
||||
AccountList.h
|
||||
Call.h
|
||||
CallModel.h
|
||||
Contact.h
|
||||
Contact.h
|
||||
ContactBackend.h
|
||||
Item.h
|
||||
configurationmanager_interface_singleton.h
|
||||
callmanager_interface_singleton.h
|
||||
|
14
kde/src/lib/ContactBackend.cpp
Normal file
14
kde/src/lib/ContactBackend.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "ContactBackend.h"
|
||||
|
||||
#include "Contact.h"
|
||||
#include <QHash>
|
||||
|
||||
ContactBackend::ContactBackend(QObject* parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ContactList ContactBackend::update()
|
||||
{
|
||||
return update_slot();
|
||||
}
|
34
kde/src/lib/ContactBackend.h
Normal file
34
kde/src/lib/ContactBackend.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef CONTACT_BACKEND_H
|
||||
#define CONTACT_BACKEND_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
class Contact;
|
||||
|
||||
typedef QList<Contact*> ContactList;
|
||||
|
||||
class LIB_EXPORT ContactBackend : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContactBackend(QObject* parent);
|
||||
virtual Contact* getContactByPhone ( QString phoneNumber ) = 0;
|
||||
virtual Contact* getContactByUid ( QString uid ) = 0;
|
||||
virtual void editContact ( Contact* contact ) = 0;
|
||||
virtual void addNewContact ( Contact* contact ) = 0;
|
||||
protected:
|
||||
virtual ContactList update_slot ( ) = 0;
|
||||
QHash<QString,Contact*> m_pContactByPhone ;
|
||||
QHash<QString,Contact*> m_pContactByUid ;
|
||||
public slots:
|
||||
ContactList update();
|
||||
|
||||
private slots:
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user