|
1 /* |
|
2 * Copyright (c) 2007 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: This class holds complete conversations for a contact |
|
15 * The class basically has two parts. One header which has |
|
16 * Unread count, Unique Id, contact information and the body |
|
17 * will have all conversations as list of conversation entries |
|
18 * |
|
19 */ |
|
20 |
|
21 #ifndef __C_CS_CONVERSATION_H |
|
22 #define __C_CS_CONVERSATION_H |
|
23 |
|
24 // SYSTEM INCLUDE FILES |
|
25 #include <ccsdefs.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CCsConversationEntry; |
|
29 class CCsConversationContact; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * This class holds complete conversations for a contact |
|
34 * The class basically has two parts. One header which has |
|
35 * Unread count, Unique Id, contact information and the body |
|
36 * will have all conversations as list of conversation entries |
|
37 */ |
|
38 class CCsConversation : public CBase |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two phase construction |
|
44 */ |
|
45 static CCsConversation* NewL(); |
|
46 |
|
47 /** |
|
48 * Destructor |
|
49 */ |
|
50 ~CCsConversation(); |
|
51 |
|
52 /** |
|
53 * GetConversationId |
|
54 * This function shall return the conversation id |
|
55 * for this conversation |
|
56 * |
|
57 * @return TCsConversationEntryID conversation id |
|
58 */ |
|
59 TCsConversationEntryID GetConversationId() const; |
|
60 |
|
61 /** |
|
62 * SetConversationId |
|
63 * This function shall set conversation id |
|
64 * for this conversation |
|
65 * |
|
66 * @param aCsConversationEntryID Id to be set |
|
67 */ |
|
68 void SetConversationId(TCsConversationEntryID aCsConversationEntryID); |
|
69 |
|
70 /** |
|
71 * GetDisplayName |
|
72 * Returns the display name of the Conversation |
|
73 * |
|
74 * @return First name of conversation |
|
75 */ |
|
76 HBufC* GetDisplayName() const; |
|
77 |
|
78 /** |
|
79 * GetContactId |
|
80 * Returns the contact Id of this conversation, |
|
81 * from which the contact information can be fetched. |
|
82 * |
|
83 * @return - integer type contact Id |
|
84 */ |
|
85 |
|
86 TInt32 GetContactId() const; |
|
87 |
|
88 /** |
|
89 * GetLatestEntryL |
|
90 * This function shall return the latest Conversation Entry |
|
91 * of this Conversation |
|
92 * |
|
93 * @return - latest conversation entry |
|
94 */ |
|
95 CCsConversationEntry* GetLatestEntryL() const; |
|
96 |
|
97 /** |
|
98 * GetLatestUnreadEntryL |
|
99 * This function shall return the latest Unread Conversation Entry |
|
100 * of this Conversation |
|
101 * |
|
102 * @return - latest unread conversation entry |
|
103 */ |
|
104 CCsConversationEntry* GetLatestUnreadEntryL() const; |
|
105 |
|
106 /** |
|
107 * GetEntryListL |
|
108 * This function shall return all the entries this conversation holds |
|
109 * |
|
110 * @param aConversationEntryList, list of conversation entries |
|
111 */ |
|
112 void |
|
113 GetEntryListL( |
|
114 RPointerArray<CCsConversationEntry>* aConversationEntryList); |
|
115 |
|
116 /** |
|
117 * GetEntryL |
|
118 * This function returns the conversation entry at a specified index. |
|
119 * |
|
120 * @param aIndex, entry list index |
|
121 */ |
|
122 CCsConversationEntry* GetEntryL(TInt aIndex); |
|
123 |
|
124 /** |
|
125 * AddEntryL |
|
126 * Adds an entry to this conversation |
|
127 * |
|
128 * @param aCsConversationEntry Entry to be added |
|
129 */ |
|
130 void AddEntryL(CCsConversationEntry* aCsConversationEntry); |
|
131 |
|
132 /** |
|
133 * AddContactDetailsL |
|
134 * Adds contact details for the conversation |
|
135 * |
|
136 * @param aContactId Contact id |
|
137 * @param aFirstName first name |
|
138 * @param aLastName last name |
|
139 */ |
|
140 void AddContactDetailsL( |
|
141 TInt32 aContactId, |
|
142 const TDesC& aDisplayName); |
|
143 |
|
144 /** |
|
145 * AddContactDetailsL |
|
146 * Over loaded method |
|
147 * Add contact Number for the conversation |
|
148 * |
|
149 * @param aContactNumber Contact number |
|
150 */ |
|
151 void AddContactDetailsL(TDesC& aContactNumber); |
|
152 |
|
153 /** |
|
154 * UpdateEntryL |
|
155 * Update the details of an conversation entry |
|
156 * and set event as new/update |
|
157 * |
|
158 * @param aCsConversationEntry Conversation entry |
|
159 * @param aEvent event set to new/update |
|
160 */ |
|
161 void UpdateEntryL(CCsConversationEntry* aCsConversationEntry, |
|
162 TUint32& aEvent); |
|
163 |
|
164 /** |
|
165 * DeleteEntryL |
|
166 * Deletes the conversation entry |
|
167 * |
|
168 * @param aindexDeletion index of the entry to be deleted |
|
169 */ |
|
170 void DeleteEntryL(TInt aindexDeletion); |
|
171 |
|
172 /** |
|
173 * |
|
174 * FindEntry |
|
175 * Finds the conversation entry in the conversation |
|
176 * |
|
177 * @param aCsConversationEntry entry to be found |
|
178 * @return index of the entry if found else KErrNotFound |
|
179 */ |
|
180 TInt FindEntry(CCsConversationEntry* aCsConversationEntry); |
|
181 |
|
182 /** |
|
183 * |
|
184 * FindUnreadEntry |
|
185 * Finds the unread conversation entry in the conversation |
|
186 * |
|
187 * @return index of the entry if found else KErrNotFound |
|
188 */ |
|
189 TInt FindUnreadEntry() const; |
|
190 |
|
191 /** |
|
192 * GetEntryCount |
|
193 * Return the number of Conversation Entries in the Conversation |
|
194 * |
|
195 * @return Count of Entries for this conversation |
|
196 */ |
|
197 TInt GetEntryCount(); |
|
198 |
|
199 /** |
|
200 * GetUnreadMessageCount |
|
201 * Returns the number of Unread Conversation Entries in the Conversation |
|
202 * |
|
203 * @return the count of unread messsages |
|
204 */ |
|
205 TUint16 GetUnreadMessageCount() const; |
|
206 |
|
207 /** |
|
208 * GetContact |
|
209 * Returns the contact details of this conversation |
|
210 * |
|
211 * @return Conversation Contact Object |
|
212 */ |
|
213 CCsConversationContact* GetContact() const; |
|
214 |
|
215 /** |
|
216 * IsSpecialConversation |
|
217 * Returns whether the conversation is special conversation, |
|
218 * may it be Drafts/Bluetooth/IrDa |
|
219 * |
|
220 * @return TBool ETrue if special conversation else EFalse |
|
221 */ |
|
222 TBool IsSpecialConversation(); |
|
223 |
|
224 /** |
|
225 * Mark deleted |
|
226 * @param aDeleted ETrue if conversation is being deleted else it is EFalse |
|
227 */ |
|
228 void MarkDeleted(TBool aDeleted); |
|
229 |
|
230 /** |
|
231 * Delete state of this conversation |
|
232 * |
|
233 * @return ETrue if delete is ongoing for this conversation |
|
234 */ |
|
235 TBool IsDeleted() const; |
|
236 |
|
237 private: |
|
238 |
|
239 /** |
|
240 * Constructor |
|
241 */ |
|
242 CCsConversation(); |
|
243 |
|
244 /** |
|
245 * Second phase constructor |
|
246 */ |
|
247 void ConstructL(); |
|
248 |
|
249 private: |
|
250 |
|
251 /** |
|
252 * iEntryList |
|
253 * This is array of actual conversation-entries |
|
254 */ |
|
255 RPointerArray<CCsConversationEntry>* iEntryList; |
|
256 |
|
257 /** |
|
258 * iContact |
|
259 * This is contact details for this conversation |
|
260 * The details shall include name and phonebook contact link |
|
261 */ |
|
262 CCsConversationContact* iContact; |
|
263 |
|
264 /** |
|
265 * iConversationID |
|
266 * Unique entry id for each conversation |
|
267 * This shall be used b/w clent server request |
|
268 */ |
|
269 TCsConversationEntryID iConversationID; |
|
270 |
|
271 /** |
|
272 * iUnreadMessagesCount |
|
273 * Unread message count in the conversation |
|
274 * @attention Range of unread message count is 0 to 65535. |
|
275 */ |
|
276 TUint16 iUnreadMessagesCount; |
|
277 |
|
278 /** |
|
279 * iDeleted |
|
280 * Enabled when delete is started for this conversation. |
|
281 */ |
|
282 TBool iDeleted; |
|
283 }; |
|
284 |
|
285 #endif // __C_CS_CONVERSATION_H |