61
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Interface for info provider plugins to class CntListModel.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CNTINFOPROVIDER_H
|
|
19 |
#define CNTINFOPROVIDER_H
|
|
20 |
|
|
21 |
#include <QObject>
|
|
22 |
#include <qcontact.h>
|
|
23 |
|
|
24 |
QTM_USE_NAMESPACE
|
|
25 |
|
|
26 |
/*
|
|
27 |
Info providers may provide up to three different types of info fields:
|
|
28 |
text, icon1 and icon2.
|
|
29 |
*/
|
|
30 |
enum ContactInfoField {
|
|
31 |
ContactInfoTextField = 0x01,
|
|
32 |
ContactInfoIcon1Field = 0x02,
|
|
33 |
ContactInfoIcon2Field = 0x04,
|
|
34 |
ContactInfoAllFields = ContactInfoTextField | ContactInfoIcon1Field | ContactInfoIcon2Field
|
|
35 |
};
|
|
36 |
Q_DECLARE_FLAGS(ContactInfoFields, ContactInfoField)
|
|
37 |
Q_DECLARE_OPERATORS_FOR_FLAGS(ContactInfoFields)
|
|
38 |
|
|
39 |
/*
|
|
40 |
Interface for info provider plugins. Info provider plugins provide the kind of
|
|
41 |
info that a listview with contacts wants. Examples includes phone number, image url
|
|
42 |
and online status (text and/or icon).
|
|
43 |
*/
|
|
44 |
class CntInfoProvider : public QObject
|
|
45 |
{
|
|
46 |
|
|
47 |
public:
|
|
48 |
/*
|
|
49 |
The unqiue name of the plugin.
|
|
50 |
|
|
51 |
/return the id of the plugin
|
|
52 |
*/
|
|
53 |
virtual QString id() const = 0;
|
|
54 |
|
|
55 |
/*
|
|
56 |
Checks fields that the client can provide.
|
|
57 |
|
|
58 |
/return all the ContactInfoFields that this plugin can provide to clients
|
|
59 |
*/
|
|
60 |
virtual ContactInfoFields supportedFields() const = 0;
|
|
61 |
|
|
62 |
/*
|
|
63 |
Requests info about a contact. The requested info fields are passed
|
|
64 |
back to the client via infoFieldReady() signals. Ideally this function
|
|
65 |
should not consume more than 50 ms of time. Info that takes longer to
|
|
66 |
fetch should use some asynchronous way of getting the data.
|
|
67 |
|
|
68 |
Info values are by default empty, so an empty value does not need not be
|
|
69 |
sent back in response to this request. However, if a value *changes* and
|
|
70 |
becomes empty, that will of course need to be signaled.
|
|
71 |
|
|
72 |
/param contact the contact for which info is requested
|
|
73 |
/param requestedInfo one or more of the flags in ContactInfoFields
|
|
74 |
*/
|
|
75 |
virtual void requestInfo(const QContact& contact, ContactInfoFields requestedInfo) = 0;
|
|
76 |
|
|
77 |
signals:
|
|
78 |
/*
|
|
79 |
The requested info fields are passed back to the client via infoFieldReady()
|
|
80 |
signals, one signal per field.
|
|
81 |
|
|
82 |
/param sender the provider that sends the signal
|
|
83 |
/param contactId the if of the contact that this info is about
|
|
84 |
/param field the field that is ready (text, icon1 or icon2)
|
|
85 |
/param value the value of the info field
|
|
86 |
*/
|
|
87 |
void infoFieldReady(CntInfoProvider* sender, int contactId, ContactInfoField field, const QString& value);
|
|
88 |
};
|
|
89 |
|
|
90 |
#endif
|