contactengine/contactsengine.h
author John Kern <johnk@symbian.org>
Thu, 12 Aug 2010 10:49:23 -0700
changeset 25 adbe71832e2b
parent 23 51fcdd1558d8
child 31 7140311376c0
permissions -rwxr-xr-x
runs on-device now; testing on 5800
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     1
#ifndef CONTACTSENGINE_H
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     2
#define CONTACTSENGINE_H
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     3
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     4
#include <QAbstractListModel>
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     5
#include <QContactManager>
25
adbe71832e2b runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents: 23
diff changeset
     6
#include <QPointer>
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     7
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     8
#include "contactsengine.h"
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
     9
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    10
using namespace QtMobility;
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    11
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    12
class ContactsEngine : public QAbstractListModel
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    13
{
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    14
    Q_OBJECT
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    15
public:
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    16
    explicit ContactsEngine(QObject *parent = 0);
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    17
    ~ContactsEngine();
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    18
23
51fcdd1558d8 clean up
John Kern <johnk@symbian.org>
parents: 19
diff changeset
    19
    // index() and parent()  are defined by QAbstractListModel. So we do not
51fcdd1558d8 clean up
John Kern <johnk@symbian.org>
parents: 19
diff changeset
    20
    // need to define the QModelIndex
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    21
    // required by list model interface.
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    22
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    23
    QVariant data(const QModelIndex &index, int role) const;
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    24
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    25
    QStringList dataSources();
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    26
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    27
public:
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    28
    void populateAddresses();
23
51fcdd1558d8 clean up
John Kern <johnk@symbian.org>
parents: 19
diff changeset
    29
    void dumpContactMgr(); // use for debugging. Hard to inspect it via Qt Creator.
51fcdd1558d8 clean up
John Kern <johnk@symbian.org>
parents: 19
diff changeset
    30
    void enumerateMgrs();
25
adbe71832e2b runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents: 23
diff changeset
    31
    void createManager();
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    32
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    33
signals:
25
adbe71832e2b runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents: 23
diff changeset
    34
    void errorOccurred(QString errMsg); // when a error message
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    35
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    36
public slots:
23
51fcdd1558d8 clean up
John Kern <johnk@symbian.org>
parents: 19
diff changeset
    37
    void setManager(const QString &aMgr);
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    38
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    39
private:
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    40
    QMap<QString, QString> m_availableManagers;
25
adbe71832e2b runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents: 23
diff changeset
    41
    QPointer<QContactManager> m_manager;
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    42
};
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    43
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    44
#endif // CONTACTSENGINE_H