author | Simon Howkins <simonh@symbian.org> |
Mon, 29 Nov 2010 11:18:43 +0000 | |
branch | RCL_3 |
changeset 37 | 7506649dda4d |
parent 34 | e7f34e614544 |
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 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "cvimpstuisinglelistboxtabviewcontrol.h" |
|
21 |
||
22 |
#include "cvimpstuisinglelistboxarray.h" |
|
23 |
#include "tvimpstenums.h" |
|
24 |
#include "mvimpstcmdhandler.h" |
|
25 |
#include "cvimpstuibranddata.h" |
|
26 |
#include "imcvuiliterals.h" |
|
27 |
#include "cvimpstuilistboxmodel.h" |
|
28 |
#include "vimpstutilsdialog.h" |
|
29 |
#include "vimpstui.hrh" |
|
30 |
#include "cvimpstuitabbedview.h" |
|
31 |
#include "mvimpstengine.h" |
|
32 |
#include "cvimpststoragemanagerfactory.h" |
|
33 |
#include "mvimpststorageserviceview.h" |
|
34 |
||
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 |
||
49 |
#include <MVPbkContactStoreListObserver.h> |
|
50 |
#include "mvimpstenginepresencesubservice.h" |
|
51 |
#include "uiservicetabtracer.h" |
|
52 |
||
53 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
54 |
// imlauncher |
|
55 |
#include <imcvlauncher.h> |
|
56 |
const TInt KTextLimit( 40 ); // Text-limit for find-field |
|
57 |
||
58 |
const TInt KMinContact(1); // minmimum number of contacts to show findpane |
|
59 |
||
60 |
// ================= MEMBER FUNCTIONS ======================= |
|
61 |
// -------------------------------------------------------------------------- |
|
62 |
// CVIMPSTUiDoubleListBoxTabViewControl::HandleAvatarChangeL |
|
63 |
// -------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleAvatarChangeL( const TDesC& /*aUserId*/ ) |
|
66 |
{ |
|
67 |
||
68 |
} |
|
69 |
||
70 |
// -------------------------------------------------------------------------- |
|
71 |
// CVIMPSTUiDoubleListBoxTabViewControl::CVIMPSTUiDoubleListBoxTabViewControl |
|
72 |
// -------------------------------------------------------------------------- |
|
73 |
// |
|
74 |
CVIMPSTUiSingleListBoxTabViewControl::CVIMPSTUiSingleListBoxTabViewControl(CVIMPSTUiTabbedView& aTabbedView, MPbk2KeyEventHandler* aKeyEventHandler, |
|
75 |
MVIMPSTCmdHandler& aCommandHandler, |
|
76 |
TUint32 aServiceId, |
|
77 |
CVIMPSTUiBrandData& aBrandHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
78 |
MVIMPSTEngine& aEngine ) |
29 | 79 |
:iTabbedView(aTabbedView), |
80 |
iKeyEventHandler(aKeyEventHandler), |
|
81 |
iCommandHandler(aCommandHandler), |
|
82 |
iArrayProcess(iCommandHandler.GetProcessInterface()), |
|
83 |
iServiceId(aServiceId), |
|
84 |
iBrandHandler(aBrandHandler), |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
85 |
iEngine(aEngine) |
29 | 86 |
{ |
87 |
||
88 |
} |
|
89 |
||
90 |
||
91 |
// -------------------------------------------------------------------------- |
|
92 |
// CVIMPSTUiSingleListBoxTabViewControl::ConstructL |
|
93 |
// -------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
void CVIMPSTUiSingleListBoxTabViewControl::ConstructL() |
|
96 |
{ |
|
97 |
TRACER_AUTO; |
|
98 |
CreateWindowL(); |
|
99 |
||
100 |
// register to get the call back for any array data change |
|
101 |
iArrayProcess.AddObserver(this); |
|
102 |
||
103 |
// Create and construct listbox |
|
104 |
iListBox = new ( ELeave ) CVIMPSTUiSingleStyleListBox; |
|
105 |
||
106 |
iListBox->ConstructL(this); |
|
107 |
||
108 |
iListBox->SetContactListModelL(iArrayProcess); |
|
109 |
||
110 |
iListBox->SetListBoxObserver( this ); |
|
111 |
||
112 |
iListBox->SetContainerWindowL(*this); |
|
113 |
iListBox->CreateScrollBarFrameL(ETrue); |
|
114 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
|
115 |
(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
116 |
// set marquee on |
|
117 |
iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
118 |
// If engine is uninstalled, do not construct the list view. |
|
119 |
// Display empty message |
|
120 |
if (iEngine.IsUnInstalled()) |
|
121 |
{ |
|
122 |
SetListEmptyTextL( R_QTN_SERVTAB_SWUPDATE_RESTART ); |
|
123 |
return; |
|
124 |
} |
|
125 |
else |
|
126 |
{ |
|
127 |
// Construction of the listbox view. Engine is not uninstalled. |
|
128 |
CVIMPSTUiSingleListboxArray* friendsArray = |
|
129 |
CVIMPSTUiSingleListboxArray::NewL(iArrayProcess, |
|
130 |
iListBox->ItemDrawer()->ColumnData(), *iListBox); |
|
131 |
// now set the array |
|
132 |
iListBox->Model()->SetItemTextArray(friendsArray); |
|
133 |
||
134 |
iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); |
|
135 |
// if there is any contact other than owndata , show findpane |
|
136 |
if (iListBox->Model()->NumberOfItems() > KMinContact) |
|
137 |
{ |
|
138 |
// Create find-pane |
|
139 |
ActivateFindPaneL(); |
|
140 |
} |
|
141 |
LoadBitmapsL(); |
|
142 |
SetCbaLockL(EFalse); |
|
143 |
} |
|
144 |
||
145 |
||
146 |
} |
|
147 |
||
148 |
||
149 |
// -------------------------------------------------------------------------- |
|
150 |
// CVIMPSTUiSingleListBoxTabViewControl::NewL |
|
151 |
// -------------------------------------------------------------------------- |
|
152 |
// |
|
153 |
CVIMPSTUiSingleListBoxTabViewControl* CVIMPSTUiSingleListBoxTabViewControl::NewL |
|
154 |
(CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler, |
|
155 |
MVIMPSTCmdHandler& aCommandHandler, TUint32 aServiceId, |
|
156 |
CVIMPSTUiBrandData& aBrandHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
157 |
MVIMPSTEngine& aEngine) |
29 | 158 |
{ |
159 |
TRACER_AUTO; |
|
160 |
CVIMPSTUiSingleListBoxTabViewControl* self = NewLC(aTabbedView,aKeyEventHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
161 |
aCommandHandler, aServiceId, aBrandHandler,aEngine); |
29 | 162 |
CleanupStack::Pop(self); |
163 |
return self; |
|
164 |
} |
|
165 |
||
166 |
||
167 |
// -------------------------------------------------------------------------- |
|
168 |
// CVIMPSTUiSingleListBoxTabViewControl::NewLC |
|
169 |
// -------------------------------------------------------------------------- |
|
170 |
// |
|
171 |
CVIMPSTUiSingleListBoxTabViewControl* CVIMPSTUiSingleListBoxTabViewControl::NewLC |
|
172 |
(CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler, |
|
173 |
MVIMPSTCmdHandler& aCommandHandler, TUint32 aServiceId, |
|
174 |
CVIMPSTUiBrandData& aBrandHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
175 |
MVIMPSTEngine& aEngine) |
29 | 176 |
{ |
177 |
TRACER_AUTO; |
|
178 |
CVIMPSTUiSingleListBoxTabViewControl* self = |
|
179 |
new (ELeave) CVIMPSTUiSingleListBoxTabViewControl(aTabbedView,aKeyEventHandler, |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
180 |
aCommandHandler, aServiceId, aBrandHandler,aEngine); |
29 | 181 |
CleanupStack::PushL(self); |
182 |
self->ConstructL(); |
|
183 |
return self; |
|
184 |
} |
|
185 |
||
186 |
||
187 |
// -------------------------------------------------------------------------- |
|
188 |
// CVIMPSTUiSingleListBoxTabViewControl::~CVIMPSTUiSingleListBoxTabViewControl |
|
189 |
// -------------------------------------------------------------------------- |
|
190 |
// |
|
191 |
CVIMPSTUiSingleListBoxTabViewControl::~CVIMPSTUiSingleListBoxTabViewControl() |
|
192 |
{ |
|
193 |
||
194 |
delete iListBox; |
|
195 |
iArrayProcess.RemoveObserver(); |
|
196 |
if( iFindbox ) |
|
197 |
{ |
|
198 |
delete iFindbox; |
|
199 |
iFindbox = NULL; |
|
200 |
} |
|
201 |
||
202 |
} |
|
203 |
||
204 |
// --------------------------------------------------------- |
|
205 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleAddition |
|
206 |
// --------------------------------------------------------- |
|
207 |
// |
|
208 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleAdditionL(TVIMPSTEnums::TItem aType, TInt aIndex) |
|
209 |
{ |
|
210 |
if(iListBox ) |
|
211 |
{ |
|
212 |
iListBox->HandleItemAdditionL(); |
|
213 |
UpdateViewL(aIndex,aType) ; |
|
214 |
} |
|
215 |
} |
|
216 |
||
217 |
// --------------------------------------------------------- |
|
218 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleAddition |
|
219 |
// --------------------------------------------------------- |
|
220 |
// |
|
221 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleDeletionL(TVIMPSTEnums::TItem aType, TInt aIndex ) |
|
222 |
{ |
|
223 |
if(iListBox) |
|
224 |
{ |
|
225 |
iListBox->HandleItemRemovalL(); |
|
226 |
TInt count = iListBox->Model()->NumberOfItems(); |
|
227 |
if( count == aIndex ) |
|
228 |
{ |
|
229 |
aIndex = 0; |
|
230 |
} |
|
231 |
UpdateViewL(aIndex,aType) ; |
|
232 |
} |
|
233 |
} |
|
234 |
||
235 |
// -------------------------------------------------------------------------- |
|
236 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleItemAdditionL |
|
237 |
// -------------------------------------------------------------------------- |
|
238 |
// |
|
239 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleItemAdditionL() |
|
240 |
{ |
|
241 |
if(iListBox) |
|
242 |
{ |
|
243 |
iListBox->HandleItemAdditionL(); |
|
244 |
TInt index = CurrentItemIndex(); |
|
245 |
TVIMPSTEnums::TItem type = iArrayProcess.GetType(index); |
|
246 |
UpdateViewL(index,type) ; |
|
247 |
} |
|
248 |
} |
|
249 |
||
250 |
||
251 |
// -------------------------------------------------------------------------- |
|
252 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleItemRemovalL |
|
253 |
// -------------------------------------------------------------------------- |
|
254 |
// |
|
255 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleItemRemovalL() |
|
256 |
{ |
|
257 |
if(iListBox) |
|
258 |
{ |
|
259 |
iListBox->HandleItemRemovalL(); |
|
260 |
TInt index = CurrentItemIndex(); |
|
261 |
TVIMPSTEnums::TItem type = iArrayProcess.GetType(index); |
|
262 |
UpdateViewL(index,type) ; |
|
263 |
} |
|
264 |
} |
|
265 |
||
266 |
||
267 |
||
268 |
// -------------------------------------------------------------------------- |
|
269 |
// CVIMPSTUiSingleListBoxTabViewControl::SizeChanged |
|
270 |
// -------------------------------------------------------------------------- |
|
271 |
// |
|
272 |
void CVIMPSTUiSingleListBoxTabViewControl::SizeChanged() |
|
273 |
{ |
|
274 |
SetLayout(); //layouting controls |
|
275 |
if ( iFindbox && iFindPaneIsVisible ) |
|
276 |
{ |
|
277 |
iFindbox->MakeVisible( ETrue ); |
|
278 |
} |
|
279 |
} |
|
280 |
||
281 |
||
282 |
// -------------------------------------------------------------------------- |
|
283 |
// CVIMPSTUiSingleListBoxTabViewControl::CountComponentControls |
|
284 |
// -------------------------------------------------------------------------- |
|
285 |
// |
|
286 |
TInt CVIMPSTUiSingleListBoxTabViewControl::CountComponentControls() const |
|
287 |
{ |
|
288 |
// return number of controls inside this container |
|
289 |
if( !iFindbox ) |
|
290 |
{ |
|
291 |
// Find-pane does not exist when there is no data in listbox, |
|
292 |
// so only one control exists (listbox) |
|
293 |
return 1; //Ignore CodeScanner warning |
|
294 |
} |
|
295 |
else |
|
296 |
{ |
|
297 |
// listbox and findbox exists. that makes it two |
|
298 |
return 2; //Ignore CodeScanner warning |
|
299 |
} |
|
300 |
} |
|
301 |
||
302 |
// -------------------------------------------------------------------------- |
|
303 |
// CVIMPSTUiSingleListBoxTabViewControl::FocusChanged |
|
304 |
// -------------------------------------------------------------------------- |
|
305 |
// |
|
306 |
void CVIMPSTUiSingleListBoxTabViewControl::FocusChanged( TDrawNow aDrawNow ) |
|
307 |
{ |
|
308 |
if ( iFindbox && iFindbox->IsVisible() ) |
|
309 |
{ |
|
310 |
iFindbox->SetFocus( IsFocused(), aDrawNow ); |
|
311 |
if ( aDrawNow == EDrawNow && IsFocused() ) |
|
312 |
{ |
|
313 |
iFindbox->DrawDeferred(); |
|
314 |
} |
|
315 |
} |
|
316 |
} |
|
317 |
||
318 |
||
319 |
// -------------------------------------------------------------------------- |
|
320 |
// CVIMPSTUiSingleListBoxTabViewControl::ComponentControl |
|
321 |
// -------------------------------------------------------------------------- |
|
322 |
// |
|
323 |
CCoeControl* CVIMPSTUiSingleListBoxTabViewControl::ComponentControl(TInt aIndex) const |
|
324 |
{ |
|
325 |
// return iListBox; |
|
326 |
switch ( aIndex ) |
|
327 |
{ |
|
328 |
// the caller wants to have the first control |
|
329 |
// so it's always listbox |
|
330 |
case 0: |
|
331 |
{ |
|
332 |
return iListBox; |
|
333 |
} |
|
334 |
// the caller wants to have the second control |
|
335 |
// so it's always the findbox if it exists |
|
336 |
case 1: |
|
337 |
{ |
|
338 |
if( iFindbox ) |
|
339 |
{ |
|
340 |
return iFindbox; |
|
341 |
} |
|
342 |
return NULL; |
|
343 |
} |
|
344 |
default: |
|
345 |
{ |
|
346 |
return NULL; |
|
347 |
} |
|
348 |
} |
|
349 |
} |
|
350 |
||
351 |
||
352 |
// -------------------------------------------------------------------------- |
|
353 |
// CVIMPSTUiSingleListBoxTabViewControl::OfferKeyEventL |
|
354 |
// -------------------------------------------------------------------------- |
|
355 |
// |
|
356 |
TKeyResponse CVIMPSTUiSingleListBoxTabViewControl::OfferKeyEventL |
|
357 |
(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
358 |
{ |
|
359 |
if ( !aKeyEvent.iCode ) |
|
360 |
{ |
|
361 |
//The character code generated |
|
362 |
//for an EEventKey, or 0 for a down or up event. |
|
363 |
//For down or up key return key consumed.. handle only the events |
|
364 |
||
365 |
if((EEventKeyDown == aType) && (EStdKeyDevice3 == aKeyEvent.iScanCode)) |
|
366 |
{ |
|
367 |
//for setting the command to be executed for the "Selection key" |
|
368 |
//in case of selection key, container's OfferKeyEventL() is called only for EEventKeyDown and EEventKeyUp |
|
369 |
//and not for EEventKey |
|
370 |
UpdateCbaL(); |
|
371 |
} |
|
372 |
return EKeyWasConsumed; |
|
373 |
} |
|
374 |
UpdateCbaL(); |
|
375 |
TKeyResponse ret = EKeyWasNotConsumed; |
|
376 |
// Offer key event first to the key event handler |
|
377 |
if ( iKeyEventHandler && iKeyEventHandler->Pbk2ProcessKeyEventL |
|
378 |
( aKeyEvent, aType ) ) |
|
379 |
{ |
|
380 |
ret = EKeyWasConsumed; |
|
381 |
} |
|
382 |
||
383 |
switch ( aKeyEvent.iCode ) |
|
384 |
{ |
|
385 |
case EKeyBackspace: |
|
386 |
{ |
|
387 |
if ( iFindbox ) |
|
388 |
{ |
|
389 |
if( iFindbox->TextLength() == 0 ) |
|
390 |
{ |
|
391 |
TVIMPSTEnums::TItem item = iArrayProcess.GetType( CurrentItemIndex() ); |
|
392 |
if(TVIMPSTEnums::EContactItem == item) |
|
393 |
{ |
|
394 |
TInt index = CurrentItemIndex(); |
|
395 |
if( iArrayProcess.IsConversationExist(index) ) |
|
396 |
{ |
|
397 |
iTabbedView.CloseConversationL(); |
|
398 |
ret = EKeyWasConsumed; |
|
399 |
} |
|
400 |
else if(TVIMPSTEnums::EContactItem == iArrayProcess.GetType( index ) ) |
|
401 |
{ |
|
402 |
if( TVIMPSTEnums::ESVCERegistered == iArrayProcess.GetLoginState() ) |
|
403 |
{ |
|
404 |
iTabbedView.DeleteContactL(); |
|
405 |
} |
|
406 |
ret = EKeyWasConsumed; |
|
407 |
} |
|
408 |
} |
|
409 |
} |
|
410 |
} |
|
411 |
break; |
|
412 |
} |
|
413 |
||
414 |
// Case to handle send key press consumption. |
|
415 |
case EKeyYes: |
|
416 |
{ |
|
417 |
TInt index = iListBox->CurrentItemIndex(); |
|
418 |
if( TVIMPSTEnums::EOwnStatusItem == iArrayProcess.GetType( index ) ) |
|
419 |
{ |
|
420 |
ret = EKeyWasConsumed; |
|
421 |
} |
|
422 |
break; |
|
423 |
} |
|
424 |
default: |
|
425 |
break; |
|
426 |
} |
|
427 |
||
428 |
if( EKeyPhoneSend == aKeyEvent.iCode && ret != EKeyWasConsumed ) |
|
429 |
{ |
|
430 |
if( iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EVoip)) |
|
431 |
{ |
|
432 |
iTabbedView.MakeVoipCallL(); |
|
433 |
ret = EKeyWasConsumed; |
|
434 |
} |
|
435 |
||
436 |
} |
|
437 |
if( ret == EKeyWasConsumed ) |
|
438 |
{ |
|
439 |
// user might has choosen back/end key/application key etc |
|
440 |
// application might switch to background |
|
441 |
// return from here |
|
442 |
return ret; |
|
443 |
} |
|
444 |
if ( iFindPaneIsVisible && iFindbox ) |
|
445 |
{ |
|
446 |
ret = iFindbox->OfferKeyEventL( aKeyEvent, aType ) ; |
|
447 |
} |
|
448 |
// Not consumed by the key handler and findpane , offer to the control next |
|
449 |
if ( ret == EKeyWasNotConsumed ) |
|
450 |
{ |
|
451 |
ret = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
452 |
} |
|
453 |
iTabbedView.UpdateToolbarL(); |
|
454 |
return ret; |
|
455 |
} |
|
456 |
||
457 |
// -------------------------------------------------------------------------- |
|
458 |
// CVIMPSTUiSingleListBoxTabViewControl::CurrentItemIndex |
|
459 |
// -------------------------------------------------------------------------- |
|
460 |
// |
|
461 |
TInt CVIMPSTUiSingleListBoxTabViewControl::CurrentItemIndex() const |
|
462 |
{ |
|
463 |
if( !iListBox ) |
|
464 |
{ |
|
465 |
return KErrNotFound; |
|
466 |
} |
|
467 |
if( !iListBox->View() ) |
|
468 |
{ |
|
469 |
// CurrentItemIndex panics if the listbox has no view |
|
470 |
return KErrNotFound; |
|
471 |
} |
|
472 |
||
473 |
TInt curIndex( iListBox->CurrentItemIndex() ); |
|
474 |
if ( curIndex < 0 ) |
|
475 |
{ |
|
476 |
return KErrNotFound; |
|
477 |
} |
|
478 |
CVIMPSTUiListBoxModel* model = |
|
479 |
static_cast<CVIMPSTUiListBoxModel*>( iListBox->Model() ); |
|
480 |
||
481 |
if( model ) |
|
482 |
{ |
|
483 |
return model->FilteredItemIndex( curIndex ); |
|
484 |
} |
|
485 |
return KErrNotFound; |
|
486 |
} |
|
487 |
||
488 |
||
489 |
||
490 |
// -------------------------------------------------------------------------- |
|
491 |
// CVIMPSTUiSingleListBoxTabViewControl::SetCurrentItemIndex |
|
492 |
// -------------------------------------------------------------------------- |
|
493 |
// |
|
494 |
void CVIMPSTUiSingleListBoxTabViewControl::SetCurrentItemIndex(TInt aIndex) |
|
495 |
{ |
|
496 |
if (iListBox->CurrentItemIndex() != aIndex && |
|
497 |
aIndex >= 0 && |
|
498 |
aIndex < iListBox->Model()->NumberOfItems() ) |
|
499 |
{ |
|
500 |
iListBox->SetCurrentItemIndex(aIndex); |
|
501 |
TRAP_IGNORE(UpdateCbaL()); |
|
502 |
} |
|
503 |
} |
|
504 |
||
505 |
||
506 |
// -------------------------------------------------------------------------- |
|
507 |
// CVIMPSTUiSingleListBoxTabViewControl::SetCurrentItemIndexAndDraw |
|
508 |
// -------------------------------------------------------------------------- |
|
509 |
// |
|
510 |
void CVIMPSTUiSingleListBoxTabViewControl::SetCurrentItemIndexAndDraw(TInt aIndex) |
|
511 |
{ |
|
512 |
SetCurrentItemIndex(aIndex); |
|
513 |
this->DrawDeferred(); |
|
514 |
} |
|
515 |
||
516 |
||
517 |
// -------------------------------------------------------------------------- |
|
518 |
// CVIMPSTUiSingleListBoxTabViewControl::SetListEmptyTextL |
|
519 |
// -------------------------------------------------------------------------- |
|
520 |
// |
|
521 |
void CVIMPSTUiSingleListBoxTabViewControl::SetListEmptyTextL(TInt aResourceId) |
|
522 |
{ |
|
523 |
HBufC* msgText; |
|
524 |
TRACER_AUTO; |
|
525 |
// Get Service Name from Engine , load string from resource and display. |
|
526 |
// This text is shown to tell the user to restart phone to get the service again. |
|
527 |
TPtrC serviceNamePtr(iEngine.ServiceName()); |
|
528 |
msgText = StringLoader::LoadLC(aResourceId, serviceNamePtr, iCoeEnv); |
|
529 |
iListBox->View()->SetListEmptyTextL(*msgText); |
|
530 |
TRACE( "Display Text %S", msgText ); |
|
531 |
||
532 |
CleanupStack::PopAndDestroy(msgText); |
|
533 |
} |
|
534 |
||
535 |
// --------------------------------------------------------- |
|
536 |
// CVIMPSTUiSingleListBoxTabViewControl::LoadBitmapsL |
|
537 |
// Called by framework when the view size is changed |
|
538 |
// --------------------------------------------------------- |
|
539 |
// |
|
540 |
void CVIMPSTUiSingleListBoxTabViewControl::LoadBitmapsL() |
|
541 |
{ |
|
542 |
||
543 |
||
544 |
CColumnListBoxData* listBoxData = iListBox->ItemDrawer()->ColumnData(); |
|
545 |
if ( !listBoxData ) |
|
546 |
{ |
|
547 |
//No listbox data |
|
548 |
User::Leave( KErrNotFound ); |
|
549 |
} |
|
550 |
||
551 |
CAknIconArray* icons = iBrandHandler.LoadIconsLC( ); |
|
552 |
||
553 |
CArrayPtr<CGulIcon>* oldIconArray = listBoxData->IconArray(); |
|
554 |
if( oldIconArray ) |
|
555 |
{ |
|
556 |
oldIconArray->ResetAndDestroy(); |
|
557 |
delete oldIconArray; |
|
558 |
listBoxData->SetIconArray( NULL ); |
|
559 |
} |
|
560 |
||
561 |
// Set icon-array to listbox's drawer |
|
562 |
listBoxData->SetIconArray( icons ); |
|
563 |
CleanupStack::Pop( icons ); |
|
564 |
} |
|
565 |
||
566 |
// --------------------------------------------------------- |
|
567 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleListBoxEventL( |
|
568 |
// CEikListBox* /*aListBox*/, TListBoxEvent /*aEventType*/ ) |
|
569 |
// From MEikListBoxObserver, Handles event's generated by listbox |
|
570 |
// (other items were commented in a header). |
|
571 |
// --------------------------------------------------------- |
|
572 |
// |
|
573 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleListBoxEventL( |
|
574 |
CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
575 |
{ |
|
576 |
iTabbedView.UpdateToolbarL(); |
|
577 |
UpdateCbaL(); |
|
578 |
switch(aEventType) |
|
579 |
{ |
|
580 |
case EEventItemSingleClicked: |
|
581 |
{ |
|
582 |
TBool presenceEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EPresence); |
|
583 |
TBool imEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EIM); |
|
584 |
TBool voipEnabled = iEngine.IsSubServiceEnabled(TVIMPSTEnums::EVoip); |
|
585 |
||
586 |
TInt index = CurrentItemIndex(); |
|
587 |
TVIMPSTEnums::TItem itemType = iArrayProcess.GetType(index); |
|
588 |
TVIMPSTEnums::TVIMPSTRegistrationState serviceState = iTabbedView.GetServiceState(); |
|
589 |
||
590 |
if(TVIMPSTEnums::EOwnStatusItem == itemType && |
|
591 |
TVIMPSTEnums::ESVCENotRegistered == serviceState) |
|
592 |
{ |
|
593 |
iTabbedView.HandleCommandL( ECmdLogin ); |
|
594 |
} |
|
595 |
else if(TVIMPSTEnums::EOwnStatusItem == itemType |
|
596 |
&& presenceEnabled && |
|
597 |
TVIMPSTEnums::ESVCERegistered == serviceState ) |
|
598 |
{ |
|
599 |
iTabbedView.HandleCommandL( ECmdChangeStatus ); |
|
600 |
} |
|
601 |
else if( ( TVIMPSTEnums::EContactItem == itemType || |
|
602 |
TVIMPSTEnums::EUnknonContactItem == itemType )&& imEnabled && |
|
603 |
TVIMPSTEnums::ESVCERegistered == serviceState ) |
|
604 |
{ |
|
605 |
iTabbedView.HandleCommandL( ECmdOpenConversation ); |
|
606 |
} |
|
607 |
else if ( itemType == TVIMPSTEnums::EFriendRequestItem |
|
608 |
&& TVIMPSTEnums::ESVCERegistered == serviceState) |
|
609 |
{ |
|
610 |
iTabbedView.HandleCommandL( ECmdOpenFriendRequest ); |
|
611 |
} |
|
612 |
else if( TVIMPSTEnums::EContactItem == itemType ) |
|
613 |
{ |
|
614 |
if( !(TVIMPSTEnums::ESVCEUpdatingContacts == serviceState || |
|
615 |
TVIMPSTEnums::ESVCENetworkConnecting == serviceState || |
|
616 |
TVIMPSTEnums::ESVCENetworkDisConnecting == serviceState)) |
|
617 |
{ |
|
618 |
iTabbedView.HandleCommandL( ECmdContactDetails ); |
|
619 |
} |
|
620 |
} |
|
621 |
break; |
|
622 |
} |
|
623 |
// Add enter key handling |
|
624 |
case EEventEnterKeyPressed: |
|
625 |
{ |
|
626 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
627 |
TInt commandId( iCba->ButtonGroup()->CommandId( CEikButtonGroupContainer::EMiddleSoftkeyPosition)); |
|
628 |
||
629 |
iTabbedView.HandleCommandL(commandId); |
|
630 |
break; |
|
631 |
} |
|
632 |
default: |
|
633 |
{ |
|
634 |
break; |
|
635 |
} |
|
636 |
} |
|
637 |
||
638 |
} |
|
639 |
// --------------------------------------------------------- |
|
640 |
// CVIMPSTUiSingleListBoxTabViewControl::SendMessageL( |
|
641 |
// CEikListBox* /*aListBox*/, TListBoxEvent /*aEventType*/ ) |
|
642 |
// From MEikListBoxObserver, Handles event's generated by listbox |
|
643 |
// (other items were commented in a header). |
|
644 |
// --------------------------------------------------------- |
|
645 |
// |
|
646 |
void CVIMPSTUiSingleListBoxTabViewControl::SendMessageL() |
|
647 |
{ |
|
648 |
TInt index = CurrentItemIndex(); |
|
649 |
TPtrC seletctedItem = iArrayProcess.GetItemUserId(index) ; |
|
650 |
if( index< 0 ) |
|
651 |
{ |
|
652 |
// return if item not found. |
|
653 |
return; |
|
654 |
} |
|
655 |
if(seletctedItem.Length()) |
|
656 |
{ |
|
657 |
// No need to check for the presence of the contact as in singleline |
|
658 |
// list box there is no presence, hence directly open the ocnversation view. |
|
659 |
TVwsViewId activeViewId; |
|
660 |
CCoeEnv::Static()->AppUi()->GetActiveViewId( activeViewId ); |
|
661 |
||
662 |
iArrayProcess.ResetPendingMsg( index ); |
|
663 |
// imlauncher call for luanching the conversationview with seletced user id |
|
664 |
IMCVLauncher::LaunchImConversationViewL(activeViewId, iServiceId, seletctedItem ); |
|
665 |
} |
|
666 |
else |
|
667 |
{ |
|
668 |
//When there is no XSP Id present it comes to here |
|
669 |
//Displaying a note that there is no XSP ID |
|
670 |
HBufC* note = NULL; |
|
671 |
note = StringLoader::LoadLC( R_QTN_SERVTAB_NOXSP_ERROR ); |
|
672 |
VIMPSTUtilsDialog::DisplayNoteDialogL( *note ); |
|
673 |
CleanupStack::PopAndDestroy( note ); |
|
674 |
} |
|
675 |
} |
|
676 |
// --------------------------------------------------------- |
|
677 |
// CVIMPSTUiSingleListBoxTabViewControl::UpdateViewL |
|
678 |
// (other items were commented in a header). |
|
679 |
// --------------------------------------------------------- |
|
680 |
// |
|
681 |
void CVIMPSTUiSingleListBoxTabViewControl::UpdateViewL( |
|
682 |
TInt aIndex, TVIMPSTEnums::TItem aType) |
|
683 |
{ |
|
684 |
TRACER_AUTO; |
|
685 |
TInt index = KErrNotFound; |
|
686 |
if( aIndex < 0 ) |
|
687 |
{ |
|
688 |
aIndex = CurrentItemIndex()<0?0:CurrentItemIndex(); |
|
689 |
} |
|
690 |
switch(aType) |
|
691 |
{ |
|
692 |
case TVIMPSTEnums::EContactItem: |
|
693 |
case TVIMPSTEnums::EOwnStatusItem: |
|
694 |
{ |
|
695 |
/*Not attempting to get the index of contact because aIndex is the |
|
696 |
same as this index and we pass it on to the contactlistboxmodel's |
|
697 |
visibleitem method*/ |
|
698 |
CVIMPSTUiListBoxModel* list = |
|
699 |
static_cast<CVIMPSTUiListBoxModel*>( iListBox->Model() ); |
|
700 |
index = list->VisibleItemIndex(aIndex); |
|
701 |
if( index != KErrNotFound && iFindbox ) |
|
702 |
{ |
|
703 |
if(iClrFindPaneFlag) |
|
704 |
{ |
|
705 |
iFindbox->SetSearchTextL( KNullDesC ); |
|
706 |
iFindbox->DrawNow(); |
|
707 |
iClrFindPaneFlag = EFalse; |
|
708 |
} |
|
709 |
else |
|
710 |
{ |
|
711 |
TBuf<KTextLimit> temp; |
|
712 |
iFindbox->GetSearchText(temp); |
|
713 |
if(0 != temp.Compare(KNullDesC)) |
|
714 |
{ |
|
715 |
((CAknFilteredTextListBoxModel*) iListBox->Model() ) |
|
716 |
->Filter()->HandleOfferkeyEventL(); |
|
717 |
} |
|
718 |
} |
|
719 |
} |
|
720 |
break; |
|
721 |
} |
|
722 |
default: |
|
723 |
{ |
|
724 |
//nothing to do |
|
725 |
break; |
|
726 |
} |
|
727 |
} |
|
728 |
iListBox->DrawNow(); |
|
729 |
SetCurrentItemIndex(aIndex); |
|
730 |
SetFocusAndMakeItemVisible(); |
|
731 |
TInt count = iArrayProcess.Count(); |
|
732 |
if(count > KMinContact && ! iFindPaneIsVisible) |
|
733 |
{ |
|
734 |
ActivateFindPaneL(); |
|
735 |
} |
|
736 |
else if(count <= KMinContact && iFindPaneIsVisible) // extra check needed here to improve performance |
|
737 |
{ |
|
738 |
DeactivateFindPaneL(); |
|
739 |
} |
|
740 |
||
741 |
//Update the Toolbar after moving the focus to the current item. |
|
742 |
iTabbedView.UpdateToolbarL(); |
|
743 |
UpdateCbaL(); |
|
744 |
} |
|
745 |
// --------------------------------------------------------- |
|
746 |
// CVIMPSTUiSingleListBoxTabViewControl::ActivateFindPaneL() |
|
747 |
// Activates find-pane |
|
748 |
// (other items were commented in a header). |
|
749 |
// --------------------------------------------------------- |
|
750 |
// |
|
751 |
void CVIMPSTUiSingleListBoxTabViewControl::ActivateFindPaneL() |
|
752 |
{ |
|
753 |
TRACER_AUTO; |
|
754 |
if( !iFindbox ) |
|
755 |
{ |
|
756 |
iFindbox = CAknSearchField::NewL( *this, |
|
757 |
CAknSearchField::ESearch, |
|
758 |
NULL, KTextLimit ); |
|
759 |
static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() ) |
|
760 |
->CreateFilterL( iListBox, iFindbox ); |
|
761 |
||
762 |
} |
|
763 |
iFindbox->SetObserver( this ); |
|
764 |
iFindbox->ActivateL(); |
|
765 |
iFindbox->ResetL(); |
|
766 |
iFindbox->SetSearchTextL( KNullDesC ); |
|
767 |
||
768 |
iFindPaneIsVisible = ETrue; |
|
769 |
SetLayout(); |
|
770 |
||
771 |
if( IsActivated() ) |
|
772 |
{ |
|
773 |
iFindbox->MakeVisible( ETrue ); |
|
774 |
iFindbox->SetFocus( ETrue ); |
|
775 |
iListBox->SizeChanged(); |
|
776 |
DrawNow(); |
|
777 |
} |
|
778 |
} |
|
779 |
||
780 |
// --------------------------------------------------------- |
|
781 |
// CVIMPSTUiSingleListBoxTabViewControl::DeactivateFindPaneL() |
|
782 |
// De-activates find-pane |
|
783 |
// (other items were commented in a header). |
|
784 |
// --------------------------------------------------------- |
|
785 |
// |
|
786 |
void CVIMPSTUiSingleListBoxTabViewControl::DeactivateFindPaneL() |
|
787 |
{ |
|
788 |
TRACER_AUTO; |
|
789 |
if( !iFindbox ) |
|
790 |
{ |
|
791 |
return; |
|
792 |
} |
|
793 |
static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() ) |
|
794 |
->Filter()->ResetFilteringL(); |
|
795 |
||
796 |
||
797 |
iFindbox->MakeVisible( EFalse ); |
|
798 |
iFindbox->SetFocus( EFalse ); |
|
799 |
||
800 |
iFindPaneIsVisible = EFalse; |
|
801 |
SetLayout(); |
|
802 |
||
803 |
if( IsActivated() ) |
|
804 |
{ |
|
805 |
DrawNow(); |
|
806 |
} |
|
807 |
} |
|
808 |
||
809 |
||
810 |
||
811 |
// --------------------------------------------------------- |
|
812 |
// CVIMPSTUiSingleListBoxTabViewControl::SetLayout() |
|
813 |
// Layouts current components according to AVKON LAF |
|
814 |
// (other items were commented in a header). |
|
815 |
// --------------------------------------------------------- |
|
816 |
// |
|
817 |
void CVIMPSTUiSingleListBoxTabViewControl::SetLayout() |
|
818 |
{ |
|
819 |
const TRect rect( Rect() ); |
|
820 |
if( iListBox && iFindPaneIsVisible ) |
|
821 |
{ |
|
822 |
||
823 |
TAknWindowLineLayout empty; |
|
824 |
empty.iC = 0; |
|
825 |
empty.il = 0; |
|
826 |
empty.it = 0; |
|
827 |
empty.ir = 0; |
|
828 |
empty.ib = 0; |
|
829 |
empty.iW = ELayoutEmpty; |
|
830 |
empty.iH = ELayoutEmpty; |
|
831 |
||
832 |
TAknWindowLineLayout findPane = AknLayoutScalable_Avkon::find_pane().LayoutLine(); |
|
833 |
TAknWindowLineLayout listPane; |
|
834 |
||
835 |
// listPane should equal to parent's rect |
|
836 |
listPane.il = Rect().iTl.iX; |
|
837 |
listPane.ir = ELayoutEmpty; |
|
838 |
listPane.it = Rect().iTl.iY; |
|
839 |
listPane.ib = ELayoutEmpty; |
|
840 |
// this check is required since it's not guaranteed that listbox's SetRect |
|
841 |
// has been called when this code is executed |
|
842 |
if ( Size().iWidth > 0 ) |
|
843 |
{ |
|
844 |
listPane.iW = Size().iWidth; |
|
845 |
listPane.ir = ELayoutEmpty; |
|
846 |
} |
|
847 |
else |
|
848 |
{ |
|
849 |
listPane.iW = ELayoutEmpty; |
|
850 |
listPane.ir = 0; |
|
851 |
} |
|
852 |
// but findpane's height should be subtracted |
|
853 |
listPane.iH = Size().iHeight - findPane.iH; |
|
854 |
||
855 |
// findPane's width should equal to listPane's width |
|
856 |
findPane.iW = listPane.iW; |
|
857 |
CAknFilteredTextListBoxModel* m = static_cast <CAknFilteredTextListBoxModel*> ( iListBox->Model() ); |
|
858 |
if ( m->Filter() ) |
|
859 |
{ |
|
860 |
m->Filter()->SetParentControl( this ); |
|
861 |
} |
|
862 |
TAknLayoutRect lrect; |
|
863 |
lrect.LayoutRect( Rect(), empty ); |
|
864 |
AknLayoutUtils::LayoutControl( iFindbox, lrect.Rect(), findPane ); |
|
865 |
AknLayoutUtils::LayoutControl( iListBox, Rect(), listPane ); |
|
866 |
||
867 |
} |
|
868 |
else if( iListBox ) |
|
869 |
{ |
|
870 |
AknLayoutUtils::LayoutControl( iListBox, |
|
871 |
rect, |
|
872 |
AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); |
|
873 |
} |
|
874 |
} |
|
875 |
||
876 |
// --------------------------------------------------------- |
|
877 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleControlEventL |
|
878 |
// --------------------------------------------------------- |
|
879 |
// |
|
880 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) |
|
881 |
{ |
|
882 |
// We only observe iFindbox |
|
883 |
if( EEventStateChanged == aEventType ) |
|
884 |
{ |
|
885 |
||
886 |
((CAknFilteredTextListBoxModel*) iListBox->Model() ) |
|
887 |
->Filter()->HandleOfferkeyEventL(); |
|
888 |
||
889 |
} |
|
890 |
iListBox->DrawNow(); |
|
891 |
iTabbedView.UpdateToolbarL(); |
|
892 |
} |
|
893 |
||
894 |
// --------------------------------------------------------- |
|
895 |
// --------------------------------------------------------- |
|
896 |
// CVIMPSTUiSingleListBoxTabViewControl::CheckAndSetLastItemFlag() |
|
897 |
// Checks if the last contact is focused and Sets the iLastItemFlag |
|
898 |
// --------------------------------------------------------- |
|
899 |
void CVIMPSTUiSingleListBoxTabViewControl::CheckAndSetLastItemFlag() |
|
900 |
{ |
|
901 |
if(iListBox->CurrentItemIndex() == (iArrayProcess.Count() - 1)) |
|
902 |
{ |
|
903 |
iLastItemFlag = ETrue; |
|
904 |
} |
|
905 |
else |
|
906 |
{ |
|
907 |
iLastItemFlag = EFalse; |
|
908 |
} |
|
909 |
} |
|
910 |
// --------------------------------------------------------- |
|
911 |
// CVIMPSTUiSingleListBoxTabViewControl::SetFocusAndMakeItemVisible() |
|
912 |
// Compares the Saved Contact in iFocussedID with the contacts in the List and focuses if it is found |
|
913 |
// --------------------------------------------------------- |
|
914 |
void CVIMPSTUiSingleListBoxTabViewControl::SetFocusAndMakeItemVisible() |
|
915 |
{ |
|
916 |
TInt count = iArrayProcess.Count(); |
|
917 |
TInt index = CurrentItemIndex(); |
|
918 |
if( index == count ) |
|
919 |
{ |
|
920 |
if( iLastItemFlag ) |
|
921 |
{ |
|
922 |
index = count - 1; |
|
923 |
iLastItemFlag = EFalse; |
|
924 |
} |
|
925 |
else |
|
926 |
{ |
|
927 |
return;//do nothing let list box handle this. |
|
928 |
} |
|
929 |
} |
|
930 |
||
931 |
CVIMPSTUiListBoxModel* model = |
|
932 |
static_cast<CVIMPSTUiListBoxModel*>( iListBox->Model() ); |
|
933 |
||
934 |
if( model ) |
|
935 |
{ |
|
936 |
index = model->VisibleItemIndex( index ); |
|
937 |
} |
|
938 |
||
939 |
iListBox->ScrollToMakeItemVisible( index ); |
|
940 |
SetCurrentItemIndex(index); |
|
941 |
iListBox->DrawNow(); |
|
942 |
||
943 |
} |
|
944 |
||
945 |
// --------------------------------------------------------- |
|
946 |
// CVIMPSTUiSingleListBoxTabViewControl::GetFocussedId() |
|
947 |
// To get the pointer to the iFocussedID |
|
948 |
// --------------------------------------------------------- |
|
949 |
TPtrC CVIMPSTUiSingleListBoxTabViewControl::GetFocussedId() |
|
950 |
{ |
|
951 |
TInt index = CurrentItemIndex(); |
|
952 |
if( index < 0 ) |
|
953 |
{ |
|
954 |
index = 0; |
|
955 |
} |
|
956 |
return iCommandHandler.GetProcessInterface().GetItemUserId( index ); |
|
957 |
} |
|
958 |
// --------------------------------------------------------- |
|
959 |
// CVIMPSTUiSingleListBoxTabViewControl::SetFocussedId() |
|
960 |
// Saves the Contact ID in iFocussedID |
|
961 |
// --------------------------------------------------------- |
|
962 |
void CVIMPSTUiSingleListBoxTabViewControl::SetFocussedId(const TDesC& aContact) |
|
963 |
{ |
|
964 |
TInt index = iCommandHandler.GetProcessInterface().GetSelectedItemIndex( aContact ); |
|
965 |
if( index < 0 ) |
|
966 |
{ |
|
967 |
index = 0; |
|
968 |
} |
|
969 |
SetCurrentItemIndex( index ); |
|
970 |
SetFocusAndMakeItemVisible(); |
|
971 |
} |
|
972 |
||
973 |
// -------------------------------------------------------------------- |
|
974 |
// CVIMPSTUiSingleListBoxTabViewControl::SetClrFindPaneFlag(TBool aFlag) |
|
975 |
// -------------------------------------------------------------------- |
|
976 |
||
977 |
void CVIMPSTUiSingleListBoxTabViewControl::SetClrFindPaneFlag(TBool aFlag) |
|
978 |
{ |
|
979 |
iClrFindPaneFlag = aFlag; |
|
980 |
} |
|
981 |
// --------------------------------------------------------- |
|
982 |
// CVIMPSTUiDoubleListBoxTabViewControl::CoeControl() |
|
983 |
// --------------------------------------------------------- |
|
984 |
||
985 |
CCoeControl* CVIMPSTUiSingleListBoxTabViewControl::CoeControl() |
|
986 |
{ |
|
987 |
return this; // return this pointer since its a parent class pointer of CCoeControl |
|
988 |
} |
|
989 |
// --------------------------------------------------------- |
|
990 |
// CVIMPSTUiSingleListBoxTabViewControl::SetCbaLockL() |
|
991 |
// Sets the lock status of cba keys. |
|
992 |
// --------------------------------------------------------- |
|
993 |
// |
|
994 |
void CVIMPSTUiSingleListBoxTabViewControl::SetCbaLockL( TBool aLock ) |
|
995 |
{ |
|
996 |
iCbaLock = aLock; |
|
997 |
if( !aLock ) |
|
998 |
{ |
|
999 |
UpdateCbaL(); |
|
1000 |
} |
|
1001 |
} |
|
1002 |
// --------------------------------------------------------- |
|
1003 |
// CVIMPSTUiSingleListBoxTabViewControl::UpdateCbaL() |
|
1004 |
// Updates Softkeys according to current focus. |
|
1005 |
// --------------------------------------------------------- |
|
1006 |
// |
|
1007 |
void CVIMPSTUiSingleListBoxTabViewControl::UpdateCbaL( TBool aUseDefaultCba /*= EFalse*/ ) |
|
1008 |
{ |
|
1009 |
TRACER_AUTO; |
|
1010 |
TInt cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
1011 |
iCurrentCmdToExe = -1; |
|
1012 |
if( !iCbaLock ) |
|
1013 |
{ |
|
1014 |
TInt index = CurrentItemIndex(); |
|
1015 |
//if invalid index then dont set any command |
|
1016 |
if(KErrNotFound == index) |
|
1017 |
{ |
|
1018 |
if ( iCba ) |
|
1019 |
{ |
|
1020 |
iCba->SetCommandSetL( cbaRes ); |
|
1021 |
iCba->DrawNow(); |
|
1022 |
} |
|
1023 |
return; |
|
1024 |
} |
|
1025 |
||
1026 |
TVIMPSTEnums::TItem itemtype = iArrayProcess.GetType(index); |
|
1027 |
TVIMPSTEnums::TVIMPSTRegistrationState servicestate = iEngine.ServiceState(); |
|
1028 |
TBool updateinvalid( iLastFocusedItemType == TVIMPSTEnums::EInvalid ); |
|
34
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1029 |
if ( !iCba ) |
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1030 |
{ |
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1031 |
iCba = CEikButtonGroupContainer::Current(); |
e7f34e614544
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1032 |
} |
29 | 1033 |
|
1034 |
// default softkeys |
|
1035 |
if( aUseDefaultCba || updateinvalid ) |
|
1036 |
{ |
|
1037 |
if( aUseDefaultCba ) |
|
1038 |
{ |
|
1039 |
iLastFocusedItemType = TVIMPSTEnums::EOwnStatusItem; |
|
1040 |
} |
|
1041 |
else |
|
1042 |
{ |
|
1043 |
iLastFocusedItemType = itemtype; |
|
1044 |
} |
|
1045 |
||
1046 |
if( iCba ) |
|
1047 |
{ |
|
1048 |
if ( itemtype == TVIMPSTEnums::EOwnStatusItem && TVIMPSTEnums::ESVCENetworkConnecting == servicestate ) |
|
1049 |
{ |
|
1050 |
if(iTabbedView.CancelLoginSupportedL()) |
|
1051 |
{ |
|
1052 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CANCEL__EXIT; |
|
1053 |
iCurrentCmdToExe = ECmdCancelLogin; |
|
1054 |
} |
|
1055 |
else |
|
1056 |
{ |
|
1057 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
1058 |
iCurrentCmdToExe = -1; |
|
1059 |
} |
|
1060 |
} |
|
1061 |
else if ( itemtype == TVIMPSTEnums::EOwnStatusItem && TVIMPSTEnums::ESVCEWaitingForNetwork == servicestate ) |
|
1062 |
{ |
|
1063 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CHANGECONN__EXIT; |
|
1064 |
iCurrentCmdToExe = ECmdChangeConnectioninOnlineState; |
|
1065 |
} |
|
1066 |
else |
|
1067 |
{ |
|
1068 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_LOGIN__EXIT; |
|
1069 |
iCurrentCmdToExe = ECmdLogin; |
|
1070 |
} |
|
1071 |
iCba->SetCommandSetL( cbaRes ); |
|
1072 |
iCba->DrawNow(); |
|
1073 |
} |
|
1074 |
} |
|
1075 |
||
1076 |
// collapse softkey ( when focus is on contact ) |
|
1077 |
else if( updateinvalid || itemtype == TVIMPSTEnums::EContactItem ) |
|
1078 |
{ |
|
1079 |
iLastFocusedItemType = itemtype; |
|
1080 |
if( iCba ) |
|
1081 |
{ |
|
1082 |
// Options/Collapse/Chat |
|
1083 |
if(TVIMPSTEnums::ESVCERegistered == servicestate) |
|
1084 |
{ |
|
1085 |
// im is supported |
|
1086 |
if(iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM)) |
|
1087 |
{ |
|
1088 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTION_OPENCONV__EXIT ); |
|
1089 |
iCurrentCmdToExe = ECmdOpenConversation; |
|
1090 |
} |
|
1091 |
else //im is not supporteed |
|
1092 |
{ |
|
1093 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTIONS_DETAILS__EXIT ); |
|
1094 |
iCurrentCmdToExe = ECmdContactDetails; |
|
1095 |
} |
|
1096 |
} |
|
1097 |
else if(TVIMPSTEnums::ESVCENotRegistered == servicestate) |
|
1098 |
{ |
|
1099 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTIONS_DETAILS__EXIT ); |
|
1100 |
iCurrentCmdToExe = ECmdContactDetails; |
|
1101 |
} |
|
1102 |
iCba->DrawNow(); |
|
1103 |
} |
|
1104 |
} |
|
1105 |
else if( itemtype == TVIMPSTEnums::EUnknonContactItem ) |
|
1106 |
{ |
|
1107 |
iLastFocusedItemType = itemtype; |
|
1108 |
if(TVIMPSTEnums::ESVCERegistered == servicestate && |
|
1109 |
iEngine.IsSubServiceSupportedL(TVIMPSTEnums::EIM)) |
|
1110 |
{ |
|
1111 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTION_OPENCONV__EXIT ); |
|
1112 |
iCurrentCmdToExe = ECmdOpenConversation; |
|
1113 |
} |
|
1114 |
else //im is not supporteed |
|
1115 |
{ |
|
1116 |
iCba->SetCommandSetL( R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY ); |
|
1117 |
iCurrentCmdToExe = -1; |
|
1118 |
} |
|
1119 |
iCba->DrawNow(); |
|
1120 |
} |
|
1121 |
// Focus on own contact item |
|
1122 |
else if( updateinvalid || itemtype == TVIMPSTEnums::EOwnStatusItem ) |
|
1123 |
{ |
|
1124 |
iLastFocusedItemType = itemtype; |
|
1125 |
if( iCba ) |
|
1126 |
{ |
|
1127 |
if ( itemtype == TVIMPSTEnums::EOwnStatusItem && TVIMPSTEnums::ESVCERegistered == servicestate ) |
|
1128 |
{ |
|
1129 |
// Own status |
|
1130 |
// Options/Back/Change status |
|
1131 |
//Get Presence SubService |
|
1132 |
MVIMPSTEngineSubService* subService = |
|
1133 |
(iEngine.SubService(TVIMPSTEnums::EPresence)); |
|
1134 |
TBool changeownstatussupported = EFalse; |
|
1135 |
if(subService) |
|
1136 |
{ |
|
1137 |
MVIMPSTEnginePresenceSubService& presence = |
|
1138 |
MVIMPSTEnginePresenceSubService::Cast (*subService); |
|
1139 |
changeownstatussupported = presence.IsChangeOwnStatusSupported(); |
|
1140 |
} |
|
1141 |
if(changeownstatussupported) |
|
1142 |
{ |
|
1143 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__CHANGESTATUS; |
|
1144 |
iCurrentCmdToExe = ECmdChangeStatus; |
|
1145 |
} |
|
1146 |
//else its cbres is set to options exit empty |
|
1147 |
} |
|
1148 |
else if ( itemtype == TVIMPSTEnums::EOwnStatusItem && TVIMPSTEnums::ESVCENetworkConnecting == servicestate ) |
|
1149 |
{ |
|
1150 |
if(iTabbedView.CancelLoginSupportedL()) |
|
1151 |
{ |
|
1152 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CANCEL__EXIT; |
|
1153 |
iCurrentCmdToExe = ECmdCancelLogin; |
|
1154 |
} |
|
1155 |
else |
|
1156 |
{ |
|
1157 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_EXIT__EMPTY; |
|
1158 |
iCurrentCmdToExe = -1; |
|
1159 |
} |
|
1160 |
} |
|
1161 |
else if ( itemtype == TVIMPSTEnums::EOwnStatusItem && TVIMPSTEnums::ESVCEWaitingForNetwork == servicestate ) |
|
1162 |
{ |
|
1163 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_CHANGECONN__EXIT; |
|
1164 |
iCurrentCmdToExe = ECmdChangeConnectioninOnlineState; |
|
1165 |
} |
|
1166 |
else |
|
1167 |
{ |
|
1168 |
cbaRes = R_SERVTAB_SOFTKEYS_OPTION_LOGIN__EXIT; |
|
1169 |
iCurrentCmdToExe = ECmdLogin; |
|
1170 |
} |
|
1171 |
//add for connecting state and waiting for connection state. |
|
1172 |
iCba->SetCommandSetL( cbaRes ); |
|
1173 |
iCba->DrawNow(); |
|
1174 |
} |
|
1175 |
} |
|
1176 |
} |
|
1177 |
} |
|
1178 |
||
1179 |
// --------------------------------------------------------- |
|
1180 |
// CVIMPSTUiSingleListBoxTabViewControl::HandleAvatarRefreshL() |
|
1181 |
// --------------------------------------------------------- |
|
1182 |
void CVIMPSTUiSingleListBoxTabViewControl::HandleAvatarRefreshL( const TDesC&/* aUserId */,TBool /*aBlock*/) |
|
1183 |
{ |
|
1184 |
//no avatar implementation for single list box. |
|
1185 |
} |
|
1186 |
||
1187 |
// End of File |