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