messagingappbase/mcesettings/src/MceSettingsArrays.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 *  Handles mce uid name array   
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <AknUtils.h> // AknTextUtils
       
    24 #include "MceSettingsArrays.h"
       
    25 
       
    26 
       
    27 // LOCAL CONSTANTS AND MACROS
       
    28 
       
    29 const TInt KMceArraysGranularity = 4;
       
    30 const TInt KMceArraysTextLength  = 100;
       
    31 const TInt KMceSettingsMailboxNameTextLength = 20;
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 // ----------------------------------------------------
       
    36 // CMceUidNameArray::NewL
       
    37 // ----------------------------------------------------
       
    38 EXPORT_C CMceUidNameArray* CMceUidNameArray::NewL( CMceUidNameArray::TMceUidNameArrayType aType )
       
    39     {
       
    40     CMceUidNameArray* self = new (ELeave) CMceUidNameArray( aType );
       
    41     CleanupStack::PushL(self);
       
    42     self->ConstructL();
       
    43     CleanupStack::Pop( self ); 
       
    44     return self;
       
    45     }
       
    46 
       
    47 // ----------------------------------------------------
       
    48 // CMceUidNameArray::CMceUidNameArray
       
    49 // ----------------------------------------------------
       
    50 CMceUidNameArray::CMceUidNameArray( TMceUidNameArrayType aType) :
       
    51     CUidNameArray( KMceArraysGranularity ),
       
    52     iListType( aType )
       
    53     {
       
    54     }
       
    55 
       
    56 // ----------------------------------------------------
       
    57 // CMceUidNameArray::~CMceUidNameArray
       
    58 // ----------------------------------------------------
       
    59 EXPORT_C CMceUidNameArray::~CMceUidNameArray()
       
    60     {
       
    61     delete iText;
       
    62     }
       
    63 
       
    64 // ----------------------------------------------------
       
    65 // CMceUidNameArray::ConstructL
       
    66 // ----------------------------------------------------
       
    67 void CMceUidNameArray::ConstructL()
       
    68     {
       
    69     iText = HBufC::NewL( KMceArraysTextLength );
       
    70     }
       
    71 
       
    72 
       
    73 // ----------------------------------------------------
       
    74 // CMceUidNameArray::MdcaPoint
       
    75 // ----------------------------------------------------
       
    76 TPtrC CMceUidNameArray::MdcaPoint( TInt aIndex ) const
       
    77     {
       
    78     TPtr tempText = iText->Des();
       
    79     tempText.Zero();
       
    80     if ( iListType == EMtmList )
       
    81         {
       
    82         tempText.Append( KColumnListSeparator );
       
    83         tempText.Append( At( aIndex ).iName );
       
    84         }
       
    85     else
       
    86         {
       
    87         tempText.Append( KColumnListSeparator );
       
    88         TBuf<KMceSettingsMailboxNameTextLength> tempBuffer;
       
    89         if ( At( aIndex ).iName.Length() > 
       
    90             At( aIndex ).iName.Left( KMceSettingsMailboxNameTextLength ).Length() )
       
    91             {
       
    92             tempBuffer.Copy( At( aIndex ).iName.Left( KMceSettingsMailboxNameTextLength - 1 ) );
       
    93             tempBuffer.Append( CEditableText::EEllipsis );
       
    94             }
       
    95         else
       
    96             {
       
    97             tempBuffer.Copy( At( aIndex ).iName.Left( KMceSettingsMailboxNameTextLength ) );
       
    98             }
       
    99         tempText.Append( tempBuffer );
       
   100         }
       
   101     return tempText;
       
   102     }
       
   103 
       
   104 
       
   105 
       
   106 
       
   107 //  End of File