|
1 /* |
|
2 * Copyright (c) 2007-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: Implementation of the MNcsEmailAddressObject |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CESMRNCSEMAILADDRESSOBJECT_H |
|
19 #define CESMRNCSEMAILADDRESSOBJECT_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <e32def.h> |
|
23 |
|
24 /** |
|
25 * The CNcsEmailAddressObject class. A single instance of this wrapper |
|
26 * class stores the email address and the optional name to display |
|
27 * inplace of the address |
|
28 */ |
|
29 NONSHARABLE_CLASS( CESMRNcsEmailAddressObject ) : public CBase |
|
30 { |
|
31 public: // Constructors and destructor |
|
32 /** |
|
33 * Creates new CESMRNcsEmailAddressObject object. Ownership |
|
34 * is transferred to caller. |
|
35 * @param aUserAdded set that user is already added |
|
36 * @return Pointer to created object, |
|
37 */ |
|
38 static CESMRNcsEmailAddressObject* NewL( TBool aUserAdded ); |
|
39 |
|
40 /** |
|
41 * Creates new CESMRNcsEmailAddressObject object. Ownership |
|
42 * is transferred to caller. |
|
43 * @param aAddress set email address manually |
|
44 * @return Pointer to created object, |
|
45 */ |
|
46 static CESMRNcsEmailAddressObject* NewL( const CESMRNcsEmailAddressObject& aAddress ); |
|
47 |
|
48 /** |
|
49 * Creates new CESMRNcsEmailAddressObject object. Ownership |
|
50 * is transferred to caller. |
|
51 * @param aDisplayName set name of the address manually |
|
52 * @param aAddress set email address manually |
|
53 * @return Pointer to created object, |
|
54 */ |
|
55 static CESMRNcsEmailAddressObject* NewL( const TDesC& aDisplayName, const TDesC& aEmailAddress ); |
|
56 |
|
57 /** |
|
58 * C++ Destructor. |
|
59 */ |
|
60 ~CESMRNcsEmailAddressObject(); |
|
61 |
|
62 public: // From MNCSEmailAddressObject |
|
63 |
|
64 // inlines |
|
65 |
|
66 /** |
|
67 * Test if object is filled/added comletely already |
|
68 * @return ETrue if user was already added |
|
69 */ |
|
70 inline TBool IsUserAdded(); |
|
71 |
|
72 /** |
|
73 * Get the email address of this contact address object |
|
74 * @return aEmailAddress descriptor of the email address of this contact address object |
|
75 */ |
|
76 inline const TDesC& EmailAddress() const; |
|
77 |
|
78 /** |
|
79 * Get the display name of this contact address object |
|
80 * @return descriptor of the display name of this contact address object |
|
81 */ |
|
82 inline const TDesC& DisplayName() const; |
|
83 |
|
84 /** |
|
85 * Display full means that both name and email address must be shown. |
|
86 * This is the case for example when contact has multiple email |
|
87 * addresses. |
|
88 */ |
|
89 inline void SetDisplayFull( TBool aDisplayFull ); |
|
90 |
|
91 /** |
|
92 * Check if the object needs to display both name and email address |
|
93 * @return ETrue if both name and email address need to be displayed |
|
94 */ |
|
95 inline TBool DisplayFull() const; |
|
96 |
|
97 /** |
|
98 * Set the email address of this contact address object |
|
99 * @param aEmailAddress descriptor of the email address for this contact address object |
|
100 */ |
|
101 void SetEmailAddressL( const TDesC& aEmailAddress ); |
|
102 |
|
103 /** |
|
104 * Set the display names of this contact address object |
|
105 * @param aGivenName descriptor of the display name for this contact address object |
|
106 * @param aFamilyName descriptor of the display name for this contact address object |
|
107 */ |
|
108 void SetDisplayNameL ( const TDesC& aGivenName, const TDesC& aFamilyName); |
|
109 |
|
110 /** |
|
111 * Set the display name of this contact address object |
|
112 * @param aName descriptor of the display name for this contact address object |
|
113 */ |
|
114 void SetDisplayNameL( const TDesC& aName ); |
|
115 |
|
116 /** |
|
117 * Get the formatted address of this contact address object |
|
118 * @return descriptor of this contact address object |
|
119 */ |
|
120 const TDesC& FormattedAddressL(); |
|
121 |
|
122 /** |
|
123 * Test of email address is idna compliant |
|
124 * @return ETrue if idna comliant |
|
125 */ |
|
126 TBool IsIdnaCompliantAddress(); |
|
127 |
|
128 private: // Constructors |
|
129 CESMRNcsEmailAddressObject( TBool aUserAdded ); |
|
130 void ConstructL(); |
|
131 void ConstructL( const CESMRNcsEmailAddressObject& aAddress ); |
|
132 void ConstructL( const TDesC& aDisplayName, const TDesC& aEmailAddress ); |
|
133 |
|
134 private: // Implementation |
|
135 void GenerateFormattedAddressL(); |
|
136 |
|
137 private: // Data |
|
138 HBufC* iEmailAddress;//Own: |
|
139 HBufC* iDisplayName;//Own: |
|
140 HBufC* iFormattedAddress;//Own: |
|
141 TBool iDirtyFlag; |
|
142 TBool iIsIdnaCompliant; |
|
143 TBool iUserAdded; |
|
144 TBool iDisplayFull; |
|
145 }; |
|
146 |
|
147 #include "cesmrncsemailaddressobject.inl" |
|
148 |
|
149 #endif // CESMRNCSEMAILADDRESSOBJECT_H |
|
150 |
|
151 // End of file |