64
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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: common email address object
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
//<cmail>
|
|
20 |
#include "emailtrace.h"
|
|
21 |
#include "cfsmailaddress.h"
|
|
22 |
//</cmail>
|
|
23 |
|
|
24 |
// ================= MEMBER FUNCTIONS ==========================================
|
|
25 |
// -----------------------------------------------------------------------------
|
|
26 |
// CFSMailAddress::NewLC
|
|
27 |
// -----------------------------------------------------------------------------
|
|
28 |
EXPORT_C CFSMailAddress* CFSMailAddress::NewLC()
|
|
29 |
{
|
|
30 |
FUNC_LOG;
|
|
31 |
CFSMailAddress* adr = new (ELeave) CFSMailAddress();
|
|
32 |
CleanupStack::PushL(adr);
|
|
33 |
adr->ConstructL();
|
|
34 |
return adr;
|
|
35 |
}
|
|
36 |
|
|
37 |
// -----------------------------------------------------------------------------
|
|
38 |
// CFSMailAddress::NewL
|
|
39 |
// -----------------------------------------------------------------------------
|
|
40 |
EXPORT_C CFSMailAddress* CFSMailAddress::NewL()
|
|
41 |
{
|
|
42 |
FUNC_LOG;
|
|
43 |
CFSMailAddress* adr = CFSMailAddress::NewLC();
|
|
44 |
CleanupStack::Pop(adr);
|
|
45 |
return adr;
|
|
46 |
}
|
|
47 |
|
|
48 |
// -----------------------------------------------------------------------------
|
|
49 |
// CFSMailAddress::ConstructL
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
void CFSMailAddress::ConstructL()
|
|
52 |
{
|
|
53 |
FUNC_LOG;
|
|
54 |
}
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// CFSMailAddress::CFSMailAddress
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
CFSMailAddress::CFSMailAddress()
|
|
60 |
{
|
|
61 |
FUNC_LOG;
|
|
62 |
iEmailAddress = HBufC::New(1);
|
|
63 |
iEmailAddress->Des().Copy(KNullDesC());
|
|
64 |
|
|
65 |
iDisplayName = HBufC::New(1);
|
|
66 |
iDisplayName->Des().Copy(KNullDesC());
|
|
67 |
}
|
|
68 |
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
// CFSMailAddress::~CFSMailAddress
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
EXPORT_C CFSMailAddress::~CFSMailAddress()
|
|
73 |
{
|
|
74 |
FUNC_LOG;
|
|
75 |
if(iEmailAddress)
|
|
76 |
{
|
|
77 |
delete iEmailAddress;
|
|
78 |
}
|
|
79 |
iEmailAddress = NULL;
|
|
80 |
|
|
81 |
if (iDisplayName)
|
|
82 |
{
|
|
83 |
delete iDisplayName;
|
|
84 |
}
|
|
85 |
iDisplayName = NULL;
|
|
86 |
}
|
|
87 |
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
// CFSMailAddress::GetEmailAddress
|
|
90 |
// -----------------------------------------------------------------------------
|
|
91 |
EXPORT_C TDesC& CFSMailAddress::GetEmailAddress() const
|
|
92 |
{
|
|
93 |
FUNC_LOG;
|
|
94 |
return *iEmailAddress;
|
|
95 |
}
|
|
96 |
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
// CFSMailAddress::SetEmailAddress
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
EXPORT_C void CFSMailAddress::SetEmailAddress(const TDesC& aAddress)
|
|
101 |
{
|
|
102 |
FUNC_LOG;
|
|
103 |
// init mailbox name
|
|
104 |
HBufC* address = HBufC::New(aAddress.Length());
|
|
105 |
|
|
106 |
// store new mailbox name
|
|
107 |
if(address)
|
|
108 |
{
|
|
109 |
delete iEmailAddress;
|
|
110 |
iEmailAddress = address;
|
|
111 |
iEmailAddress->Des().Copy(aAddress);
|
|
112 |
}
|
|
113 |
|
|
114 |
}
|
|
115 |
|
|
116 |
// -----------------------------------------------------------------------------
|
|
117 |
// CFSMailAddress::GetDisplayName
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
EXPORT_C TDesC& CFSMailAddress::GetDisplayName() const
|
|
120 |
{
|
|
121 |
FUNC_LOG;
|
|
122 |
return *iDisplayName;
|
|
123 |
}
|
|
124 |
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
// CFSMailAddress::SetDisplayName
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
EXPORT_C void CFSMailAddress::SetDisplayName(const TDesC& aDisplayName)
|
|
129 |
{
|
|
130 |
FUNC_LOG;
|
|
131 |
// init mailbox name
|
|
132 |
HBufC* name = HBufC::New(aDisplayName.Length());
|
|
133 |
|
|
134 |
// store new mailbox name
|
|
135 |
if(name)
|
|
136 |
{
|
|
137 |
delete iDisplayName;
|
|
138 |
iDisplayName = name;
|
|
139 |
iDisplayName->Des().Copy(aDisplayName);
|
|
140 |
}
|
|
141 |
}
|
|
142 |
|