64
|
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: Container class for CESMRRichTextViewer links
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "cesmrrichtextlink.h"
|
|
20 |
#include "esmrcommands.h"
|
|
21 |
#include "emailtrace.h"
|
|
22 |
|
|
23 |
#include <avkon.hrh>
|
|
24 |
#include <avkon.rsg>
|
|
25 |
#include <esmrgui.rsg>
|
|
26 |
|
|
27 |
// ======== MEMBER FUNCTIONS ========
|
|
28 |
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
// CESMRRichTextLink::NewL
|
|
31 |
// ---------------------------------------------------------------------------
|
|
32 |
//
|
|
33 |
EXPORT_C CESMRRichTextLink* CESMRRichTextLink::NewL(
|
|
34 |
TInt aStartPos,
|
|
35 |
TInt aLength,
|
|
36 |
const TDesC& aValue,
|
|
37 |
TType aType,
|
|
38 |
TTriggerKey aTriggerKey )
|
|
39 |
{
|
|
40 |
FUNC_LOG;
|
|
41 |
CESMRRichTextLink* self =
|
|
42 |
new (ELeave) CESMRRichTextLink(aStartPos, aLength, aType, aTriggerKey);
|
|
43 |
CleanupStack::PushL (self );
|
|
44 |
self->ConstructL (aValue );
|
|
45 |
CleanupStack::Pop (self );
|
|
46 |
return self;
|
|
47 |
}
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
// CESMRRichTextLink::~CESMRRichTextLink
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
EXPORT_C CESMRRichTextLink::~CESMRRichTextLink( )
|
|
54 |
{
|
|
55 |
FUNC_LOG;
|
|
56 |
delete iValue;
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
// CESMRRichTextLink::StartPos
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
EXPORT_C TInt CESMRRichTextLink::StartPos( ) const
|
|
64 |
{
|
|
65 |
FUNC_LOG;
|
|
66 |
return iStartPos;
|
|
67 |
}
|
|
68 |
|
|
69 |
// ---------------------------------------------------------------------------
|
|
70 |
// CESMRRichTextLink::Length
|
|
71 |
// ---------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
EXPORT_C TInt CESMRRichTextLink::Length( ) const
|
|
74 |
{
|
|
75 |
FUNC_LOG;
|
|
76 |
return iLength;
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// CESMRRichTextLink::Value
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
EXPORT_C TDesC& CESMRRichTextLink::Value( ) const
|
|
84 |
{
|
|
85 |
FUNC_LOG;
|
|
86 |
return *iValue;
|
|
87 |
}
|
|
88 |
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
// CESMRRichTextLink::TType
|
|
91 |
// ---------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
EXPORT_C CESMRRichTextLink::TType CESMRRichTextLink::Type( ) const
|
|
94 |
{
|
|
95 |
FUNC_LOG;
|
|
96 |
return iType;
|
|
97 |
}
|
|
98 |
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
// CESMRRichTextLink::TTriggerKey
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
EXPORT_C CESMRRichTextLink::TTriggerKey CESMRRichTextLink::TriggerKey( ) const
|
|
104 |
{
|
|
105 |
FUNC_LOG;
|
|
106 |
return iTriggerKey;
|
|
107 |
}
|
|
108 |
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
// CESMRRichTextLink::SetStartPos
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
EXPORT_C void CESMRRichTextLink::SetStartPos( TInt aPos )
|
|
114 |
{
|
|
115 |
FUNC_LOG;
|
|
116 |
iStartPos = aPos;
|
|
117 |
}
|
|
118 |
|
|
119 |
// ---------------------------------------------------------------------------
|
|
120 |
// CESMRRichTextLink::MSKCommand
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
TInt CESMRRichTextLink::MSKCommand() const
|
|
124 |
{
|
|
125 |
TInt command = EAknSoftkeySelect;
|
|
126 |
switch ( iType )
|
|
127 |
{
|
|
128 |
case ETypeEmail:
|
|
129 |
case ETypePhoneNumber:
|
|
130 |
case ETypeURL:
|
|
131 |
case ETypeAttachment:
|
|
132 |
{
|
|
133 |
command = EAknSoftkeyContextOptions;
|
|
134 |
break;
|
|
135 |
}
|
|
136 |
case ETypeShowAll:
|
|
137 |
{
|
|
138 |
command = EESMRCmdShowAllAttendees;
|
|
139 |
break;
|
|
140 |
}
|
|
141 |
case ETypeLocationUrl:
|
|
142 |
{
|
|
143 |
command = EESMRCmdShowOnMap;
|
|
144 |
break;
|
|
145 |
}
|
|
146 |
default:
|
|
147 |
{
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
return command;
|
|
153 |
}
|
|
154 |
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
// CESMRRichTextLink::MSKText
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
TInt CESMRRichTextLink::MSKText() const
|
|
160 |
{
|
|
161 |
TInt resource = R_QTN_MSK_SELECT;
|
|
162 |
switch ( iType )
|
|
163 |
{
|
|
164 |
case ETypeEmail:
|
|
165 |
case ETypePhoneNumber:
|
|
166 |
case ETypeURL:
|
|
167 |
case ETypeAttachment:
|
|
168 |
case ETypeLocationUrl:
|
|
169 |
{
|
|
170 |
resource = R_QTN_MSK_OPEN;
|
|
171 |
break;
|
|
172 |
}
|
|
173 |
case ETypeShowAll:
|
|
174 |
{
|
|
175 |
resource = R_QTN_MEET_REQ_SHOW_ALL;
|
|
176 |
break;
|
|
177 |
}
|
|
178 |
default:
|
|
179 |
{
|
|
180 |
break;
|
|
181 |
}
|
|
182 |
}
|
|
183 |
|
|
184 |
return resource;
|
|
185 |
}
|
|
186 |
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
// CESMRRichTextLink::CESMRRichTextLink
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
CESMRRichTextLink::CESMRRichTextLink(
|
|
192 |
TInt aStartPos,
|
|
193 |
TInt aLength,
|
|
194 |
TType aType,
|
|
195 |
TTriggerKey aTriggerKey )
|
|
196 |
{
|
|
197 |
FUNC_LOG;
|
|
198 |
iStartPos = aStartPos;
|
|
199 |
iLength = aLength;
|
|
200 |
iType = aType;
|
|
201 |
iTriggerKey = aTriggerKey;
|
|
202 |
}
|
|
203 |
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
// CESMRRichTextLink::ConstructL
|
|
206 |
// ---------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
void CESMRRichTextLink::ConstructL(const TDesC& aValue )
|
|
209 |
{
|
|
210 |
FUNC_LOG;
|
|
211 |
iValue = aValue.AllocL();
|
|
212 |
}
|
|
213 |
|
|
214 |
// EOF
|
|
215 |
|