|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef T_CONVERSATIONENGINESTUB_H_ |
|
19 #define T_CONVERSATIONENGINESTUB_H_ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32def.h> |
|
23 #include <e32std.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MCsResultsObserver; |
|
27 class TestConversationNotifier; |
|
28 class CCsConversationEntry; |
|
29 class MCsConversationChangeObserver; |
|
30 class MCsConversationListChangeObserver; |
|
31 class CCsClientConversation; |
|
32 |
|
33 |
|
34 class TestConversationEngineStub { |
|
35 |
|
36 public: |
|
37 /** |
|
38 * Returns pointer to sole instance. |
|
39 * @return TestConversationEngineStub object |
|
40 */ |
|
41 static TestConversationEngineStub* Instance(); |
|
42 |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 ~TestConversationEngineStub(); |
|
47 |
|
48 public: //stub client related functions for |
|
49 //handling requests and commands from appengine |
|
50 |
|
51 /** |
|
52 * Set result observer |
|
53 */ |
|
54 void SetResultObserver(MCsResultsObserver *aResultObserver); |
|
55 |
|
56 |
|
57 /** |
|
58 * Remove result observer |
|
59 */ |
|
60 void RemoveResultObserver(); |
|
61 |
|
62 /** |
|
63 * Set conversation change observer |
|
64 */ |
|
65 void SetConversationChangeObserver(MCsConversationChangeObserver* aObserver, |
|
66 CCsClientConversation* aClientConversation); |
|
67 |
|
68 /** |
|
69 * Remove conversation change observer |
|
70 */ |
|
71 void RemoveConversationChangeObserver(); |
|
72 |
|
73 /** |
|
74 * Set conversation list change observer |
|
75 */ |
|
76 void SetConversationListChangeObserver(MCsConversationListChangeObserver* |
|
77 aConversationListChangeObserver); |
|
78 |
|
79 /** |
|
80 * Remove conversation list change observer |
|
81 */ |
|
82 void RemoveConversationListChangeObserver(); |
|
83 |
|
84 /** |
|
85 * Mark conversation as read associated with conversation id |
|
86 */ |
|
87 void MarkConversationRead(const TInt aConversationId); |
|
88 |
|
89 /** |
|
90 * Delete conversation associated with conversation id |
|
91 */ |
|
92 void DeleteConversation(const TInt aConversationId); |
|
93 |
|
94 /** |
|
95 * Get the client conversation id associated with contact id |
|
96 */ |
|
97 TInt GetClientConversationID(const TInt aContactId); |
|
98 |
|
99 /** |
|
100 * Get the client conversation id associated with contact address |
|
101 */ |
|
102 TInt GetClientConversationID(const TDesC& aContactAddress); |
|
103 |
|
104 public: //stub notifications to appengine |
|
105 |
|
106 //Conversation list notification |
|
107 void UpdateConversationList(); |
|
108 |
|
109 //Update modified Conversation entry |
|
110 //to conversation change handler |
|
111 void UpdateConvEntry(TInt aConversationId); |
|
112 |
|
113 //Update new added conversation entry |
|
114 //to conversation change handler |
|
115 void UpdateAddConvEntry(); |
|
116 |
|
117 //Update deleted conversation entry |
|
118 //to conversation change handler |
|
119 void UpdateDeletedConvEntry(); |
|
120 |
|
121 //conversation client list notification |
|
122 void UpdateConversationClientList(); |
|
123 |
|
124 //Update new added conversation client |
|
125 //to conversation list change handler |
|
126 void UpdateAddConvClient(); |
|
127 |
|
128 //Update deleted conversation client |
|
129 //to conversation list change handler |
|
130 void UpdateDeletedConvClient(); |
|
131 |
|
132 //Update modified conversation client |
|
133 //to conversation list change handler |
|
134 void UpdateConvClient(TInt aConversationId); |
|
135 |
|
136 public: //test conversation engine validation functions |
|
137 |
|
138 //Get the conversation list size |
|
139 TInt GetConvListSize(); |
|
140 |
|
141 //Get the unread message count |
|
142 TInt GetUnreadCount(); |
|
143 |
|
144 //Get the current conversation id |
|
145 TInt GetConversationID(); |
|
146 |
|
147 //Get the message time stamp |
|
148 TInt GetTimeStamp(); |
|
149 |
|
150 //Get the message type |
|
151 TInt GetMsgType(); |
|
152 |
|
153 //Get the contact id |
|
154 TDesC& GetContactID(); |
|
155 |
|
156 //Get the message description |
|
157 TDesC& GetDescription(); |
|
158 |
|
159 //Get the conversation client list |
|
160 RPointerArray<CCsClientConversation>& GetConversationClientList(); |
|
161 |
|
162 private: |
|
163 |
|
164 /** |
|
165 * Constructor |
|
166 */ |
|
167 TestConversationEngineStub(); |
|
168 |
|
169 /** |
|
170 * Initializes the stub data |
|
171 */ |
|
172 void InitL(); |
|
173 |
|
174 /** |
|
175 * Create conversation entry |
|
176 */ |
|
177 CCsConversationEntry* CreateConversationEntryL(TInt aConvID, bool aUnread); |
|
178 |
|
179 /** |
|
180 * Prepare conversation list |
|
181 */ |
|
182 void PrepareConversationListL(TInt aConvID, TInt aToatalCnt, TInt aUnreadCnt); |
|
183 |
|
184 /** |
|
185 * Create conversation client |
|
186 */ |
|
187 CCsClientConversation* |
|
188 CreateConversationClientL(const HBufC* aDispName, TInt aContactID, |
|
189 TInt aUnreadCnt, |
|
190 CCsConversationEntry& aConvEntry); |
|
191 |
|
192 /** |
|
193 * Prepare conversation client list |
|
194 */ |
|
195 void PrepareConversationClientListL(TInt aContactID, TInt aListSize, |
|
196 TInt aUnRead, TInt aUnReadCnt); |
|
197 |
|
198 /** |
|
199 * Update added conversation entry |
|
200 */ |
|
201 void UpdateAddConvEntryL(); |
|
202 |
|
203 /** |
|
204 * Update added conversation client |
|
205 */ |
|
206 void UpdateAddConvClientL(); |
|
207 |
|
208 private://Data |
|
209 TestConversationNotifier* iNotifier; |
|
210 |
|
211 //Test Conversation Stub Data |
|
212 TInt iConversationID; |
|
213 TInt iTimeStamp; |
|
214 TInt iMsgType; |
|
215 TInt iUnReadCount; |
|
216 TBufC<12> iContactID; |
|
217 TBufC<30> iDescription; |
|
218 CCsConversationEntry* iDeletedEntry; |
|
219 RPointerArray<CCsConversationEntry> iConversationEntryList; |
|
220 //Test Conversationclient Stub Data |
|
221 RPointerArray<CCsClientConversation> iConversationClientList; |
|
222 }; |
|
223 |
|
224 #endif /* T_CONVERSATIONENGINESTUB_H_ */ |