logsui/logsapp/tsrc/ut_logsapp/logsengine_stub/logsevent.h
changeset 0 4a5361db8937
child 4 e52d42f9500c
equal deleted inserted replaced
-1:000000000000 0:4a5361db8937
       
     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 LOGSEVENT_H
       
    19 #define LOGSEVENT_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <QObject>
       
    23 #include <QDateTime>
       
    24 #include <logsexport.h>
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 class LogsEventData;
       
    28 class LogsEventStrings;
       
    29 class CLogEvent;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34  *
       
    35  */
       
    36 class LogsEvent
       
    37     {
       
    38 public:
       
    39     
       
    40     // direction of the event
       
    41     enum LogsDirection
       
    42         {
       
    43         DirUndefined = -1, // undefined
       
    44         DirIn =  0,        // incoming
       
    45         DirOut = 1,        // outgoing
       
    46         DirMissed = 2      // missed
       
    47         };
       
    48 
       
    49     // type of the event
       
    50     enum LogsEventType
       
    51         {
       
    52         TypeUndefined = -1,
       
    53         TypeVoiceCall,
       
    54         TypeVideoCall,
       
    55         TypeVoIPCall
       
    56         };
       
    57     
       
    58     enum LogsEventState
       
    59         {
       
    60         EventAdded,
       
    61         EventUpdated,
       
    62         EventNotUpdated
       
    63         };
       
    64     
       
    65     public:
       
    66 
       
    67        /**
       
    68         * Constructor.
       
    69         */
       
    70         LogsEvent();
       
    71         
       
    72         /**
       
    73          * Copy constructor.
       
    74          */
       
    75         LogsEvent( const LogsEvent& event );
       
    76         
       
    77         /**
       
    78         * Destructor.
       
    79         */
       
    80         virtual ~LogsEvent();
       
    81               
       
    82 
       
    83     public:
       
    84         
       
    85         /**
       
    86          * Initialized the event with contents of given source event.
       
    87          * Event state and view status are updated automatically at
       
    88          * this phase.
       
    89          * @param source, source event
       
    90          * @param strings, list of strings used for comparison
       
    91          */
       
    92         void initializeEventL( const CLogEvent& source,
       
    93                                const LogsEventStrings& strings );
       
    94         
       
    95         /**
       
    96          * Check event's view status which tells whether the event is
       
    97          * still valid or not. If event is not anymore in view, it
       
    98          * is not probably needed anymore.
       
    99          */
       
   100         bool isInView() const;
       
   101         
       
   102         /**
       
   103          * Get state of the event. Event state is updated
       
   104          * always at initialization phase. See initializeEventL.
       
   105          */
       
   106         LogsEventState eventState() const;
       
   107 
       
   108 		bool isRead() const;
       
   109         
       
   110         void setIsRead(bool isRead);
       
   111 		
       
   112         QDateTime time() const;
       
   113         
       
   114         int logId() const;
       
   115 
       
   116         const QString& number() const;
       
   117 
       
   118         const QString& remoteParty() const;
       
   119 
       
   120         LogsDirection direction() const;
       
   121 
       
   122         int eventUid() const;
       
   123 
       
   124         LogsEventType eventType() const;
       
   125 
       
   126         int duplicates() const;
       
   127 
       
   128         LogsEventData* logsEventData() const;
       
   129 
       
   130         bool ALS() const; 
       
   131 
       
   132         bool CNAP() const { return false; };
       
   133         
       
   134         int ringDuration() const;
       
   135         
       
   136         int duration() const;
       
   137      
       
   138         /**
       
   139          * Sets current index of the event.
       
   140          */
       
   141         void setIndex(int index);
       
   142         
       
   143         /**
       
   144          * Returns last set index for the event.
       
   145          */
       
   146         int index() const;
       
   147         
       
   148         /**
       
   149          * Set view status of the event.
       
   150          */
       
   151         void setIsInView(bool isInView);
       
   152         
       
   153         /**
       
   154          * Set number of duplicates for this events (e.g. 2 missed calls)
       
   155          */
       
   156         void setDuplicates( int duplicates );
       
   157         
       
   158         /**
       
   159          * Set remote party name for the event.
       
   160          */
       
   161         void setRemoteParty( const QString& remoteParty );
       
   162         
       
   163         /**
       
   164          * Check if event is valid.
       
   165          * @return true if valid, otherwise false
       
   166          */
       
   167         bool validate();
       
   168         
       
   169         /**
       
   170          * Return direction as string
       
   171          */
       
   172         QString directionAsString() const;
       
   173         
       
   174         /**
       
   175          * Return event type as string
       
   176          */
       
   177         QString typeAsString() const;
       
   178         
       
   179         /**
       
   180          * 
       
   181          */
       
   182         QString getNumberForCalling();
       
   183         
       
   184     private:                               
       
   185 
       
   186         bool setTime( const QDateTime& time );
       
   187 
       
   188         void setLogId( const int logId );
       
   189        
       
   190         bool setNumber( const QString& number );
       
   191 
       
   192         bool setDirection( LogsDirection aDirection );
       
   193 
       
   194         void setEventUid( int uid );
       
   195 
       
   196         void setEventType( LogsEventType aEventType );
       
   197 
       
   198         void setLogsEventData( LogsEventData* logsEventData );
       
   199 
       
   200         void setALS( bool aALS ); 
       
   201         
       
   202         void setRingDuration( int ringDuration );     
       
   203 
       
   204         bool isEmergencyNumber( const QString& number );
       
   205         
       
   206         void setDuration( int duration );
       
   207         
       
   208     private:    // data
       
   209             
       
   210         int mLogId;        
       
   211         LogsDirection mDirection;
       
   212         LogsEventType mEventType;
       
   213         int mUid;
       
   214         LogsEventData* mLogsEventData;
       
   215         QString mRemoteParty;
       
   216         QString mNumber;
       
   217         int mDuplicates;               
       
   218         QDateTime mTime;       
       
   219         int mRingDuration;
       
   220 	    bool mIsRead;  
       
   221 	    bool mIsALS;
       
   222 	    int mDuration;
       
   223 	    
       
   224 	    int mIndex;
       
   225 	    bool mIsInView;
       
   226 	    LogsEventState mEventState;
       
   227 	    
       
   228     private:
       
   229         
       
   230         friend class LogsEventParser;
       
   231         friend class LogsReaderStateFillDetails;
       
   232         
       
   233     private: // Testing related friend definitions
       
   234 
       
   235 #ifdef LOGSDBCONNECTOR_SIMULATION
       
   236         friend class LogsDbConnector; 
       
   237 #endif
       
   238         friend class UT_LogsFilter;
       
   239         friend class UT_LogsModel;
       
   240         friend class UT_LogsEvent;
       
   241         friend class UT_LogsDbConnector;
       
   242         friend class UT_LogsCall;
       
   243         friend class UT_LogsContact;
       
   244         friend class UT_LogsEventParser;
       
   245         friend class UT_LogsEventDataParser;
       
   246         friend class UT_LogsReaderStates;
       
   247         friend class UT_LogsDetailsModel;
       
   248         friend class UT_LogsMessage;
       
   249     };
       
   250 
       
   251 #endif      // LOGSEVENT_H
       
   252 
       
   253 
       
   254 
       
   255 // End of File