37
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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: This file contains the implementation of the CPERemoteInfo object
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <cphcntcontactid.h>
|
|
19 |
#include "cperemoteinfo.h"
|
|
20 |
#include "talogger.h"
|
|
21 |
|
|
22 |
// ======== MEMBER FUNCTIONS ========
|
|
23 |
|
|
24 |
// ---------------------------------------------------------------------------
|
|
25 |
// CPERemoteInfo::NewL
|
|
26 |
// Two-phased constructor.
|
|
27 |
// ---------------------------------------------------------------------------
|
|
28 |
//
|
|
29 |
CPERemoteInfo* CPERemoteInfo::NewL()
|
|
30 |
{
|
|
31 |
TEFLOGSTRING( KTAOBJECT, "CPERemoteInfo::NewL" );
|
|
32 |
CPERemoteInfo* remoteInfo = new ( ELeave ) CPERemoteInfo();
|
|
33 |
return remoteInfo;
|
|
34 |
}
|
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
// Constructor
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CPERemoteInfo::CPERemoteInfo()
|
|
41 |
{
|
|
42 |
TEFLOGSTRING( KTAOBJECT, "CPERemoteInfo::CPERemoteInfo" );
|
|
43 |
ResetRemoteInfo();
|
|
44 |
}
|
|
45 |
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
// Destructor
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
CPERemoteInfo::~CPERemoteInfo()
|
|
51 |
{
|
|
52 |
TEFLOGSTRING( KTAOBJECT, "CPERemoteInfo::~CPERemoteInfo" );
|
|
53 |
delete iTextToSpeechText;
|
|
54 |
delete iCallerText;
|
|
55 |
delete iCallerImage;
|
|
56 |
delete iContactLink;
|
|
57 |
if ( iContactId )
|
|
58 |
{
|
|
59 |
if ( iContactId->IsValid() )
|
|
60 |
{
|
|
61 |
iContactId->Invalidate();
|
|
62 |
delete iContactId;
|
|
63 |
}
|
|
64 |
}
|
|
65 |
iGroupId.Reset();
|
|
66 |
delete iCallerThumbnail;
|
|
67 |
delete iPredefinedDtmfStrings;
|
|
68 |
}
|
|
69 |
|
|
70 |
TInt CPERemoteInfo::CallId() const
|
|
71 |
{
|
|
72 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::CallId, id: %d", iCallId );
|
|
73 |
return iCallId;
|
|
74 |
}
|
|
75 |
|
|
76 |
const CPhCntContactId& CPERemoteInfo::ContactId() const
|
|
77 |
{
|
|
78 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::ContactId, ptr: %x", iContactId );
|
|
79 |
return *iContactId;
|
|
80 |
}
|
|
81 |
|
|
82 |
const TDesC8& CPERemoteInfo::ContactLink() const
|
|
83 |
{
|
|
84 |
if( iContactLink )
|
|
85 |
{
|
|
86 |
return *iContactLink;
|
|
87 |
}
|
|
88 |
else
|
|
89 |
{
|
|
90 |
return KNullDesC8;
|
|
91 |
}
|
|
92 |
}
|
|
93 |
|
|
94 |
const TPEPhoneNumber& CPERemoteInfo::PhoneNumber() const
|
|
95 |
{
|
|
96 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::PhoneNumber, number: '%S'", &iPhoneNumber );
|
|
97 |
return iPhoneNumber;
|
|
98 |
}
|
|
99 |
|
|
100 |
const TPEPhoneNumber& CPERemoteInfo::ColpNumber() const
|
|
101 |
{
|
|
102 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::ColpNumber, number: '%S'", &iColpNumber );
|
|
103 |
return iColpNumber;
|
|
104 |
}
|
|
105 |
|
|
106 |
const TPEContactName& CPERemoteInfo::Name() const
|
|
107 |
{
|
|
108 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::Name, name: '%S'", &iName );
|
|
109 |
return iName;
|
|
110 |
}
|
|
111 |
|
|
112 |
const TPEContactCompany& CPERemoteInfo::CompanyName() const
|
|
113 |
{
|
|
114 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::CompanyName, name: '%S'", &iCompanyName );
|
|
115 |
return iCompanyName;
|
|
116 |
}
|
|
117 |
|
|
118 |
const TPEContactFileName& CPERemoteInfo::PersonalRingingTone() const
|
|
119 |
{
|
|
120 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::PersonalRingingTone, path: '%S'", &iPersonalRingingTone );
|
|
121 |
return iPersonalRingingTone;
|
|
122 |
}
|
|
123 |
|
|
124 |
const TPEPhoneNumberIdType& CPERemoteInfo::PhoneNumberType() const
|
|
125 |
{
|
|
126 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::PhoneNumberType, type: %d", iPhoneNumberType );
|
|
127 |
return iPhoneNumberType;
|
|
128 |
}
|
|
129 |
|
|
130 |
const TPtrC CPERemoteInfo::TextToSpeechText() const
|
|
131 |
{
|
|
132 |
if( iTextToSpeechText )
|
|
133 |
{
|
|
134 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::TextToSpeechText, path: '%S'", iTextToSpeechText );
|
|
135 |
return *iTextToSpeechText;
|
|
136 |
}
|
|
137 |
else
|
|
138 |
{
|
|
139 |
return KNullDesC();
|
|
140 |
}
|
|
141 |
}
|
|
142 |
|
|
143 |
const TArray< TContactItemId > CPERemoteInfo::ContactGroups() const
|
|
144 |
{
|
|
145 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::ContactGroups, entries: %d", iGroupId.Count() );
|
|
146 |
return iGroupId.Array();
|
|
147 |
}
|
|
148 |
|
|
149 |
const TPtrC CPERemoteInfo::CallerText() const
|
|
150 |
{
|
|
151 |
if( iCallerText )
|
|
152 |
{
|
|
153 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::CallerText, path: '%S'", iCallerText );
|
|
154 |
return *iCallerText;
|
|
155 |
}
|
|
156 |
else
|
|
157 |
{
|
|
158 |
return KNullDesC();
|
|
159 |
}
|
|
160 |
}
|
|
161 |
|
|
162 |
const TPtrC CPERemoteInfo::CallerImage() const
|
|
163 |
{
|
|
164 |
if( iCallerImage )
|
|
165 |
{
|
|
166 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::CallerImage, path: %S", iCallerImage );
|
|
167 |
return *iCallerImage;
|
|
168 |
}
|
|
169 |
else
|
|
170 |
{
|
|
171 |
return KNullDesC();
|
|
172 |
}
|
|
173 |
}
|
|
174 |
|
|
175 |
CFbsBitmap* CPERemoteInfo::CallerThumbnail() const
|
|
176 |
{
|
|
177 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::CallerThumbnail, ptr: %x", iCallerThumbnail );
|
|
178 |
return iCallerThumbnail;
|
|
179 |
}
|
|
180 |
|
|
181 |
TBool CPERemoteInfo::HasCallerThumbnail() const
|
|
182 |
{
|
|
183 |
return iHasCallerThumbnail;
|
|
184 |
}
|
|
185 |
|
|
186 |
void CPERemoteInfo::SetCallId( const TInt aCallId )
|
|
187 |
{
|
|
188 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetCallId, id: %d", iCallId );
|
|
189 |
iCallId = aCallId;
|
|
190 |
}
|
|
191 |
|
|
192 |
void CPERemoteInfo::SetContactId( CPhCntContactId* aContactId )
|
|
193 |
{
|
|
194 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetContactId, ptr: %x", iContactId );
|
|
195 |
iContactId = aContactId;
|
|
196 |
|
|
197 |
delete iContactLink;
|
|
198 |
iContactLink = NULL;
|
|
199 |
TRAP_IGNORE( iContactLink = iContactId->PackLC();
|
|
200 |
CleanupStack::Pop( iContactLink ); );
|
|
201 |
|
|
202 |
}
|
|
203 |
|
|
204 |
void CPERemoteInfo::SetPhoneNumber( const TPEPhoneNumber& aPhoneNumber )
|
|
205 |
{
|
|
206 |
iPhoneNumber = aPhoneNumber;
|
|
207 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetPhoneNumber, number: '%S'", &iPhoneNumber );
|
|
208 |
}
|
|
209 |
|
|
210 |
void CPERemoteInfo::SetColpNumber( const TPEPhoneNumber& aColpNumber )
|
|
211 |
{
|
|
212 |
iColpNumber = aColpNumber;
|
|
213 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetColpNumber, number: '%S'", &iColpNumber );
|
|
214 |
}
|
|
215 |
|
|
216 |
void CPERemoteInfo::SetName( const TPEContactName& aContactName )
|
|
217 |
{
|
|
218 |
iName = aContactName;
|
|
219 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetName, name: '%S'", &iName );
|
|
220 |
}
|
|
221 |
|
|
222 |
void CPERemoteInfo::SetCompanyName( const TPEContactName& aCompanyName )
|
|
223 |
{
|
|
224 |
iCompanyName = aCompanyName;
|
|
225 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetCompanyName, company name: '%S'", &iCompanyName );
|
|
226 |
}
|
|
227 |
|
|
228 |
void CPERemoteInfo::SetPersonalRingingTone(
|
|
229 |
const TPEContactFileName& aPersonalRingingTone )
|
|
230 |
{
|
|
231 |
iPersonalRingingTone = aPersonalRingingTone;
|
|
232 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetPersonalRingingTone, path: '%S'", &iPersonalRingingTone );
|
|
233 |
}
|
|
234 |
|
|
235 |
void CPERemoteInfo::SetPhoneNumberType( const TPEPhoneNumberIdType aPhoneNumberType )
|
|
236 |
{
|
|
237 |
iPhoneNumberType = aPhoneNumberType;
|
|
238 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetPhoneNumberType, type: %d", iPhoneNumberType );
|
|
239 |
}
|
|
240 |
|
|
241 |
void CPERemoteInfo::SetTextToSpeechText( HBufC* aText )
|
|
242 |
{
|
|
243 |
iTextToSpeechText = aText;
|
|
244 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetTextToSpeechText, path: '%S'", &iTextToSpeechText );
|
|
245 |
}
|
|
246 |
|
|
247 |
void CPERemoteInfo::SetContactGroups(
|
|
248 |
const TArray< TContactItemId >& aGroupIdArray )
|
|
249 |
{
|
|
250 |
TEFLOGSTRING( KTAINT, "CPERemoteInfo::SetContactGroups" );
|
|
251 |
TInt errorCode( KErrNone );
|
|
252 |
|
|
253 |
iGroupId.Reset();
|
|
254 |
for ( TInt i = 0; i < aGroupIdArray.Count(); i++ )
|
|
255 |
{
|
|
256 |
errorCode = iGroupId.Append( aGroupIdArray[ i ] );
|
|
257 |
TEFLOGSTRING3(
|
|
258 |
KTAINT,
|
|
259 |
"PE CPERemoteInfo::SetContactGroups, index: %d, group id: %d",
|
|
260 |
i,
|
|
261 |
aGroupIdArray[ i ] );
|
|
262 |
}
|
|
263 |
if ( errorCode != KErrNone )
|
|
264 |
{
|
|
265 |
TEFLOGSTRING2( KTAERROR,
|
|
266 |
"CPERemoteInfo::SetContactGroups ! RARRAY::APPEND FAILED WITH EXIT CODE: &d",
|
|
267 |
errorCode );
|
|
268 |
iGroupId.Reset();
|
|
269 |
}
|
|
270 |
TEFLOGSTRING2( KTAINT, "PE CPERemoteInfo::SetContactGroups, entries: %d", iGroupId.Count() );
|
|
271 |
}
|
|
272 |
|
|
273 |
void CPERemoteInfo::SetCallerText( const TPtrC aCallerText )
|
|
274 |
{
|
|
275 |
delete iCallerText;
|
|
276 |
if ( aCallerText.Length() > 0 )
|
|
277 |
{
|
|
278 |
iCallerText = aCallerText.Alloc();
|
|
279 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetCallerText, text: '%S'", &iCallerText );
|
|
280 |
}
|
|
281 |
else
|
|
282 |
{
|
|
283 |
TEFLOGSTRING( KTAERROR, "CPEREMOTEINFO::SETCALLERTEXT ! NO CALLER TEXT" );
|
|
284 |
}
|
|
285 |
}
|
|
286 |
|
|
287 |
void CPERemoteInfo::SetCallerImage( const TPtrC aCallerImage )
|
|
288 |
{
|
|
289 |
delete iCallerImage;
|
|
290 |
if ( aCallerImage.Length() > 0 )
|
|
291 |
{
|
|
292 |
iCallerImage = aCallerImage.Alloc();
|
|
293 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetCallerImage, path: '%S'", &iCallerImage );
|
|
294 |
}
|
|
295 |
else
|
|
296 |
{
|
|
297 |
TEFLOGSTRING( KTAERROR, "CPEREMOTEINFO::SETCALLERIMAGE ! NO CALLER IMAGE PATH" );
|
|
298 |
}
|
|
299 |
}
|
|
300 |
|
|
301 |
void CPERemoteInfo::SetCallerThumbnail( CFbsBitmap* aCallerThumbnail )
|
|
302 |
{
|
|
303 |
delete iCallerThumbnail;
|
|
304 |
iCallerThumbnail = aCallerThumbnail;
|
|
305 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetCallerThumbnail, ptr: %x", iCallerThumbnail );
|
|
306 |
}
|
|
307 |
|
|
308 |
|
|
309 |
void CPERemoteInfo::SetHasCallerThumbnail( TBool aStatus )
|
|
310 |
{
|
|
311 |
iHasCallerThumbnail = aStatus;
|
|
312 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetHasCallerThumbnail, %d", aStatus );
|
|
313 |
}
|
|
314 |
|
|
315 |
// -----------------------------------------------------------------------------
|
|
316 |
// CPERemoteInfo::SetPredefinedDtmfStrings()
|
|
317 |
//
|
|
318 |
//
|
|
319 |
// -----------------------------------------------------------------------------
|
|
320 |
//
|
|
321 |
void CPERemoteInfo::SetPredefinedDtmfStrings(
|
|
322 |
const CDesCArray& aArray )
|
|
323 |
{
|
|
324 |
if ( iPredefinedDtmfStrings )
|
|
325 |
{
|
|
326 |
delete iPredefinedDtmfStrings;
|
|
327 |
iPredefinedDtmfStrings = NULL;
|
|
328 |
}
|
|
329 |
|
|
330 |
TInt count = aArray.Count();
|
|
331 |
|
|
332 |
if ( count )
|
|
333 |
{
|
|
334 |
TRAPD( err, iPredefinedDtmfStrings = new ( ELeave ) CDesCArrayFlat( count ) );
|
|
335 |
|
|
336 |
if( err != KErrNone )
|
|
337 |
{
|
|
338 |
TEFLOGSTRING2( KTAINT, "CPERemoteInfo::SetPredefinedDtmfStrings, err: %d", err );
|
|
339 |
return;
|
|
340 |
}
|
|
341 |
|
|
342 |
for ( TInt i = 0; i < count; i++ )
|
|
343 |
{
|
|
344 |
TRAP_IGNORE( iPredefinedDtmfStrings->AppendL( aArray.MdcaPoint(i) ) );
|
|
345 |
}
|
|
346 |
}
|
|
347 |
}
|
|
348 |
|
|
349 |
|
|
350 |
// -----------------------------------------------------------------------------
|
|
351 |
// CPERemoteInfo::PredefinedDtmfStrings()
|
|
352 |
//
|
|
353 |
//
|
|
354 |
// -----------------------------------------------------------------------------
|
|
355 |
//
|
|
356 |
CDesCArray& CPERemoteInfo::PredefinedDtmfStrings()
|
|
357 |
{
|
|
358 |
if ( !iPredefinedDtmfStrings )
|
|
359 |
{
|
|
360 |
// Create dymmy array to help post handling
|
|
361 |
TRAP_IGNORE( iPredefinedDtmfStrings = new ( ELeave ) CDesCArrayFlat( 1 ) );
|
|
362 |
}
|
|
363 |
return *iPredefinedDtmfStrings;
|
|
364 |
}
|
|
365 |
|
|
366 |
|
|
367 |
void CPERemoteInfo::ResetRemoteInfo()
|
|
368 |
{
|
|
369 |
TEFLOGSTRING( KTAINT, "CPERemoteInfo::ResetRemoteInfo" );
|
|
370 |
iPhoneNumber = KNullDesC;
|
|
371 |
iColpNumber = KNullDesC;
|
|
372 |
iName = KNullDesC;
|
|
373 |
iCompanyName = KNullDesC;
|
|
374 |
iPersonalRingingTone = KNullDesC;
|
|
375 |
iPhoneNumberType = EPEUnknownNumber;
|
|
376 |
delete iTextToSpeechText;
|
|
377 |
iTextToSpeechText = NULL;
|
|
378 |
delete iCallerText;
|
|
379 |
iCallerText = NULL;
|
|
380 |
delete iCallerImage;
|
|
381 |
iCallerImage = NULL;
|
|
382 |
if ( iContactId )
|
|
383 |
{
|
|
384 |
if ( iContactId->IsValid() )
|
|
385 |
{
|
|
386 |
iContactId->Invalidate();
|
|
387 |
delete iContactId;
|
|
388 |
iContactId = NULL;
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
|
392 |
delete iContactLink;
|
|
393 |
iContactLink = NULL;
|
|
394 |
|
|
395 |
iGroupId.Reset();
|
|
396 |
delete iCallerThumbnail;
|
|
397 |
iCallerThumbnail = NULL;
|
|
398 |
delete iPredefinedDtmfStrings;
|
|
399 |
iPredefinedDtmfStrings = NULL;
|
|
400 |
iHasCallerThumbnail = EFalse;
|
|
401 |
}
|