|
1 /* |
|
2 * Copyright (c) 2008 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CONVERSATIONS_CHANGEHANDLER_H |
|
19 #define CONVERSATIONS_CHANGEHANDLER_H |
|
20 |
|
21 //SYSTEM INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 #include <badesca.h> |
|
25 #include <mcsconversationchangeobserver.h> |
|
26 |
|
27 // USER INCLUDE |
|
28 |
|
29 //FORWARD DECLARATIONS |
|
30 class ConversationsModel; |
|
31 class ConversationsEnginePrivate; |
|
32 |
|
33 /** |
|
34 * Handles the change events (add/modify/delete) related to conversations |
|
35 * form the server |
|
36 * |
|
37 * @code |
|
38 * @endcode |
|
39 * |
|
40 * @since S60 v10.1 |
|
41 */ |
|
42 class ConversationsChangeHandler : public CActive, |
|
43 public MCsConversationChangeObserver |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Default constructor. |
|
49 */ |
|
50 explicit ConversationsChangeHandler( |
|
51 ConversationsEnginePrivate* convEnginePrivate, |
|
52 ConversationsModel* conversationsModel); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~ConversationsChangeHandler(); |
|
58 |
|
59 /** |
|
60 * Starts fetching remaining conversations |
|
61 */ |
|
62 void restartHandleConversations(); |
|
63 |
|
64 public:// CActive |
|
65 |
|
66 /** |
|
67 * RunL. |
|
68 */ |
|
69 void RunL(); |
|
70 |
|
71 /** |
|
72 * DoCancel |
|
73 */ |
|
74 void DoCancel(); |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Conversations |
|
80 * This is for handling GetConversation results asynchronusly |
|
81 * from the server. |
|
82 * |
|
83 * @param aConversationEntryList List of conversation entries |
|
84 * returned by server. |
|
85 */ |
|
86 |
|
87 void ConversationsL( |
|
88 RPointerArray<CCsConversationEntry>& aConversationEntryList); |
|
89 |
|
90 public://MCsConversationChangeObserver |
|
91 /** |
|
92 * AddConversation |
|
93 * This is for handling addition of new conversation entry in |
|
94 * conversation view asynchronusly from the server. |
|
95 * |
|
96 * @param aConversationEntry Conversation Entry |
|
97 */ |
|
98 void AddConversation(const CCsConversationEntry& aConversationEntry); |
|
99 |
|
100 /** |
|
101 * ModifyConversation |
|
102 * This is for handling modification of existing |
|
103 * conversation entry in conversation view |
|
104 * asynchronusly from the server. |
|
105 * |
|
106 * @param aConversationEntry Conversation Entry |
|
107 */ |
|
108 void ModifyConversation(const CCsConversationEntry& aConversationEntry); |
|
109 |
|
110 /** |
|
111 * DeleteConversation |
|
112 * This is for handling deletion of existing |
|
113 * conversation entry from conversation view |
|
114 * asynchronusly from the server. |
|
115 * |
|
116 * @param aConversationEntry Conversation Entry |
|
117 */ |
|
118 void DeleteConversation(const CCsConversationEntry& aConversationEntry); |
|
119 |
|
120 /** |
|
121 * RefreshConversation |
|
122 * This is for handling refresh asynchronusly from the server. |
|
123 */ |
|
124 void RefreshConversation(); |
|
125 |
|
126 private: |
|
127 |
|
128 /** |
|
129 * Make the active object alive |
|
130 */ |
|
131 void IssueRequest(); |
|
132 |
|
133 /** |
|
134 * Handles Conversations received from server and updates into model |
|
135 */ |
|
136 void HandleConversationsL(); |
|
137 |
|
138 private: |
|
139 // Data |
|
140 |
|
141 /** |
|
142 * ConversationsChangeHandler Internal States |
|
143 */ |
|
144 enum ConvChangeHandlerStates |
|
145 { |
|
146 EInit = 500, |
|
147 EInitialCache, |
|
148 EListenToEvents |
|
149 }; |
|
150 |
|
151 /** |
|
152 * mCurrentState |
|
153 * Holds Current state |
|
154 */ |
|
155 ConvChangeHandlerStates mCurrentState; |
|
156 |
|
157 /** |
|
158 * First list of conversations updated |
|
159 * Own. |
|
160 */ |
|
161 TBool mFirstWindowCached; |
|
162 |
|
163 /** |
|
164 * Current entry being processed |
|
165 * Own. |
|
166 */ |
|
167 TInt mCurrentIndex; |
|
168 |
|
169 /** |
|
170 * ConversationsModel Object |
|
171 * Not Own. |
|
172 */ |
|
173 ConversationsModel* mConversationsModel; |
|
174 |
|
175 /** |
|
176 * ConversationsEnginePrivate object |
|
177 * Not Own. |
|
178 */ |
|
179 ConversationsEnginePrivate* mConvEnginePrivate; |
|
180 |
|
181 /** |
|
182 * List of CCsConversationEntry entries |
|
183 * Own. |
|
184 */ |
|
185 RPointerArray<CCsConversationEntry> mConversationEntryList; |
|
186 }; |
|
187 |
|
188 #endif // CONVERSATIONS_CHANGEHANDLER_H |