author | John Kern <johnk@symbian.org> |
Fri, 13 Aug 2010 15:37:06 -0700 | |
changeset 31 | 7140311376c0 |
parent 25 | adbe71832e2b |
child 34 | 93c5a58496b6 |
permissions | -rwxr-xr-x |
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 | 19 |
// index() and parent() are defined by QAbstractListModel. So we do not |
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 | 29 |
void dumpContactMgr(); // use for debugging. Hard to inspect it via Qt Creator. |
30 |
void enumerateMgrs(); |
|
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
31 |
void createManager(); |
31
7140311376c0
created in memory contact mgr; populateAddress populates it
John Kern <johnk@symbian.org>
parents:
25
diff
changeset
|
32 |
void createManagerSF(); |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
33 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
34 |
signals: |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
35 |
void errorOccurred(QString errMsg); // when a error message |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
36 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
37 |
public slots: |
23 | 38 |
void setManager(const QString &aMgr); |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
39 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
40 |
private: |
31
7140311376c0
created in memory contact mgr; populateAddress populates it
John Kern <johnk@symbian.org>
parents:
25
diff
changeset
|
41 |
QString errorString(QContactManager::Error); |
7140311376c0
created in memory contact mgr; populateAddress populates it
John Kern <johnk@symbian.org>
parents:
25
diff
changeset
|
42 |
|
7140311376c0
created in memory contact mgr; populateAddress populates it
John Kern <johnk@symbian.org>
parents:
25
diff
changeset
|
43 |
private: |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
44 |
QMap<QString, QString> m_availableManagers; |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
45 |
QPointer<QContactManager> m_manager; |
31
7140311376c0
created in memory contact mgr; populateAddress populates it
John Kern <johnk@symbian.org>
parents:
25
diff
changeset
|
46 |
QPointer<QContactManager> m_manager_sf; |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
47 |
}; |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
48 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
49 |
#endif // CONTACTSENGINE_H |