logsui/EngineInc/CLogsClearNewMissed.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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 *     Class for setting a missed calls event and its duplicates read. This is needed only for 
       
    16 *     clearing the new missed icon and duplicate counters for one missed calls event if a call or 
       
    17 *     message is initiated. 
       
    18 * 
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef __CLOGSCLEARNEWMISSED_H_
       
    24 #define __CLOGSCLEARNEWMISSED_H_
       
    25 
       
    26 //  INCLUDES
       
    27 #include <e32base.h>
       
    28 #include <f32file.h>
       
    29 #include <logwrap.h>
       
    30 #include <logviewchangeobserver.h>
       
    31 
       
    32 
       
    33 #include "MLogsEvent.h"
       
    34 #include "MLogsClearLog.h"
       
    35 #include "MLogsStateHolder.h"
       
    36 #include "MLogsClearNewMissed.h"
       
    37 
       
    38 // MACROS
       
    39 
       
    40 // DATA TYPES
       
    41 
       
    42 // FUNCTION PROTOTYPES
       
    43 
       
    44 // FORWARD DECLARATIONS
       
    45 class CLogClient;
       
    46 class MLogsObserver;
       
    47 class CLogViewRecent;
       
    48 class CLogViewDuplicate;
       
    49 class MLogsEventGetter;
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 /**
       
    54  *	Clearing class.
       
    55  */
       
    56 class CLogsClearNewMissed : public CActive,
       
    57                          public MLogsClearNewMissed
       
    58                      // public MLogsStateHolder
       
    59     {
       
    60     public:
       
    61         /**
       
    62          * Symbian OS constructor. 
       
    63          *
       
    64          * @param aFsSession   ref. to file server session
       
    65          * @param aObserver pointer to observer. Default NULL
       
    66          * @return New instance of this class
       
    67          */
       
    68         static CLogsClearNewMissed* NewL
       
    69                             (   RFs& aFsSession );
       
    70 
       
    71         /**
       
    72          *  Destructor
       
    73          */
       
    74         ~CLogsClearNewMissed();
       
    75 
       
    76     private:
       
    77     
       
    78         /**
       
    79          * Default constructor. 
       
    80          */
       
    81         CLogsClearNewMissed();
       
    82 
       
    83         /**
       
    84          * Second phase constructor. 
       
    85          */
       
    86         void ConstructL();
       
    87 
       
    88         /**
       
    89          * C++ constructor. 
       
    90          *
       
    91          * @param aFsSession   ref. to file server session
       
    92          * @param aObserver pointer to observer
       
    93          */
       
    94         CLogsClearNewMissed( RFs& aFsSession );
       
    95 
       
    96     protected: // from CActive
       
    97         void DoCancel();
       
    98         void RunL();
       
    99 		TInt RunError(TInt aError);
       
   100 
       
   101     public: 
       
   102         /**
       
   103          * Sets one Log missed call event read in order to clear the new missed call icon.
       
   104          * 
       
   105          * As a first thing calls GetEvent to fetch the event details from the log as we cannot relay 
       
   106          * to Logs event array which could be reseted just before a call to SetEventRead.
       
   107          * 
       
   108          * If the event doesn't have any duplicates, then simply calls CLogClient::ChangeEvent. 
       
   109          * If there are duplicates, we need to first set the recent lists view
       
   110          * and then the get the duplicates view of the current event.
       
   111          * 
       
   112          * @param aLogid    the id of the Log event
       
   113          */
       
   114         void SetNewMissedCallRead(TLogId aLogId, TInt aDuplicates);    
       
   115     
       
   116     private:
       
   117         
       
   118        /**
       
   119         * Tries to set a filtered recent view.
       
   120         * Goal is to get a view which only contains the event being processed
       
   121         * as this is only needed to get the duplicates of the event.
       
   122         * 
       
   123         * return true/false 
       
   124         */
       
   125         TBool TrySetRecentViewL();
       
   126         
       
   127        /**
       
   128         * If the recent view was succesfully set, proceed to 
       
   129         * get the duplicates view of the current event.
       
   130         * 
       
   131         * return true/false 
       
   132         */
       
   133         TBool TrySetDuplicatesViewL();
       
   134         
       
   135        /**
       
   136         * Set the read flags of the recent and duplicates view.
       
   137         * Clears all duplicates too. 
       
   138         */
       
   139         void SetReadFlagsL();
       
   140         
       
   141        /**
       
   142         * Helper function to set the recent lists filter. Goal is to 
       
   143         * get a view which only contains the event being processed. 
       
   144         */
       
   145         void SetRecentFilterL();
       
   146         
       
   147        /**
       
   148         * As a first thing we'll fetch the event details from the log.          
       
   149         */
       
   150         void GetEventL(TLogId aLogId);
       
   151         
       
   152  // internal states of object
       
   153         enum TClearNewMissedPhase
       
   154             {
       
   155             EUnInitilized = 0,
       
   156             EGetEvent,
       
   157             EChangeEvent,
       
   158         	ESetRecentView,
       
   159         	ESetDuplicatesView,
       
   160             EFinished
       
   161             };
       
   162     
       
   163 
       
   164     private: // data
       
   165         /// Ref: File server session
       
   166         RFs&                iFsSession;
       
   167 
       
   168         /// Own: Log client
       
   169         CLogClient*         iLogClient;
       
   170         CLogEvent*          iLogEvent;
       
   171 
       
   172         TClearNewMissedPhase        iPhase;
       
   173         
       
   174         TInt 				iDuplicates;
       
   175         
       
   176         /// Own: View to filtered events.
       
   177         CLogViewRecent*         iLogViewRecent;
       
   178         /// Own: duplicate filter, excludes 
       
   179         CLogFilter*             iRecentFilter;
       
   180         
       
   181         CLogViewDuplicate* 		iLogViewDuplicates;
       
   182         /// Own: duplicate filter, excludes 
       
   183         CLogFilter*             iDuplicateFilter;
       
   184 
       
   185     };
       
   186 
       
   187 #endif
       
   188 
       
   189 // End of File  __CLOGSCLEARNEWMISSED_H_