author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:16:29 +0300 | |
branch | RCL_3 |
changeset 34 | e7f34e614544 |
parent 29 | 9a48e301e94b |
permissions | -rw-r--r-- |
29 | 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: Implementation for CVIMPSTUiDoubleListBoxTabViewControl. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDE FILES |
|
19 |
#include "cvimpstuidoublelistboxtabviewcontrol.h" |
|
20 |
||
21 |
#include "cvimpstuidoublelistboxarray.h" |
|
22 |
#include "tvimpstenums.h" |
|
23 |
#include "mvimpstcmdhandler.h" |
|
24 |
#include "cvimpstuibranddata.h" |
|
25 |
#include "imcvuiliterals.h" |
|
26 |
#include "cvimpstuilistboxmodel.h" |
|
27 |
#include "vimpstutilsdialog.h" |
|
28 |
#include "vimpstui.hrh" |
|
29 |
#include "cvimpstuitabbedview.h" |
|
30 |
#include "mvimpstengine.h" |
|
31 |
#include "cvimpststoragemanagerfactory.h" |
|
32 |
#include "mvimpststorageserviceview.h" |
|
33 |
#include "cvimpstsettingsstore.h" // settings store in cenrep used for own avatar data |
|
34 |
#include "cvimpstengineimagehandler.h" |
|
35 |
// system include |
|
36 |
#include <aknenv.h> |
|
37 |
#include <aknlists.h> |
|
38 |
#include <AknIconArray.h> |
|
39 |
#include <eikclbd.h> |
|
40 |
#include <aknsfld.h> |
|
41 |
#include <AknUtils.h> |
|
42 |
#include <AknLayout.lag> |
|
43 |
#include <StringLoader.h> |
|
44 |
// Pbk2 |
|
45 |
#include <MPbk2KeyEventHandler.h> |
|
46 |
#include <vimpstuires.rsg> |
|
47 |
||
48 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
49 |
#include "uiservicetabtracer.h" |
|
50 |
// imlauncher |
|
51 |
#include <imcvlauncher.h> |
|
52 |
const TInt KTextLimit( 40 ); // Text-limit for find-field |
|
53 |
||
54 |
const TInt KMinContact(1); // minmimum number of contacts to show findpane |
|
55 |
||
56 |
// ================= MEMBER FUNCTIONS ======================= |
|
57 |
||
58 |
inline CVIMPSTUiDoubleStyleListBox& CVIMPSTUiDoubleListBoxTabViewControl::ListBox() const |
|
59 |
{ |
|
60 |
return(*iListBox); |
|
61 |
} |
|
62 |
// -------------------------------------------------------------------------- |
|
63 |
// CVIMPSTUiDoubleListBoxTabViewControl::CVIMPSTUiDoubleListBoxTabViewControl |
|
64 |
// -------------------------------------------------------------------------- |
|
65 |
// |
|
66 |
CVIMPSTUiDoubleListBoxTabViewControl::CVIMPSTUiDoubleListBoxTabViewControl(CVIMPSTUiTabbedView& aTabbedView, MPbk2KeyEventHandler* aKeyEventHandler, |
|
67 |
MVIMPSTCmdHandler& aCommandHandler, |
|
68 |
TUint32 aServiceId, |
|
69 |
CVIMPSTUiBrandData& aBrandHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
70 |
MVIMPSTEngine& aEngine ) |
29 | 71 |
:iTabbedView(aTabbedView), |
72 |
iKeyEventHandler(aKeyEventHandler), |
|
73 |
iCommandHandler(aCommandHandler), |
|
74 |
iArrayProcess(iCommandHandler.GetProcessInterface()), |
|
75 |
iServiceId(aServiceId), |
|
76 |
iBrandHandler(aBrandHandler), |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
77 |
iEngine(aEngine) |
29 | 78 |
{ |
79 |
||
80 |
} |
|
81 |
||
82 |
||
83 |
// -------------------------------------------------------------------------- |
|
84 |
// CVIMPSTUiDoubleListBoxTabViewControl::ConstructL |
|
85 |
// -------------------------------------------------------------------------- |
|
86 |
// |
|
87 |
void CVIMPSTUiDoubleListBoxTabViewControl::ConstructL() |
|
88 |
{ |
|
89 |
TRACER_AUTO; |
|
90 |
CreateWindowL(); |
|
91 |
// register to get the call back for any array data change |
|
92 |
iArrayProcess.AddObserver(this); |
|
93 |
// this to make sure that if user id changed storage should be refresh with new user id |
|
94 |
// Initialize the listbox |
|
95 |
// Create and construct listbox |
|
96 |
iListBox = new ( ELeave ) CVIMPSTUiDoubleStyleListBox; |
|
97 |
||
98 |
iListBox->ConstructL(this , EAknListBoxSelectionList); |
|
99 |
||
100 |
iListBox->SetContactListModelL(iArrayProcess); |
|
101 |
||
102 |
iListBox->SetListBoxObserver( this ); |
|
103 |
||
104 |
iListBox->SetContainerWindowL(*this); |
|
105 |
iListBox->CreateScrollBarFrameL(ETrue); |
|
106 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
|
107 |
(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
108 |
// set marquee on |
|
109 |
iListBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); |
|
110 |
// If engine is uninstalled, do not construct the list view. |
|
111 |
// Display empty message |
|
112 |
if (iEngine.IsUnInstalled()) |
|
113 |
{ |
|
114 |
SetListEmptyTextL( R_QTN_SERVTAB_SWUPDATE_RESTART ); |
|
115 |
return; |
|
116 |
} |
|
117 |
else |
|
118 |
{ |
|
119 |
// Construction of the listbox view. Engine is not uninstalled. |
|
120 |
CVIMPSTUiDoubleListboxArray* friendsArray = |
|
121 |
CVIMPSTUiDoubleListboxArray::NewL(iArrayProcess, |
|
122 |
iListBox->ItemDrawer()->ColumnData(), *iListBox, |
|
123 |
*this); |
|
124 |
// now set the array |
|
125 |
iListBox->Model()->SetItemTextArray(friendsArray); |
|
126 |
||
127 |
iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); |
|
128 |
// if there is any contact other than owndata , show findpane |
|
129 |
if (iListBox->Model()->NumberOfItems() > KMinContact) |
|
130 |
{ |
|
131 |
// Create find-pane |
|
132 |
ActivateFindPaneL(); |
|
133 |
} |
|
134 |
LoadBitmapsL(); |
|
135 |
SetCbaLockL(EFalse); |
|
136 |
} |
|
137 |
||
138 |
} |
|
139 |
// -------------------------------------------------------------------------- |
|
140 |
// CVIMPSTUiDoubleListBoxTabViewControl::NewL |
|
141 |
// -------------------------------------------------------------------------- |
|
142 |
// |
|
143 |
CVIMPSTUiDoubleListBoxTabViewControl* CVIMPSTUiDoubleListBoxTabViewControl::NewL |
|
144 |
(CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler, |
|
145 |
MVIMPSTCmdHandler& aCommandHandler, TUint32 aServiceId, |
|
146 |
CVIMPSTUiBrandData& aBrandHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
147 |
MVIMPSTEngine& aEngine) |
29 | 148 |
{ |
149 |
TRACER_AUTO; |
|
150 |
CVIMPSTUiDoubleListBoxTabViewControl* self = NewLC(aTabbedView,aKeyEventHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
151 |
aCommandHandler, aServiceId, aBrandHandler,aEngine); |
29 | 152 |
CleanupStack::Pop(self); |
153 |
return self; |
|
154 |
} |
|
155 |
||
156 |
||
157 |
// -------------------------------------------------------------------------- |
|
158 |
// CVIMPSTUiDoubleListBoxTabViewControl::NewLC |
|
159 |
// -------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
CVIMPSTUiDoubleListBoxTabViewControl* CVIMPSTUiDoubleListBoxTabViewControl::NewLC |
|
162 |
(CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler, |
|
163 |
MVIMPSTCmdHandler& aCommandHandler, TUint32 aServiceId, |
|
164 |
CVIMPSTUiBrandData& aBrandHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
165 |
MVIMPSTEngine& aEngine) |
29 | 166 |
{ |
167 |
TRACER_AUTO; |
|
168 |
CVIMPSTUiDoubleListBoxTabViewControl* self = |
|
169 |
new (ELeave) CVIMPSTUiDoubleListBoxTabViewControl(aTabbedView,aKeyEventHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
170 |
aCommandHandler, aServiceId, aBrandHandler,aEngine); |
29 | 171 |
CleanupStack::PushL(self); |
172 |
self->ConstructL(); |
|
173 |
return self; |
|
174 |
} |
|
175 |
||
176 |
||
177 |
// -------------------------------------------------------------------------- |
|
178 |
// CVIMPSTUiDoubleListBoxTabViewControl::~CVIMPSTUiDoubleListBoxTabViewControl |
|
179 |
// -------------------------------------------------------------------------- |
|
180 |
// |
|
181 |
CVIMPSTUiDoubleListBoxTabViewControl::~CVIMPSTUiDoubleListBoxTabViewControl() |
|
182 |
{ |
|
183 |
delete iListBox; |
|
184 |
iArrayProcess.RemoveObserver(); |
|
185 |
if( iFindbox ) |
|
186 |
{ |
|
187 |
delete iFindbox; |
|
188 |
iFindbox = NULL; |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
// -------------------------------------------------------------------------- |
|
193 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleAvatarChangeL |
|
194 |
// -------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleAvatarChangeL( const TDesC& aUserId ) |
|
197 |
{ |
|
198 |
TRACER_AUTO; |
|
199 |
TRACE( "aUserId = %S ", &aUserId ); |
|
200 |
CFormattedCellListBoxData* listBoxData = iListBox->ItemDrawer()->ColumnData(); |
|
201 |
TPtrC loginUserId = iArrayProcess.LoginUserIdFromStoreL(); |
|
202 |
TInt Avindex = 0; |
|
203 |
CGulIcon* newIcon = NULL; |
|
204 |
TRACE( "loginUserId = %S ", &loginUserId ); |
|
205 |
if( KErrNone == loginUserId.Compare( aUserId ) ) |
|
206 |
{ |
|
207 |
TRACE( "inside if ownuserid" ); |
|
208 |
TPtrC8 avatardata = iArrayProcess.OwnAvatarContentL(); |
|
209 |
TRACE( "after iArrayProcess.OwnAvatarContentL()" ); |
|
210 |
Avindex = iArrayProcess.OwnAvatarIndexL(); |
|
211 |
if( avatardata.Length() ) |
|
212 |
{ |
|
213 |
TRACE( "avatardata.Length()" ); |
|
214 |
newIcon = AvatarToIconL( avatardata ); |
|
215 |
} |
|
216 |
if( newIcon ) // there is a new avatar icon |
|
217 |
{ |
|
218 |
TRACE("newIcon" ); |
|
219 |
CArrayPtr<CGulIcon>* currentIconArray = listBoxData->IconArray(); |
|
220 |
if( Avindex ) // if there is old icon already |
|
221 |
{ |
|
222 |
TRACE( "Avindex " ); |
|
223 |
// delete the old icon compress the array and insert at the same position |
|
224 |
currentIconArray->Delete( Avindex ); |
|
225 |
currentIconArray->Compress(); |
|
226 |
currentIconArray->InsertL( Avindex , newIcon); |
|
227 |
} |
|
228 |
else |
|
229 |
{ |
|
230 |
TRACE( "else of Avindex " ); |
|
231 |
// if there is no old icon append at the last |
|
232 |
currentIconArray->AppendL( newIcon); |
|
233 |
// set the index to cenrep |
|
234 |
TRACE( " currentIconArray->Count()-1 = %d ",currentIconArray->Count()-1 ); |
|
235 |
iArrayProcess.SetOwnAvatarIndexL( currentIconArray->Count()-1 ); |
|
236 |
} |
|
237 |
} |
|
238 |
else |
|
239 |
{ |
|
240 |
TRACE( "else of avatar got cleared." ); |
|
241 |
// avatar got cleared just set the icon index to '0' |
|
242 |
// icon what was added still remains in the listbox icon array |
|
243 |
// dont delete the old icon, because that needs to modify the whole |
|
244 |
// indexes of the other contacts. |
|
245 |
// "keeping the icon is better than changing all contacts indexes" |
|
246 |
// The icons will be deleted by listbox, when list box got destructed. |
|
247 |
iArrayProcess.SetOwnAvatarIndexL( KErrNone ); |
|
248 |
} |
|
249 |
} |
|
250 |
else |
|
251 |
{ |
|
252 |
TRACE( " else not own id" ); |
|
253 |
TRACE( " else not own id aUserId = %S",&aUserId ); |
|
254 |
TInt index = iArrayProcess.GetSelectedItemIndex( aUserId );//Get the index from storage. |
|
255 |
||
256 |
TRACE( " after GetSelectedItemIndex" ); |
|
257 |
TPtrC8 avatardata = iArrayProcess.AvatarContent( index ); |
|
258 |
TRACE("after iArrayProcess.AvatarContent" ); |
|
259 |
Avindex = iArrayProcess.AvatarIndex(index); |
|
260 |
TRACE( " after Avindex = %d",Avindex ); |
|
261 |
if( avatardata.Length() ) |
|
262 |
{ |
|
263 |
TRACE( "inside if avatardata.Length()" ); |
|
264 |
newIcon = AvatarToIconL( avatardata ); |
|
265 |
} |
|
266 |
if( newIcon ) // there is a new avatar icon |
|
267 |
{ |
|
268 |
TRACE( "inside if newIcon" ); |
|
269 |
CArrayPtr<CGulIcon>* currentIconArray = listBoxData->IconArray(); |
|
270 |
if( Avindex ) // if there is old icon already |
|
271 |
{ |
|
272 |
TRACE( " inside Avindex" ); |
|
273 |
// delete the old icon compress the array and insert at the same position |
|
274 |
currentIconArray->Delete( Avindex ); |
|
275 |
currentIconArray->Compress(); |
|
276 |
currentIconArray->InsertL( Avindex , newIcon); |
|
277 |
} |
|
278 |
else |
|
279 |
{ |
|
280 |
TRACE( " inside Avindex else" ); |
|
281 |
// if there is no old icon append at the last |
|
282 |
currentIconArray->AppendL( newIcon); |
|
283 |
// set the index to cenrep |
|
284 |
iArrayProcess.SetAvatarIndex(index, currentIconArray->Count()-1 ); |
|
285 |
} |
|
286 |
} |
|
287 |
else |
|
288 |
{ |
|
289 |
TRACE( " avatar got cleared" ); |
|
290 |
// avatar got cleared just set the icon index to '0' |
|
291 |
// icon what was added still remains in the listbox icon array |
|
292 |
// dont delete the old icon, because that needs to modify the whole |
|
293 |
// indexes of the other contacts. |
|
294 |
// "keeping the icon is better than changing all contacts indexes" |
|
295 |
// The icons will be deleted by listbox, when list box got destructed. |
|
296 |
iArrayProcess.SetAvatarIndex( index , KErrNone ); |
|
297 |
} |
|
298 |
} |
|
299 |
||
300 |
iListBox->DrawNow(); |
|
301 |
||
302 |
} |
|
303 |
// --------------------------------------------------------- |
|
304 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleAddition |
|
305 |
// --------------------------------------------------------- |
|
306 |
// |
|
307 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleAdditionL(TVIMPSTEnums::TItem aType, TInt aIndex) |
|
308 |
{ |
|
309 |
if(iListBox ) |
|
310 |
{ |
|
311 |
iListBox->HandleItemAdditionL(); |
|
312 |
UpdateViewL(aIndex,aType) ; |
|
313 |
} |
|
314 |
} |
|
315 |
||
316 |
// --------------------------------------------------------- |
|
317 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleAddition |
|
318 |
// --------------------------------------------------------- |
|
319 |
// |
|
320 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleDeletionL(TVIMPSTEnums::TItem aType , TInt aIndex ) |
|
321 |
{ |
|
322 |
TRACER_AUTO; |
|
323 |
if(iListBox) |
|
324 |
{ |
|
325 |
iListBox->HandleItemRemovalL(); |
|
326 |
TInt count = iListBox->Model()->NumberOfItems(); |
|
327 |
if( count == aIndex ) |
|
328 |
{ |
|
329 |
aIndex = 0; |
|
330 |
} |
|
331 |
UpdateViewL(aIndex,aType) ; |
|
332 |
} |
|
333 |
} |
|
334 |
||
335 |
// -------------------------------------------------------------------------- |
|
336 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleItemAdditionL |
|
337 |
// -------------------------------------------------------------------------- |
|
338 |
// |
|
339 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleItemAdditionL() |
|
340 |
{ |
|
341 |
TRACER_AUTO; |
|
342 |
if(iListBox) |
|
343 |
{ |
|
344 |
iListBox->HandleItemAdditionL(); |
|
345 |
TInt index = CurrentItemIndex(); |
|
346 |
TVIMPSTEnums::TItem type = iArrayProcess.GetType(index); |
|
347 |
UpdateViewL(index,type) ; |
|
348 |
} |
|
349 |
} |
|
350 |
||
351 |
||
352 |
// -------------------------------------------------------------------------- |
|
353 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleItemRemovalL |
|
354 |
// -------------------------------------------------------------------------- |
|
355 |
// |
|
356 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleItemRemovalL() |
|
357 |
{ |
|
358 |
if(iListBox) |
|
359 |
{ |
|
360 |
iListBox->HandleItemRemovalL(); |
|
361 |
TInt index = CurrentItemIndex(); |
|
362 |
TVIMPSTEnums::TItem type = iArrayProcess.GetType(index); |
|
363 |
UpdateViewL(index,type) ; |
|
364 |
} |
|
365 |
} |
|
366 |
||
367 |
// -------------------------------------------------------------------------- |
|
368 |
// CVIMPSTUiDoubleListBoxTabViewControl::SizeChanged |
|
369 |
// -------------------------------------------------------------------------- |
|
370 |
// |
|
371 |
void CVIMPSTUiDoubleListBoxTabViewControl::SizeChanged() |
|
372 |
{ |
|
373 |
SetLayout(); //layouting controls |
|
374 |
if ( iFindbox && iFindPaneIsVisible ) |
|
375 |
{ |
|
376 |
iFindbox->MakeVisible( ETrue ); |
|
377 |
} |
|
378 |
} |
|
379 |
||
380 |
||
381 |
// -------------------------------------------------------------------------- |
|
382 |
// CVIMPSTUiDoubleListBoxTabViewControl::CountComponentControls |
|
383 |
// -------------------------------------------------------------------------- |
|
384 |
// |
|
385 |
TInt CVIMPSTUiDoubleListBoxTabViewControl::CountComponentControls() const |
|
386 |
{ |
|
387 |
// return number of controls inside this container |
|
388 |
if( !iFindbox ) |
|
389 |
{ |
|
390 |
// Find-pane does not exist when there is no data in listbox, |
|
391 |
// so only one control exists (listbox) |
|
392 |
return 1; //Ignore CodeScanner warning |
|
393 |
} |
|
394 |
else |
|
395 |
{ |
|
396 |
// listbox and findbox exists. that makes it two |
|
397 |
return 2; //Ignore CodeScanner warning |
|
398 |
} |
|
399 |
} |
|
400 |
||
401 |
// -------------------------------------------------------------------------- |
|
402 |
// CVIMPSTUiDoubleListBoxTabViewControl::FocusChanged |
|
403 |
// -------------------------------------------------------------------------- |
|
404 |
// |
|
405 |
void CVIMPSTUiDoubleListBoxTabViewControl::FocusChanged( TDrawNow aDrawNow ) |
|
406 |
{ |
|
407 |
if ( iFindbox && iFindbox->IsVisible() ) |
|
408 |
{ |
|
409 |
iFindbox->SetFocus( IsFocused(), aDrawNow ); |
|
410 |
if ( aDrawNow == EDrawNow && IsFocused() ) |
|
411 |
{ |
|
412 |
iFindbox->DrawDeferred(); |
|
413 |
} |
|
414 |
} |
|
415 |
} |
|
416 |
||
417 |
// -------------------------------------------------------------------------- |
|
418 |
// CVIMPSTUiDoubleListBoxTabViewControl::ComponentControl |
|
419 |
// -------------------------------------------------------------------------- |
|
420 |
// |
|
421 |
CCoeControl* CVIMPSTUiDoubleListBoxTabViewControl::ComponentControl(TInt aIndex) const |
|
422 |
{ |
|
423 |
TRACER_AUTO; |
|
424 |
// return iListBox; |
|
425 |
switch ( aIndex ) |
|
426 |
{ |
|
427 |
// the caller wants to have the first control |
|
428 |
// so it's always listbox |
|
429 |
case 0: |
|
430 |
{ |
|
431 |
return iListBox; |
|
432 |
} |
|
433 |
// the caller wants to have the second control |
|
434 |
// so it's always the findbox if it exists |
|
435 |
case 1: |
|
436 |
{ |
|
437 |
if( iFindbox ) |
|
438 |
{ |
|
439 |
return iFindbox; |
|
440 |
} |
|
441 |
return NULL; |
|
442 |
} |
|
443 |
default: |
|
444 |
{ |
|
445 |
return NULL; |
|
446 |
} |
|
447 |
} |
|
448 |
} |
|
449 |
||
450 |
||
451 |
// -------------------------------------------------------------------------- |
|
452 |
// CVIMPSTUiDoubleListBoxTabViewControl::OfferKeyEventL |
|
453 |
// -------------------------------------------------------------------------- |
|
454 |
// |
|
455 |
TKeyResponse CVIMPSTUiDoubleListBoxTabViewControl::OfferKeyEventL |
|
456 |
(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
457 |
{ |
|
458 |
TRACER_AUTO; |
|
459 |
if ( !aKeyEvent.iCode ) |
|
460 |
{ |
|
461 |
//The character code generated |
|
462 |
//for an EEventKey, or 0 for a down or up event. |
|
463 |
//For down or up key return key consumed.. handle only the events |
|
464 |
||
465 |
if((EEventKeyDown == aType) && (EStdKeyDevice3 == aKeyEvent.iScanCode)) |
|
466 |
{ |
|
467 |
//for setting the command to be executed for the "Selection key" |
|
468 |
//in case of selection key, container's OfferKeyEventL() is called only for EEventKeyDown and EEventKeyUp |
|
469 |
//and not for EEventKey |
|
470 |
UpdateCbaL(); |
|
471 |
} |
|
472 |
return EKeyWasConsumed; |
|
473 |
} |
|
474 |
UpdateCbaL(); |
|
475 |
TKeyResponse ret = EKeyWasNotConsumed; |
|
476 |
// Offer key event first to the key event handler |
|
477 |
if ( iKeyEventHandler && iKeyEventHandler->Pbk2ProcessKeyEventL |
|
478 |
( aKeyEvent, aType ) ) |
|
479 |
{ |
|
480 |
ret = EKeyWasConsumed; |
|
481 |
} |
|
482 |
switch ( aKeyEvent.iCode ) |
|
483 |
{ |
|
484 |
case EKeyBackspace: |
|
485 |
{ |
|
486 |
if ( iFindbox ) |
|
487 |
{ |
|
488 |
if( iFindbox->TextLength() == 0 ) |
|
489 |
{ |
|
490 |
TInt index = CurrentItemIndex(); |
|
491 |
if( iArrayProcess.IsConversationExist(index) ) |
|
492 |
{ |
|
493 |
iTabbedView.CloseConversationL(); |
|
494 |
ret = EKeyWasConsumed; |
|
495 |
} |
|
496 |
else if(TVIMPSTEnums::EContactItem == iArrayProcess.GetType( index ) ) |
|
497 |
{ |
|
498 |
if( TVIMPSTEnums::ESVCERegistered == iArrayProcess.GetLoginState() ) |
|
499 |
{ |
|
500 |
iTabbedView.DeleteContactL(); |
|
501 |
} |
|
502 |
ret = EKeyWasConsumed; |
|
503 |
} |
|
504 |
} |
|
505 |
} |
|
506 |
break; |
|
507 |
} |
|
508 |
// Case to handle send key press consumption. |
|
509 |
case EKeyYes: |
|
510 |
{ |
|
511 |
TInt index = iListBox->CurrentItemIndex(); |
|
512 |
if( TVIMPSTEnums::EOwnStatusItem == iArrayProcess.GetType( index ) ) |
|
513 |
{ |
|
514 |
ret = EKeyWasConsumed; |
|
515 |
} |
|
516 |
break; |
|
517 |
} |
|
518 |
default: |
|
519 |
break; |
|
520 |
} |
|
521 |
if( EKeyPhoneSend == aKeyEvent.iCode && ret != EKeyWasConsumed ) |
|
522 |
{ |
|
523 |
if( iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EVoip)) |
|
524 |
{ |
|
525 |
iTabbedView.MakeVoipCallL(); |
|
526 |
ret = EKeyWasConsumed; |
|
527 |
} |
|
528 |
||
529 |
} |
|
530 |
if( ret == EKeyWasConsumed ) |
|
531 |
{ |
|
532 |
// user might has choosen back/end key/application key etc |
|
533 |
// application might switch to background |
|
534 |
// return from here |
|
535 |
return ret; |
|
536 |
} |
|
537 |
if (iFindPaneIsVisible && iFindbox ) |
|
538 |
{ |
|
539 |
ret = iFindbox->OfferKeyEventL( aKeyEvent, aType ) ; |
|
540 |
} |
|
541 |
// Not consumed by the key handler and findpane , offer to the control next |
|
542 |
if ( ret == EKeyWasNotConsumed ) |
|
543 |
{ |
|
544 |
ret = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
545 |
} |
|
546 |
iTabbedView.UpdateToolbarL(); |
|
547 |
return ret; |
|
548 |
} |
|
549 |
||
550 |
||
551 |
// -------------------------------------------------------------------------- |
|
552 |
// CVIMPSTUiDoubleListBoxTabViewControl::CurrentItemIndex |
|
553 |
// -------------------------------------------------------------------------- |
|
554 |
// |
|
555 |
TInt CVIMPSTUiDoubleListBoxTabViewControl::CurrentItemIndex() const |
|
556 |
{ |
|
557 |
TRACER_AUTO; |
|
558 |
if( !iListBox ) |
|
559 |
{ |
|
560 |
return KErrNotFound; |
|
561 |
} |
|
562 |
if( !iListBox->View() ) |
|
563 |
{ |
|
564 |
// CurrentItemIndex panics if the listbox has no view |
|
565 |
return KErrNotFound; |
|
566 |
} |
|
567 |
||
568 |
TInt curIndex( iListBox->CurrentItemIndex() ); |
|
569 |
if ( curIndex < 0 ) |
|
570 |
{ |
|
571 |
return KErrNotFound; |
|
572 |
} |
|
573 |
CVIMPSTUiListBoxModel* model = |
|
574 |
static_cast<CVIMPSTUiListBoxModel*>( iListBox->Model() ); |
|
575 |
||
576 |
if( model ) |
|
577 |
{ |
|
578 |
return model->FilteredItemIndex( curIndex ); |
|
579 |
} |
|
580 |
return KErrNotFound; |
|
581 |
} |
|
582 |
||
583 |
||
584 |
||
585 |
// -------------------------------------------------------------------------- |
|
586 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetCurrentItemIndex |
|
587 |
// -------------------------------------------------------------------------- |
|
588 |
// |
|
589 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetCurrentItemIndex(TInt aIndex) |
|
590 |
{ |
|
591 |
TRACER_AUTO; |
|
592 |
if (iListBox->CurrentItemIndex() != aIndex && |
|
593 |
aIndex >= 0 && |
|
594 |
aIndex < iListBox->Model()->NumberOfItems() ) |
|
595 |
{ |
|
596 |
iListBox->SetCurrentItemIndex(aIndex); |
|
597 |
TRAP_IGNORE(UpdateCbaL()); |
|
598 |
} |
|
599 |
} |
|
600 |
||
601 |
||
602 |
// -------------------------------------------------------------------------- |
|
603 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetCurrentItemIndexAndDraw |
|
604 |
// -------------------------------------------------------------------------- |
|
605 |
// |
|
606 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetCurrentItemIndexAndDraw(TInt aIndex) |
|
607 |
{ |
|
608 |
SetCurrentItemIndex(aIndex); |
|
609 |
this->DrawDeferred(); |
|
610 |
} |
|
611 |
||
612 |
||
613 |
// -------------------------------------------------------------------------- |
|
614 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetListEmptyTextL |
|
615 |
// -------------------------------------------------------------------------- |
|
616 |
// |
|
617 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetListEmptyTextL(TInt aResourceId) |
|
618 |
{ |
|
619 |
HBufC* msgText; |
|
620 |
TRACER_AUTO; |
|
621 |
// Get Service Name from Engine , load string from resource and display. |
|
622 |
// This text is shown to tell the user to restart phone to get the service again. |
|
623 |
TPtrC serviceNamePtr(iEngine.ServiceName()); |
|
624 |
msgText = StringLoader::LoadLC(aResourceId, serviceNamePtr, iCoeEnv); |
|
625 |
iListBox->View()->SetListEmptyTextL(*msgText); |
|
626 |
TRACE("Display Text %S", msgText ); |
|
627 |
||
628 |
CleanupStack::PopAndDestroy(msgText); |
|
629 |
} |
|
630 |
||
631 |
// --------------------------------------------------------- |
|
632 |
// CVIMPSTUiDoubleListBoxTabViewControl::LoadBitmapsL |
|
633 |
// Called by framework when the view size is changed |
|
634 |
// --------------------------------------------------------- |
|
635 |
// |
|
636 |
void CVIMPSTUiDoubleListBoxTabViewControl::LoadBitmapsL() |
|
637 |
{ |
|
638 |
||
639 |
TRACER_AUTO; |
|
640 |
CFormattedCellListBoxData* listBoxData = iListBox->ItemDrawer()->ColumnData(); |
|
641 |
if ( !listBoxData ) |
|
642 |
{ |
|
643 |
//No listbox data |
|
644 |
User::Leave( KErrNotFound ); |
|
645 |
} |
|
646 |
||
647 |
CAknIconArray* icons = iBrandHandler.LoadIconsLC( ); |
|
648 |
||
649 |
CArrayPtr<CGulIcon>* oldIconArray = listBoxData->IconArray(); |
|
650 |
if( oldIconArray ) |
|
651 |
{ |
|
652 |
oldIconArray->ResetAndDestroy(); |
|
653 |
delete oldIconArray; |
|
654 |
listBoxData->SetIconArray( NULL ); |
|
655 |
} |
|
656 |
TPtrC8 avatardata = iArrayProcess.OwnAvatarContentL(); |
|
657 |
CGulIcon* newIcon = NULL; |
|
658 |
if( avatardata.Length() ) |
|
659 |
{ |
|
660 |
newIcon = AvatarToIconL( avatardata ); |
|
661 |
} |
|
662 |
if( newIcon ) |
|
663 |
{ |
|
664 |
// if icon creation from avatar is successful then append icon |
|
665 |
// set the index |
|
666 |
icons->AppendL(newIcon); |
|
667 |
iArrayProcess.SetOwnAvatarIndexL( icons->Count()-1 ); |
|
668 |
} |
|
669 |
else |
|
670 |
{ // set the index to '0' |
|
671 |
// index=0 means default icon |
|
672 |
iArrayProcess.SetOwnAvatarIndexL( KErrNone ); |
|
673 |
} |
|
674 |
||
675 |
TInt count = iArrayProcess.Count(); |
|
676 |
// loop all the items in the array and get the avatar data |
|
677 |
for (TInt i=0 ;i< count ;++i) |
|
678 |
{ |
|
679 |
TPtrC8 avatarContent = iArrayProcess.AvatarContent(i); |
|
680 |
newIcon = NULL;// make this as NULL since the icon |
|
681 |
//ownership will be taken from LIstbox |
|
682 |
if( avatarContent.Length()) |
|
683 |
{ |
|
684 |
// if that contact has any avatar data then process and create the icon |
|
685 |
newIcon = AvatarToIconL( avatarContent ); |
|
686 |
} |
|
687 |
if ( newIcon ) |
|
688 |
{ |
|
689 |
// if the icon is created successfully the append to icon array |
|
690 |
icons->AppendL(newIcon); |
|
691 |
// set the icon index to the storage |
|
692 |
iArrayProcess.SetAvatarIndex( i , icons->Count()-1); |
|
693 |
} |
|
694 |
else |
|
695 |
{ |
|
696 |
//if icon not found. set the default for buddies |
|
697 |
iArrayProcess.SetAvatarIndex( i , KErrNone); |
|
698 |
} |
|
699 |
} |
|
700 |
// Set icon-array to listbox's drawer |
|
701 |
listBoxData->SetIconArray( icons ); |
|
702 |
CleanupStack::Pop( icons ); |
|
703 |
} |
|
704 |
||
705 |
// --------------------------------------------------------- |
|
706 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleListBoxEventL( |
|
707 |
// CEikListBox* /*aListBox*/, TListBoxEvent /*aEventType*/ ) |
|
708 |
// From MEikListBoxObserver, Handles event's generated by listbox |
|
709 |
// (other items were commented in a header). |
|
710 |
// --------------------------------------------------------- |
|
711 |
// |
|
712 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleListBoxEventL( |
|
713 |
CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
714 |
{ |
|
715 |
TRACER_AUTO; |
|
716 |
iTabbedView.UpdateToolbarL(); |
|
717 |
switch(aEventType) |
|
718 |
{ |
|
719 |
case EEventItemSingleClicked: |
|
720 |
||
721 |
{ |
|
722 |
TInt index = CurrentItemIndex(); |
|
723 |
TVIMPSTEnums::TItem itemType = iArrayProcess.GetType(index); |
|
724 |
TBool presenceEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EPresence); |
|
725 |
TBool imEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EIM); |
|
726 |
TBool voipEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EVoip); |
|
727 |
TVIMPSTEnums::TVIMPSTRegistrationState serviceState = iTabbedView.GetServiceState(); |
|
728 |
TVIMPSTEnums::TOnlineStatus onlinestatus = iArrayProcess.GetOnlineStatusL(index); |
|
729 |
||
730 |
if(TVIMPSTEnums::EOwnStatusItem == itemType && |
|
731 |
TVIMPSTEnums::ESVCENotRegistered == serviceState) |
|
732 |
{ |
|
733 |
iTabbedView.HandleCommandL( ECmdLogin ); |
|
734 |
} |
|
735 |
else if(TVIMPSTEnums::EOwnStatusItem == itemType && |
|
736 |
TVIMPSTEnums::ESVCEWaitingForNetwork == serviceState) |
|
737 |
{ |
|
738 |
iTabbedView.HandleCommandL( ECmdChangeConnectioninWaitingState); |
|
739 |
} |
|
740 |
else if(TVIMPSTEnums::EOwnStatusItem == itemType |
|
741 |
&& presenceEnabled && |
|
742 |
TVIMPSTEnums::ESVCERegistered == serviceState ) |
|
743 |
{ |
|
744 |
iTabbedView.HandleCommandL( ECmdChangeStatus ); |
|
745 |
} |
|
746 |
else if( ( TVIMPSTEnums::EContactItem == itemType || |
|
747 |
TVIMPSTEnums::EUnknonContactItem == itemType )&& imEnabled && |
|
748 |
TVIMPSTEnums::ESVCERegistered == serviceState && |
|
749 |
TVIMPSTEnums::EServiceOut != onlinestatus ) |
|
750 |
{ |
|
751 |
iTabbedView.HandleCommandL( ECmdOpenConversation ); |
|
752 |
} |
|
753 |
else if ( itemType == TVIMPSTEnums::EFriendRequestItem |
|
754 |
&& TVIMPSTEnums::ESVCERegistered == serviceState) |
|
755 |
{ |
|
756 |
iTabbedView.HandleCommandL( ECmdOpenFriendRequest ); |
|
757 |
} |
|
758 |
else if( TVIMPSTEnums::EContactItem == itemType ) |
|
759 |
{ |
|
760 |
if((TVIMPSTEnums::EPending != onlinestatus) && |
|
761 |
!(TVIMPSTEnums::ESVCEUpdatingContacts == serviceState || |
|
762 |
TVIMPSTEnums::ESVCENetworkConnecting == serviceState || |
|
763 |
TVIMPSTEnums::ESVCENetworkDisConnecting == serviceState)) |
|
764 |
{ |
|
765 |
iTabbedView.HandleCommandL( ECmdContactDetails ); |
|
766 |
} |
|
767 |
} |
|
768 |
break; |
|
769 |
||
770 |
} |
|
771 |
// Add enter key handling |
|
772 |
case EEventEnterKeyPressed: |
|
773 |
{ |
|
774 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
775 |
TInt commandId( iCba->ButtonGroup()->CommandId( CEikButtonGroupContainer::EMiddleSoftkeyPosition)); |
|
776 |
||
777 |
iTabbedView.HandleCommandL(commandId); |
|
778 |
break; |
|
779 |
} |
|
780 |
default: |
|
781 |
{ |
|
782 |
break; |
|
783 |
} |
|
784 |
} |
|
785 |
||
786 |
} |
|
787 |
// --------------------------------------------------------- |
|
788 |
// CVIMPSTUiDoubleListBoxTabViewControl::SendMessageL( |
|
789 |
// CEikListBox* /*aListBox*/, TListBoxEvent /*aEventType*/ ) |
|
790 |
// From MEikListBoxObserver, Handles event's generated by listbox |
|
791 |
// (other items were commented in a header). |
|
792 |
// --------------------------------------------------------- |
|
793 |
// |
|
794 |
void CVIMPSTUiDoubleListBoxTabViewControl::SendMessageL() |
|
795 |
{ |
|
796 |
TRACER_AUTO; |
|
797 |
// TInt index = iListBox->CurrentItemIndex(); |
|
798 |
TInt index = CurrentItemIndex(); |
|
799 |
if( index< 0 ) |
|
800 |
{ |
|
801 |
// return if item not found |
|
802 |
return; |
|
803 |
} |
|
804 |
TPtrC seletctedItem = iArrayProcess.GetItemUserId(index) ; |
|
805 |
if(seletctedItem.Length()) |
|
806 |
{ |
|
807 |
TInt result = EAknSoftkeyOk; |
|
808 |
//get the status from engine. |
|
809 |
TVIMPSTEnums::TOnlineStatus status = iArrayProcess.GetOnlineStatusL(index); |
|
810 |
||
811 |
if( status == TVIMPSTEnums::EOffline ) |
|
812 |
{ |
|
813 |
TBool isConvExist = iArrayProcess.IsConversationExist(index); |
|
814 |
if( !isConvExist) |
|
815 |
{ |
|
816 |
// TODO : need to show only once if conversation not exist |
|
817 |
// handling of error message need to be done in cv also ,waiting for ximp changes |
|
818 |
// Show note about offline contact |
|
819 |
HBufC* msg = StringLoader::LoadLC( |
|
820 |
R_QTN_CHAT_CONTACT_MAY_NOT_RECEIVE_MESSAGE, |
|
821 |
seletctedItem ); |
|
822 |
||
823 |
result = VIMPSTUtilsDialog::DisplayQueryDialogL( |
|
824 |
R_CHAT_CONTACT_MAY_NOT_RECEIVE_MESSAGE_DIALOG, |
|
825 |
msg->Des() ); |
|
826 |
CleanupStack::PopAndDestroy( msg ); |
|
827 |
} |
|
828 |
} |
|
829 |
||
830 |
if( ( result == EAknSoftkeyOk ) || ( result == EAknSoftkeyYes ) ) |
|
831 |
{ |
|
832 |
TPtrC itemName = iArrayProcess.GetItemNameText(index) ; |
|
833 |
// not own this p |
|
834 |
MVPbkContactLink* contactLink = iArrayProcess.ContactLink( index ); |
|
835 |
||
836 |
TVwsViewId activeViewId; |
|
837 |
CCoeEnv::Static()->AppUi()->GetActiveViewId( activeViewId ); |
|
838 |
UpdateCbaL(); |
|
839 |
// imlauncher call for luanching the conversationview with seletced user id |
|
840 |
IMCVLauncher::LaunchImConversationViewL(activeViewId, iServiceId, seletctedItem, itemName, contactLink); |
|
841 |
} |
|
842 |
} |
|
843 |
else |
|
844 |
{ |
|
845 |
//When there is no XSP Id present it comes to here |
|
846 |
//Displaying a note that there is no XSP ID |
|
847 |
HBufC* note = NULL; |
|
848 |
note = StringLoader::LoadLC( R_QTN_SERVTAB_NOXSP_ERROR ); |
|
849 |
VIMPSTUtilsDialog::DisplayNoteDialogL( *note ); |
|
850 |
CleanupStack::PopAndDestroy( note ); |
|
851 |
} |
|
852 |
||
853 |
} |
|
854 |
// --------------------------------------------------------- |
|
855 |
// CVIMPSTUiDoubleListBoxTabViewControl::UpdateViewL |
|
856 |
// (other items were commented in a header). |
|
857 |
// --------------------------------------------------------- |
|
858 |
// |
|
859 |
void CVIMPSTUiDoubleListBoxTabViewControl::UpdateViewL( |
|
860 |
TInt aIndex, TVIMPSTEnums::TItem aType) |
|
861 |
{ |
|
862 |
TRACER_AUTO; |
|
863 |
TInt index = KErrNotFound; |
|
864 |
if( aIndex < 0 ) |
|
865 |
{ |
|
866 |
aIndex = CurrentItemIndex()<0?0:CurrentItemIndex(); |
|
867 |
} |
|
868 |
switch(aType) |
|
869 |
{ |
|
870 |
case TVIMPSTEnums::EContactItem: |
|
871 |
case TVIMPSTEnums::EOwnStatusItem: |
|
872 |
{ |
|
873 |
/*Not attempting to get the index of contact because aIndex is the |
|
874 |
same as this index and we pass it on to the contactlistboxmodel's |
|
875 |
visibleitem method*/ |
|
876 |
CVIMPSTUiListBoxModel* list = |
|
877 |
static_cast<CVIMPSTUiListBoxModel*>( iListBox->Model() ); |
|
878 |
index = list->VisibleItemIndex(aIndex); |
|
879 |
if( index != KErrNotFound && iFindbox ) |
|
880 |
{ |
|
881 |
if(iClrFindPaneFlag) |
|
882 |
{ |
|
883 |
iFindbox->SetSearchTextL( KNullDesC ); |
|
884 |
iFindbox->DrawNow(); |
|
885 |
iClrFindPaneFlag = EFalse; |
|
886 |
} |
|
887 |
else |
|
888 |
{ |
|
889 |
TBuf<KTextLimit> temp; |
|
890 |
iFindbox->GetSearchText(temp); |
|
891 |
if(0 != temp.Compare(KNullDesC)) |
|
892 |
{ |
|
893 |
((CAknFilteredTextListBoxModel*) iListBox->Model() ) |
|
894 |
->Filter()->HandleOfferkeyEventL(); |
|
895 |
} |
|
896 |
} |
|
897 |
} |
|
898 |
break; |
|
899 |
} |
|
900 |
default: |
|
901 |
{ |
|
902 |
//nothing to do |
|
903 |
break; |
|
904 |
} |
|
905 |
} |
|
906 |
iListBox->DrawNow(); |
|
907 |
SetCurrentItemIndex(aIndex); |
|
908 |
SetFocusAndMakeItemVisible(); |
|
909 |
TInt count = iArrayProcess.Count(); |
|
910 |
if(count > KMinContact && ! iFindPaneIsVisible) |
|
911 |
{ |
|
912 |
ActivateFindPaneL(); |
|
913 |
} |
|
914 |
else if(count <= KMinContact && iFindPaneIsVisible) // extra check needed here to improve performance |
|
915 |
{ |
|
916 |
DeactivateFindPaneL(); |
|
917 |
} |
|
918 |
||
919 |
//Update the Toolbar after moving the focus to the current item. |
|
920 |
iTabbedView.UpdateToolbarL(); |
|
921 |
UpdateCbaL(); |
|
922 |
} |
|
923 |
// --------------------------------------------------------- |
|
924 |
// CVIMPSTUiDoubleListBoxTabViewControl::ActivateFindPaneL() |
|
925 |
// Activates find-pane |
|
926 |
// (other items were commented in a header). |
|
927 |
// --------------------------------------------------------- |
|
928 |
// |
|
929 |
void CVIMPSTUiDoubleListBoxTabViewControl::ActivateFindPaneL() |
|
930 |
{ |
|
931 |
TRACER_AUTO; |
|
932 |
if( !iFindbox ) |
|
933 |
{ |
|
934 |
// Use EAdaptiveSearch so that we can search according to columns. |
|
935 |
iFindbox = CAknSearchField::NewL( *this, |
|
936 |
CAknSearchField::EAdaptiveSearch, |
|
937 |
NULL, KTextLimit ); |
|
938 |
||
939 |
// This is to filter the presence status from the search |
|
940 |
// username(0)/presencestatus(1) - 1 is to filter the presence status |
|
941 |
// column out of the search. In this case there are only two columns. |
|
942 |
TBitFlags32 columnFilterFlag; |
|
943 |
columnFilterFlag.Set(1); |
|
944 |
iFindbox->SetListColumnFilterFlags(columnFilterFlag); |
|
945 |
static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() ) |
|
946 |
->CreateFilterL( iListBox, iFindbox ); |
|
947 |
} |
|
948 |
iFindbox->SetObserver( this ); |
|
949 |
iFindbox->ActivateL(); |
|
950 |
iFindbox->ResetL(); |
|
951 |
iFindbox->SetSearchTextL( KNullDesC ); |
|
952 |
||
953 |
iFindPaneIsVisible = ETrue; |
|
954 |
SetLayout(); |
|
955 |
||
956 |
if( IsActivated() ) |
|
957 |
{ |
|
958 |
iFindbox->MakeVisible( ETrue ); |
|
959 |
iFindbox->SetFocus( ETrue ); |
|
960 |
iListBox->SizeChanged(); |
|
961 |
DrawNow(); |
|
962 |
} |
|
963 |
} |
|
964 |
||
965 |
// --------------------------------------------------------- |
|
966 |
// CVIMPSTUiDoubleListBoxTabViewControl::DeactivateFindPaneL() |
|
967 |
// De-activates find-pane |
|
968 |
// (other items were commented in a header). |
|
969 |
// --------------------------------------------------------- |
|
970 |
// |
|
971 |
void CVIMPSTUiDoubleListBoxTabViewControl::DeactivateFindPaneL() |
|
972 |
{ |
|
973 |
TRACER_AUTO; |
|
974 |
if( !iFindbox ) |
|
975 |
{ |
|
976 |
return; |
|
977 |
} |
|
978 |
static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() ) |
|
979 |
->Filter()->ResetFilteringL(); |
|
980 |
||
981 |
||
982 |
iFindbox->MakeVisible( EFalse ); |
|
983 |
iFindbox->SetFocus( EFalse ); |
|
984 |
||
985 |
iFindPaneIsVisible = EFalse; |
|
986 |
SetLayout(); |
|
987 |
||
988 |
if( IsActivated() ) |
|
989 |
{ |
|
990 |
DrawNow(); |
|
991 |
} |
|
992 |
} |
|
993 |
||
994 |
// --------------------------------------------------------- |
|
995 |
// CVIMPSTUiDoubleListBoxTabViewControl::GetFocussedId() |
|
996 |
// To get the pointer to the iFocussedID |
|
997 |
// --------------------------------------------------------- |
|
998 |
TPtrC CVIMPSTUiDoubleListBoxTabViewControl::GetFocussedId() |
|
999 |
{ |
|
1000 |
TInt index = CurrentItemIndex(); |
|
1001 |
if( index < 0 ) |
|
1002 |
{ |
|
1003 |
index = 0; |
|
1004 |
} |
|
1005 |
return iCommandHandler.GetProcessInterface().GetItemUserId( index ); |
|
1006 |
} |
|
1007 |
// --------------------------------------------------------- |
|
1008 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetFocussedId() |
|
1009 |
// Saves the Contact ID in iFocussedID |
|
1010 |
// --------------------------------------------------------- |
|
1011 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetFocussedId(const TDesC& aContact) |
|
1012 |
{ |
|
1013 |
TInt index = iCommandHandler.GetProcessInterface().GetSelectedItemIndex( aContact ); |
|
1014 |
if( index < 0 ) |
|
1015 |
{ |
|
1016 |
index = 0; |
|
1017 |
} |
|
1018 |
SetCurrentItemIndex( index ); |
|
1019 |
SetFocusAndMakeItemVisible(); |
|
1020 |
} |
|
1021 |
// --------------------------------------------------------- |
|
1022 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetLayout() |
|
1023 |
// Layouts current components according to AVKON LAF |
|
1024 |
// (other items were commented in a header). |
|
1025 |
// --------------------------------------------------------- |
|
1026 |
// |
|
1027 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetLayout() |
|
1028 |
{ |
|
1029 |
TRACER_AUTO; |
|
1030 |
const TRect rect( Rect() ); |
|
1031 |
if( iListBox && iFindPaneIsVisible ) |
|
1032 |
{ |
|
1033 |
||
1034 |
TAknWindowLineLayout empty; |
|
1035 |
empty.iC = 0; |
|
1036 |
empty.il = 0; |
|
1037 |
empty.it = 0; |
|
1038 |
empty.ir = 0; |
|
1039 |
empty.ib = 0; |
|
1040 |
empty.iW = ELayoutEmpty; |
|
1041 |
empty.iH = ELayoutEmpty; |
|
1042 |
||
1043 |
TAknWindowLineLayout findPane = AknLayoutScalable_Avkon::find_pane().LayoutLine(); |
|
1044 |
TAknWindowLineLayout listPane; |
|
1045 |
||
1046 |
// listPane should equal to parent's rect |
|
1047 |
listPane.il = Rect().iTl.iX; |
|
1048 |
listPane.ir = ELayoutEmpty; |
|
1049 |
listPane.it = Rect().iTl.iY; |
|
1050 |
listPane.ib = ELayoutEmpty; |
|
1051 |
// this check is required since it's not guaranteed that listbox's SetRect |
|
1052 |
// has been called when this code is executed |
|
1053 |
if ( Size().iWidth > 0 ) |
|
1054 |
{ |
|
1055 |
listPane.iW = Size().iWidth; |
|
1056 |
listPane.ir = ELayoutEmpty; |
|
1057 |
} |
|
1058 |
else |
|
1059 |
{ |
|
1060 |
listPane.iW = ELayoutEmpty; |
|
1061 |
listPane.ir = 0; |
|
1062 |
} |
|
1063 |
// but findpane's height should be subtracted |
|
1064 |
listPane.iH = Size().iHeight - findPane.iH; |
|
1065 |
||
1066 |
// findPane's width should equal to listPane's width |
|
1067 |
findPane.iW = listPane.iW; |
|
1068 |
CAknFilteredTextListBoxModel* m = static_cast <CAknFilteredTextListBoxModel*> ( iListBox->Model() ); |
|
1069 |
if ( m->Filter() ) |
|
1070 |
{ |
|
1071 |
m->Filter()->SetParentControl( this ); |
|
1072 |
} |
|
1073 |
TAknLayoutRect lrect; |
|
1074 |
lrect.LayoutRect( Rect(), empty ); |
|
1075 |
AknLayoutUtils::LayoutControl( iFindbox, lrect.Rect(), findPane ); |
|
1076 |
AknLayoutUtils::LayoutControl( iListBox, Rect(), listPane ); |
|
1077 |
||
1078 |
} |
|
1079 |
else if( iListBox ) |
|
1080 |
{ |
|
1081 |
AknLayoutUtils::LayoutControl( iListBox, |
|
1082 |
rect, |
|
1083 |
AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); |
|
1084 |
} |
|
1085 |
} |
|
1086 |
||
1087 |
// --------------------------------------------------------- |
|
1088 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleControlEventL |
|
1089 |
// --------------------------------------------------------- |
|
1090 |
// |
|
1091 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) |
|
1092 |
{ |
|
1093 |
// We only observe iFindbox |
|
1094 |
if( EEventStateChanged == aEventType ) |
|
1095 |
{ |
|
1096 |
||
1097 |
((CAknFilteredTextListBoxModel*) iListBox->Model() ) |
|
1098 |
->Filter()->HandleOfferkeyEventL(); |
|
1099 |
||
1100 |
} |
|
1101 |
iListBox->DrawNow(); |
|
1102 |
iTabbedView.UpdateToolbarL(); |
|
1103 |
} |
|
1104 |
||
1105 |
// --------------------------------------------------------- |
|
1106 |
||
1107 |
// --------------------------------------------------------- |
|
1108 |
// CVIMPSTUiDoubleListBoxTabViewControl::CheckAndSetLastItemFlag() |
|
1109 |
// Checks if the last contact is focused and Sets the iLastItemFlag |
|
1110 |
// --------------------------------------------------------- |
|
1111 |
void CVIMPSTUiDoubleListBoxTabViewControl::CheckAndSetLastItemFlag() |
|
1112 |
{ |
|
1113 |
if(iListBox->CurrentItemIndex() == (iArrayProcess.Count() - 1)) |
|
1114 |
{ |
|
1115 |
iLastItemFlag = ETrue; |
|
1116 |
} |
|
1117 |
else |
|
1118 |
{ |
|
1119 |
iLastItemFlag = EFalse; |
|
1120 |
} |
|
1121 |
} |
|
1122 |
// --------------------------------------------------------- |
|
1123 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetFocusAndMakeItemVisible() |
|
1124 |
// Compares the Saved Contact in iFocussedID with the contacts in the List and focuses if it is found |
|
1125 |
// --------------------------------------------------------- |
|
1126 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetFocusAndMakeItemVisible() |
|
1127 |
{ |
|
1128 |
TRACER_AUTO; |
|
1129 |
TInt count = iArrayProcess.Count(); |
|
1130 |
TInt index = CurrentItemIndex(); |
|
1131 |
if( index == count ) |
|
1132 |
{ |
|
1133 |
if( iLastItemFlag ) |
|
1134 |
{ |
|
1135 |
index = count - 1; |
|
1136 |
iLastItemFlag = EFalse; |
|
1137 |
} |
|
1138 |
} |
|
1139 |
CVIMPSTUiListBoxModel* model = |
|
1140 |
static_cast<CVIMPSTUiListBoxModel*>( iListBox->Model() ); |
|
1141 |
||
1142 |
if( model ) |
|
1143 |
{ |
|
1144 |
index = model->VisibleItemIndex( index ); |
|
1145 |
} |
|
1146 |
iListBox->ScrollToMakeItemVisible(index ); |
|
1147 |
SetCurrentItemIndex(index); |
|
1148 |
iListBox->DrawDeferred(); |
|
1149 |
} |
|
1150 |
||
1151 |
// --------------------------------------------------------------------- |
|
1152 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetClrFindPaneFlag(TBool aFlag) |
|
1153 |
// --------------------------------------------------------------------- |
|
1154 |
||
1155 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetClrFindPaneFlag(TBool aFlag) |
|
1156 |
{ |
|
1157 |
iClrFindPaneFlag = aFlag; |
|
1158 |
} |
|
1159 |
||
1160 |
// --------------------------------------------------------- |
|
1161 |
// CVIMPSTUiDoubleListBoxTabViewControl::CoeControl() |
|
1162 |
// --------------------------------------------------------- |
|
1163 |
||
1164 |
CCoeControl* CVIMPSTUiDoubleListBoxTabViewControl::CoeControl() |
|
1165 |
{ |
|
1166 |
return this; // return this pointer since its a parent class pointer of CCoeControl |
|
1167 |
} |
|
1168 |
// ------------------------------------------------------------------------ |
|
1169 |
// CVIMPSTUiDoubleListBoxTabViewControl::AvatarToIconL |
|
1170 |
// |
|
1171 |
// ------------------------------------------------------------------------ |
|
1172 |
CGulIcon* CVIMPSTUiDoubleListBoxTabViewControl::AvatarToIconL( const TDesC8& aAvatarContent ) |
|
1173 |
{ |
|
1174 |
TRACER_AUTO; |
|
1175 |
CGulIcon* newIcon = NULL; |
|
1176 |
CVIMPSTEngineImageHandler* imageHandler = CVIMPSTEngineImageHandler::NewL(); |
|
1177 |
CleanupStack::PushL( imageHandler ); |
|
1178 |
// pass the avatar content and mimetype as NULL |
|
1179 |
// mimetype will be recognised by the UTILS class |
|
1180 |
HBufC8* content = imageHandler->ProcessImageFromDataL( aAvatarContent , KNullDesC8); |
|
1181 |
if ( iAvatarError == KErrNone) |
|
1182 |
{ |
|
1183 |
newIcon = CGulIcon ::NewL( &(imageHandler->Bitmap()) ); |
|
1184 |
newIcon->SetBitmapsOwnedExternally( EFalse ); |
|
1185 |
} |
|
1186 |
CleanupStack::PopAndDestroy(); // imageHandler |
|
1187 |
if(content) |
|
1188 |
{ |
|
1189 |
delete content; |
|
1190 |
content = NULL; |
|
1191 |
} |
|
1192 |
return newIcon; |
|
1193 |
} |
|
1194 |
// --------------------------------------------------------- |
|
1195 |
// CVIMPSTUiDoubleListBoxTabViewControl::SetCbaLockL() |
|
1196 |
// Sets the lock status of cba keys. |
|
1197 |
// --------------------------------------------------------- |
|
1198 |
// |
|
1199 |
void CVIMPSTUiDoubleListBoxTabViewControl::SetCbaLockL( TBool aLock ) |
|
1200 |
{ |
|
1201 |
iCbaLock = aLock; |
|
1202 |
if( !aLock ) |
|
1203 |
{ |
|
1204 |
UpdateCbaL(); |
|
1205 |
} |
|
1206 |
} |
|
1207 |
// --------------------------------------------------------- |
|
1208 |
// CVIMPSTUiDoubleListBoxTabViewControl::UpdateCbaL() |
|
1209 |
// Updates Softkeys according to current focus. |
|
1210 |
// --------------------------------------------------------- |
|
1211 |
// |
|
1212 |
void CVIMPSTUiDoubleListBoxTabViewControl::UpdateCbaL( TBool aUseDefaultCba /*= EFalse*/ ) |
|
1213 |
{ |
|
1214 |
TRACER_AUTO; |
|
1215 |
TInt cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
1216 |
iCurrentCmdToExe = -1; |
|
1217 |
if( !iCbaLock ) |
|
1218 |
{ |
|
1219 |
TInt index = CurrentItemIndex(); |
|
1220 |
//if invalid index then dont set any command |
|
1221 |
if(KErrNotFound == index) |
|
1222 |
{ |
|
1223 |
if ( iCba ) |
|
1224 |
{ |
|
1225 |
iCba->SetCommandSetL( cbaRes ); |
|
1226 |
iCba->DrawNow(); |
|
1227 |
} |
|
1228 |
return; |
|
1229 |
} |
|
1230 |
||
1231 |
TVIMPSTEnums::TItem itemtype = iArrayProcess.GetType(index); |
|
1232 |
TVIMPSTEnums::TOnlineStatus onlinestatus = iCommandHandler.GetProcessInterface().GetOnlineStatusL(index); |
|
1233 |
TVIMPSTEnums::TVIMPSTRegistrationState servicestate = iEngine.ServiceState(); |
|
1234 |
TBool updateinvalid( iLastFocusedItemType == TVIMPSTEnums::EInvalid ); |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1235 |
if ( !iCba ) |
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1236 |
{ |
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1237 |
iCba = CEikButtonGroupContainer::Current(); |
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1238 |
} |
29 | 1239 |
|
1240 |
// default softkeys |
|
1241 |
if(iCba) |
|
1242 |
{ |
|
1243 |
if( aUseDefaultCba || updateinvalid ) |
|
1244 |
{ |
|
1245 |
if( aUseDefaultCba ) |
|
1246 |
{ |
|
1247 |
iLastFocusedItemType = TVIMPSTEnums::EOwnStatusItem; |
|
1248 |
} |
|
1249 |
else |
|
1250 |
{ |
|
1251 |
iLastFocusedItemType = itemtype; |
|
1252 |
} |
|
1253 |
||
1254 |
if ( itemtype == TVIMPSTEnums::EOwnStatusItem ) |
|
1255 |
{ |
|
1256 |
// Own status |
|
1257 |
if(TVIMPSTEnums::ESVCERegistered == servicestate) |
|
1258 |
{ |
|
1259 |
// Options/Back/Change status |
|
1260 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__CHANGESTATUS; |
|
1261 |
iCurrentCmdToExe = ECmdChangeStatus; |
|
1262 |
} |
|
1263 |
else if(TVIMPSTEnums::ESVCENetworkConnecting == servicestate) |
|
1264 |
{ |
|
1265 |
if(iTabbedView.CancelLoginSupportedL()) |
|
1266 |
{ |
|
1267 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CANCEL__EXIT; |
|
1268 |
iCurrentCmdToExe = ECmdCancelLogin; |
|
1269 |
} |
|
1270 |
else |
|
1271 |
{ |
|
1272 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
1273 |
iCurrentCmdToExe = -1; |
|
1274 |
} |
|
1275 |
} |
|
1276 |
else if(TVIMPSTEnums::ESVCEWaitingForNetwork == servicestate) |
|
1277 |
{ |
|
1278 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CHANGECONN__EXIT; |
|
1279 |
iCurrentCmdToExe = ECmdChangeConnectioninWaitingState; |
|
1280 |
} |
|
1281 |
else if(TVIMPSTEnums::ESVCEUpdatingContacts != servicestate) |
|
1282 |
{ |
|
1283 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_LOGIN__EXIT; |
|
1284 |
iCurrentCmdToExe = ECmdLogin; |
|
1285 |
} |
|
1286 |
} |
|
1287 |
||
1288 |
iCba->SetCommandSetL( cbaRes ); |
|
1289 |
iCba->DrawNow(); |
|
1290 |
} |
|
1291 |
||
1292 |
// collapse softkey ( when focus is on contact ) |
|
1293 |
else if( itemtype == TVIMPSTEnums::EContactItem ) |
|
1294 |
{ |
|
1295 |
iLastFocusedItemType = itemtype; |
|
1296 |
if(TVIMPSTEnums::ESVCERegistered == servicestate) |
|
1297 |
{ |
|
1298 |
// im is supported |
|
1299 |
if(iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM)) |
|
1300 |
{ |
|
1301 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTION_OPENCONV__EXIT ); |
|
1302 |
iCurrentCmdToExe = ECmdOpenConversation; |
|
1303 |
} |
|
1304 |
else //im is not supporteed |
|
1305 |
{ |
|
1306 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTIONS_DETAILS__EXIT ); |
|
1307 |
iCurrentCmdToExe = ECmdContactDetails; |
|
1308 |
} |
|
1309 |
} |
|
1310 |
else if(TVIMPSTEnums::ESVCENotRegistered == servicestate) |
|
1311 |
{ |
|
1312 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTIONS_DETAILS__EXIT ); |
|
1313 |
iCurrentCmdToExe = ECmdContactDetails; |
|
1314 |
} |
|
1315 |
iCba->DrawNow(); |
|
1316 |
} |
|
1317 |
else if( itemtype == TVIMPSTEnums::EUnknonContactItem ) |
|
1318 |
{ |
|
1319 |
iLastFocusedItemType = itemtype; |
|
1320 |
if(TVIMPSTEnums::ESVCERegistered == servicestate && |
|
1321 |
iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM)) |
|
1322 |
{ |
|
1323 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTION_OPENCONV__EXIT ); |
|
1324 |
iCurrentCmdToExe = ECmdOpenConversation; |
|
1325 |
} |
|
1326 |
else //im is not supporteed |
|
1327 |
{ |
|
1328 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY ); |
|
1329 |
iCurrentCmdToExe = -1; |
|
1330 |
} |
|
1331 |
iCba->DrawNow(); |
|
1332 |
} |
|
1333 |
// Focus on own contact item |
|
1334 |
else if( itemtype == TVIMPSTEnums::EOwnStatusItem ) |
|
1335 |
{ |
|
1336 |
iLastFocusedItemType = itemtype; |
|
1337 |
if ( itemtype == TVIMPSTEnums::EOwnStatusItem ) |
|
1338 |
{ |
|
1339 |
// Own status |
|
1340 |
if(TVIMPSTEnums::ESVCERegistered == servicestate) |
|
1341 |
{ |
|
1342 |
// Options/Back/Change status |
|
1343 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__CHANGESTATUS; |
|
1344 |
iCurrentCmdToExe = ECmdChangeStatus; |
|
1345 |
} |
|
1346 |
else if(TVIMPSTEnums::ESVCENetworkConnecting == servicestate) |
|
1347 |
{ |
|
1348 |
if(iTabbedView.CancelLoginSupportedL()) |
|
1349 |
{ |
|
1350 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CANCEL__EXIT; |
|
1351 |
iCurrentCmdToExe = ECmdCancelLogin; |
|
1352 |
} |
|
1353 |
else |
|
1354 |
{ |
|
1355 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
1356 |
iCurrentCmdToExe = -1; |
|
1357 |
} |
|
1358 |
} |
|
1359 |
else if(TVIMPSTEnums::ESVCEWaitingForNetwork == servicestate) |
|
1360 |
{ |
|
1361 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CHANGECONN__EXIT; |
|
1362 |
iCurrentCmdToExe = ECmdChangeConnectioninWaitingState; |
|
1363 |
} |
|
1364 |
else if(TVIMPSTEnums::ESVCEUpdatingContacts != servicestate) |
|
1365 |
{ |
|
1366 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_LOGIN__EXIT; |
|
1367 |
iCurrentCmdToExe = ECmdLogin; |
|
1368 |
} |
|
1369 |
} |
|
1370 |
//add for connecting state and waiting for connection state. |
|
1371 |
iCba->SetCommandSetL( cbaRes ); |
|
1372 |
iCba->DrawNow(); |
|
1373 |
} |
|
1374 |
// Focus on invitation item |
|
1375 |
else if( itemtype == TVIMPSTEnums::EFriendRequestItem ) |
|
1376 |
{ |
|
1377 |
iLastFocusedItemType = itemtype; |
|
1378 |
if(TVIMPSTEnums::ESVCERegistered == servicestate) |
|
1379 |
{ |
|
1380 |
iCurrentCmdToExe = ECmdOpenFriendRequest; |
|
1381 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTION_OPENFRNDREQ__EXIT ); |
|
1382 |
iCba->DrawNow(); |
|
1383 |
} |
|
1384 |
||
1385 |
} |
|
1386 |
} |
|
1387 |
||
1388 |
} |
|
1389 |
} |
|
1390 |
||
1391 |
// --------------------------------------------------------- |
|
1392 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleAvatarRefreshL() |
|
1393 |
// Saves the Contact ID in iFocussedID |
|
1394 |
// --------------------------------------------------------- |
|
1395 |
void CVIMPSTUiDoubleListBoxTabViewControl::HandleAvatarRefreshL( const TDesC& aUserId,TBool aBlock ) |
|
1396 |
{ |
|
1397 |
TRACER_AUTO; |
|
1398 |
if(aBlock) |
|
1399 |
{ |
|
1400 |
TRACE("inside blocking"); |
|
1401 |
TInt index = iArrayProcess.GetSelectedItemIndex(aUserId );//Get the index from storage. |
|
1402 |
if(index >= 0) |
|
1403 |
{ |
|
1404 |
CFormattedCellListBoxData* listBoxData = iListBox->ItemDrawer()->ColumnData(); |
|
1405 |
CArrayPtr<CGulIcon>* currentIconArray = listBoxData->IconArray(); |
|
1406 |
TInt avIndex = iArrayProcess.AvatarIndex(index); |
|
1407 |
||
1408 |
if( avIndex ) // if there is old icon already |
|
1409 |
{ |
|
1410 |
// delete the old icon compress the array and insert at the same position |
|
1411 |
currentIconArray->Delete( avIndex ); |
|
1412 |
currentIconArray->Compress(); |
|
1413 |
} |
|
1414 |
||
1415 |
// avatar got cleared just set the icon index to '0' |
|
1416 |
// icon what was added still remains in the listbox icon array |
|
1417 |
// dont delete the old icon, because that needs to modify the whole |
|
1418 |
// indexes of the other contacts. |
|
1419 |
// "keeping the icon is better than changing all contacts indexes" |
|
1420 |
// The icons will be deleted by listbox, when list box got destructed. |
|
1421 |
iArrayProcess.SetAvatarIndex( index , KErrNone ); |
|
1422 |
||
1423 |
} |
|
1424 |
} |
|
1425 |
||
1426 |
else |
|
1427 |
{ |
|
1428 |
TRACE("inside unblocking calling handleavatarchangel"); |
|
1429 |
HandleAvatarChangeL(aUserId); |
|
1430 |
} |
|
1431 |
||
1432 |
} |
|
1433 |
||
1434 |
||
1435 |
// End of File |