23
|
1 |
/*
|
|
2 |
* Copyright (c) 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: CVIMPSTProcessContactItem, CVIMPSTProcessContactListItem, CVIMPSTProcessOwnDataItem,
|
|
15 |
CVIMPSTProcessConversationItem: Method implementation
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#include "cvimpstprocessarrayitem.h"
|
|
21 |
#include "tvimpstconsts.h"
|
|
22 |
#include "vimpstutils.h"
|
|
23 |
#include <vimpstuires.rsg>
|
|
24 |
#include <StringLoader.h>
|
|
25 |
|
|
26 |
|
|
27 |
const TInt KAvtarLength = 3;
|
|
28 |
_LIT( KAvatarString , "%d\t" );
|
|
29 |
|
|
30 |
// -----------------------------------------------------------------------------
|
|
31 |
// CVIMPSTProcessContactItem::NewL
|
|
32 |
// -----------------------------------------------------------------------------
|
|
33 |
//
|
|
34 |
CVIMPSTProcessContactItem* CVIMPSTProcessContactItem::NewL(CVIMPSTProcessArray& aParent,const TDesC& aContactName,
|
|
35 |
const TDesC& aContactId ,
|
|
36 |
MVPbkContactLink* aContactLink,
|
|
37 |
const TDesC& aStatusText,
|
|
38 |
TVIMPSTEnums::TOnlineStatus aOnlineStatus)
|
|
39 |
{
|
|
40 |
CVIMPSTProcessContactItem* self = new( ELeave ) CVIMPSTProcessContactItem
|
|
41 |
( aParent, aContactLink);
|
|
42 |
CleanupStack::PushL( self );
|
|
43 |
self->ConstructL(aContactId,aContactName,aStatusText,aOnlineStatus );
|
|
44 |
CleanupStack::Pop(); //Codescanner warning ignored
|
|
45 |
return self;
|
|
46 |
}
|
|
47 |
|
|
48 |
// -----------------------------------------------------------------------------
|
|
49 |
// CVIMPSTProcessContactItem::ConstructL
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
void CVIMPSTProcessContactItem::ConstructL(const TDesC& aContactId,
|
|
53 |
const TDesC& aContactName,
|
|
54 |
const TDesC& aStatusText,
|
|
55 |
TVIMPSTEnums::TOnlineStatus aOnlineStatus )
|
|
56 |
{
|
|
57 |
iContactUserId = aContactId.AllocL();
|
|
58 |
iItemNameTextContact = aContactName.AllocL();
|
|
59 |
iSMsgPending = EFalse;
|
|
60 |
iStatusText = aStatusText.AllocL();
|
|
61 |
iOnlineStatus = aOnlineStatus;
|
|
62 |
|
|
63 |
TInt maxLengthOfIcons = KDefaultAvatar().Length()+ // longest A-Column icon
|
|
64 |
(KTab().Length() * 2)+ // length of tabs between items
|
|
65 |
KContactOnlineIconA().Length(); // longest D-Column icon
|
|
66 |
|
|
67 |
iFormattedString = HBufC::NewL( KFriendsListMaxIdentificationLength +
|
|
68 |
KStatusMsgMaxLength +
|
|
69 |
maxLengthOfIcons );
|
|
70 |
|
|
71 |
|
|
72 |
DoFormatStringL();
|
|
73 |
}
|
|
74 |
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
// CVIMPSTProcessContactItem::CVIMPSTProcessContactItem
|
|
77 |
// -----------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
CVIMPSTProcessContactItem::CVIMPSTProcessContactItem(CVIMPSTProcessArray& aParent, MVPbkContactLink* aContactLink)
|
|
80 |
: iParent(aParent),
|
|
81 |
iContactLink(aContactLink)
|
|
82 |
{
|
|
83 |
}
|
|
84 |
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
// CVIMPSTProcessContactItem::~CVIMPSTProcessContactItem
|
|
87 |
// -----------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
CVIMPSTProcessContactItem::~CVIMPSTProcessContactItem()
|
|
90 |
{
|
|
91 |
delete iContactUserId;
|
|
92 |
delete iItemNameTextContact;
|
|
93 |
if(iStatusText)
|
|
94 |
{
|
|
95 |
delete iStatusText;
|
|
96 |
}
|
|
97 |
if(iFormattedString)
|
|
98 |
delete iFormattedString;
|
|
99 |
}
|
|
100 |
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//CVIMPSTProcessContactItem: Type
|
|
103 |
// -----------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
TVIMPSTEnums::TItem CVIMPSTProcessContactItem::Type()
|
|
106 |
{
|
|
107 |
return TVIMPSTEnums::EContactItem;
|
|
108 |
}
|
|
109 |
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
//CVIMPSTProcessContactItem: GetItemNameText
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
TPtrC CVIMPSTProcessContactItem::GetItemNameText()
|
|
115 |
{
|
|
116 |
if( iItemNameTextContact )
|
|
117 |
{
|
|
118 |
return *iItemNameTextContact;
|
|
119 |
}
|
|
120 |
return KNullDesC();
|
|
121 |
}
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
//CVIMPSTProcessContactItem: GetItemUserId
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
TPtrC CVIMPSTProcessContactItem::GetItemUserId()
|
|
128 |
{
|
|
129 |
if( iContactUserId )
|
|
130 |
{
|
|
131 |
return *iContactUserId;
|
|
132 |
}
|
|
133 |
return KNullDesC();
|
|
134 |
}
|
|
135 |
|
|
136 |
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
//CVIMPSTProcessContactItem::StatusText
|
|
139 |
// -----------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
const TDesC& CVIMPSTProcessContactItem::StatusText()
|
|
142 |
{
|
|
143 |
if( iStatusText )
|
|
144 |
{
|
|
145 |
return *iStatusText;
|
|
146 |
}
|
|
147 |
return KNullDesC;
|
|
148 |
}
|
|
149 |
// -----------------------------------------------------------------------------
|
|
150 |
//CVIMPSTProcessContactItem::OnlineStatus
|
|
151 |
// -----------------------------------------------------------------------------
|
|
152 |
//
|
|
153 |
TVIMPSTEnums::TOnlineStatus CVIMPSTProcessContactItem::OnlineStatus()
|
|
154 |
{
|
|
155 |
return iOnlineStatus;
|
|
156 |
}
|
|
157 |
|
|
158 |
|
|
159 |
// -----------------------------------------------------------------------------
|
|
160 |
//CVIMPSTProcessContactItem: SetMsgPending
|
|
161 |
// -----------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
void CVIMPSTProcessContactItem::SetMsgPending(TBool aPendingMessageStatus)
|
|
164 |
{
|
|
165 |
iSMsgPending = aPendingMessageStatus;
|
|
166 |
|
|
167 |
TRAP_IGNORE(DoFormatStringL());
|
|
168 |
}
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
//CVIMPSTProcessContactItem: GetMsgPending
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
TBool CVIMPSTProcessContactItem::IsMsgPending()
|
|
174 |
{
|
|
175 |
return iSMsgPending;
|
|
176 |
}
|
|
177 |
|
|
178 |
// -----------------------------------------------------------------------------
|
|
179 |
//CVIMPSTProcessContactItem: SetConversationOpen
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
void CVIMPSTProcessContactItem::SetConversationOpen(TBool aConversationOpen)
|
|
183 |
{
|
|
184 |
iIsConversationOpen = aConversationOpen;
|
|
185 |
|
|
186 |
TRAP_IGNORE(DoFormatStringL());
|
|
187 |
}
|
|
188 |
// -----------------------------------------------------------------------------
|
|
189 |
//CVIMPSTProcessContactItem: IsConversationOpen
|
|
190 |
// -----------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
TBool CVIMPSTProcessContactItem::IsConversationOpen()
|
|
193 |
{
|
|
194 |
return iIsConversationOpen;
|
|
195 |
}
|
|
196 |
|
|
197 |
void CVIMPSTProcessContactItem::DoFormatStringL()
|
|
198 |
{
|
|
199 |
TPtr dataPtr( iFormattedString->Des() );
|
|
200 |
dataPtr.Zero();
|
|
201 |
|
|
202 |
TVIMPSTEnums::TVIMPSTRegistrationState loginstate = iParent.GetLoginState();
|
|
203 |
|
|
204 |
TInt avtarIndex = AvatarIndex();
|
|
205 |
|
|
206 |
TVIMPSTEnums::TOnlineStatus status = OnlineStatus();
|
|
207 |
|
|
208 |
if( avtarIndex && (status != TVIMPSTEnums::EBlocked))
|
|
209 |
{
|
|
210 |
// if there is any avatar index then append that icon
|
|
211 |
TBuf<KAvtarLength> buf;
|
|
212 |
buf.Format( KAvatarString, avtarIndex);
|
|
213 |
dataPtr.Append( buf);
|
|
214 |
}
|
|
215 |
else if( status == TVIMPSTEnums::EPending && TVIMPSTEnums::ESVCERegistered == loginstate)//if contact is remote pending
|
|
216 |
{
|
|
217 |
// append friend request icon online for column A
|
|
218 |
dataPtr.Append( KRemotePendingRequest );
|
|
219 |
}
|
|
220 |
else if( status == TVIMPSTEnums::EBlocked && TVIMPSTEnums::ESVCERegistered == loginstate)//if contact is remote pending
|
|
221 |
{
|
|
222 |
// append blocked icon for column A
|
|
223 |
dataPtr.Append( KFrndBlockedIcon );
|
|
224 |
}
|
|
225 |
else
|
|
226 |
{
|
|
227 |
// append default avatar for column A
|
|
228 |
dataPtr.Append( KDefaultAvatar );
|
|
229 |
}
|
|
230 |
|
|
231 |
// B-column append dispplay id
|
|
232 |
TPtrC identification(GetItemNameText());
|
|
233 |
// append only max length of the user id allowed : extra check
|
|
234 |
dataPtr.Append( identification.Left( KFriendsListMaxIdentificationLength ) );
|
|
235 |
|
|
236 |
// append \t before second line text
|
|
237 |
dataPtr.Append( KTab );
|
|
238 |
|
|
239 |
// append status text for second line and Icon for column D based on conditions
|
|
240 |
if ( ( TVIMPSTEnums::ESVCERegistered == loginstate ) && ( iParent.IsPresenceSupported() ) )
|
|
241 |
{
|
|
242 |
|
|
243 |
TPtrC statusText = StatusText();
|
|
244 |
if( statusText.Length() > 0) // if status text show it
|
|
245 |
{
|
|
246 |
// append only KStatusMsgMaxLenght of status masg
|
|
247 |
dataPtr.Append( statusText.Left( KStatusMsgMaxLength ) );
|
|
248 |
}
|
|
249 |
else
|
|
250 |
{ // show default if no status text based on status
|
|
251 |
switch(status)
|
|
252 |
{
|
|
253 |
case TVIMPSTEnums::EOnline:
|
|
254 |
{
|
|
255 |
|
|
256 |
HBufC* onlineText = StringLoader::LoadLC( R_QTN_SERVTAB_DEFAULT_STATUSTEXT_ONLINE );
|
|
257 |
dataPtr.Append( onlineText->Des());
|
|
258 |
CleanupStack::PopAndDestroy(); //onlineText
|
|
259 |
break;
|
|
260 |
}
|
|
261 |
case TVIMPSTEnums::EBusy:
|
|
262 |
{
|
|
263 |
HBufC* busyText = StringLoader::LoadLC( R_SERVDETAIL_STATUSTEXT_BUSY ) ;
|
|
264 |
dataPtr.Append( busyText->Des());
|
|
265 |
CleanupStack::PopAndDestroy(); //busyText
|
|
266 |
break;
|
|
267 |
}
|
|
268 |
case TVIMPSTEnums::EAway:
|
|
269 |
{
|
|
270 |
HBufC* awayText = StringLoader::LoadLC( R_QTN_SERVTAB_DEFAULT_STATUSTEXT_AWAY );
|
|
271 |
dataPtr.Append( awayText->Des());
|
|
272 |
CleanupStack::PopAndDestroy(); //Away text
|
|
273 |
break;
|
|
274 |
}
|
|
275 |
case TVIMPSTEnums::EOnPhone:
|
|
276 |
{
|
|
277 |
HBufC* onphoneText = StringLoader::LoadLC( R_SERVDETAIL_STATUSTEXT_ONTHEPHONE );
|
|
278 |
dataPtr.Append( onphoneText->Des());
|
|
279 |
CleanupStack::PopAndDestroy(); // on phone text
|
|
280 |
break;
|
|
281 |
}
|
|
282 |
case TVIMPSTEnums::EDoNotDisturb:
|
|
283 |
{
|
|
284 |
HBufC* dndText = StringLoader::LoadLC( R_SERVDETAIL_STATUSTEXT_DND );
|
|
285 |
dataPtr.Append( dndText->Des());
|
|
286 |
CleanupStack::PopAndDestroy(); //dnd Text
|
|
287 |
break;
|
|
288 |
}
|
|
289 |
case TVIMPSTEnums::EPending:
|
|
290 |
{
|
|
291 |
HBufC* pndText = StringLoader::LoadLC( R_REMOTEPENDING_STATUSTEXT );
|
|
292 |
dataPtr.Append( pndText->Des());
|
|
293 |
CleanupStack::PopAndDestroy(); //pnd Text
|
|
294 |
break;
|
|
295 |
}
|
|
296 |
case TVIMPSTEnums::EBlocked:
|
|
297 |
{
|
|
298 |
HBufC* blockedText = StringLoader::LoadLC( R_QTN_SERVTAB_DEFAULT_STATUSTEXT_BLOCKED );
|
|
299 |
dataPtr.Append( blockedText->Des());
|
|
300 |
CleanupStack::PopAndDestroy(); //blockedText
|
|
301 |
break;
|
|
302 |
}
|
|
303 |
case TVIMPSTEnums::EOffline: //Flowthrough
|
|
304 |
{
|
|
305 |
HBufC* offlineText = StringLoader::LoadLC( R_QTN_SERVTAB_DEFAULT_STATUSTEXT_OFFLINE );
|
|
306 |
dataPtr.Append( offlineText->Des());
|
|
307 |
CleanupStack::PopAndDestroy(); //offlineText
|
|
308 |
break;
|
|
309 |
}
|
|
310 |
case TVIMPSTEnums::ECallForward: //Flowthrough
|
|
311 |
{
|
|
312 |
HBufC* callforwardText = StringLoader::LoadLC( R_QTN_SERVTAB_DEFAULT_STATUSTEXT_CALLFORWARD );
|
|
313 |
dataPtr.Append( callforwardText->Des());
|
|
314 |
CleanupStack::PopAndDestroy(); //callforwardText
|
|
315 |
break;
|
|
316 |
}
|
|
317 |
case TVIMPSTEnums::EServiceOut:
|
|
318 |
default:
|
|
319 |
{
|
|
320 |
break;
|
|
321 |
}
|
|
322 |
}// end of switch
|
|
323 |
}// end of else
|
|
324 |
|
|
325 |
// append tab before appending icon
|
|
326 |
dataPtr.Append( KTab );
|
|
327 |
|
|
328 |
switch(status)
|
|
329 |
{
|
|
330 |
case TVIMPSTEnums::EOnline:
|
|
331 |
{
|
|
332 |
dataPtr.Append( KContactOnlineIconA );
|
|
333 |
break;
|
|
334 |
}
|
|
335 |
case TVIMPSTEnums::EInvisible:
|
|
336 |
{
|
|
337 |
dataPtr.Append( KListInvisibleIcon );
|
|
338 |
break;
|
|
339 |
}
|
|
340 |
case TVIMPSTEnums::EBusy:
|
|
341 |
case TVIMPSTEnums::EDoNotDisturb:
|
|
342 |
{
|
|
343 |
dataPtr.Append( KListBusyIcon );
|
|
344 |
break;
|
|
345 |
}
|
|
346 |
case TVIMPSTEnums::EAway:
|
|
347 |
{
|
|
348 |
dataPtr.Append( KListAwayIcon );
|
|
349 |
break;
|
|
350 |
}
|
|
351 |
case TVIMPSTEnums::EOnPhone:
|
|
352 |
{
|
|
353 |
dataPtr.Append( KFrndOnMobileIcon );
|
|
354 |
break;
|
|
355 |
}
|
|
356 |
case TVIMPSTEnums::EOffline: //Flowthrough
|
|
357 |
{
|
|
358 |
dataPtr.Append( KContactOfflineIconA );
|
|
359 |
break;
|
|
360 |
}
|
|
361 |
case TVIMPSTEnums::ECallForward: //Flowthrough
|
|
362 |
{
|
|
363 |
dataPtr.Append( KCallForward );
|
|
364 |
break;
|
|
365 |
}
|
|
366 |
case TVIMPSTEnums::EBlocked:
|
|
367 |
case TVIMPSTEnums::EPending:
|
|
368 |
case TVIMPSTEnums::EServiceOut:
|
|
369 |
default:
|
|
370 |
{
|
|
371 |
dataPtr.Append( KEmptyIconA );
|
|
372 |
break;
|
|
373 |
}
|
|
374 |
}//end switch
|
|
375 |
|
|
376 |
if( iParent.IsIMSupported() )
|
|
377 |
{
|
|
378 |
|
|
379 |
if( IsMsgPending() )
|
|
380 |
{
|
|
381 |
// unread message
|
|
382 |
dataPtr.Append( KContactNewMsgIcon );
|
|
383 |
}
|
|
384 |
else if( IsConversationOpen() )
|
|
385 |
{
|
|
386 |
// open conversation
|
|
387 |
dataPtr.Append( KContactOpenConvIcon );
|
|
388 |
}
|
|
389 |
else
|
|
390 |
{
|
|
391 |
//empty
|
|
392 |
dataPtr.Append( KEmptyIconC );
|
|
393 |
}
|
|
394 |
}
|
|
395 |
}
|
|
396 |
|
|
397 |
}
|
|
398 |
|
|
399 |
|
|
400 |
TPtrC16 CVIMPSTProcessContactItem::FormattedItemString()
|
|
401 |
{
|
|
402 |
if(iFormattedString)
|
|
403 |
return iFormattedString->Des();
|
|
404 |
else
|
|
405 |
return KNullDesC();
|
|
406 |
}
|
|
407 |
|
|
408 |
|
|
409 |
// -----------------------------------------------------------------------------
|
|
410 |
// CVIMPSTProcessContactListItem::NewL
|
|
411 |
// -----------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
CVIMPSTProcessContactListItem* CVIMPSTProcessContactListItem::NewL(CVIMPSTProcessArray& aParent)
|
|
414 |
{
|
|
415 |
CVIMPSTProcessContactListItem* self = new( ELeave ) CVIMPSTProcessContactListItem(aParent);
|
|
416 |
CleanupStack::PushL( self );
|
|
417 |
self->ConstructL();
|
|
418 |
CleanupStack::Pop();//Codescanner warning ignored
|
|
419 |
return self;
|
|
420 |
}
|
|
421 |
|
|
422 |
// -----------------------------------------------------------------------------
|
|
423 |
// CVIMPSTProcessContactListItem::ConstructL
|
|
424 |
// -----------------------------------------------------------------------------
|
|
425 |
//
|
|
426 |
void CVIMPSTProcessContactListItem::ConstructL()
|
|
427 |
{
|
|
428 |
iItemNameTextList = HBufC::NewL(KFriendsListMaxIdentificationLength);
|
|
429 |
}
|
|
430 |
// -----------------------------------------------------------------------------
|
|
431 |
// CVIMPSTProcessContactListItem::c++ default constructor
|
|
432 |
// -----------------------------------------------------------------------------
|
|
433 |
//
|
|
434 |
CVIMPSTProcessContactListItem::CVIMPSTProcessContactListItem(CVIMPSTProcessArray& aParent)
|
|
435 |
: iParent(aParent)
|
|
436 |
{
|
|
437 |
|
|
438 |
}
|
|
439 |
// -----------------------------------------------------------------------------
|
|
440 |
// CVIMPSTProcessContactListItemPC::~CVIMPSTProcessContactListItemPC destructor
|
|
441 |
// -----------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
CVIMPSTProcessContactListItem::~CVIMPSTProcessContactListItem()
|
|
444 |
{
|
|
445 |
delete iItemNameTextList;
|
|
446 |
iItemNameTextList = NULL;
|
|
447 |
}
|
|
448 |
|
|
449 |
// -----------------------------------------------------------------------------
|
|
450 |
//CVIMPSTProcessContactListItem: Type
|
|
451 |
// -----------------------------------------------------------------------------
|
|
452 |
//
|
|
453 |
TVIMPSTEnums::TItem CVIMPSTProcessContactListItem::Type()
|
|
454 |
{
|
|
455 |
return TVIMPSTEnums::EContactListItem;
|
|
456 |
}
|
|
457 |
|
|
458 |
// -----------------------------------------------------------------------------
|
|
459 |
//CVIMPSTProcessContactListItem: IsCollapsed
|
|
460 |
// -----------------------------------------------------------------------------
|
|
461 |
//
|
|
462 |
TBool CVIMPSTProcessContactListItem::IsCollapsed()
|
|
463 |
{
|
|
464 |
return iCollapsedStatus;
|
|
465 |
}
|
|
466 |
|
|
467 |
// -----------------------------------------------------------------------------
|
|
468 |
//CVIMPSTProcessContactListItem: SetCollapsed
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
//
|
|
471 |
void CVIMPSTProcessContactListItem::SetCollapsed(TBool aCollapsedStatus)
|
|
472 |
{
|
|
473 |
iCollapsedStatus = aCollapsedStatus;
|
|
474 |
}
|
|
475 |
|
|
476 |
// -----------------------------------------------------------------------------
|
|
477 |
//CVIMPSTProcessContactListItem: GetItemNameText
|
|
478 |
// -----------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
TPtrC CVIMPSTProcessContactListItem::GetItemNameText()
|
|
481 |
{
|
|
482 |
return *iItemNameTextList;
|
|
483 |
}
|
|
484 |
|
|
485 |
// -----------------------------------------------------------------------------
|
|
486 |
//CVIMPSTProcessContactListItem: SetItemNameText
|
|
487 |
// -----------------------------------------------------------------------------
|
|
488 |
//
|
|
489 |
void CVIMPSTProcessContactListItem::SetItemNameText(const TDesC& aItemName)
|
|
490 |
{
|
|
491 |
*iItemNameTextList = aItemName;
|
|
492 |
}
|
|
493 |
|
|
494 |
|
|
495 |
void CVIMPSTProcessContactListItem::DoFormatStringL()
|
|
496 |
{
|
|
497 |
//not implemented
|
|
498 |
}
|
|
499 |
|
|
500 |
TPtrC16 CVIMPSTProcessContactListItem::FormattedItemString()
|
|
501 |
{
|
|
502 |
//Not Implemented
|
|
503 |
return KNullDesC();
|
|
504 |
}
|
|
505 |
|
|
506 |
// -----------------------------------------------------------------------------
|
|
507 |
// CVIMPSTProcessOwnDataItem::NewL
|
|
508 |
// -----------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
CVIMPSTProcessOwnDataItem* CVIMPSTProcessOwnDataItem::NewL(CVIMPSTProcessArray& aParent, TDesC& aOwnId)
|
|
511 |
{
|
|
512 |
CVIMPSTProcessOwnDataItem* self = new( ELeave ) CVIMPSTProcessOwnDataItem(aParent, aOwnId);
|
|
513 |
CleanupStack::PushL( self );
|
|
514 |
self->ConstructL();
|
|
515 |
CleanupStack::Pop(); //Codescanner warning ignored
|
|
516 |
return self;
|
|
517 |
}
|
|
518 |
|
|
519 |
// -----------------------------------------------------------------------------
|
|
520 |
// CVIMPSTProcessOwnDataItem::ConstructL
|
|
521 |
// -----------------------------------------------------------------------------
|
|
522 |
//
|
|
523 |
void CVIMPSTProcessOwnDataItem::ConstructL()
|
|
524 |
{
|
|
525 |
|
|
526 |
}
|
|
527 |
|
|
528 |
// -----------------------------------------------------------------------------
|
|
529 |
// CVIMPSTProcessOwnDataItem::CVIMPSTProcessOwnDataItem
|
|
530 |
// -----------------------------------------------------------------------------
|
|
531 |
//
|
|
532 |
CVIMPSTProcessOwnDataItem::CVIMPSTProcessOwnDataItem(CVIMPSTProcessArray& aParent, TDesC& aOwnId)
|
|
533 |
:iParent(aParent),
|
|
534 |
iOwnDataId(aOwnId)
|
|
535 |
{
|
|
536 |
|
|
537 |
}
|
|
538 |
// -----------------------------------------------------------------------------
|
|
539 |
// CVIMPSTProcessOwnDataItem::~CVIMPSTProcessOwnDataItem
|
|
540 |
// -----------------------------------------------------------------------------
|
|
541 |
//
|
|
542 |
CVIMPSTProcessOwnDataItem::~CVIMPSTProcessOwnDataItem()
|
|
543 |
{
|
|
544 |
|
|
545 |
}
|
|
546 |
|
|
547 |
// -----------------------------------------------------------------------------
|
|
548 |
//CVIMPSTProcessOwnDataItem: Type
|
|
549 |
// -----------------------------------------------------------------------------
|
|
550 |
//
|
|
551 |
TVIMPSTEnums::TItem CVIMPSTProcessOwnDataItem::Type()
|
|
552 |
{
|
|
553 |
return TVIMPSTEnums::EOwnStatusItem;
|
|
554 |
}
|
|
555 |
|
|
556 |
// -----------------------------------------------------------------------------
|
|
557 |
//CVIMPSTProcessOwnDataItemPC: GetItemUserId
|
|
558 |
// -----------------------------------------------------------------------------
|
|
559 |
//
|
|
560 |
TPtrC CVIMPSTProcessOwnDataItem::GetItemUserId()
|
|
561 |
{
|
|
562 |
return iOwnDataId;
|
|
563 |
}
|
|
564 |
|
|
565 |
void CVIMPSTProcessOwnDataItem::DoFormatStringL()
|
|
566 |
{
|
|
567 |
//not implemented
|
|
568 |
}
|
|
569 |
|
|
570 |
TPtrC16 CVIMPSTProcessOwnDataItem::FormattedItemString()
|
|
571 |
{
|
|
572 |
//Not Implemented
|
|
573 |
return KNullDesC();
|
|
574 |
}
|
|
575 |
|
|
576 |
/////////////////////////////////////////////////////////////////////////
|
|
577 |
///////////////////////////////// Unknowncontact item ////////////////////
|
|
578 |
|
|
579 |
|
|
580 |
// -----------------------------------------------------------------------------
|
|
581 |
// CVIMPSTProcessUnknownContactItem::default constructor
|
|
582 |
// -----------------------------------------------------------------------------
|
|
583 |
//
|
|
584 |
CVIMPSTProcessUnknownContactItem::CVIMPSTProcessUnknownContactItem(CVIMPSTProcessArray& aParent)
|
|
585 |
: iParent(aParent)
|
|
586 |
{
|
|
587 |
|
|
588 |
}
|
|
589 |
|
|
590 |
// -----------------------------------------------------------------------------
|
|
591 |
// CVIMPSTProcessUnknownContactItem::NewL
|
|
592 |
// -----------------------------------------------------------------------------
|
|
593 |
//
|
|
594 |
CVIMPSTProcessUnknownContactItem* CVIMPSTProcessUnknownContactItem::NewL(CVIMPSTProcessArray& aParent, const TDesC& aBuddyId )
|
|
595 |
{
|
|
596 |
CVIMPSTProcessUnknownContactItem* self = new (ELeave) CVIMPSTProcessUnknownContactItem(aParent);
|
|
597 |
CleanupStack::PushL(self);
|
|
598 |
self->ConstructL(aBuddyId);
|
|
599 |
CleanupStack::Pop();
|
|
600 |
return self;
|
|
601 |
}
|
|
602 |
|
|
603 |
// -----------------------------------------------------------------------------
|
|
604 |
// CVIMPSTProcessUnknownContactItem::ConstructL
|
|
605 |
// -----------------------------------------------------------------------------
|
|
606 |
//
|
|
607 |
void CVIMPSTProcessUnknownContactItem::ConstructL(const TDesC& aBuddyId)
|
|
608 |
{
|
|
609 |
iUesrId = aBuddyId.AllocL();
|
|
610 |
//load formatted string from resource.
|
|
611 |
iItemNameText = VIMPSTUtils::LoadResourceL(R_SERVTAB_UNKNOWN_BUDDY);
|
|
612 |
iIndex = -1;//default index if no index is set.
|
|
613 |
|
|
614 |
TInt maxLengthOfIcons = KDefaultAvatar().Length()+ // longest A-Column icon
|
|
615 |
(KTab().Length() * 2)+ // length of tabs between items
|
|
616 |
KContactOnlineIconA().Length(); // longest D-Column icon
|
|
617 |
|
|
618 |
iFormattedString = HBufC::NewL( KFriendsListMaxIdentificationLength +
|
|
619 |
KStatusMsgMaxLength +
|
|
620 |
maxLengthOfIcons );
|
|
621 |
|
|
622 |
DoFormatStringL();
|
|
623 |
}
|
|
624 |
|
|
625 |
// -----------------------------------------------------------------------------
|
|
626 |
// CVIMPSTProcessUnknownContactItem::destructor
|
|
627 |
// -----------------------------------------------------------------------------
|
|
628 |
//
|
|
629 |
CVIMPSTProcessUnknownContactItem::~CVIMPSTProcessUnknownContactItem()
|
|
630 |
{
|
|
631 |
delete iItemNameText;
|
|
632 |
delete iUesrId;
|
|
633 |
|
|
634 |
if(iFormattedString)
|
|
635 |
delete iFormattedString;
|
|
636 |
}
|
|
637 |
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
// CVIMPSTProcessUnknownContactItem::GetItemNameText
|
|
640 |
// -----------------------------------------------------------------------------
|
|
641 |
//
|
|
642 |
TPtrC CVIMPSTProcessUnknownContactItem::GetItemNameText()
|
|
643 |
{
|
|
644 |
return iItemNameText->Des();
|
|
645 |
}
|
|
646 |
|
|
647 |
// -----------------------------------------------------------------------------
|
|
648 |
// CVIMPSTProcessUnknownContactItem::Type
|
|
649 |
// -----------------------------------------------------------------------------
|
|
650 |
//
|
|
651 |
TVIMPSTEnums::TItem CVIMPSTProcessUnknownContactItem::Type()
|
|
652 |
{
|
|
653 |
return TVIMPSTEnums::EUnknonContactItem;
|
|
654 |
}
|
|
655 |
/**
|
|
656 |
* Returns the user id of the listbox item
|
|
657 |
* @return TPtrC: user id of the listbox item.
|
|
658 |
*/
|
|
659 |
TPtrC CVIMPSTProcessUnknownContactItem::GetItemUserId()
|
|
660 |
{
|
|
661 |
return iUesrId->Des();
|
|
662 |
}
|
|
663 |
|
|
664 |
// -----------------------------------------------------------------------------
|
|
665 |
//CVIMPSTProcessUnknownContactItem: SetMsgPending
|
|
666 |
// -----------------------------------------------------------------------------
|
|
667 |
//
|
|
668 |
void CVIMPSTProcessUnknownContactItem::SetMsgPending(TBool aPendingMessageStatus)
|
|
669 |
{
|
|
670 |
iSMsgPending = aPendingMessageStatus;
|
|
671 |
|
|
672 |
TRAP_IGNORE(DoFormatStringL());
|
|
673 |
}
|
|
674 |
// -----------------------------------------------------------------------------
|
|
675 |
//CVIMPSTProcessUnknownContactItem: GetMsgPending
|
|
676 |
// -----------------------------------------------------------------------------
|
|
677 |
//
|
|
678 |
TBool CVIMPSTProcessUnknownContactItem::IsMsgPending()
|
|
679 |
{
|
|
680 |
return iSMsgPending;
|
|
681 |
}
|
|
682 |
|
|
683 |
// -----------------------------------------------------------------------------
|
|
684 |
//CVIMPSTProcessUnknownContactItem: SetConversationOpen
|
|
685 |
// -----------------------------------------------------------------------------
|
|
686 |
//
|
|
687 |
void CVIMPSTProcessUnknownContactItem::SetConversationOpen(TBool aConversationOpen)
|
|
688 |
{
|
|
689 |
iIsConversationOpen = aConversationOpen;
|
|
690 |
|
|
691 |
TRAP_IGNORE(DoFormatStringL());
|
|
692 |
}
|
|
693 |
// -----------------------------------------------------------------------------
|
|
694 |
//CVIMPSTProcessUnknownContactItem: IsConversationOpen
|
|
695 |
// -----------------------------------------------------------------------------
|
|
696 |
//
|
|
697 |
TBool CVIMPSTProcessUnknownContactItem::IsConversationOpen()
|
|
698 |
{
|
|
699 |
return iIsConversationOpen;
|
|
700 |
}
|
|
701 |
|
|
702 |
void CVIMPSTProcessUnknownContactItem::DoFormatStringL()
|
|
703 |
{
|
|
704 |
TPtr dataPtr( iFormattedString->Des() );
|
|
705 |
dataPtr.Zero();
|
|
706 |
|
|
707 |
if ( TVIMPSTEnums::ESVCERegistered == iParent.GetLoginState())
|
|
708 |
{
|
|
709 |
// append friend request icon online for column A
|
|
710 |
dataPtr.Append( KDefaultAvatar );
|
|
711 |
}
|
|
712 |
else
|
|
713 |
{// append friend request icon offline for column A
|
|
714 |
dataPtr.Append( KLocalPendingRequestOffline );
|
|
715 |
}
|
|
716 |
|
|
717 |
// B-column append friend request text
|
|
718 |
dataPtr.Append(GetItemUserId().Left( KFriendsListMaxIdentificationLength ));
|
|
719 |
|
|
720 |
// append \t before second line text
|
|
721 |
dataPtr.Append( KTab );
|
|
722 |
|
|
723 |
TPtrC identification(GetItemNameText() );
|
|
724 |
|
|
725 |
dataPtr.Append( identification );
|
|
726 |
|
|
727 |
|
|
728 |
|
|
729 |
|
|
730 |
// append tab before appending icon
|
|
731 |
dataPtr.Append( KTab );
|
|
732 |
|
|
733 |
dataPtr.Append( KEmptyIconA );
|
|
734 |
|
|
735 |
if( iParent.IsIMSupported() )
|
|
736 |
{
|
|
737 |
if( this->IsMsgPending() )
|
|
738 |
{
|
|
739 |
// unread message
|
|
740 |
dataPtr.Append( KContactNewMsgIcon );
|
|
741 |
}
|
|
742 |
else if( this->IsConversationOpen())
|
|
743 |
{
|
|
744 |
// open conversation
|
|
745 |
dataPtr.Append( KContactOpenConvIcon );
|
|
746 |
}
|
|
747 |
else
|
|
748 |
{
|
|
749 |
//empty
|
|
750 |
dataPtr.Append( KEmptyIconC );
|
|
751 |
}
|
|
752 |
}
|
|
753 |
|
|
754 |
}
|
|
755 |
|
|
756 |
|
|
757 |
TPtrC16 CVIMPSTProcessUnknownContactItem::FormattedItemString()
|
|
758 |
{
|
|
759 |
if(iFormattedString)
|
|
760 |
return iFormattedString->Des();
|
|
761 |
else
|
|
762 |
return KNullDesC();
|
|
763 |
}
|
|
764 |
|