emailservices/emailclientapi/src/emailaddress.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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: This file implements class CEmailAddress.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "emailaddress.h"
       
    19 #include "CFSMailClient.h"
       
    20 #include "emailclientapi.hrh"
       
    21 
       
    22 CEmailAddress* CEmailAddress::NewL( const TRole aRole, const TDataOwner aOwner )
       
    23     {
       
    24     CEmailAddress* self = new ( ELeave ) CEmailAddress( aRole, aOwner );
       
    25     
       
    26     return self;
       
    27     }
       
    28 
       
    29 CEmailAddress* CEmailAddress::NewLC( const TRole aRole, const TDataOwner aOwner )
       
    30     {
       
    31     CEmailAddress* self = CEmailAddress::NewL( aRole, aOwner );
       
    32     CleanupStack::PushL( self );
       
    33     return self;
       
    34     }
       
    35 
       
    36 CEmailAddress::~CEmailAddress()
       
    37     {
       
    38     iAddress.Close();
       
    39     iDisplayName.Close();
       
    40     }
       
    41 
       
    42 CEmailAddress::CEmailAddress( const TRole aRole, const TDataOwner aOwner ) : iRole( aRole ), iOwner( aOwner )
       
    43     {
       
    44     }
       
    45 
       
    46 TEmailTypeId CEmailAddress::InterfaceId() const
       
    47     {
       
    48     return KEmailIFUidAddress;
       
    49     }
       
    50 
       
    51 void CEmailAddress::Release()
       
    52     {
       
    53     if ( iOwner == EClientOwns )
       
    54         {
       
    55         delete this;
       
    56         }
       
    57     }
       
    58 
       
    59 void CEmailAddress::SetAddressL( const TDesC& aAddress )
       
    60     {
       
    61     iAddress.Close();
       
    62     iAddress.CreateL( aAddress );
       
    63     }
       
    64 
       
    65 TPtrC CEmailAddress::Address() const
       
    66     {    
       
    67     return iAddress;
       
    68     }
       
    69     
       
    70 void CEmailAddress::SetDisplayNameL( const TDesC& aDisplayName )
       
    71     {
       
    72     iDisplayName.Close();
       
    73     iDisplayName.CreateL( aDisplayName );
       
    74     }
       
    75 
       
    76 TPtrC CEmailAddress::DisplayName() const
       
    77     {
       
    78     return iDisplayName;
       
    79     }
       
    80     
       
    81 MEmailAddress::TRole CEmailAddress::Role() const
       
    82     {
       
    83     return iRole;
       
    84     }
       
    85 
       
    86 void CEmailAddress::SetRole( const TRole aRole )
       
    87     {
       
    88     iRole = aRole;
       
    89     }
       
    90 
       
    91 // End of file.