|
1 /* |
|
2 * Copyright (c) 2010 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 // ----------------------------------------------------------------------------- |
|
23 // |
|
24 // ----------------------------------------------------------------------------- |
|
25 CEmailAddress* CEmailAddress::NewL( const TRole aRole, const TDataOwner aOwner ) |
|
26 { |
|
27 CEmailAddress* self = new ( ELeave ) CEmailAddress( aRole, aOwner ); |
|
28 |
|
29 return self; |
|
30 } |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 // ----------------------------------------------------------------------------- |
|
35 CEmailAddress* CEmailAddress::NewLC( const TRole aRole, const TDataOwner aOwner ) |
|
36 { |
|
37 CEmailAddress* self = CEmailAddress::NewL( aRole, aOwner ); |
|
38 CleanupStack::PushL( self ); |
|
39 return self; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 // ----------------------------------------------------------------------------- |
|
45 CEmailAddress::~CEmailAddress() |
|
46 { |
|
47 iAddress.Close(); |
|
48 iDisplayName.Close(); |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 // ----------------------------------------------------------------------------- |
|
54 CEmailAddress::CEmailAddress( const TRole aRole, const TDataOwner aOwner ) : |
|
55 iRole( aRole ), |
|
56 iOwner( aOwner ) |
|
57 { |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 // ----------------------------------------------------------------------------- |
|
63 TEmailTypeId CEmailAddress::InterfaceId() const |
|
64 { |
|
65 return KEmailIFUidAddress; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 // ----------------------------------------------------------------------------- |
|
71 void CEmailAddress::Release() |
|
72 { |
|
73 if ( iOwner == EClientOwns ) |
|
74 { |
|
75 delete this; |
|
76 } |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 // ----------------------------------------------------------------------------- |
|
82 void CEmailAddress::SetAddressL( const TDesC& aAddress ) |
|
83 { |
|
84 iAddress.Close(); |
|
85 iAddress.CreateL( aAddress ); |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 // ----------------------------------------------------------------------------- |
|
91 TPtrC CEmailAddress::Address() const |
|
92 { |
|
93 return iAddress; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 // ----------------------------------------------------------------------------- |
|
99 void CEmailAddress::SetDisplayNameL( const TDesC& aDisplayName ) |
|
100 { |
|
101 iDisplayName.Close(); |
|
102 iDisplayName.CreateL( aDisplayName ); |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 // ----------------------------------------------------------------------------- |
|
108 TPtrC CEmailAddress::DisplayName() const |
|
109 { |
|
110 return iDisplayName; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 // ----------------------------------------------------------------------------- |
|
116 MEmailAddress::TRole CEmailAddress::Role() const |
|
117 { |
|
118 return iRole; |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 // ----------------------------------------------------------------------------- |
|
124 void CEmailAddress::SetRole( const TRole aRole ) |
|
125 { |
|
126 iRole = aRole; |
|
127 } |
|
128 |
|
129 // End of file |