|
1 /* |
|
2 * Copyright (c) 2007-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 of CWsfMainViewContainer. |
|
15 * |
|
16 */ |
|
17 |
|
18 // EXTERNAL INCLUDES |
|
19 #include <AknUtils.h> |
|
20 #include <aknlists.h> |
|
21 #include <badesca.h> |
|
22 #include <wlansniffer.rsg> |
|
23 #include <wsficons.mbg> |
|
24 #include <AknIconUtils.h> |
|
25 #include <AknsUtils.h> |
|
26 #include <gulicon.h> |
|
27 #include <eikclbd.h> |
|
28 #include <aknnavi.h> |
|
29 #include <aknnavide.h> |
|
30 #include <StringLoader.h> |
|
31 #include <eikenv.h> |
|
32 #include <csxhelp/sniffer.hlp.hrh> |
|
33 |
|
34 |
|
35 // INTERNAL INCLUDES |
|
36 #include "wsfmainviewcontainer.h" |
|
37 #include "wsfmainviewinternals.h" |
|
38 #include "wsfmainviewcontrollerpartner.h" |
|
39 #include "wsfdocument.h" |
|
40 #include "wsfwlaninfoarrayvisitor.h" |
|
41 #include "wsfappui.h" |
|
42 #include <wlansniffer.rsg> |
|
43 |
|
44 #include "wsflogger.h" |
|
45 |
|
46 |
|
47 |
|
48 // LOCAL DEFINITIONS |
|
49 const TUint KIconListGranularity = 12; // Default size of the icons list |
|
50 // path of the app's iconfile |
|
51 _LIT( KIconFileName, "\\resource\\apps\\wsficons.mif" ); |
|
52 |
|
53 const TInt KConnectingStepTime = 200 * 1000; |
|
54 |
|
55 _LIT( KFormat1Icon, "%d" ); |
|
56 |
|
57 |
|
58 // CONSTRUCTION AND DESTRUCTION |
|
59 // --------------------------------------------------------- |
|
60 // CWsfMainViewContainer::NewL |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 CWsfMainViewContainer* CWsfMainViewContainer::NewL( const TRect& aRect ) |
|
64 { |
|
65 LOG_ENTERFN( "CWsfMainViewContainer::NewL" ); |
|
66 CWsfMainViewContainer* self = CWsfMainViewContainer::NewLC( aRect ); |
|
67 CleanupStack::Pop( self ); |
|
68 return self; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CWsfMainViewContainer::NewLC |
|
73 // --------------------------------------------------------- |
|
74 // |
|
75 CWsfMainViewContainer* CWsfMainViewContainer::NewLC( const TRect& aRect ) |
|
76 { |
|
77 LOG_ENTERFN( "CWsfMainViewContainer::NewLC" ); |
|
78 CWsfMainViewContainer* self = new( ELeave ) CWsfMainViewContainer; |
|
79 CleanupStack::PushL( self ); |
|
80 self->ConstructL( aRect ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------- |
|
85 // CWsfMainViewContainer::~CWsfMainViewContainer |
|
86 // --------------------------------------------------------- |
|
87 // |
|
88 CWsfMainViewContainer::~CWsfMainViewContainer() |
|
89 { |
|
90 LOG_ENTERFN( "CWsfMainViewContainer::~CWsfMainViewContainer" ); |
|
91 |
|
92 StopConnectingAnimation(); |
|
93 |
|
94 PopNaviPane(); |
|
95 |
|
96 if ( iStatusConnecting ) |
|
97 { |
|
98 delete iStatusConnecting; |
|
99 } |
|
100 |
|
101 delete iListBox; |
|
102 delete iNaviDecorator; |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------- |
|
106 // CWsfMainViewContainer::CWsfMainViewContainer |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 CWsfMainViewContainer::CWsfMainViewContainer() |
|
110 { |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------- |
|
114 // CWsfMainViewContainer::ConstructL |
|
115 // --------------------------------------------------------- |
|
116 // |
|
117 void CWsfMainViewContainer::ConstructL( const TRect& aRect ) |
|
118 { |
|
119 LOG_ENTERFN( "CWsfMainViewContainer::ConstructL" ); |
|
120 CreateWindowL(); |
|
121 |
|
122 iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox(); |
|
123 TInt flags( EAknGenericListBoxFlags ); |
|
124 iListBox->SetMopParent(this); // |
|
125 iListBox->ConstructL( this, flags ); |
|
126 iListBox->SetContainerWindowL(*this); |
|
127 |
|
128 iListBox->SetFocus(ETrue); |
|
129 |
|
130 iListBox->CreateScrollBarFrameL( ETrue ); |
|
131 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
132 CEikScrollBarFrame::EOff, |
|
133 CEikScrollBarFrame::EAuto ); |
|
134 |
|
135 SetListboxIconsL(); |
|
136 |
|
137 iConnectingIcons[0] = KWlanOnIcon_0; |
|
138 iConnectingIcons[1] = KWlanOnIcon_1; |
|
139 iConnectingIcons[2] = KWlanOnIcon; |
|
140 iConnectingIcons[3] = KWlanOnIcon_1; |
|
141 |
|
142 SetRect( aRect ); |
|
143 iListBox->SetRect( Rect() ); |
|
144 ActivateL(); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------- |
|
148 // CWsfMainViewContainer::SizeChanged |
|
149 // --------------------------------------------------------- |
|
150 // |
|
151 void CWsfMainViewContainer::SizeChanged() |
|
152 { |
|
153 iListBox->SetRect( Rect() ); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------- |
|
157 // CWsfMainViewContainer::CountComponentControls |
|
158 // --------------------------------------------------------- |
|
159 // |
|
160 TInt CWsfMainViewContainer::CountComponentControls() const |
|
161 { |
|
162 return 1;// return number of controls inside this container |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------- |
|
166 // CWsfMainViewContainer::ComponentControl |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 CCoeControl* CWsfMainViewContainer::ComponentControl(TInt aIndex) const |
|
170 { |
|
171 CCoeControl* object = NULL; |
|
172 switch ( aIndex ) |
|
173 { |
|
174 case 0: |
|
175 object = iListBox; |
|
176 break; |
|
177 default: |
|
178 object = NULL; |
|
179 } |
|
180 return object; |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------- |
|
184 // CWsfMainViewContainer::OfferKeyEventL |
|
185 // --------------------------------------------------------- |
|
186 // |
|
187 TKeyResponse CWsfMainViewContainer::OfferKeyEventL( |
|
188 const TKeyEvent& aKeyEvent, |
|
189 TEventCode aType ) |
|
190 { |
|
191 LOG_ENTERFN( "CWsfMainViewContainer::OfferKeyEventL" ); |
|
192 CWsfAppUi* appui = static_cast<CWsfAppUi*>( iEikonEnv->AppUi() ); |
|
193 |
|
194 if ( appui->SuppressingKeyEvents() ) |
|
195 { |
|
196 return EKeyWasConsumed; |
|
197 } |
|
198 |
|
199 TKeyResponse result( EKeyWasNotConsumed ); |
|
200 if ( aType == EEventKey || aType == EEventKeyDown ) |
|
201 { |
|
202 TInt index = iListBox->CurrentItemIndex(); |
|
203 if( ( aKeyEvent.iCode == EKeyBackspace ) && ( index != -1 ) ) |
|
204 { |
|
205 result = EKeyWasConsumed; |
|
206 } |
|
207 else |
|
208 { |
|
209 result = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
210 |
|
211 |
|
212 if( aKeyEvent.iCode == EKeyUpArrow ) |
|
213 { |
|
214 if( iPartner ) |
|
215 { |
|
216 iPartner->HandleUpKeyPressedL(); |
|
217 } |
|
218 } |
|
219 else if( aKeyEvent.iCode == EKeyDownArrow ) |
|
220 { |
|
221 if( iPartner ) |
|
222 { |
|
223 iPartner->HandleDownKeyPressedL(); |
|
224 } |
|
225 } |
|
226 else if( aKeyEvent.iCode == EKeyOK ) |
|
227 { |
|
228 if( iPartner ) |
|
229 { |
|
230 iPartner->HandleSelectionKeyPressedL(); |
|
231 } |
|
232 |
|
233 } |
|
234 } |
|
235 } |
|
236 return result; |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------- |
|
240 // CWsfMainViewContainer::LoadGraphicsL |
|
241 // --------------------------------------------------------- |
|
242 // |
|
243 CAknIconArray* CWsfMainViewContainer::LoadGraphicsL() |
|
244 { |
|
245 LOG_ENTERFN( "CWsfMainViewContainer::LoadGraphicsL" ); |
|
246 CAknIconArray* icons = new(ELeave) CAknIconArray( KIconListGranularity ); |
|
247 CleanupStack::PushL( TCleanupItem( CleanUpResetAndDestroy,icons) ); |
|
248 |
|
249 |
|
250 //KWlanOnIcon |
|
251 icons->InsertL( KWlanOnIcon, |
|
252 LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn, |
|
253 EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on) ); |
|
254 CleanupStack::Pop(); /*icon*/ |
|
255 |
|
256 //KWlanOnIcon_0 |
|
257 icons->InsertL( KWlanOnIcon_0, |
|
258 LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn0, |
|
259 EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_0) ); |
|
260 CleanupStack::Pop(); /*icon*/ |
|
261 |
|
262 //KWlanOnIcon_0 |
|
263 icons->InsertL( KWlanOnIcon_1, |
|
264 LoadSkinnableIconLC( KAknsIIDQgnIndiWlanSnifferPluginOn1, |
|
265 EMbmWsficonsQgn_indi_wlan_sniffer_plugin_on_1) ); |
|
266 CleanupStack::Pop(); /*icon*/ |
|
267 |
|
268 //ESecureNetworkIcon |
|
269 icons->InsertL( KSecureNetworkIcon, LoadSkinnableBlackIconLC( |
|
270 KAknsIIDQgnIndiWlanSecureNetworkAdd, |
|
271 EMbmWsficonsQgn_indi_wlan_secure_network_add) ); |
|
272 |
|
273 CleanupStack::Pop(); /*icon*/ |
|
274 |
|
275 //ENoSignalIcon |
|
276 icons->InsertL( KNoSignalIcon, LoadIconLC( |
|
277 EMbmWsficonsEmpty13x13) ); |
|
278 CleanupStack::Pop(); /*icon*/ |
|
279 |
|
280 //EPoorSignal |
|
281 icons->InsertL( KPoorSignal, LoadSkinnableBlackIconLC( |
|
282 KAknsIIDQgnIndiWlanSignalLowAdd, |
|
283 EMbmWsficonsQgn_indi_wlan_signal_low_add) ); |
|
284 |
|
285 CleanupStack::Pop(); /*icon*/ |
|
286 |
|
287 //EAverageSignal |
|
288 icons->InsertL( KAverageSignal, LoadSkinnableBlackIconLC( |
|
289 KAknsIIDQgnIndiWlanSignalMedAdd, |
|
290 EMbmWsficonsQgn_indi_wlan_signal_med_add) ); |
|
291 CleanupStack::Pop(); /*icon*/ |
|
292 |
|
293 //EExcelentSignal |
|
294 icons->InsertL( KExcelentSignal, LoadSkinnableBlackIconLC( |
|
295 KAknsIIDQgnIndiWlanSignalGoodAdd , |
|
296 EMbmWsficonsQgn_indi_wlan_signal_good_add) ); |
|
297 CleanupStack::Pop(); /*icon*/ |
|
298 |
|
299 //EConnectedNWIcon |
|
300 icons->InsertL( KConnectedNWIcon, |
|
301 LoadSkinnableIconLC( KAknsIIDQgnPropCmonWlanConn, |
|
302 EMbmWsficonsQgn_prop_cmon_wlan_conn) ); |
|
303 |
|
304 CleanupStack::Pop(); /*icon*/ |
|
305 |
|
306 //EKnownNWIcon |
|
307 icons->InsertL( KKnownNWIcon, LoadSkinnableIconLC( |
|
308 KAknsIIDQgnPropWlanBearer, |
|
309 EMbmWsficonsQgn_prop_wlan_bearer) ); |
|
310 CleanupStack::Pop(); /*icon*/ |
|
311 |
|
312 //ETransparentIcon |
|
313 icons->InsertL( KTransparentIcon, LoadIconLC( |
|
314 EMbmWsficonsQgn_prop_empty) ); |
|
315 CleanupStack::Pop(); /*icon*/ |
|
316 |
|
317 CleanupStack::Pop( icons ); |
|
318 return icons; |
|
319 } |
|
320 |
|
321 |
|
322 |
|
323 // --------------------------------------------------------- |
|
324 // CWsfMainViewContainer::CleanUpResetAndDestroy |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 void CWsfMainViewContainer::CleanUpResetAndDestroy( TAny* aArray ) |
|
328 { |
|
329 if ( aArray ) |
|
330 { |
|
331 CArrayPtrFlat<CBase>* array = static_cast<CArrayPtrFlat<CBase>*>( |
|
332 aArray ); |
|
333 array->ResetAndDestroy(); |
|
334 delete array; |
|
335 } |
|
336 } |
|
337 |
|
338 |
|
339 // --------------------------------------------------------- |
|
340 // CWsfMainViewContainer::LoadIconLC |
|
341 // --------------------------------------------------------- |
|
342 // |
|
343 CGulIcon* CWsfMainViewContainer::LoadIconLC( TInt aIconId) |
|
344 { |
|
345 LOG_ENTERFN( "CWsfMainViewContainer::LoadIconLC" ); |
|
346 CGulIcon* icon = CGulIcon::NewLC(); |
|
347 CFbsBitmap* bitmap; |
|
348 CFbsBitmap* mask; |
|
349 |
|
350 // Creates bitmap an icon. |
|
351 AknIconUtils::CreateIconL( bitmap, |
|
352 mask, |
|
353 KIconFileName, |
|
354 aIconId, |
|
355 aIconId + 1 ); |
|
356 |
|
357 icon->SetBitmap( bitmap ); |
|
358 icon->SetMask( mask ); |
|
359 return icon; |
|
360 } |
|
361 |
|
362 // --------------------------------------------------------- |
|
363 // CWsfMainViewContainer::LoadBlackIconLC |
|
364 // --------------------------------------------------------- |
|
365 // |
|
366 CGulIcon* CWsfMainViewContainer::LoadBlackIconLC( TInt aIconId ) |
|
367 { |
|
368 LOG_ENTERFN( "CWsfMainViewContainer::LoadBlackIconLC" ); |
|
369 CGulIcon* icon = CGulIcon::NewLC(); |
|
370 CFbsBitmap* bitmap; |
|
371 CFbsBitmap* mask; |
|
372 |
|
373 // Creates bitmap an icon. |
|
374 |
|
375 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
376 KAknsIIDNone, |
|
377 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, |
|
378 bitmap, |
|
379 mask, |
|
380 KIconFileName, |
|
381 aIconId, |
|
382 aIconId+1, |
|
383 KRgbBlack ); |
|
384 |
|
385 |
|
386 |
|
387 icon->SetBitmap( bitmap ); |
|
388 icon->SetMask( mask ); |
|
389 return icon; |
|
390 } |
|
391 |
|
392 // --------------------------------------------------------- |
|
393 // CWsfMainViewContainer::LoadSkinnableIconLC |
|
394 // --------------------------------------------------------- |
|
395 // |
|
396 CGulIcon* CWsfMainViewContainer::LoadSkinnableIconLC( |
|
397 const TAknsItemID aAknItemId, |
|
398 const TInt aIconId ) |
|
399 { |
|
400 CGulIcon* icon = CGulIcon::NewLC(); |
|
401 CFbsBitmap* bitmap; |
|
402 CFbsBitmap* mask; |
|
403 |
|
404 // Creates bitmap an icon. |
|
405 |
|
406 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), |
|
407 aAknItemId, |
|
408 bitmap, |
|
409 mask, |
|
410 KIconFileName, |
|
411 aIconId, |
|
412 aIconId+1 ); |
|
413 |
|
414 icon->SetBitmap( bitmap ); |
|
415 icon->SetMask( mask ); |
|
416 return icon; |
|
417 } |
|
418 |
|
419 // --------------------------------------------------------- |
|
420 // CWsfMainViewContainer::LoadSkinnableBlackIconLC |
|
421 // --------------------------------------------------------- |
|
422 // |
|
423 CGulIcon* CWsfMainViewContainer::LoadSkinnableBlackIconLC( |
|
424 const TAknsItemID aAknItemId, |
|
425 const TInt aIconId ) |
|
426 { |
|
427 CGulIcon* icon = CGulIcon::NewLC(); |
|
428 CFbsBitmap* bitmap; |
|
429 CFbsBitmap* mask; |
|
430 |
|
431 // Creates bitmap an icon. |
|
432 |
|
433 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
434 aAknItemId, |
|
435 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, |
|
436 bitmap, |
|
437 mask, |
|
438 KIconFileName, |
|
439 aIconId, |
|
440 aIconId+1, |
|
441 KRgbBlack ); |
|
442 |
|
443 icon->SetBitmap( bitmap ); |
|
444 icon->SetMask( mask ); |
|
445 return icon; |
|
446 } |
|
447 |
|
448 |
|
449 |
|
450 // --------------------------------------------------------- |
|
451 // CWsfMainViewContainer::UpdateHotSpotsL |
|
452 // --------------------------------------------------------- |
|
453 // |
|
454 void CWsfMainViewContainer::UpdateHotSpotsL( MDesCArray* aItemTextArray, |
|
455 TInt aCurrentItem ) |
|
456 { |
|
457 LOG_ENTERFN( "CWsfMainViewContainer::UpdateHotSpotsL" ); |
|
458 StopConnectingAnimation(); |
|
459 iListBox->Reset(); |
|
460 iListBox->Model()->SetItemTextArray( aItemTextArray ); |
|
461 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
462 iListBox->HandleItemAdditionL(); |
|
463 |
|
464 if ( aItemTextArray->MdcaCount() ) |
|
465 { |
|
466 TUint lastIndex = aItemTextArray->MdcaCount() -1; |
|
467 if ( aCurrentItem <= lastIndex ) |
|
468 { |
|
469 iListBox->SetCurrentItemIndex( aCurrentItem ); |
|
470 } |
|
471 else //( aCurrentItem > lastIndex ) |
|
472 { |
|
473 iListBox->SetCurrentItemIndex( lastIndex ); |
|
474 } |
|
475 TPtrC itemtext = iListBox->Model()->ItemText(0); |
|
476 HBufC* text = itemtext.AllocLC(); |
|
477 TPtr buffer = text->Des(); |
|
478 if ( ParseStringForAnimationL( buffer ) ) |
|
479 { |
|
480 //Get the list box items model. |
|
481 MDesCArray* listArray = iListBox->Model()->ItemTextArray(); |
|
482 CDesCArray* itemArray = static_cast<CDesCArray*>(listArray); |
|
483 itemArray->Delete(0,1); |
|
484 itemArray->InsertL(0,buffer); |
|
485 LOG_WRITE("Connecting status found"); |
|
486 StartConnectingAnimationL(); |
|
487 } |
|
488 CleanupStack::PopAndDestroy(text); |
|
489 } |
|
490 iListBox->DrawDeferred(); |
|
491 } |
|
492 |
|
493 |
|
494 // -------------------------------------------------------------------------- |
|
495 // CWsfAiView::ParseStringForAnimationL() |
|
496 // -------------------------------------------------------------------------- |
|
497 // |
|
498 TBool CWsfMainViewContainer::ParseStringForAnimationL( TDes& aString ) |
|
499 { |
|
500 LOG_ENTERFN( "CWsfMainViewContainer::ParseStringForAnimationL" ); |
|
501 TBool found = EFalse; |
|
502 // start looking for '\t' digits and parse |
|
503 // the icon identifiers and label text |
|
504 |
|
505 // L"\tOther (hidden netw.)" |
|
506 // L"6\tAd-hoc WPA\tConnecting\t4\t0" - this we are trying to find |
|
507 |
|
508 TChar delimiter('\t'); |
|
509 TInt firstTabPos = aString.Locate( delimiter ); |
|
510 TInt secondTabPos = aString.Mid( |
|
511 firstTabPos +1 ).Locate( |
|
512 delimiter ) + firstTabPos + 1; |
|
513 TInt thirdTabPos = aString.Mid( |
|
514 secondTabPos +1 ).Locate( |
|
515 delimiter ) + secondTabPos + 1; |
|
516 |
|
517 // ok we have the tab positions read the values... |
|
518 TInt firstIcon; |
|
519 if ( firstTabPos ) |
|
520 { |
|
521 TLex( aString.Mid( 0, firstTabPos )).Val( (TInt&)firstIcon ); |
|
522 LOG_WRITEF( "First Icon %d", firstIcon ); |
|
523 } |
|
524 |
|
525 if ( secondTabPos && thirdTabPos ) |
|
526 { |
|
527 HBufC * foundString = aString.Mid( secondTabPos+1, |
|
528 thirdTabPos-secondTabPos-1 ).AllocLC(); |
|
529 |
|
530 if ( !iStatusConnecting ) |
|
531 { |
|
532 iStatusConnecting = StringLoader::LoadL( |
|
533 R_QTN_SNIFFER_CONNECTING ); |
|
534 } |
|
535 |
|
536 if ( !foundString->Compare( iStatusConnecting->Des() ) ) |
|
537 { |
|
538 HBufC* item = HBufC::NewLC( KFormat1Icon().Length() ); |
|
539 item->Des().Format( KFormat1Icon, iConnectingIcons[iConnectingIndex] ); |
|
540 LOG_WRITEF( "Replace Icon %d", iConnectingIcons[iConnectingIndex] ); |
|
541 |
|
542 aString.Replace(0, firstTabPos, item->Des() ); |
|
543 found = ETrue; |
|
544 CleanupStack::PopAndDestroy( item ); |
|
545 } |
|
546 CleanupStack::PopAndDestroy( foundString ); |
|
547 } |
|
548 |
|
549 return found; |
|
550 } |
|
551 |
|
552 |
|
553 // -------------------------------------------------------------------------- |
|
554 // CWsfMainViewContainer::StartConnectingAnimationL |
|
555 // -------------------------------------------------------------------------- |
|
556 // |
|
557 void CWsfMainViewContainer::StartConnectingAnimationL() |
|
558 { |
|
559 LOG_ENTERFN( "CWsfMainViewContainer::StartConnectingAnimationL" ); |
|
560 |
|
561 if ( iAnimationPeriodic ) |
|
562 { |
|
563 iAnimationPeriodic->Cancel(); |
|
564 delete iAnimationPeriodic; |
|
565 iAnimationPeriodic = NULL; |
|
566 } |
|
567 |
|
568 InitializeConnectingAnimation(); |
|
569 iAnimationPeriodic = CPeriodic::NewL( |
|
570 CActive::EPriorityLow ); |
|
571 |
|
572 iAnimationPeriodic->Start( |
|
573 TTimeIntervalMicroSeconds32( KConnectingStepTime ), |
|
574 TTimeIntervalMicroSeconds32( KConnectingStepTime ), |
|
575 TCallBack( |
|
576 CWsfMainViewContainer::DoConnectingAnimationStepL, |
|
577 this |
|
578 ) ); |
|
579 } |
|
580 |
|
581 |
|
582 // -------------------------------------------------------------------------- |
|
583 // CWsfMainViewContainer::StopConnectingAnimation |
|
584 // -------------------------------------------------------------------------- |
|
585 // |
|
586 void CWsfMainViewContainer::StopConnectingAnimation() |
|
587 { |
|
588 LOG_ENTERFN( "CWsfMainViewContainer::StopConnectingAnimation" ); |
|
589 |
|
590 if ( iAnimationPeriodic ) |
|
591 { |
|
592 iAnimationPeriodic->Cancel(); |
|
593 delete iAnimationPeriodic; |
|
594 iAnimationPeriodic = NULL; |
|
595 } |
|
596 } |
|
597 |
|
598 |
|
599 // --------------------------------------------------------------------------- |
|
600 // CWsfAiPlugin::DoConnectingAnimationStepL |
|
601 // --------------------------------------------------------------------------- |
|
602 // |
|
603 TInt CWsfMainViewContainer::DoConnectingAnimationStepL( TAny* ptr ) |
|
604 { |
|
605 LOG_ENTERFN( "CWsfMainViewContainer::DoConnectingAnimationStepL" ); |
|
606 static_cast<CWsfMainViewContainer*>( ptr )->DoConnectingAnimationStepL(); |
|
607 return ETrue; |
|
608 } |
|
609 |
|
610 // --------------------------------------------------------------------------- |
|
611 // CWsfAiPlugin::DoConnectingAnimationStepL |
|
612 // --------------------------------------------------------------------------- |
|
613 // |
|
614 void CWsfMainViewContainer::DoConnectingAnimationStepL() |
|
615 { |
|
616 LOG_ENTERFN( "CWsfMainViewContainer::DoConnectingAnimationStepL" ); |
|
617 AnimateConnecting(); |
|
618 if ( iListBox->Model()->ItemTextArray()->MdcaCount() ) |
|
619 { |
|
620 TPtrC itemtext = iListBox->Model()->ItemText(0); |
|
621 HBufC* text = itemtext.AllocLC(); |
|
622 TPtr buffer = text->Des(); |
|
623 if ( ParseStringForAnimationL( buffer )) |
|
624 { |
|
625 //Get the list box items model. |
|
626 MDesCArray* listArray = iListBox->Model()->ItemTextArray(); |
|
627 CDesCArray* itemArray = static_cast<CDesCArray*>(listArray); |
|
628 itemArray->Delete(0,1); |
|
629 itemArray->InsertL(0,buffer); |
|
630 iListBox->HandleItemAdditionL(); |
|
631 iListBox->DrawDeferred(); |
|
632 LOG_WRITE("Connecting status found"); |
|
633 } |
|
634 else |
|
635 { |
|
636 StopConnectingAnimation(); |
|
637 } |
|
638 CleanupStack::PopAndDestroy( text ); |
|
639 } |
|
640 } |
|
641 |
|
642 |
|
643 // -------------------------------------------------------------------------- |
|
644 // CWsfAiModel::InitializeRefreshAnimation |
|
645 // -------------------------------------------------------------------------- |
|
646 // |
|
647 void CWsfMainViewContainer::InitializeConnectingAnimation() |
|
648 { |
|
649 LOG_ENTERFN( "CWsfMainViewContainer::InitializeConnectingAnimation" ); |
|
650 iConnectingIndex = 0; |
|
651 } |
|
652 |
|
653 |
|
654 // -------------------------------------------------------------------------- |
|
655 // CWsfAiModel::AnimateConnecting |
|
656 // -------------------------------------------------------------------------- |
|
657 // |
|
658 void CWsfMainViewContainer::AnimateConnecting() |
|
659 { |
|
660 LOG_ENTERFN( "CWsfMainViewContainer::AnimateConnecting" ); |
|
661 ++iConnectingIndex %= iConnectingIcons.Count(); |
|
662 } |
|
663 |
|
664 |
|
665 // --------------------------------------------------------- |
|
666 // CWsfMainViewContainer::SelectedItem |
|
667 // --------------------------------------------------------- |
|
668 // |
|
669 TInt CWsfMainViewContainer::SelectedItem() |
|
670 { |
|
671 return iListBox->CurrentItemIndex(); |
|
672 } |
|
673 |
|
674 // --------------------------------------------------------- |
|
675 // CWsfMainViewContainer::HandleResourceChange |
|
676 // --------------------------------------------------------- |
|
677 // |
|
678 void CWsfMainViewContainer::HandleResourceChange( TInt aType ) |
|
679 { |
|
680 LOG_ENTERFN( "CWsfMainViewContainer::HandleResourceChange" ); |
|
681 CCoeControl::HandleResourceChange( aType ); |
|
682 |
|
683 if ( aType == KAknsMessageSkinChange ) |
|
684 { |
|
685 TRAP_IGNORE( SetListboxIconsL() ); |
|
686 SizeChanged(); |
|
687 } |
|
688 |
|
689 if( aType == KEikDynamicLayoutVariantSwitch ) |
|
690 { |
|
691 TRect mainPaneRect; |
|
692 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
693 mainPaneRect ); |
|
694 SetRect( mainPaneRect ); |
|
695 DrawNow(); |
|
696 } |
|
697 } |
|
698 |
|
699 // --------------------------------------------------------- |
|
700 // CWsfMainViewContainer::SetPartner |
|
701 // --------------------------------------------------------- |
|
702 // |
|
703 void CWsfMainViewContainer::SetPartner( |
|
704 MWsfMainViewControllerPartner& aPartner ) |
|
705 { |
|
706 iPartner = &aPartner; |
|
707 } |
|
708 |
|
709 // --------------------------------------------------------- |
|
710 // CWsfMainViewContainer::UpdateNaviPaneL |
|
711 // --------------------------------------------------------- |
|
712 // |
|
713 void CWsfMainViewContainer::UpdateNaviPaneL( const TDesC& aPaneText ) |
|
714 { |
|
715 LOG_ENTERFN( "CWsfMainViewContainer::UpdateNaviPaneL" ); |
|
716 if ( !( ( CWsfAppUi *)( iEikonEnv->AppUi() ) )->Foreground() ) |
|
717 { |
|
718 return; |
|
719 } |
|
720 |
|
721 GetPanesL(); |
|
722 |
|
723 if ( iNaviDecorator ) |
|
724 { |
|
725 PopNaviPane(); |
|
726 } |
|
727 |
|
728 iNaviDecorator = iNaviPane->CreateNavigationLabelL( aPaneText ); |
|
729 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
|
730 iNaviPane->PushL( *iNaviDecorator ); |
|
731 } |
|
732 |
|
733 // --------------------------------------------------------- |
|
734 // CWsfMainViewContainer::ListBox |
|
735 // --------------------------------------------------------- |
|
736 // |
|
737 CAknDoubleGraphicStyleListBox* CWsfMainViewContainer::ListBox() const |
|
738 { |
|
739 return iListBox; |
|
740 } |
|
741 |
|
742 // --------------------------------------------------------- |
|
743 // CWsfMainViewContainer::PopNaviPane |
|
744 // --------------------------------------------------------- |
|
745 // |
|
746 void CWsfMainViewContainer::PopNaviPane() |
|
747 { |
|
748 LOG_ENTERFN( "CWsfMainViewContainer::PopNaviPane" ); |
|
749 if ( iNaviPane && iNaviDecorator ) |
|
750 { |
|
751 iNaviPane->Pop( iNaviDecorator ); |
|
752 delete iNaviDecorator; |
|
753 iNaviDecorator = NULL; |
|
754 } |
|
755 } |
|
756 |
|
757 // --------------------------------------------------------- |
|
758 // CWsfMainViewContainer::GetPanesL |
|
759 // --------------------------------------------------------- |
|
760 // |
|
761 void CWsfMainViewContainer::GetPanesL() |
|
762 { |
|
763 LOG_ENTERFN( "CWsfMainViewContainer::GetPanesL" ); |
|
764 if( !iNaviPane ) |
|
765 { |
|
766 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
767 |
|
768 iNaviPane = static_cast<CAknNavigationControlContainer*>( |
|
769 statusPane->ControlL( |
|
770 TUid::Uid(EEikStatusPaneUidNavi ) ) ); |
|
771 } |
|
772 } |
|
773 |
|
774 // --------------------------------------------------------- |
|
775 // CWsfMainViewContainer::SetListboxIconsL |
|
776 // --------------------------------------------------------- |
|
777 // |
|
778 void CWsfMainViewContainer::SetListboxIconsL() |
|
779 { |
|
780 LOG_ENTERFN( "CWsfMainViewContainer::SetListboxIconsL" ); |
|
781 CAknIconArray* icons = LoadGraphicsL(); |
|
782 |
|
783 CWsfDocument* doc = static_cast<CWsfDocument*> |
|
784 ( iEikonEnv->EikAppUi()->Document() ); |
|
785 |
|
786 doc->WlanInfoBranding().AppendBrandingIconsL( *icons ); |
|
787 |
|
788 iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
789 |
|
790 } |
|
791 |
|
792 // --------------------------------------------------------- |
|
793 // CWsfMainViewContainer::GetHelpContext |
|
794 // --------------------------------------------------------- |
|
795 // |
|
796 void CWsfMainViewContainer::GetHelpContext( TCoeHelpContext& aContext) const |
|
797 { |
|
798 aContext.iMajor = TUid::Uid( 0x10281CAA ); |
|
799 aContext.iContext = KSNIFFER_HLP_MAIN; |
|
800 } |
|
801 |
|
802 |
|
803 // End of file |