|
1 /* |
|
2 * Copyright (c) 2006 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: Single list-array decorator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "MCAMainViewArrayPC.h" |
|
22 #include "MCAProcessManager.h" |
|
23 #include "CCASingleListViewArray.h" |
|
24 |
|
25 #include "MCASkinVariant.h" |
|
26 #include "ChatDebugAssert.h" |
|
27 #include "ChatDebugPrint.h" |
|
28 #include "imutils.h" |
|
29 #include "ccacontactlistboxmodel.h" |
|
30 #include "impsbuilddefinitions.h" |
|
31 #include "CCAContactListBox.h" |
|
32 #include "chatdefinitions.h" |
|
33 |
|
34 // platform includes |
|
35 #include <chatNG.rsg> |
|
36 #include <chatNG.mbg> |
|
37 #include <avkon.mbg> |
|
38 #include <aknutils.h> |
|
39 #include <stringloader.h> |
|
40 #include <AknIconUtils.h> |
|
41 #include <AknIconArray.h> |
|
42 #include <eikclbd.h> |
|
43 |
|
44 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
45 // so the enums for keys and central repository header is added here |
|
46 #include "VariantKeys.h" |
|
47 // CONSTANTS |
|
48 |
|
49 _LIT( KTemporaryAll, "All" ); |
|
50 // constants for column numbers (A=0, B=1, C=2, D=3 ) and font indices |
|
51 const TInt KCColumn = 2; |
|
52 const TInt KPrimaryFont = 0; |
|
53 const TInt KSecondaryFont = 1; |
|
54 |
|
55 // We need to have same icons twice if we're going to use them in both A and |
|
56 // B columns in the same time. Otherwise the list starts to flicker when |
|
57 // marquee is acticve. List has to resize the icon all the time to |
|
58 // refresh the view. |
|
59 |
|
60 // A-column icons |
|
61 _LIT( KEmptyIconA, "4\t" ); |
|
62 _LIT( KListExpandedIcon, "5\t" ); |
|
63 _LIT( KListCollapsedIcon, "6\t" ); |
|
64 _LIT( KChatListExpandedIcon, "21\t" ); |
|
65 _LIT( KChatListCollapsedIcon, "20\t" ); |
|
66 _LIT( KContactOnlineIconA, "12\t" ); |
|
67 _LIT( KContactAwayIconA, "13\t" ); |
|
68 _LIT( KContactOfflineIconA, "14\t" ); |
|
69 |
|
70 _LIT( KContactSelectedIcon, "09\t" ); |
|
71 _LIT( KContactNotSelectedIcon, "10\t" ); |
|
72 _LIT( KContactOnDeviceTypeIconA, "16\t" ); |
|
73 _LIT( KContactAppearOfflineIconA, "19\t" ); |
|
74 // A-column Invitation Icon |
|
75 _LIT( KInvitationIconA, "18\t" ); |
|
76 // B-column icons |
|
77 _LIT( KContactOnlineIconB, "0\t" ); |
|
78 _LIT( KContactOfflineIconB, "1\t" ); |
|
79 _LIT( KContactBlockedIcon, "7\t" ); |
|
80 _LIT( KContactAwayIconB, "8\t" ); |
|
81 _LIT( KContactUnknownIcon, "11\t" ); |
|
82 _LIT( KEmptyIconB, "11\t" ); |
|
83 _LIT( KContactBusyIconB, "15\t" ); |
|
84 _LIT( KContactOnDeviceTypeIconB, "17\t" ); |
|
85 |
|
86 // D-column icons |
|
87 _LIT( KContactWatcherIcon, "\t2" ); |
|
88 #ifdef RD_MESSAGE_INDICATION_NEW |
|
89 _LIT( KContactMsgPendingIcon, "3\t" ); |
|
90 #else |
|
91 _LIT( KContactMsgPendingIcon, "\t3" ); |
|
92 #endif |
|
93 |
|
94 const TInt KIconIndexMaxLenght = 4; |
|
95 |
|
96 |
|
97 // ================= MEMBER FUNCTIONS ======================= |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // Destructor |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 CCASingleListViewArray::~CCASingleListViewArray() |
|
104 { |
|
105 delete iData; |
|
106 delete iAllText; |
|
107 iFonts.Close(); |
|
108 } |
|
109 |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // CCAChatListView::NewL() |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 CCASingleListViewArray* CCASingleListViewArray::NewL( |
|
116 MCAMainViewArrayPC& aMainViewArray, |
|
117 TEnumsPC::TListSelectionType aSelectionList, |
|
118 CColumnListBoxData* aListboxData /*= NULL*/, |
|
119 TBool aShowIndicators /*= ETrue*/, |
|
120 TBool aAutomaticRefresh /*=ETrue*/, |
|
121 CCAContactListBox& aListBox ) |
|
122 { |
|
123 CCASingleListViewArray* self = new ( ELeave ) |
|
124 CCASingleListViewArray( |
|
125 aMainViewArray, |
|
126 aSelectionList, |
|
127 aListboxData, |
|
128 aShowIndicators, |
|
129 aAutomaticRefresh, |
|
130 aListBox ); |
|
131 |
|
132 CleanupStack::PushL( self ); |
|
133 self->ConstructL(); |
|
134 CleanupStack::Pop( self ); |
|
135 return self; |
|
136 } |
|
137 |
|
138 |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // Constructor |
|
142 // C++ default constructor can NOT contain any code, that |
|
143 // might leave. |
|
144 // --------------------------------------------------------- |
|
145 // |
|
146 CCASingleListViewArray::CCASingleListViewArray( |
|
147 MCAMainViewArrayPC& aMainViewArray, |
|
148 TEnumsPC::TListSelectionType aSelectionList, |
|
149 CColumnListBoxData* aListboxData, |
|
150 TBool aShowIndicators, |
|
151 TBool aAutomaticRefresh, |
|
152 CCAContactListBox& aListBox ) |
|
153 : iMainViewArray( aMainViewArray ), |
|
154 iSelectionList( aSelectionList ), |
|
155 iListboxData( aListboxData ), |
|
156 iShowIndicators( aShowIndicators ), |
|
157 iAutomaticRefresh( aAutomaticRefresh ), |
|
158 iListBox ( aListBox ) |
|
159 { |
|
160 iFilter = iMainViewArray.Filter(); |
|
161 } |
|
162 |
|
163 // --------------------------------------------------------- |
|
164 // CCAChatListView::ConstructL() |
|
165 // Symbian OS default constructor can leave. |
|
166 // (other items were commented in a header). |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 void CCASingleListViewArray::ConstructL() |
|
170 { |
|
171 // maximum length of icons appended to identification |
|
172 // There can be four icons (A+B and two on D-column) |
|
173 iMaxLengthOfIcons = |
|
174 KEmptyIconB().Length() + // longest B-column icon |
|
175 KContactOnlineIconA().Length() + // longest A-Column icon |
|
176 KContactWatcherIcon().Length() + |
|
177 KContactMsgPendingIcon().Length(); |
|
178 |
|
179 // Reserve enough memory to handle maximum size item |
|
180 iData = HBufC::NewL( KFriendsListMaxIdentificationLength + |
|
181 iMaxLengthOfIcons ); |
|
182 |
|
183 |
|
184 // set this length to wrapper array... |
|
185 // |
|
186 iAllText = KTemporaryAll().AllocL(); |
|
187 |
|
188 // fetch the font pointers |
|
189 iFonts.AppendL( AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont ) ); |
|
190 iFonts.AppendL( |
|
191 AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ) ); |
|
192 } |
|
193 |
|
194 |
|
195 // --------------------------------------------------------- |
|
196 // CCASingleListViewArray::LoadIconsLC |
|
197 // Loads necessary icons |
|
198 // (other items were commented in a header). |
|
199 // --------------------------------------------------------- |
|
200 // |
|
201 CAknIconArray* CCASingleListViewArray::LoadIconsLC( const TDesC& aMbmFile, |
|
202 MCASkinVariant& aSkinVariant ) |
|
203 { |
|
204 // array granularity is 15, because 15 icons are added to array |
|
205 CAknIconArray* icons = new( ELeave )CAknIconArray( 15 ); |
|
206 CleanupStack::PushL( icons ); |
|
207 |
|
208 icons->AppendL( aSkinVariant.LoadBitmapL( // 0 |
|
209 EMbmChatngQgn_prop_im_friend_on, |
|
210 EMbmChatngQgn_prop_im_friend_on_mask, |
|
211 aMbmFile ) ); |
|
212 icons->AppendL( aSkinVariant.LoadBitmapL( // 1 |
|
213 EMbmChatngQgn_prop_im_friend_off, |
|
214 EMbmChatngQgn_prop_im_friend_off_mask, |
|
215 aMbmFile ) ); |
|
216 |
|
217 icons->AppendL( aSkinVariant.LoadBitmapL( // 2 |
|
218 EMbmChatngQgn_indi_im_watch_add, |
|
219 EMbmChatngQgn_indi_im_watch_add_mask, |
|
220 aMbmFile ) ); |
|
221 icons->AppendL( aSkinVariant.LoadBitmapL( // 3 |
|
222 EMbmChatngQgn_prop_im_imsg_new, |
|
223 EMbmChatngQgn_prop_im_imsg_new_mask, |
|
224 aMbmFile ) ); |
|
225 |
|
226 TPtrC avkonBmpFile( AknIconUtils::AvkonIconFileName() ); |
|
227 icons->AppendL( aSkinVariant.LoadBitmapL( // 4 |
|
228 EMbmAvkonQgn_prop_empty, |
|
229 EMbmAvkonQgn_prop_empty_mask, |
|
230 avkonBmpFile ) ); |
|
231 |
|
232 /*icons->AppendL( aSkinVariant.LoadBitmapL( // 5 |
|
233 EMbmChatngQgn_prop_group_expanded, |
|
234 EMbmChatngQgn_prop_group_expanded_mask, |
|
235 aMbmFile ) ); |
|
236 icons->AppendL( aSkinVariant.LoadBitmapL( // 6 |
|
237 EMbmChatngQgn_prop_group_collapsed, |
|
238 EMbmChatngQgn_prop_group_collapsed_mask, |
|
239 aMbmFile ) ); |
|
240 */ |
|
241 icons->AppendL( aSkinVariant.LoadBitmapL( // 5 |
|
242 EMbmChatngQgn_prop_im_friends_expanded, |
|
243 EMbmChatngQgn_prop_im_friends_expanded_mask, |
|
244 aMbmFile ) ); |
|
245 |
|
246 icons->AppendL( aSkinVariant.LoadBitmapL( // 6 |
|
247 EMbmChatngQgn_prop_im_friends_collapsed, |
|
248 EMbmChatngQgn_prop_im_friends_collapsed_mask, |
|
249 aMbmFile ) ); |
|
250 |
|
251 icons->AppendL( aSkinVariant.LoadBitmapL( // 7 |
|
252 EMbmChatngQgn_prop_im_user_blocked, |
|
253 EMbmChatngQgn_prop_im_user_blocked_mask, |
|
254 aMbmFile ) ); |
|
255 icons->AppendL( aSkinVariant.LoadBitmapL( // 8 |
|
256 EMbmChatngQgn_prop_im_friend_away, |
|
257 EMbmChatngQgn_prop_im_friend_away_mask, |
|
258 aMbmFile ) ); |
|
259 |
|
260 //Change the check box icon to correct type as specified by UI Specification |
|
261 icons->AppendL( aSkinVariant.LoadBitmapL( // 9 |
|
262 EMbmAvkonQgn_prop_checkbox_on, |
|
263 EMbmAvkonQgn_prop_checkbox_on_mask, |
|
264 avkonBmpFile ) ); |
|
265 icons->AppendL( aSkinVariant.LoadBitmapL( // 10 |
|
266 EMbmAvkonQgn_prop_checkbox_off, |
|
267 EMbmAvkonQgn_prop_checkbox_off_mask, |
|
268 avkonBmpFile ) ); |
|
269 |
|
270 icons->AppendL( aSkinVariant.LoadBitmapL( // 11 |
|
271 EMbmAvkonQgn_prop_empty, |
|
272 EMbmAvkonQgn_prop_empty_mask, |
|
273 avkonBmpFile ) ); |
|
274 |
|
275 icons->AppendL( aSkinVariant.LoadBitmapL( // 12 |
|
276 EMbmChatngQgn_prop_im_friend_on, |
|
277 EMbmChatngQgn_prop_im_friend_on_mask, |
|
278 aMbmFile ) ); |
|
279 |
|
280 icons->AppendL( aSkinVariant.LoadBitmapL( // 13 |
|
281 EMbmChatngQgn_prop_im_friend_away, |
|
282 EMbmChatngQgn_prop_im_friend_away_mask, |
|
283 aMbmFile ) ); |
|
284 |
|
285 icons->AppendL( aSkinVariant.LoadBitmapL( // 14 |
|
286 EMbmChatngQgn_prop_im_friend_off, |
|
287 EMbmChatngQgn_prop_im_friend_off_mask, |
|
288 aMbmFile ) ); |
|
289 |
|
290 icons->AppendL( aSkinVariant.LoadBitmapL( // 15 |
|
291 EMbmChatngQgn_prop_im_friend_busy, |
|
292 EMbmChatngQgn_prop_im_friend_busy_mask, |
|
293 aMbmFile ) ); |
|
294 |
|
295 icons->AppendL( aSkinVariant.LoadBitmapL( // 16 |
|
296 EMbmChatngQgn_prop_im_on_mobile_title, |
|
297 EMbmChatngQgn_prop_im_on_mobile_title_mask, |
|
298 aMbmFile ) ); |
|
299 |
|
300 icons->AppendL( aSkinVariant.LoadBitmapL( // 17 |
|
301 EMbmChatngQgn_prop_im_on_mobile_title, |
|
302 EMbmChatngQgn_prop_im_on_mobile_title_mask, |
|
303 aMbmFile ) ); |
|
304 |
|
305 //for invitations |
|
306 icons->AppendL( aSkinVariant.LoadBitmapL( // 18 |
|
307 EMbmChatngQgn_prop_im_new_invit, |
|
308 EMbmChatngQgn_prop_im_new_invit_mask, |
|
309 aMbmFile ) ); |
|
310 |
|
311 icons->AppendL( aSkinVariant.LoadBitmapL( // 19 |
|
312 EMbmChatngQgn_prop_im_friend_invisible, |
|
313 EMbmChatngQgn_prop_im_friend_invisible_mask, |
|
314 aMbmFile ) ); |
|
315 |
|
316 icons->AppendL( aSkinVariant.LoadBitmapL( // 20 |
|
317 EMbmChatngQgn_prop_im_chats_collapsed, |
|
318 EMbmChatngQgn_prop_im_chats_collapsed_mask, |
|
319 aMbmFile ) ); |
|
320 |
|
321 icons->AppendL( aSkinVariant.LoadBitmapL( // 21 |
|
322 EMbmChatngQgn_prop_im_chats_expanded, |
|
323 EMbmChatngQgn_prop_im_chats_expanded_mask, |
|
324 aMbmFile ) ); |
|
325 |
|
326 return icons; |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------- |
|
330 // CCASingleListViewArray::SetFilterType( TFilterType aFilter ) |
|
331 // --------------------------------------------------------- |
|
332 // |
|
333 void CCASingleListViewArray::SetFilterType( |
|
334 TEnumsPC::TFilterType aFilter ) |
|
335 { |
|
336 iFilter = aFilter; |
|
337 iMainViewArray.SetSingleListArrayFilter( iFilter ); |
|
338 } |
|
339 |
|
340 // --------------------------------------------------------- |
|
341 // CCASingleListViewArray::MdcaCount |
|
342 // Returns the number of descriptor elements in a descriptor array. |
|
343 // (other items were commented in a header). |
|
344 // --------------------------------------------------------- |
|
345 // |
|
346 TInt CCASingleListViewArray::MdcaCount() const |
|
347 { |
|
348 return iMainViewArray.Count(); |
|
349 } |
|
350 |
|
351 // --------------------------------------------------------- |
|
352 // CCASingleListViewArray::MdcaCount |
|
353 // Return pointer to descriptor data in given index of an array |
|
354 // (other items were commented in a header). |
|
355 // --------------------------------------------------------- |
|
356 // |
|
357 TPtrC16 CCASingleListViewArray::MdcaPoint( TInt aIndex ) const |
|
358 { |
|
359 // Although this is a const method, we do change the member data. |
|
360 // This is done because of performance |
|
361 // -> no need to create new buffer every time. |
|
362 TPtr dataPtr( iData->Des() ); |
|
363 dataPtr.Zero(); |
|
364 |
|
365 TInt fontIndex( KSecondaryFont ); |
|
366 |
|
367 // fetch the item and process correct type |
|
368 TEnumsPC::TItem ItemType = iMainViewArray.GetType( aIndex ); |
|
369 |
|
370 if ( aIndex == iListBox.TopItemIndex() && iSelectionList == TEnumsPC::ESingleListViewSelect ) |
|
371 { |
|
372 ItemType = TEnumsPC::EOwnStatusItem; |
|
373 aIndex = 0; |
|
374 } |
|
375 else |
|
376 { |
|
377 ItemType = iMainViewArray.GetType( aIndex ); |
|
378 } |
|
379 |
|
380 |
|
381 switch ( ItemType ) |
|
382 { |
|
383 case TEnumsPC::EOwnStatusItem: |
|
384 { |
|
385 fontIndex = KPrimaryFont; |
|
386 // Own data...... |
|
387 AppendOwnData( dataPtr, aIndex ); |
|
388 break; |
|
389 } |
|
390 case TEnumsPC::EOpenChatsListItem: |
|
391 { |
|
392 fontIndex = KPrimaryFont; |
|
393 // Openchats folder data...... |
|
394 AppendOpenChatsList( dataPtr, aIndex ); |
|
395 break; |
|
396 } |
|
397 case TEnumsPC::EConversationItem: |
|
398 { |
|
399 // ongoing conversatiosn data...... |
|
400 AppendConversationItem( dataPtr, aIndex ); |
|
401 break; |
|
402 } |
|
403 |
|
404 case TEnumsPC::EContactListItem: |
|
405 { |
|
406 // contact list |
|
407 fontIndex = KPrimaryFont; |
|
408 TRAPD( err, AppendContactListL( dataPtr, aIndex ) ); |
|
409 |
|
410 if ( err != KErrNone ) |
|
411 { |
|
412 CActiveScheduler::Current()->Error( err ); |
|
413 } |
|
414 break; |
|
415 } |
|
416 case TEnumsPC::EContactItem: |
|
417 { |
|
418 // contact item |
|
419 AppendContact( dataPtr, aIndex ); |
|
420 break; |
|
421 } |
|
422 case TEnumsPC::EAll: |
|
423 { |
|
424 // "All" |
|
425 AppendAll( dataPtr, aIndex ); |
|
426 break; |
|
427 } |
|
428 |
|
429 case TEnumsPC::EInviteItem: |
|
430 { |
|
431 // InvitationItem data...... |
|
432 AppendInvitationItem( dataPtr, aIndex ); |
|
433 break; |
|
434 } |
|
435 case TEnumsPC::EGroupItem: |
|
436 { |
|
437 // InvitationItem data...... |
|
438 AppendGroupItem( dataPtr, aIndex ); |
|
439 break; |
|
440 } |
|
441 default: |
|
442 { |
|
443 // shouldn't be here |
|
444 __CHAT_ASSERT_DEBUG( EFalse ); |
|
445 } |
|
446 } //end outer switch |
|
447 |
|
448 // set font if we have listbox data |
|
449 if ( iListboxData ) |
|
450 { |
|
451 // text is in C-column |
|
452 if ( iContactListBoxModel ) |
|
453 { |
|
454 TInt index = iContactListBoxModel->VisibleItemIndex( aIndex ); |
|
455 |
|
456 ItemType = iMainViewArray.GetType( index ); |
|
457 TInt err = KErrNone; |
|
458 |
|
459 if ( ItemType == TEnumsPC::EOwnStatusItem ) |
|
460 { |
|
461 TInt topIndex = iListBox.TopItemIndex(); |
|
462 fontIndex = KPrimaryFont; |
|
463 TRAP( err, iListboxData->SetColumnFontForRowL( topIndex, |
|
464 KCColumn, iFonts[ fontIndex ] ) ); |
|
465 |
|
466 } |
|
467 else |
|
468 { |
|
469 TRAP( err, iListboxData->SetColumnFontForRowL( index, |
|
470 KCColumn, iFonts[ fontIndex ] ) ); |
|
471 |
|
472 } |
|
473 if ( err != KErrNone ) |
|
474 { |
|
475 CActiveScheduler::Current()->Error( err ); |
|
476 } |
|
477 } |
|
478 } |
|
479 return dataPtr; |
|
480 } |
|
481 |
|
482 // --------------------------------------------------------- |
|
483 // CCASingleListViewArray::AppendOpenChatsList |
|
484 // (other items were commented in a header). |
|
485 // --------------------------------------------------------- |
|
486 // |
|
487 void CCASingleListViewArray::AppendOpenChatsList( TPtr& aBuffer, TInt aIndex ) const |
|
488 { |
|
489 // append the data to A-column of the list box |
|
490 aBuffer.Append( iMainViewArray.IsCollapsed( aIndex ) |
|
491 ? KChatListCollapsedIcon : KChatListExpandedIcon ); |
|
492 |
|
493 // append the data to B-column of the list box |
|
494 aBuffer.Append( KTab ); |
|
495 |
|
496 // append the data to C-column of the list box |
|
497 aBuffer.Append( iMainViewArray.GetItemNameText( aIndex ) ); |
|
498 |
|
499 |
|
500 // D - Column,is not needed |
|
501 |
|
502 } |
|
503 |
|
504 // --------------------------------------------------------- |
|
505 // CCASingleListViewArray::AppendConversationItem |
|
506 // (other items were commented in a header). |
|
507 // --------------------------------------------------------- |
|
508 // |
|
509 void CCASingleListViewArray::AppendConversationItem( TPtr& aBuffer, TInt aIndex ) const |
|
510 { |
|
511 // A Column |
|
512 aBuffer.Append( KEmptyIconA ); |
|
513 |
|
514 // B-column |
|
515 if ( iMainViewArray.IsMsgPending( aIndex ) ) |
|
516 { |
|
517 aBuffer.Append( KContactMsgPendingIcon ); |
|
518 } |
|
519 else |
|
520 { |
|
521 aBuffer.Append( KEmptyIconB ); |
|
522 } |
|
523 |
|
524 |
|
525 // C-Column |
|
526 aBuffer.Append( iMainViewArray.GetItemNameText( aIndex ) ); |
|
527 |
|
528 |
|
529 } |
|
530 // --------------------------------------------------------- |
|
531 // CCASingleListViewArray::AppendGroupItem |
|
532 // (other items were commented in a header). |
|
533 // --------------------------------------------------------- |
|
534 // |
|
535 void CCASingleListViewArray::AppendGroupItem( TPtr& aBuffer, TInt aIndex ) const |
|
536 { |
|
537 // A Column |
|
538 aBuffer.Append( KEmptyIconA ); |
|
539 |
|
540 |
|
541 // B-column |
|
542 if ( iMainViewArray.IsMsgPending( aIndex ) ) |
|
543 { |
|
544 aBuffer.Append( KContactMsgPendingIcon ); |
|
545 } |
|
546 else |
|
547 { |
|
548 aBuffer.Append( KEmptyIconB ); |
|
549 } |
|
550 |
|
551 // C-Column |
|
552 aBuffer.Append( iMainViewArray.GetItemNameText( aIndex ) ); |
|
553 |
|
554 |
|
555 } |
|
556 |
|
557 |
|
558 // --------------------------------------------------------- |
|
559 // CCASingleListViewArray::AppendInvitationItem |
|
560 // (other items were commented in a header). |
|
561 // --------------------------------------------------------- |
|
562 // |
|
563 void CCASingleListViewArray::AppendInvitationItem( TPtr& aBuffer, TInt aIndex ) const |
|
564 { |
|
565 // A Column |
|
566 aBuffer.Append( KEmptyIconA ); |
|
567 |
|
568 // B-column |
|
569 if ( iMainViewArray.GetType( aIndex ) == TEnumsPC::EInviteItem ) |
|
570 { |
|
571 aBuffer.Append( KInvitationIconA ); |
|
572 } |
|
573 else |
|
574 { |
|
575 aBuffer.Append( KEmptyIconB ); |
|
576 } |
|
577 |
|
578 // C-Column |
|
579 aBuffer.Append( iMainViewArray.GetItemNameText( aIndex ) ); |
|
580 } |
|
581 |
|
582 // --------------------------------------------------------- |
|
583 // CCASingleListViewArray::AppendContact |
|
584 // Append formatted contact identification to buffer |
|
585 // (other items were commented in a header). |
|
586 // --------------------------------------------------------- |
|
587 // |
|
588 void CCASingleListViewArray::AppendContact( TPtr& aBuffer, TInt aIndex ) const |
|
589 { |
|
590 // A-column |
|
591 if ( iSelectionList == TEnumsPC::EMultiSelect || |
|
592 iSelectionList == TEnumsPC::ESingleListMultiSelect ) //For checkbox to be displayed |
|
593 { |
|
594 aBuffer.Append( iMainViewArray.Selected( aIndex ) ? |
|
595 KContactSelectedIcon : KContactNotSelectedIcon ); |
|
596 } |
|
597 /* |
|
598 * only in single list view we show msg pending icon and not for SINGLE SELECT |
|
599 * or MULTI SELECT mode |
|
600 */ |
|
601 else if ( iSelectionList == TEnumsPC::ESingleListViewSelect ) |
|
602 { |
|
603 #ifdef RD_MESSAGE_INDICATION_NEW |
|
604 // A-column |
|
605 if ( iMainViewArray.IsMsgPending( aIndex ) && iShowIndicators ) |
|
606 { |
|
607 // Add icon if there are unreaded p2p messages |
|
608 aBuffer.Append( KContactMsgPendingIcon ); |
|
609 } |
|
610 else |
|
611 { |
|
612 aBuffer.Append( KEmptyIconA ); |
|
613 } |
|
614 #else |
|
615 aBuffer.Append( KEmptyIconA ); |
|
616 #endif |
|
617 } |
|
618 else |
|
619 { |
|
620 aBuffer.Append( KEmptyIconA ); |
|
621 } |
|
622 |
|
623 // B-column |
|
624 if ( iMainViewArray.IsBlocked( aIndex ) ) |
|
625 { |
|
626 // contact is blocked |
|
627 aBuffer.Append( KContactBlockedIcon ); |
|
628 } |
|
629 else |
|
630 { |
|
631 // contact isn't blocked, check the status |
|
632 switch ( iMainViewArray.GetOnlineStatus( aIndex ) ) |
|
633 { |
|
634 case TEnumsPC::EOnline: |
|
635 { |
|
636 TBuf<KIconIndexMaxLenght> icon( KContactOnlineIconB ); |
|
637 TInt value( 0 ); |
|
638 TInt ignore( 0 ); |
|
639 TRAP( ignore, value = IMUtils::IntResourceValueL( |
|
640 RSC_CHAT_VARIATION_DEVICE_TYPE_TO_ONLINE_STATUS ) ); |
|
641 if ( value ) |
|
642 { |
|
643 if ( iMainViewArray.ClientType( aIndex ) == TEnumsPC::EMobile ) |
|
644 { |
|
645 icon = KContactOnDeviceTypeIconB; |
|
646 } |
|
647 } |
|
648 aBuffer.Append( icon ); |
|
649 break; |
|
650 } |
|
651 case TEnumsPC::EOffline: |
|
652 { |
|
653 aBuffer.Append( KContactOfflineIconB ); |
|
654 break; |
|
655 } |
|
656 case TEnumsPC::EAway: |
|
657 { |
|
658 aBuffer.Append( KContactAwayIconB ); |
|
659 break; |
|
660 } |
|
661 case TEnumsPC::EBusy: |
|
662 { |
|
663 aBuffer.Append( KContactBusyIconB ); |
|
664 break; |
|
665 } |
|
666 case TEnumsPC::EUnknown: // flowthrough |
|
667 default: |
|
668 { |
|
669 aBuffer.Append( KContactUnknownIcon ); |
|
670 break; |
|
671 } |
|
672 } |
|
673 } |
|
674 |
|
675 // C-column |
|
676 TPtrC identification( iMainViewArray.GetItemNameText( aIndex ) ); |
|
677 aBuffer.Append( identification.Left( aBuffer.MaxLength() - iMaxLengthOfIcons ) ); |
|
678 |
|
679 #ifndef RD_MESSAGE_INDICATION_NEW |
|
680 // D-column |
|
681 if ( iMainViewArray.IsMsgPending( aIndex ) && iShowIndicators ) |
|
682 { |
|
683 // Add icon if there are unreaded p2p messages |
|
684 aBuffer.Append( KContactMsgPendingIcon ); |
|
685 } |
|
686 #endif |
|
687 |
|
688 if ( iMainViewArray.IsWatched( aIndex ) && iShowIndicators && iAutomaticRefresh ) |
|
689 { |
|
690 // Add icon if contact's presence is watched |
|
691 aBuffer.Append( KContactWatcherIcon ); |
|
692 } |
|
693 }//end AppendContact(..) |
|
694 |
|
695 |
|
696 #ifdef IMPS_CONTACT_FETCH_BACKGROUND |
|
697 // --------------------------------------------------------- |
|
698 // CCASingleListViewArray::AppendContactListL |
|
699 // Append formatted contact list identification to buffer |
|
700 // (other items were commented in a header). |
|
701 // --------------------------------------------------------- |
|
702 // |
|
703 void CCASingleListViewArray::AppendContactListL( TPtr& aBuffer, TInt aIndex ) const |
|
704 { |
|
705 TEnumsPC::TSyncStatus syncState = iMainViewArray.Synchronised( aIndex ); |
|
706 // A-column |
|
707 if ( syncState == TEnumsPC::ESyncSuccess ) |
|
708 { |
|
709 aBuffer.Append( iMainViewArray.IsCollapsed( aIndex ) |
|
710 && !iMainViewArray.IsForceExpanded() |
|
711 ? KListCollapsedIcon : KListExpandedIcon ); |
|
712 } |
|
713 else |
|
714 { |
|
715 aBuffer.Append( KEmptyIconA ); |
|
716 } |
|
717 |
|
718 // B-column |
|
719 aBuffer.Append( KTab ); |
|
720 |
|
721 // C-column |
|
722 // append "number of online contacts / total number |
|
723 // of contacts" after identification |
|
724 |
|
725 if ( syncState == TEnumsPC::ESyncSuccess ) |
|
726 { |
|
727 |
|
728 // have only one icon in D-column |
|
729 |
|
730 TPtrC identification( iMainViewArray.GetItemNameText( aIndex ) ); |
|
731 aBuffer.Append( identification.Left( aBuffer.MaxLength() - iMaxLengthOfIcons ) ); |
|
732 |
|
733 } |
|
734 else if ( syncState == TEnumsPC::ESyncFailed ) |
|
735 { |
|
736 HBufC* text = StringLoader::LoadL( R_QTN_CHAT_CONTACTLIST_FETCHING_FAILED, |
|
737 iMainViewArray.GetItemNameText( aIndex ) ); |
|
738 aBuffer.Append( text->Des() ); |
|
739 delete text; |
|
740 } |
|
741 else |
|
742 { |
|
743 HBufC* text = StringLoader::LoadL( R_QTN_CHAT_CONTACTLIST_FETCHING ); |
|
744 aBuffer.Append( text->Des() ); |
|
745 delete text; |
|
746 } |
|
747 /* |
|
748 #ifndef RD_MESSAGE_INDICATION_NEW |
|
749 // D-column |
|
750 if( iMainViewArray.IsMsgPending( aIndex ) && iShowIndicators && |
|
751 syncState == TEnumsPC::ESyncSuccess ) |
|
752 { |
|
753 // Add icon if there are unreaded p2p messages |
|
754 aBuffer.Append( KContactMsgPendingIcon ); |
|
755 } |
|
756 #endif |
|
757 */ |
|
758 } |
|
759 |
|
760 #else |
|
761 // --------------------------------------------------------- |
|
762 // CCASingleListViewArray::AppendContactListL |
|
763 // Append formatted contact list identification to buffer |
|
764 // (other items were commented in a header). |
|
765 // --------------------------------------------------------- |
|
766 // |
|
767 void CCASingleListViewArray::AppendContactListL( TPtr& aBuffer, |
|
768 TInt aIndex ) const |
|
769 { |
|
770 // A-column |
|
771 aBuffer.Append( iMainViewArray.IsCollapsed( aIndex ) |
|
772 && !iMainViewArray.IsForceExpanded() |
|
773 ? KListCollapsedIcon : KListExpandedIcon ); |
|
774 |
|
775 // B-column |
|
776 aBuffer.Append( KTab ); |
|
777 |
|
778 // C-column |
|
779 // append "number of online contacts / total number |
|
780 // of contacts" after identification |
|
781 // have only one icon in D-column |
|
782 TPtrC identification( iMainViewArray.GetItemNameText( aIndex ) ); |
|
783 aBuffer.Append( identification.Left( |
|
784 aBuffer.MaxLength() - iMaxLengthOfIcons ) ); |
|
785 /* |
|
786 #ifndef RD_MESSAGE_INDICATION_NEW |
|
787 |
|
788 // D-column |
|
789 if( iMainViewArray.IsMsgPending(aIndex) > 0 && iShowIndicators ) |
|
790 { |
|
791 // Add icon if there are unreaded p2p messages |
|
792 aBuffer.Append( KContactMsgPendingIcon ); |
|
793 } |
|
794 #endif |
|
795 */ |
|
796 } |
|
797 |
|
798 #endif //IMPS_CONTACT_FETCH_BACKGROUND |
|
799 |
|
800 |
|
801 |
|
802 // --------------------------------------------------------- |
|
803 // CCASingleListViewArray::AppendAll |
|
804 // (other items were commented in a header). |
|
805 // --------------------------------------------------------- |
|
806 // |
|
807 |
|
808 void CCASingleListViewArray::AppendAll( TPtr& aBuffer, TInt aIndex ) const |
|
809 { |
|
810 // A-column |
|
811 if ( iSelectionList == TEnumsPC::EMultiSelect || |
|
812 iSelectionList == TEnumsPC::ESingleListMultiSelect ) //check box for multi select |
|
813 { |
|
814 aBuffer.Append( iMainViewArray.Selected( aIndex ) |
|
815 ? KContactSelectedIcon : KContactNotSelectedIcon ); |
|
816 |
|
817 } |
|
818 else if ( iSelectionList != TEnumsPC::EUnknownSelect ) |
|
819 { |
|
820 aBuffer.Append( KEmptyIconA ); |
|
821 } |
|
822 |
|
823 // B-column |
|
824 aBuffer.Append( KTab ); |
|
825 |
|
826 // C-column |
|
827 aBuffer.Append( *iAllText ); |
|
828 } |
|
829 |
|
830 // --------------------------------------------------------- |
|
831 // CCASingleListViewArray::AppendOwnData |
|
832 // (other items were commented in a header). |
|
833 // --------------------------------------------------------- |
|
834 // |
|
835 void CCASingleListViewArray::AppendOwnData( TPtr& aBuffer, TInt aIndex ) const |
|
836 { |
|
837 |
|
838 // append each string to each column in the list box... |
|
839 |
|
840 // append to A-Column |
|
841 switch ( iMainViewArray.GetOnlineStatus( aIndex ) ) |
|
842 { |
|
843 case TEnumsPC::EOnline: |
|
844 { |
|
845 TBuf<KIconIndexMaxLenght> icon( KContactOnlineIconA ); |
|
846 TInt value( 0 ); |
|
847 TInt ignore( 0 ); |
|
848 TRAP( ignore, value = IMUtils::IntResourceValueL( |
|
849 RSC_CHAT_VARIATION_DEVICE_TYPE_TO_ONLINE_STATUS ) ); |
|
850 if ( value ) |
|
851 { |
|
852 if ( iMainViewArray.ClientType( aIndex ) |
|
853 == TEnumsPC::EMobile ) |
|
854 { |
|
855 icon = KContactOnDeviceTypeIconA; |
|
856 } |
|
857 } |
|
858 aBuffer.Append( icon ); |
|
859 break; |
|
860 } |
|
861 case TEnumsPC::EInvisible: |
|
862 { |
|
863 aBuffer.Append( KContactAppearOfflineIconA ); |
|
864 break; |
|
865 } |
|
866 case TEnumsPC::EAway: |
|
867 { |
|
868 aBuffer.Append( KContactAwayIconA ); |
|
869 break; |
|
870 } |
|
871 case TEnumsPC::EOffline: //Flowthrough |
|
872 default: |
|
873 { |
|
874 aBuffer.Append( KContactOfflineIconA ); |
|
875 break; |
|
876 } |
|
877 }//end switch of TEnumsPC::EOwnStatusItem |
|
878 // append to B-Column |
|
879 // B-Column |
|
880 aBuffer.Append( KTab ); |
|
881 aBuffer.Append( iMainViewArray.GetItemNameText( aIndex ) ); |
|
882 } |
|
883 |
|
884 // --------------------------------------------------------- |
|
885 // CCASingleListViewArray::SetContactListModel |
|
886 // (other items were commented in a header). |
|
887 // --------------------------------------------------------- |
|
888 // |
|
889 void CCASingleListViewArray::SetContactListBoxModel( CCAContactListBoxModel* aModel ) |
|
890 { |
|
891 iContactListBoxModel = aModel; |
|
892 } |
|
893 |
|
894 // --------------------------------------------------------- |
|
895 // CCASingleListViewArray::SetAutomaticRefresh |
|
896 // (other items were commented in a header). |
|
897 // --------------------------------------------------------- |
|
898 // |
|
899 void CCASingleListViewArray::SetAutomaticRefresh( TBool aAutomaticRefresh ) |
|
900 { |
|
901 iAutomaticRefresh = aAutomaticRefresh; |
|
902 } |
|
903 |
|
904 // End of File |