1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The contact class represents a social contact |
|
17 * Note: This class has dependencies on QtMobility project |
|
18 * |
|
19 */ |
|
20 |
|
21 #ifndef SMFCONTACT_H_ |
|
22 #define SMFCONTACT_H_ |
|
23 |
|
24 #include "qtcontacts.h" |
|
25 #include <qdatastream.h> |
|
26 #include <QSharedData> |
|
27 #include <smfclientglobal.h> |
|
28 |
|
29 using namespace QtMobility; |
|
30 |
|
31 class SmfContactPrivate; |
|
32 |
|
33 /** |
|
34 * @ingroup smf_common_group |
|
35 * The contact class represents a social contact |
|
36 * |
|
37 * Note: This class has dependencies on QtMobility project |
|
38 */ |
|
39 class SMFCLIENT_EXPORT SmfContact |
|
40 { |
|
41 |
|
42 public: |
|
43 /** |
|
44 * Constructor with default argument |
|
45 * @param aParent The parent object |
|
46 */ |
|
47 SmfContact(); |
|
48 |
|
49 /** |
|
50 * Copy Constructor |
|
51 * @param aOther The reference object |
|
52 */ |
|
53 SmfContact( const SmfContact &aOther ); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~SmfContact( ); |
|
59 |
|
60 /** |
|
61 * Method to get the available sub fields for contacts. |
|
62 * The following are the available sub types of a contact |
|
63 * QtMobility::QContactAddress Address; |
|
64 * QtMobility::QContactAnniversary Anniversary; |
|
65 * QtMobility::QContactAvatar Avatar; |
|
66 * QtMobility::QContactBirthday Birthday; |
|
67 * QtMobility::QContactId ContactId; |
|
68 * QtMobility::QContactEmailAddress EmailAddress; |
|
69 * QtMobility::QContactGender Gender; |
|
70 * QtMobility::QContactGeolocation Geolocation; |
|
71 * QtMobility::QContactGuid Guid; |
|
72 * QtMobility::QContactName Name; |
|
73 * QtMobility::QContactNickname Nickname; |
|
74 * QtMobility::QContactNote Note; |
|
75 * QtMobility::QContactOnlineAccount OnlineAccount; |
|
76 * QtMobility::QContactOrganization Organization; |
|
77 * QtMobility::QContactPhoneNumber PhoneNumber; |
|
78 * QtMobility::QContactTimestamp Timestamp; |
|
79 * QtMobility::QContactType Type; |
|
80 * QtMobility::QContactUrl Url; |
|
81 * @return The Available sub fields for this contact |
|
82 */ |
|
83 QStringList subTypes( ) const; |
|
84 |
|
85 /** |
|
86 * Method to convert an SmfContact to a QContact |
|
87 * Changes made to the returned QContact will not be reflected |
|
88 * in its parent SmfContact object |
|
89 * @param aContact QContact corresponding to SmfContact |
|
90 */ |
|
91 void convert( QContact &aContact ) const; |
|
92 |
|
93 /** |
|
94 * Method to get the value of a sub field for this contact |
|
95 * @param aSubType The sub field type |
|
96 * @return The value of the sub field subType |
|
97 * @see subTypes() |
|
98 */ |
|
99 QVariant value( const QString& aSubType ) const; |
|
100 |
|
101 private: |
|
102 QSharedDataPointer<SmfContactPrivate> d; |
|
103 |
|
104 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
105 const SmfContact &aContact ); |
|
106 |
|
107 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
108 SmfContact &aContact ); |
|
109 |
|
110 }; |
|
111 |
|
112 |
|
113 /** |
|
114 * Method for Externalization. Writes the SmfContact object to |
|
115 * the stream and returns a reference to the stream. |
|
116 * @param aDataStream Stream to be written |
|
117 * @param aContact The SmfContact object to be externalized |
|
118 * @return reference to the written stream |
|
119 */ |
|
120 QDataStream &operator<<( QDataStream &aDataStream, |
|
121 const SmfContact &aContact ); |
|
122 |
|
123 /** |
|
124 * Method for Internalization. Reads a SmfContact object from |
|
125 * the stream and returns a reference to the stream. |
|
126 * @param aDataStream Stream to be read |
|
127 * @param aContact The SmfContact object to be internalized |
|
128 * @return reference to the stream |
|
129 */ |
|
130 QDataStream &operator>>( QDataStream &aDataStream, |
|
131 SmfContact &aContact ); |
|
132 |
|
133 // Make the class SmfContact known to QMetaType, so that as to register it. |
|
134 Q_DECLARE_METATYPE(SmfContact) |
|
135 |
|
136 #endif /* SMFCONTACT_H_ */ |
|