first release
[groupsms] / sms / contactinterface.h
diff --git a/sms/contactinterface.h b/sms/contactinterface.h
new file mode 100644 (file)
index 0000000..dd4b840
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef CONTACTINTERFACE_H
+#define CONTACTINTERFACE_H
+
+#include <QObject>
+#include <QVector>
+#include <contactwidgetitem.h>
+
+#include "itemobserver.h"
+
+#ifdef ONLY_FOR_EBOOK
+
+extern "C" {
+#include <gtk/gtk.h>
+#include <libosso.h>
+#include <libebook/e-book.h>
+#include <libosso-abook/osso-abook.h>
+}
+
+#endif
+
+class ContactInterface : public QObject
+{
+    Q_OBJECT
+public:
+    static ContactInterface* getInstance();
+    ~ContactInterface();
+
+    bool initEbook();
+
+    bool updateContactsFromEbookToXml();
+
+    void setItemObserver( ItemObserver *observer );
+    void setItemSelectObserver( ItemSelectObserver *observer );
+
+    /**
+      get all contacts from libosso-abook
+     */
+    ItemListPtr getAllContacts();
+    /**
+      get all contacts from xml file
+     */
+    void getAllContactsFromXml();
+    void getAllContactsFromXml(const QString &groupname);
+
+    QStringList getAllGroupNames();
+
+    bool createGroup(const QString &groupname);
+    bool removeGroup(const QString &groupname);
+    bool addContactToGroup( ItemListPtr items, const QString &groupname );
+    bool removeContactToGroup( ItemListPtr items, const QString &groupname );
+    bool removeContactToGroup( ItemListPtr items );
+
+private:
+    static ContactInterface* instance;
+    ContactInterface(QObject *parent = 0);
+
+private:
+    ItemListPtr all_contacts_items;
+    ItemListPtr all_contacts_items_db;
+    Item current_contact_item;
+    QString current_uid;
+    QString current_fullname;
+    QString current_mobilenumber;
+
+#ifdef ONLY_FOR_EBOOK    
+    OssoABookRoster *roster;
+#endif
+
+Q_SIGNALS:
+
+public Q_SLOTS:
+
+};
+
+#endif // CONTACTINTERFACE_H