From 74ac68f5a5415a340d27a430dc3a53d60dc3fff7 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> Date: Tue, 27 Sep 2011 12:48:17 -0400 Subject: [PATCH] [7021] Add contact abstraction support --- src/CMakeLists.txt | 6 +++--- src/ContactBackend.cpp | 14 ++++++++++++++ src/ContactBackend.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 src/ContactBackend.cpp create mode 100644 src/ContactBackend.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 566789a0..6e0c8d42 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/ContactBackend.cpp b/src/ContactBackend.cpp new file mode 100644 index 00000000..f95c0284 --- /dev/null +++ b/src/ContactBackend.cpp @@ -0,0 +1,14 @@ +#include "ContactBackend.h" + +#include "Contact.h" +#include <QHash> + +ContactBackend::ContactBackend(QObject* parent) : QObject(parent) +{ + +} + +ContactList ContactBackend::update() +{ + return update_slot(); +} diff --git a/src/ContactBackend.h b/src/ContactBackend.h new file mode 100644 index 00000000..72584f8c --- /dev/null +++ b/src/ContactBackend.h @@ -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 \ No newline at end of file -- GitLab