equal
deleted
inserted
replaced
20 #include <hbglobal.h> |
20 #include <hbglobal.h> |
21 #include <hbicon.h> |
21 #include <hbicon.h> |
22 #include <hbframebackground.h> |
22 #include <hbframebackground.h> |
23 |
23 |
24 #include "cnthistorymodel_p.h" |
24 #include "cnthistorymodel_p.h" |
|
25 #include "cntdebug.h" |
25 |
26 |
26 |
27 |
27 // Unnamed namespace for helper functions |
28 // Unnamed namespace for helper functions |
28 namespace |
29 namespace |
29 { |
30 { |
33 } |
34 } |
34 |
35 |
35 bool lessThan(const HItemPointer& t1, const HItemPointer& t2) |
36 bool lessThan(const HItemPointer& t1, const HItemPointer& t2) |
36 { |
37 { |
37 return ((*t1).timeStamp < (*t2).timeStamp); |
38 return ((*t1).timeStamp < (*t2).timeStamp); |
|
39 } |
|
40 |
|
41 #ifdef TRACES |
|
42 #define LOG_ITEM(i) logItem(i) |
|
43 #else |
|
44 #define LOG_ITEM(i) |
|
45 #endif |
|
46 |
|
47 void logItem(const HistoryItem& item) |
|
48 { |
|
49 QStringList l; |
|
50 |
|
51 l << item.message << item.number << item.timeStamp.toString() << item.title; |
|
52 l << (item.flags & CntIncoming ? "incoming" : "outgoing"); |
|
53 l << (item.flags & CntUnseen ? "unseen" : "seen"); |
|
54 l << (item.flags & CntAttachment ? "attachment" : ""); |
|
55 l << (item.flags & CntCallLog ? "call" : "message"); |
|
56 if (item.flags & CntReceivedCall) |
|
57 l << "recieved"; |
|
58 else if (item.flags & CntMissedCall) |
|
59 l << "missed"; |
|
60 else if (item.flags & CntDialledCall) |
|
61 l << "dialled"; |
|
62 |
|
63 l.removeAll(""); |
|
64 |
|
65 qDebug() << l; |
38 } |
66 } |
39 } |
67 } |
40 |
68 |
41 Q_DECLARE_METATYPE(LogsEvent *) |
69 Q_DECLARE_METATYPE(LogsEvent *) |
42 |
70 |
380 bodyText = hbTrId("txt_phob_list_missed_call"); |
408 bodyText = hbTrId("txt_phob_list_missed_call"); |
381 item.flags |= CntMissedCall; |
409 item.flags |= CntMissedCall; |
382 } |
410 } |
383 } |
411 } |
384 |
412 |
385 if ( event->direction() == LogsEvent::DirOut ) |
413 if ( event->direction() == LogsEvent::DirMissed |
386 item.flags |= CntOutgoing; |
414 || event->direction() == LogsEvent::DirIn ) { |
387 else |
|
388 item.flags |= CntIncoming; |
415 item.flags |= CntIncoming; |
|
416 } else { |
|
417 item.flags &= ~CntIncoming; |
|
418 } |
389 |
419 |
390 item.message = bodyText; |
420 item.message = bodyText; |
391 item.title = title; |
421 item.title = title; |
392 item.timeStamp = event->time().toLocalTime(); |
422 item.timeStamp = event->time().toLocalTime(); |
393 item.flags |= CntCallLog; |
423 item.flags |= CntCallLog; |
394 item.number = QString(event->number()); |
424 item.number = QString(event->number()); |
|
425 |
|
426 LOG_ITEM(item); |
395 } |
427 } |
396 |
428 |
397 /*! |
429 /*! |
398 * Slot used for receiving new rows from the LogsModel. |
430 * Slot used for receiving new rows from the LogsModel. |
399 * |
431 * |
602 if ( event.isAttributeSet(MsgItem::MsgAttributeUnread) ) |
634 if ( event.isAttributeSet(MsgItem::MsgAttributeUnread) ) |
603 item.flags |= CntUnseen; |
635 item.flags |= CntUnseen; |
604 else |
636 else |
605 item.flags &= ~CntUnseen; |
637 item.flags &= ~CntUnseen; |
606 } else if ( event.direction() == MsgItem::MsgDirectionOutgoing ) |
638 } else if ( event.direction() == MsgItem::MsgDirectionOutgoing ) |
607 item.flags |= CntOutgoing; |
639 item.flags &= ~CntIncoming; |
608 |
640 |
609 // Attachment |
641 // Attachment |
610 if (event.isAttributeSet(MsgItem::MsgAttributeAttachment)) |
642 if (event.isAttributeSet(MsgItem::MsgAttributeAttachment)) |
611 item.flags |= CntAttachment; |
643 item.flags |= CntAttachment; |
612 |
644 |
621 { |
653 { |
622 item.message = event.body(); |
654 item.message = event.body(); |
623 } |
655 } |
624 |
656 |
625 item.timeStamp = event.timeStamp().toLocalTime(); |
657 item.timeStamp = event.timeStamp().toLocalTime(); |
|
658 |
|
659 LOG_ITEM(item); |
626 } |
660 } |
627 |
661 |
628 /*! |
662 /*! |
629 * Slot to receive new messages for the first time |
663 * Slot to receive new messages for the first time |
630 * from the messages model |
664 * from the messages model |