phonebookui/cnthistorymodel/inc/cnthistorymodel_p.h
changeset 31 2a11b5b00470
parent 27 de1630741fbe
child 40 b46a585f6909
equal deleted inserted replaced
27:de1630741fbe 31:2a11b5b00470
    22 #include <QSharedPointer>
    22 #include <QSharedPointer>
    23 #include <QMap>
    23 #include <QMap>
    24 #include <QDateTime>
    24 #include <QDateTime>
    25 #include <qcontactmanager.h>
    25 #include <qcontactmanager.h>
    26 
    26 
    27 QTM_USE_NAMESPACE
    27 #ifdef PBK_UNIT_TEST
    28 
    28 #include "stub_classes.h"
       
    29 #else
    29 #include <logsevent.h>
    30 #include <logsevent.h>
    30 #include <logsmodel.h>
    31 #include <logsmodel.h>
    31 #include <logscustomfilter.h>
    32 #include <logscustomfilter.h>
       
    33 #endif
    32 #include <msghistory.h>
    34 #include <msghistory.h>
       
    35 #include <msgitem.h>
    33 
    36 
    34 class HistoryItem 
    37 QTM_USE_NAMESPACE
       
    38 
       
    39 // Constants
       
    40 #define MISSED_CALL_ICON "qtg_small_missed_call"
       
    41 #define DAILED_CALL_ICON "qtg_small_sent"
       
    42 #define RECEIVED_CALL_ICON "qtg_small_received"
       
    43 #define MESSAGE_ICON "qtg_small_message"
       
    44 const QString DATE_FORMAT("dd/MM");     // Date format.
       
    45 const QString TIME_FORMAT("hh:mm");     // Time format.
       
    46 
       
    47 class HistoryItem
    35 {   
    48 {   
    36 public:   
    49 public:   
    37     HistoryItem() :
    50     HistoryItem() : flags(0)
    38         seenStatus(4)
       
    39     {};
    51     {};
    40     
    52     
    41     inline const HistoryItem& operator=(const HistoryItem& other)
    53     inline const HistoryItem& operator=(const HistoryItem& other)
    42     {
    54     {
    43         direction = other.direction;
    55         flags = other.flags;
    44         seenStatus = other.seenStatus;
       
    45         msgType = other.msgType;
       
    46         number = other.number;
    56         number = other.number;
    47         iconPath = other.iconPath;
       
    48         title = other.title;
    57         title = other.title;
    49         message = other.message;
    58         message = other.message;
    50         timeStamp = other.timeStamp;
    59         timeStamp = other.timeStamp;
    51         return *this;
    60         return *this;
    52     }
    61     }
    55     {
    64     {
    56          return timeStamp == other.timeStamp;
    65          return timeStamp == other.timeStamp;
    57     }
    66     }
    58     
    67     
    59 public:
    68 public:
    60     int direction; // 0 - incoming, 1 - outgoing, 2 - missed
    69     int flags;
    61     int seenStatus;    // 3 = unseen, 4 = seen
    70     QString number;
    62     int msgType;    // 5 = call log, 6 = message
       
    63     QString number; 
       
    64     QString iconPath;
       
    65     QString title;
    71     QString title;
    66     QString message;
    72     QString message;
    67     QDateTime timeStamp;
    73     QDateTime timeStamp;
    68 };
    74 };
    69 
    75 
    78           m_logsFilter(NULL),
    84           m_logsFilter(NULL),
    79           m_AbstractLogsModel(NULL),
    85           m_AbstractLogsModel(NULL),
    80           m_msgHistory(NULL),
    86           m_msgHistory(NULL),
    81           m_contactId(contactId),
    87           m_contactId(contactId),
    82           m_contactManager(manager),
    88           m_contactManager(manager),
    83           m_isMarkedAsSeen(false)
    89           m_isMyCard(false),
       
    90           m_isMarkedAsSeen(false),
       
    91           m_initLogs(false)
    84           {}
    92           {}
    85     ~CntHistoryModelData()
    93     ~CntHistoryModelData()
    86     {
    94     {
    87         if (m_logsModel) {
    95         if (m_logsModel) {
    88             delete m_logsModel;
    96             delete m_logsModel;
   105     MsgHistory* m_msgHistory;
   113     MsgHistory* m_msgHistory;
   106 	QContactLocalId m_contactId;
   114 	QContactLocalId m_contactId;
   107     QContactManager* m_contactManager;
   115     QContactManager* m_contactManager;
   108     bool m_isMyCard;
   116     bool m_isMyCard;
   109     bool m_isMarkedAsSeen;
   117     bool m_isMarkedAsSeen;
       
   118     bool m_initLogs;
   110     //this contains merged calls and messages history
   119     //this contains merged calls and messages history
   111     QList<HItemPointer> m_List;
   120     QList<HItemPointer> m_List;
   112     QMap<int, HItemPointer> m_logsMap;
   121     QMap<int, HItemPointer> m_logsMap;
   113     QMap<int, HItemPointer> m_msgMap;
   122     QMap<int, HItemPointer> m_msgMap;
   114 };
   123 };