|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation for PC Group Interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCAGROUPPC_H |
|
20 #define CCAGROUPPC_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include "mcagrouppc.h" |
|
25 #include "MCAChatObserver.h" |
|
26 #include "MCAGroupEventObserver.h" |
|
27 #include "MCAMessageErrorObserver.h" |
|
28 #include "MCAMessageRWInterfacePC.h" |
|
29 |
|
30 #include <impsgroupprops.h> |
|
31 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CCAEngine; |
|
35 class MCAGroupObserverPC; |
|
36 class MCAMessagesReadInterface; |
|
37 class MCAMessagesWriteInterface; |
|
38 class MCAChatInterface; |
|
39 class MCAStoredGroups; |
|
40 class MCAStoredGroup; |
|
41 class MCAGroupEventObserverPC; |
|
42 class MCAGroupManagerInterface; |
|
43 class MCAGroupOperations; |
|
44 class MCAStoredContacts; |
|
45 class MCAServerContactsArrayPC; |
|
46 class MCAMessageUtils; |
|
47 |
|
48 |
|
49 //class declaration |
|
50 /** |
|
51 * Implementation class for Group Interface for the UI. |
|
52 * @lib wvuiprocessng.lib |
|
53 * @since 3.2 |
|
54 */ |
|
55 class CCAGroupPC: public CBase, |
|
56 public MCAGroupPC, |
|
57 public MCAChatObserver, |
|
58 public MCAGroupEventObserver, |
|
59 public MCAMessageErrorObserver, |
|
60 public MCAMessageRWInterfacePC |
|
61 |
|
62 { |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * Symbian Two Phase Constructor |
|
68 * @param aGroupInterface : a pointer to group interface |
|
69 * @param aChatInterface : a reference to chat interface |
|
70 * @param aMessageUtils : a reference to Message Utils |
|
71 */ |
|
72 static CCAGroupPC* NewL( MCAGroupManagerInterface* aGroupInterface, |
|
73 MCAChatInterface& aChatInterface, |
|
74 const MCAMessageUtils& aMessageUtils ); |
|
75 |
|
76 |
|
77 /** |
|
78 * Second phased symbian constructor. |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 /** |
|
83 * virtual destructor |
|
84 */ |
|
85 virtual ~CCAGroupPC(); |
|
86 |
|
87 private: |
|
88 |
|
89 /** |
|
90 * default constructor |
|
91 * @param aGroupInterface : a pointer to group interface |
|
92 * @param aChatInterface : a reference to chat interface |
|
93 * @param aMessageUtils : a reference to Message Utils |
|
94 */ |
|
95 |
|
96 CCAGroupPC( MCAGroupManagerInterface* aGroupInterface, |
|
97 MCAChatInterface& aChatInterface, |
|
98 const MCAMessageUtils& aMessageUtils ); |
|
99 |
|
100 public: //From MCAGroupPC |
|
101 |
|
102 /** |
|
103 * Set the current group |
|
104 * @param aGroupId groupid of the active group in the local list. |
|
105 */ |
|
106 void SetActiveGroupChatL( const TDesC& aGroupId ); |
|
107 |
|
108 /** |
|
109 * To register the UI component as an observer |
|
110 * to listen to the chat/message error related events |
|
111 * @param aGroupObserverPC - Ptr to the group pc observer to be added |
|
112 */ |
|
113 void RegisterGroupObserver( MCAGroupObserverPC* aGroupObserverPC ); |
|
114 |
|
115 /** |
|
116 * To unregister the observer |
|
117 */ |
|
118 void UnRegisterGroupObserver(); |
|
119 |
|
120 |
|
121 /** |
|
122 * Set an observer for events of individual group (join, leave, etc.) |
|
123 * @param aGroupEventObserverPC The observer to be added |
|
124 * @param aGroupId The group id for which group events to be received |
|
125 */ |
|
126 void SetGroupEventObserverL( MCAGroupEventObserverPC* aGroupEventObserverPC, |
|
127 const TDesC& aGroupId ); |
|
128 |
|
129 |
|
130 /** |
|
131 * Part of container identifier which contains this message |
|
132 * @return Identifier to identify container which contains this message |
|
133 */ |
|
134 const TDesC& ActiveGroupId(); |
|
135 |
|
136 /** |
|
137 * Part of identification of container |
|
138 * @return Screen name of container owner. |
|
139 */ |
|
140 const TDesC& ScreenName() const; |
|
141 |
|
142 |
|
143 /** |
|
144 * InitialiseResourcesL - intialise iGroupId |
|
145 * and some other members like read/write interface |
|
146 * @param aGroupId - the current groupid |
|
147 */ |
|
148 void InitialiseResourcesL( const TDesC& aGroupId ); |
|
149 |
|
150 /** |
|
151 * Tests whether the logging is on or not. |
|
152 * @return ETrue if on EFalse if not. |
|
153 */ |
|
154 TBool IsLoggingOn() const ; |
|
155 |
|
156 /** |
|
157 * Release all resources that was initialised |
|
158 */ |
|
159 void ReleaseResources() ; |
|
160 |
|
161 |
|
162 /** |
|
163 * Gets the properties of group |
|
164 * @param aIsGroupProps return ETrue if |
|
165 * Common group properties are defined |
|
166 */ |
|
167 TInt GetPropertiesL( TBool& aIsGroupProps ); |
|
168 |
|
169 /** |
|
170 * Name of the group |
|
171 * @return name of the group |
|
172 */ |
|
173 TPtrC GroupName() const; |
|
174 |
|
175 /** |
|
176 * Is private messages allowed |
|
177 * @return EImpsPropYes if allowed |
|
178 */ |
|
179 TEnumsPC::TImpsPropertyBoolPC IsPrivateAllowed(); |
|
180 |
|
181 |
|
182 /** |
|
183 * Is group open or closed |
|
184 * @return EImpsPropYes if open |
|
185 */ |
|
186 TEnumsPC::TImpsPropertyBoolPC IsOpen(); |
|
187 |
|
188 /** |
|
189 * @see MCAGroupPC |
|
190 */ |
|
191 void EndLoggingL() ; |
|
192 |
|
193 |
|
194 /** |
|
195 * @see MCAGroupPC |
|
196 */ |
|
197 void SaveChatL( const TDesC& aLogFilename ); |
|
198 |
|
199 /** |
|
200 * @see MCAGroupPC |
|
201 */ |
|
202 TInt GroupCount( TBool aOnlyVisible ) const ; |
|
203 |
|
204 |
|
205 /** |
|
206 * @see MCAGroupPC |
|
207 */ |
|
208 TInt ContactCount( |
|
209 TBool aSkipOfflineContacts = EFalse ) const ; |
|
210 |
|
211 |
|
212 |
|
213 /** |
|
214 * @see MCAGroupPC |
|
215 */ |
|
216 void SendMessageL( const TDesC& aMessageBuffer, |
|
217 CDesCArrayFlat& aRecipients ) ; |
|
218 |
|
219 /** |
|
220 * @see MCAGroupPC |
|
221 */ |
|
222 |
|
223 MCAServerContactsArrayPC* GetGroupPairArrayLC(); |
|
224 |
|
225 /** |
|
226 * @see MCAGroupPC |
|
227 */ |
|
228 TBool IsActiveGroupChat( const TDesC& aGroupId ); |
|
229 |
|
230 |
|
231 /** |
|
232 * @see MCAGroupPC |
|
233 */ |
|
234 TInt MessageCount(); |
|
235 |
|
236 public: |
|
237 |
|
238 /** |
|
239 * To convert the impsengine side TImpsPropertyBool enum to PC side TImpsPropertyBoolPC |
|
240 * @param aEventSource: enum type in impsengine TImpsPropertyBool |
|
241 * @return TEnumsPC::TImpsPropertyBoolPC |
|
242 */ |
|
243 TEnumsPC::TImpsPropertyBoolPC ConvertTImpsPropertyBoolToTEnumsPC |
|
244 ( TImpsPropertyBool aEventSource ); |
|
245 |
|
246 |
|
247 |
|
248 public: //From MCAMessageRWInterfacePC |
|
249 /** |
|
250 * @see MCAMessageRWInterfacePC |
|
251 */ |
|
252 MCAMessagesReadInterface& ReadInterfaceL() const; |
|
253 |
|
254 /** |
|
255 * @see MCAMessageRWInterfacePC |
|
256 */ |
|
257 MCAMessagesWriteInterface& WriteInterfaceL() const; |
|
258 |
|
259 private: //From MCAGroupEventObserver |
|
260 |
|
261 /** |
|
262 * @see MCAGroupEventObserver |
|
263 */ |
|
264 void HandleGroupPropertiesChanged() ; |
|
265 |
|
266 /** |
|
267 * @see MCAGroupEventObserver |
|
268 */ |
|
269 void HandleGroupLeft( TInt aReason ) ; |
|
270 |
|
271 |
|
272 private: //From MCAChatObserver |
|
273 |
|
274 /** |
|
275 * Handle chat events. |
|
276 * @param aEvent Event to handle. |
|
277 * @param aMessage, Event occurred because of message |
|
278 */ |
|
279 void HandleChatEvent( TChatEventType aEvent, |
|
280 MCAMessage* aMessage = NULL ) ; |
|
281 |
|
282 private: //From MCAMessageErrorObserver |
|
283 |
|
284 /** |
|
285 * Handle message error related events. |
|
286 * @param aMessage, Event occurred because of message |
|
287 */ |
|
288 void HandleMessageError( TInt aError, MCAMessage* aMessage ) ; |
|
289 |
|
290 private: |
|
291 |
|
292 //Doesn't own. Group interface |
|
293 MCAGroupManagerInterface* iGroupInterface; |
|
294 |
|
295 //Chat interface,doesn't own |
|
296 MCAChatInterface& iChatInterface; |
|
297 |
|
298 //Ref to MessageUtils on engine side,Doesn't own |
|
299 const MCAMessageUtils& iMessageUtils; |
|
300 |
|
301 |
|
302 //Doesn't own, pointer to PC group observer |
|
303 MCAGroupObserverPC* iGroupObserverPC; |
|
304 |
|
305 //Doesn't own, pointer to PC group event observer |
|
306 MCAGroupEventObserverPC* iGroupEventObserverPC; |
|
307 |
|
308 |
|
309 //Doesnt own,Handle to stored groups interface |
|
310 MCAStoredGroups* iStoredGroups; |
|
311 |
|
312 |
|
313 // Interface for reading messages |
|
314 MCAMessagesReadInterface* iReadInterface; |
|
315 |
|
316 // Interface for writing messages |
|
317 MCAMessagesWriteInterface* iWriteInterface; |
|
318 |
|
319 //Owns. Current Group id |
|
320 HBufC* iGroupId; |
|
321 |
|
322 // Doesn't own. Pointer to this stored chat-group's |
|
323 // data in engine |
|
324 MCAStoredGroup* iStoredGroup; |
|
325 |
|
326 // Doesn't own. Pointer to group operations |
|
327 MCAGroupOperations* iGrOps; |
|
328 |
|
329 //common group properties |
|
330 CImpsCommonGroupProps* iGroupProps; |
|
331 |
|
332 //private group props |
|
333 CImpsPrivateGroupProps* iPrivateProps; |
|
334 |
|
335 //Doesnt own, Handle to Interface for stored contacts |
|
336 MCAStoredContacts* iStoredContacts; |
|
337 |
|
338 }; |
|
339 |
|
340 #endif // CCAGROUPPC_H |
|
341 |
|
342 // End of File |