14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include "conversationsengine.h" |
17 #include "conversationsengine.h" |
18 |
18 |
|
19 #include <ccsconversationentry.h> |
|
20 #include <ccsclientconversation.h> |
|
21 |
19 #include "conversationsenginedefines.h" |
22 #include "conversationsenginedefines.h" |
20 #include "convergedmessage.h" |
23 #include "convergedmessage.h" |
21 #include "conversationmsgstorehandler.h" |
24 #include "conversationmsgstorehandler.h" |
22 #include "conversationssummarymodel.h" |
25 #include "conversationssummarymodel.h" |
23 #include "conversationsmodel.h" |
26 #include "conversationsmodel.h" |
24 #include "draftsmodel.h" |
27 #include "draftsmodel.h" |
25 #include "conversationsengine_p.h" |
28 #include "conversationsengine_p.h" |
26 #include "debugtraces.h" |
29 #include "debugtraces.h" |
27 #include "s60qconversions.h" |
30 #include <xqconversions.h> |
28 |
31 |
29 //--------------------------------------------------------------- |
32 //--------------------------------------------------------------- |
30 // ConversationsEngine::instance |
33 // ConversationsEngine::instance |
31 // @see header |
34 // @see header |
32 //--------------------------------------------------------------- |
35 //--------------------------------------------------------------- |
50 this); |
53 this); |
51 |
54 |
52 d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler, |
55 d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler, |
53 mConversationsSummaryModel, |
56 mConversationsSummaryModel, |
54 mConversationsModel); |
57 mConversationsModel); |
|
58 |
|
59 connect (mConversationsModel, |
|
60 SIGNAL(conversationViewEmpty()), |
|
61 this, |
|
62 SIGNAL(conversationViewEmpty())); |
|
63 |
55 } |
64 } |
56 |
65 |
57 //--------------------------------------------------------------- |
66 //--------------------------------------------------------------- |
58 // ConversationsEngine::~ConversationsEngine |
67 // ConversationsEngine::~ConversationsEngine |
59 // @see header |
68 // @see header |
210 |
219 |
211 if(indexList.count() > 0) |
220 if(indexList.count() > 0) |
212 { |
221 { |
213 displayName = indexList[0].data(DisplayName).toString(); |
222 displayName = indexList[0].data(DisplayName).toString(); |
214 address = indexList[0].data(ConversationAddress).toString(); |
223 address = indexList[0].data(ConversationAddress).toString(); |
215 } |
224 } |
|
225 else |
|
226 { |
|
227 int error; |
|
228 CCsClientConversation* clientConv = NULL; |
|
229 TRAP(error, clientConv = d_ptr->getConversationFromConversationIdL(conversationId)); |
|
230 |
|
231 HBufC *name = clientConv->GetDisplayName(); |
|
232 if (name && name->Length()) |
|
233 { |
|
234 displayName = XQConversions::s60DescToQString(*name); |
|
235 } |
|
236 |
|
237 HBufC *addr = clientConv->GetConversationEntry()->Contact(); |
|
238 if (addr && addr->Length()) |
|
239 { |
|
240 address = XQConversions::s60DescToQString(*addr); |
|
241 } |
|
242 |
|
243 delete clientConv; |
|
244 } |
216 } |
245 } |
217 |
246 |
218 //--------------------------------------------------------------- |
247 //--------------------------------------------------------------- |
219 // ConversationsEngine::getConversationIdFromAddress |
248 // ConversationsEngine::getConversationIdFromAddress |
220 // @see header |
249 // @see header |
222 qint64 ConversationsEngine::getConversationIdFromAddress(QString address) |
251 qint64 ConversationsEngine::getConversationIdFromAddress(QString address) |
223 { |
252 { |
224 qint64 conversationId = -1; |
253 qint64 conversationId = -1; |
225 |
254 |
226 int error; |
255 int error; |
227 HBufC* number = S60QConversions::qStringToS60Desc(address); |
256 HBufC* number = XQConversions::qStringToS60Desc(address); |
228 TRAP(error,conversationId = |
257 TRAP(error,conversationId = |
229 d_ptr->getConversationIdFromAddressL(*number)); |
258 d_ptr->getConversationIdFromAddressL(*number)); |
230 |
259 |
231 delete number; |
260 delete number; |
232 |
261 |
282 { |
311 { |
283 emit conversationListModelPopulated(); |
312 emit conversationListModelPopulated(); |
284 } |
313 } |
285 |
314 |
286 //--------------------------------------------------------------- |
315 //--------------------------------------------------------------- |
|
316 // ConversationsEngine::emitConversationListModelEntryDeleted |
|
317 // @see header |
|
318 //--------------------------------------------------------------- |
|
319 void ConversationsEngine::emitConversationListModelEntryDeleted( int conversationId ) |
|
320 { |
|
321 emit conversationListEntryDeleted( conversationId ); |
|
322 } |
|
323 |
|
324 //--------------------------------------------------------------- |
|
325 // ConversationsEngine::emitOpenConversationViewIdUpdate |
|
326 // @see header |
|
327 //--------------------------------------------------------------- |
|
328 void ConversationsEngine::emitOpenConversationViewIdUpdate( |
|
329 int newConversationId) |
|
330 { |
|
331 //also register for subscription now |
|
332 d_ptr->registerAgainForConversationUpdatesL(newConversationId); |
|
333 } |
|
334 |
|
335 //--------------------------------------------------------------- |
|
336 // ConversationsEngine::disableRegisterationForCVEvents |
|
337 // @see header |
|
338 //--------------------------------------------------------------- |
|
339 void ConversationsEngine::disableRegisterationForCVEvents() |
|
340 { |
|
341 d_ptr->deRegisterCVUpdatesTemporary(); |
|
342 } |
|
343 |
|
344 //--------------------------------------------------------------- |
287 // ConversationsEngine::fetchMoreConversations |
345 // ConversationsEngine::fetchMoreConversations |
288 // @see header |
346 // @see header |
289 //--------------------------------------------------------------- |
347 //--------------------------------------------------------------- |
290 void ConversationsEngine::fetchMoreConversations() |
348 void ConversationsEngine::fetchMoreConversations() |
291 { |
349 { |
333 mConversationMsgStoreHandler->markAsReadAndGetType(messageId, |
391 mConversationMsgStoreHandler->markAsReadAndGetType(messageId, |
334 msgType, |
392 msgType, |
335 msgSubType); |
393 msgSubType); |
336 } |
394 } |
337 |
395 |
|
396 //--------------------------------------------------------------- |
|
397 // ConversationsEngine::getDBHandle() |
|
398 // @see header |
|
399 //--------------------------------------------------------------- |
|
400 RSqlDatabase& ConversationsEngine::getDBHandle(TBool& isOpen) |
|
401 { |
|
402 return mConversationsModel->getDBHandle(isOpen); |
|
403 } |
|
404 |
|
405 |
|
406 //--------------------------------------------------------------- |
|
407 // ConversationsEngine::getMsgSubType() |
|
408 // @see header |
|
409 //--------------------------------------------------------------- |
|
410 int ConversationsEngine::getMsgSubType(int messageId) |
|
411 { |
|
412 return mConversationMsgStoreHandler->getMsgSubType(messageId); |
|
413 } |
338 |
414 |
339 |
415 |
340 //EOF |
416 //EOF |
341 |
417 |