|
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 * GetEntryListL |
|
118 * This function shall return all the entries this conversation holds |
|
119 * |
|
120 * @param aConversationEntryList, list of conversation entries |
|
121 * @param aStartIndex, start index for conversation entries. |
|
122 * @param aEndIndex, end index for conversation entries. |
|
123 */ |
|
124 void GetEntryListL( |
|
125 RPointerArray<CCsConversationEntry>* aConversationEntryList, |
|
126 TInt aStartIndex, |
|
127 TInt aEndIndex); |
|
128 |
|
129 /** |
|
130 * GetEntryL |
|
131 * This function returns the conversation entry at a specified index. |
|
132 * |
|
133 * @param aIndex, entry list index |
|
134 */ |
|
135 CCsConversationEntry* GetEntryL(TInt aIndex); |
|
136 |
|
137 /** |
|
138 * AddEntryL |
|
139 * Adds an entry to this conversation |
|
140 * |
|
141 * @param aCsConversationEntry Entry to be added |
|
142 */ |
|
143 void AddEntryL(CCsConversationEntry* aCsConversationEntry); |
|
144 |
|
145 /** |
|
146 * AddContactDetailsL |
|
147 * Adds contact details for the conversation |
|
148 * |
|
149 * @param aContactId Contact id |
|
150 * @param aFirstName first name |
|
151 * @param aLastName last name |
|
152 */ |
|
153 void AddContactDetailsL( |
|
154 TInt32 aContactId, |
|
155 const HBufC* aDisplayName); |
|
156 |
|
157 /** |
|
158 * AddContactDetailsL |
|
159 * Over loaded method |
|
160 * Add contact Number for the conversation |
|
161 * |
|
162 * @param aContactNumber Contact number |
|
163 */ |
|
164 void AddContactDetailsL(TDesC& aContactNumber); |
|
165 |
|
166 /** |
|
167 * UpdateEntryL |
|
168 * Update the details of an conversation entry |
|
169 * and set event as new/update |
|
170 * |
|
171 * @param aCsConversationEntry Conversation entry |
|
172 * @param aEvent event set to new/update |
|
173 */ |
|
174 void UpdateEntryL(CCsConversationEntry* aCsConversationEntry, |
|
175 TUint32& aEvent); |
|
176 |
|
177 /** |
|
178 * DeleteEntryL |
|
179 * Deletes the conversation entry |
|
180 * |
|
181 * @param aindexDeletion index of the entry to be deleted |
|
182 */ |
|
183 void DeleteEntryL(TInt aindexDeletion); |
|
184 |
|
185 /** |
|
186 * |
|
187 * FindEntry |
|
188 * Finds the conversation entry in the conversation |
|
189 * |
|
190 * @param aCsConversationEntry entry to be found |
|
191 * @return index of the entry if found else KErrNotFound |
|
192 */ |
|
193 TInt FindEntry(CCsConversationEntry* aCsConversationEntry); |
|
194 |
|
195 /** |
|
196 * |
|
197 * FindUnreadEntry |
|
198 * Finds the unread conversation entry in the conversation |
|
199 * |
|
200 * @return index of the entry if found else KErrNotFound |
|
201 */ |
|
202 TInt FindUnreadEntry() const; |
|
203 |
|
204 /** |
|
205 * GetEntryCount |
|
206 * Return the number of Conversation Entries in the Conversation |
|
207 * |
|
208 * @return Count of Entries for this conversation |
|
209 */ |
|
210 TInt GetEntryCount(); |
|
211 |
|
212 /** |
|
213 * GetUnreadMessageCount |
|
214 * Returns the number of Unread Conversation Entries in the Conversation |
|
215 * |
|
216 * @return the count of unread messsages |
|
217 */ |
|
218 TUint16 GetUnreadMessageCount() const; |
|
219 |
|
220 /** |
|
221 * GetContact |
|
222 * Returns the contact details of this conversation |
|
223 * |
|
224 * @return Conversation Contact Object |
|
225 */ |
|
226 CCsConversationContact* GetContact() const; |
|
227 |
|
228 /** |
|
229 * IsSpecialConversation |
|
230 * Returns whether the conversation is special conversation, |
|
231 * may it be Drafts/Bluetooth/IrDa |
|
232 * |
|
233 * @return TBool ETrue if special conversation else EFalse |
|
234 */ |
|
235 TBool IsSpecialConversation(); |
|
236 |
|
237 /** |
|
238 * Mark deleted |
|
239 * @param aDeleted ETrue if conversation is being deleted else it is EFalse |
|
240 */ |
|
241 void MarkDeleted(TBool aDeleted); |
|
242 |
|
243 /** |
|
244 * Delete state of this conversation |
|
245 * |
|
246 * @return ETrue if delete is ongoing for this conversation |
|
247 */ |
|
248 TBool IsDeleted() const; |
|
249 |
|
250 private: |
|
251 |
|
252 /** |
|
253 * Constructor |
|
254 */ |
|
255 CCsConversation(); |
|
256 |
|
257 /** |
|
258 * Second phase constructor |
|
259 */ |
|
260 void ConstructL(); |
|
261 |
|
262 private: |
|
263 |
|
264 /** |
|
265 * iEntryList |
|
266 * This is array of actual conversation-entries |
|
267 */ |
|
268 RPointerArray<CCsConversationEntry>* iEntryList; |
|
269 |
|
270 /** |
|
271 * iContact |
|
272 * This is contact details for this conversation |
|
273 * The details shall include name and phonebook contact link |
|
274 */ |
|
275 CCsConversationContact* iContact; |
|
276 |
|
277 /** |
|
278 * iConversationID |
|
279 * Unique entry id for each conversation |
|
280 * This shall be used b/w clent server request |
|
281 */ |
|
282 TCsConversationEntryID iConversationID; |
|
283 |
|
284 /** |
|
285 * iUnreadMessagesCount |
|
286 * Unread message count in the conversation |
|
287 * @attention Range of unread message count is 0 to 65535. |
|
288 */ |
|
289 TUint16 iUnreadMessagesCount; |
|
290 |
|
291 /** |
|
292 * iDeleted |
|
293 * Enabled when delete is started for this conversation. |
|
294 */ |
|
295 TBool iDeleted; |
|
296 }; |
|
297 |
|
298 #endif // __C_CS_CONVERSATION_H |