logsui/AppSrc/CLogsCtAdapter.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 *     Adaptor to EventList, copies data from model listbox
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CLogsCtAdapter_H__
       
    21 #define __CLogsCtAdapter_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <bamdesca.h>  // MDesCArray
       
    25 #include <e32base.h>
       
    26 
       
    27 #include "LogsAlsEnum.hrh"
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KLogsCtAdapterLen = 100;
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class MLogsSharedData;
       
    39 class MLogsCallStatus;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  Adaptor to EventList, copies data from model listbox
       
    45 */
       
    46 class CLogsCtAdapter : public CBase, public MDesCArray
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49 
       
    50         /**
       
    51          *  Two-phased constructor.
       
    52          *
       
    53          * @param aModel, pointer to logs model.
       
    54          * @param aSelectedAlsLine, selected als line.
       
    55          * @param aCallStatus, call status accessor class.
       
    56          */
       
    57         static CLogsCtAdapter* NewL( MLogsSharedData* aSharedData, 
       
    58                             const TAlsEnum& aSelectedAlsLine,
       
    59                             MLogsCallStatus& aCallStatus );
       
    60 
       
    61         /**
       
    62          *  Destructor.
       
    63          */
       
    64         virtual ~CLogsCtAdapter();
       
    65 
       
    66     public: 
       
    67         /**
       
    68          * Update data for adaptation
       
    69          */
       
    70         TBool UpdateDataL();
       
    71 
       
    72         /**
       
    73          * Get time strings in localised form for recent call counters. UpdateDataL() needs
       
    74          * to be called before to get up-to-date values
       
    75          */
       
    76         TInt LastCallTimeStringL( TDes& aDes, const TAlsEnum& aSelectedAlsLine, const TVoipEnum aVoip );
       
    77         TInt ReceivedCallsTimeStringL( TDes& aDes, const TAlsEnum& aSelectedAlsLine, const TVoipEnum aVoip);        
       
    78         TInt DialledCallsTimeStringL( TDes& aDes, const TAlsEnum& aSelectedAlsLine, const TVoipEnum aVoip );                
       
    79         TInt AllCallsTimeStringL( TDes& aDes, const TAlsEnum& aSelectedAlsLine, const TVoipEnum aVoip );                        
       
    80         
       
    81 
       
    82     private:
       
    83         /** 
       
    84          * Active call timer in seconds.
       
    85          */
       
    86         TInt ActiveTime();
       
    87 
       
    88         /**
       
    89          * Converts seconds to proper time format
       
    90          * @param aSeconds time in seconds
       
    91          * @param aText converted string
       
    92          */
       
    93         void ToTimeFormat( TInt aSeconds, HBufC* aText );
       
    94 
       
    95     private:        
       
    96         /**
       
    97          *  C++ default constructor.
       
    98          */
       
    99         CLogsCtAdapter( MLogsSharedData* aSharedData, 
       
   100                             const TAlsEnum& aSelectedAlsLine,
       
   101                             MLogsCallStatus& aCallStatus);
       
   102 
       
   103         /**
       
   104          *  Symbian OS constructor.
       
   105          */
       
   106         void ConstructL();
       
   107 
       
   108 	private: // from MDesCArray
       
   109 
       
   110 		/**
       
   111 		 *  Returns number of entries
       
   112          *
       
   113 		 *  @return TInt 
       
   114 		 */
       
   115 		TInt MdcaCount() const;
       
   116 	
       
   117 		/**
       
   118 		 *  Returns a TPtrC related with the position given by aIndex
       
   119          *
       
   120 		 *  @param  TInt    aIndex
       
   121 		 *  @return TPtrC16
       
   122 		 */
       
   123 		TPtrC16 MdcaPoint( TInt aIndex ) const;        
       
   124 	
       
   125 	private: //data
       
   126 
       
   127         /// Ref: Reference to SD
       
   128         MLogsSharedData* iSharedData;
       
   129 
       
   130         /// Own: main buffer 
       
   131 		TBuf<KLogsCtAdapterLen> iBuffer;
       
   132 
       
   133         /// Own: "Active call timer" text
       
   134         HBufC* iActiveCallText;
       
   135 
       
   136         /// Own: "Last call timer" text
       
   137         HBufC* iLastCallText;
       
   138 
       
   139         /// Own: "Dialled call timer" text
       
   140         HBufC* iDialledCallsText;
       
   141 
       
   142         /// Own: "Received call timer" text
       
   143         HBufC* iReceivedCallsText;
       
   144 
       
   145         /// Own: "All call timer" text
       
   146         HBufC* iAllCallsText;
       
   147 
       
   148         /// Own: active call timer conversion buffer
       
   149         HBufC* iActiveCallTime; 
       
   150 
       
   151         /// Own: last call timer conversion buffer
       
   152         HBufC* iLastCallTime; 
       
   153 
       
   154         /// Own: dialled call timer conversion buffer
       
   155         HBufC* iDialledCallsTime; 
       
   156 
       
   157         /// Own: received call timer conversion buffer
       
   158         HBufC* iReceivedCallsTime;
       
   159 
       
   160         /// Own: all call timer conversion buffer
       
   161         HBufC* iAllCallsTime; 
       
   162 
       
   163         /// Ref: Selected als line
       
   164         const TAlsEnum& iSelectedAlsLine;
       
   165 
       
   166         /// Ref: call status object reference.
       
   167         MLogsCallStatus& iCallStatus;
       
   168 
       
   169         //Members to track whether a time value has changed from previous call
       
   170         TInt iPreviousActiveTime;
       
   171         TInt iPreviousAllCallsTime;
       
   172 
       
   173         TBool iShowCallDurationLogs;
       
   174     };
       
   175 
       
   176 #endif  // CLogsCtAdapter_H
       
   177            
       
   178 // End of File