logsui/AppSrc/CLogsRecentListAdapter.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 RecentModel, copies data from model listbox
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CLogsRecentListAdapter_H__
       
    21 #define __CLogsRecentListAdapter_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <bamdesca.h> 
       
    25 #include <e32base.h>
       
    26 
       
    27 #include "LogsConsts.h"
       
    28 #include "LogsEng.hrh"
       
    29 #include <AknUtils.h>
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // DATA TYPES
       
    36 
       
    37 // FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CEikLabel;
       
    41 class MLogsModel;
       
    42 class MLogsEventGetter;
       
    43 class MLogsUiControlExtension;
       
    44 class CPhoneNumberFormat;
       
    45 class CEikFormattedCellListBox;
       
    46 class CLogsRecentListView;
       
    47 class CLogsRecentListControlContainer;
       
    48 class CLogsEngine;
       
    49 //For ring duation feature
       
    50 class MLogsSharedData;
       
    51 
       
    52 
       
    53 // CLASS DECLARATION
       
    54 
       
    55 /**
       
    56 *  Adaptor to RecentModel, copies data from model listbox
       
    57 */
       
    58 class CLogsRecentListAdapter : public CBase, public MDesCArray
       
    59     {
       
    60     public:  // Constructors and destructor
       
    61 
       
    62         /**
       
    63          * Two-phased constructor.
       
    64          * @param aContainer
       
    65          * @param aAlsIconId icon id for ALS2 line calls.
       
    66          * @return new object 
       
    67          */
       
    68         static CLogsRecentListAdapter* NewL
       
    69             (   
       
    70             CLogsRecentListControlContainer* aContainer,
       
    71             TInt aAlsIconId );
       
    72 
       
    73         /**
       
    74          *  Destructor.
       
    75          */
       
    76         virtual ~CLogsRecentListAdapter();
       
    77 
       
    78     public: 
       
    79         /**
       
    80          *  Sets the maximum width in pixels for the detail line. This needs to be called from controller's
       
    81          *  SizeChanged() method.
       
    82          *
       
    83          *  @param  TInt    aTextWidth Maximum width in pixels
       
    84          *  @param  TInt    aNumOfTrailingIcons Number of icons needing extra space in the end of line.
       
    85          */
       
    86         void SetLineWidth(TInt aTextWidth, TInt aNumOfTrailingIcons);
       
    87 
       
    88         
       
    89 
       
    90 
       
    91     private:        
       
    92         /**
       
    93          * C++ default constructor.
       
    94          * @param aContainer
       
    95          * @param aAlsIconId icon id for ALS2 events
       
    96          */
       
    97         CLogsRecentListAdapter
       
    98             (   
       
    99             CLogsRecentListControlContainer* aContainer,
       
   100             TInt aAlsIconId );
       
   101 
       
   102         /**
       
   103          *  Symbian OS constructor.
       
   104          */
       
   105         void ConstructL();
       
   106 
       
   107         /**
       
   108          * Date and time localization
       
   109          * @param aEvent localize, stores result to iBuffer
       
   110          * @param aPtr Pointer to buffer which stores result 
       
   111          */ 
       
   112         void DateTimeLocalizationL( const MLogsEventGetter* aEvent ,TPtr& aPtr ) const;
       
   113 
       
   114     private: // from MDesCArray
       
   115         /**
       
   116          *  Returns number of entries
       
   117          *  @return TInt number of lines in list
       
   118          */
       
   119         TInt MdcaCount() const;
       
   120 
       
   121         /**
       
   122          *  Returns a TPtrC related with the position given by aIndex
       
   123          *  @param  aIndex list item
       
   124          *  @return item descriptor
       
   125          */
       
   126         TPtrC16 MdcaPoint( TInt aIndex ) const;  
       
   127         
       
   128     private:
       
   129         /**
       
   130          *  Returns a TPtrC related with the position given by aIndex
       
   131          *
       
   132          *  @param aDest destination string
       
   133          *  @param aDuplBufLength pixel length of "(dupl. count)"
       
   134          *  @param aDuplBuffer string to insert if duplicates "(dupl. count)"
       
   135          *  @param aNumIcons number of trailing icons (need space in the end of row)
       
   136          *  @param aOriginal original string
       
   137          */
       
   138         void BuildDisplayString
       
   139             (   TDes& aDest
       
   140             ,   TInt aDuplBufPixels
       
   141             ,   TDesC& aNonClippedDuplBuffer
       
   142             ,   TInt   aNumIcons
       
   143             ,   TPtrC aOriginal 
       
   144             ,   AknTextUtils::TClipDirection aClipDirection = AknTextUtils::EClipFromEnd
       
   145             ) const;
       
   146 
       
   147         const CFont* LineFont();
       
   148         
       
   149 //For ring duation feature
       
   150         /** Append Ring Duration to the string 
       
   151         *   @param aEvent : an event information to be processed
       
   152         *          aPtr:    a pointer to the ouput string
       
   153         *   @return  None
       
   154         */
       
   155         void AppendRingDuration( const MLogsEventGetter& aEvent, TPtr& aPtr ) const;
       
   156 
       
   157         /** Format Ring Duration Value to 00:00
       
   158         *   @param aDesc :  An output string
       
   159         *          aSeconds:An input ring duration value in seconds
       
   160         *   @return  None
       
   161         */
       
   162         void FormatRingDuration( TDes& aDesc, TInt aSeconds ) const;
       
   163       
       
   164         /** Append 2 digit number. If it is one digit number, insert zero before the number 
       
   165         *   @param aDesc :  An output string
       
   166         *          aNum:    A number to be appended
       
   167         *   @return  None
       
   168         */
       
   169         void AppendNum( TDes& aDesc, TInt aNum ) const;
       
   170 
       
   171         /** Append char if it is valid
       
   172         *   @param aDesc :  An output string
       
   173         *          aCh:     A character to be appended
       
   174         *   @return  None
       
   175         */
       
   176         inline void AppendChar( TDes& aDesc, TChar aCh ) const;
       
   177   
       
   178         // no use currently, use it just incase the Phone's implementation changes
       
   179         /** Evaluate the icon type from virtual pbk eng field type
       
   180         *   @param aNumberFieldType:  a VPbk number field type
       
   181         *   @return  the icon type
       
   182         */
       
   183         RecentListIconArrayIcons NumberIconTypeFromVPbk( TInt aNumberFieldType ) const;
       
   184         
       
   185         /** Evaluate the icon type from phonebook field type
       
   186         *   @param aNumberFieldType:  a phone number field type
       
   187         *   @return  the icon type
       
   188         */
       
   189         RecentListIconArrayIcons NumberIconTypeFromPbkField( TInt aNumberFieldType ) const;
       
   190         
       
   191 
       
   192     private: //data
       
   193     
       
   194         /// Ref: reference to recent model
       
   195         MLogsModel*             iModel;
       
   196 
       
   197      
       
   198         
       
   199         //For ring duation feature
       
   200         /// a Pointer to shared data
       
   201         MLogsSharedData&        iSharedData;
       
   202         // A key getting from central repository to decide whether to show ring duration or not 
       
   203         TBool                   iShowRingDuration;
       
   204          
       
   205 
       
   206         /// Own: Conversion buffer 
       
   207         HBufC*                  iBuffer;
       
   208         /// Own: Resource string
       
   209         HBufC*                  iDateResource;  // QTN_DATE_WITHOUT_YEAR_WITH_ZERO 
       
   210         /// Own: Resource string
       
   211         HBufC*                  iTimeResource;  // R_LOGS_STM_TIME_LOC_STRING 
       
   212         /// Own: Strings for various phone number types
       
   213         HBufC*                  iPrivateNumber;
       
   214         HBufC*                  iUnknownNumber;
       
   215         HBufC*                  iPayphoneNumber;
       
   216         HBufC*                  iEmergencyCall;
       
   217         HBufC*                  iSATNumber;
       
   218         HBufC* iGroupCall;        
       
   219 
       
   220         /// Ref: control extension
       
   221         MLogsUiControlExtension* iControlExtension;
       
   222 
       
   223         /// Own: object with groupping, clipping and A&H functionality
       
   224         CPhoneNumberFormat*     iPhoneNumber;
       
   225 
       
   226         /// Ref: reference to the list box owned by the control container
       
   227         CEikFormattedCellListBox*   iListBox;
       
   228         
       
   229         /// Own: Offset to own icon .
       
   230         TInt iLastOwnIconOffset;
       
   231 
       
   232         /// Own: Array of TInt's containing maximum pixel length for displayded rows.
       
   233         TInt* iTextWidth;
       
   234 
       
   235         /// Ref: 
       
   236         const CFont* iListboxFont;  
       
   237 
       
   238         /// Ref:         
       
   239         CLogsEngine* iEngine;       
       
   240     };
       
   241 
       
   242 #endif  // __CLogsRecentListAdapter_H__
       
   243            
       
   244 // End of File