phonebookui/cnthistorymodel/tsrc/mt_cnthistorymodel/stub_classes.h
changeset 31 2a11b5b00470
parent 27 de1630741fbe
equal deleted inserted replaced
27:de1630741fbe 31:2a11b5b00470
    15 *
    15 *
    16 */
    16 */
    17 #ifndef STUB_CLASSES_H
    17 #ifndef STUB_CLASSES_H
    18 #define STUB_CLASSES_H
    18 #define STUB_CLASSES_H
    19 
    19 
    20 #include <QString>
       
    21 #include <QDateTime>
       
    22 #include <QtTest/QtTest>
    20 #include <QtTest/QtTest>
    23 #include <QAbstractItemModel>
    21 #include <QAbstractItemModel>
    24 #include <qcontactmanager.h>
    22 #include "cnthistorymodel.h"
    25 
    23 
    26 #define ALL_EVENTS 7
    24 #define ALL_EVENTS 7
    27 #define FILTERED_EVENTS 5
    25 #define FILTERED_EVENTS 5
    28 
    26 
    29 const QString own_msg = QString("Own card view message %1 added");
    27 const QString own_msg = QString("Own card view message %1 added");
    30 const QString cc_msg = QString("Contact message %1 added");
    28 const QString cc_msg = QString("Contact message %1 added");
    31 const QString icon_path = QString("Icon %1 path");
    29 const QString icon_path = QString("Icon %1 path");
    32 const QDateTime constDateTime = QDateTime(QDate(2010, 2, 15), QTime(12, 10, 10));
    30 const QDateTime constDateTime = QDateTime(QDate(2010, 2, 15), QTime(12, 10, 10));
    33 
       
    34 struct HistoryItem {
       
    35     int direction; // 0 - incoming, 1 - outgoing, 2 - missed
       
    36     int seenStatus;    // 3 = unseen, 4 = seen
       
    37     int msgType;    // 5 = call log, 6 = message
       
    38     QString number; 
       
    39     QString iconPath;
       
    40     QString title;
       
    41     QString message;
       
    42     QDateTime timeStamp;
       
    43     QString mmsMessage;
       
    44     
       
    45     HistoryItem() :
       
    46         direction(0),
       
    47         seenStatus(4),
       
    48         iconPath(QString()),
       
    49         title(QString()),
       
    50         message(QString()),
       
    51         timeStamp(QDateTime()),
       
    52         mmsMessage(QString())
       
    53     {};
       
    54     
       
    55     inline const HistoryItem& operator=(const HistoryItem& other)
       
    56     {        
       
    57         direction = other.direction;
       
    58         seenStatus = other.seenStatus;
       
    59         msgType = other.msgType;
       
    60         number = other.number;
       
    61         iconPath = other.iconPath;
       
    62         title = other.title;
       
    63         message = other.message;
       
    64         timeStamp = other.timeStamp;
       
    65         return *this;
       
    66     }
       
    67     
       
    68     inline bool operator==(const HistoryItem& other) const
       
    69     { return timeStamp == other.timeStamp; }
       
    70 };
       
    71 
       
    72 enum
       
    73 {
       
    74    TimeStamp,
       
    75    Direction,
       
    76    BodyText,
       
    77    UnReadStatus,
       
    78    FirstName,
       
    79    LastName
       
    80 };
       
    81 
       
    82 enum
       
    83 {
       
    84     Incoming,
       
    85     Outgoing,
       
    86     Missed
       
    87 };
       
    88 
       
    89 enum
       
    90 {
       
    91     Unseen = 3,
       
    92     Seen
       
    93 };
       
    94 
       
    95 enum ItemType
       
    96 {
       
    97     CallLog = 5,
       
    98     Message
       
    99 };
       
   100 
       
   101 enum CustomRoles
       
   102 {
       
   103     SeenStatusRole = Qt::UserRole + 1,
       
   104     DirectionRole, 
       
   105     ItemTypeRole,
       
   106     PhoneNumberRole
       
   107 };
       
   108 
    31 
   109 class LogsEvent
    32 class LogsEvent
   110 {
    33 {
   111 public:
    34 public:
   112     enum LogsDirection
    35     enum LogsDirection