1 /* |
|
2 * Copyright (c) 2007-2010 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: This module contains the implementation of CIAUpdateMainContainer class |
|
15 * member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 //INCLUDES |
|
22 #include <barsread.h> |
|
23 #include <coemain.h> |
|
24 #include <aknlists.h> |
|
25 #include <badesca.h> // CDesCArray |
|
26 #include <iaupdate.rsg> |
|
27 #include <avkon.mbg> |
|
28 #include <iaupdate.mbg> |
|
29 #include <AknIconArray.h> |
|
30 #include <gulicon.h> |
|
31 #include <StringLoader.h> |
|
32 #include <data_caging_path_literals.hrh> |
|
33 #include <e32property.h> |
|
34 #include <featmgr.h> |
|
35 |
|
36 #include "iaupdatefwnode.h" |
|
37 #include "iaupdatemaincontainer.h" |
|
38 #include "iaupdatecontainerobserver.h" |
|
39 #include "iaupdateapplication.h" |
|
40 #include "iaupdatenode.h" |
|
41 #include "iaupdatebasenode.h" |
|
42 #include "iaupdateversion.h" |
|
43 #include "iaupdatefwnsmlpskeys.h" |
|
44 |
|
45 //MACROS |
|
46 _LIT( KTabulator, "\t" ); |
|
47 _LIT( KOne, "1"); |
|
48 _LIT( KTwo, "2"); |
|
49 _LIT( KSpace, " "); |
|
50 |
|
51 //CONSTANTS |
|
52 const TInt KKiloByte = 1024; |
|
53 const TInt KMegaByte = 1024 * 1024; |
|
54 const TInt KMaxShownInKiloBytes = 10 * KMegaByte; |
|
55 |
|
56 _LIT( KSWUPDATE_HLP_MAIN, "SWUPDATE_HLP_MAIN" ); |
|
57 |
|
58 // MACROS |
|
59 _LIT(KIAUpdateIconFileName, "IAUpdate.mif"); |
|
60 |
|
61 //CONST |
|
62 |
|
63 const TUid KFOTAUid = {0x102072C4}; |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CIAUpdateMainContainer::NewL |
|
67 // Two-phased constructor. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CIAUpdateMainContainer* CIAUpdateMainContainer::NewL( |
|
71 const TRect& aRect, |
|
72 MIAUpdateContainerObserver& aObserver ) |
|
73 { |
|
74 CIAUpdateMainContainer* self = CIAUpdateMainContainer::NewLC(aRect,aObserver); |
|
75 CleanupStack::Pop(self); |
|
76 return self; |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CIAUpdateMainContainer::NewLC |
|
81 // |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CIAUpdateMainContainer* CIAUpdateMainContainer::NewLC( |
|
85 const TRect& aRect, |
|
86 MIAUpdateContainerObserver& aObserver ) |
|
87 { |
|
88 CIAUpdateMainContainer* self = new (ELeave) CIAUpdateMainContainer(aObserver); |
|
89 CleanupStack::PushL(self); |
|
90 self->ConstructL(aRect); |
|
91 return self; |
|
92 } |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CIAUpdateMainContainer::CIAUpdateMainContainer |
|
95 // C++ default constructor can NOT contain any code, that |
|
96 // might leave. |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 CIAUpdateMainContainer::CIAUpdateMainContainer(MIAUpdateContainerObserver& aObserver) |
|
100 : iObserver( aObserver ) |
|
101 { |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CIAUpdateMainContainer::~CIAUpdateMainContainer |
|
106 // Destructor |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 CIAUpdateMainContainer::~CIAUpdateMainContainer() |
|
110 { |
|
111 delete iListBox; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CIAUpdateMainContainer::ConstructL |
|
116 // Symbian 2nd phase constructor can leave. |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CIAUpdateMainContainer::ConstructL(const TRect& aRect ) |
|
120 { |
|
121 // Create a window for this application view |
|
122 CreateWindowL(); |
|
123 |
|
124 // Create list box |
|
125 iListBox = new (ELeave) CAknDoubleGraphicStyleListBox(); |
|
126 iListBox->SetContainerWindowL( *this ); |
|
127 |
|
128 TResourceReader reader; |
|
129 iEikonEnv->CreateResourceReaderLC( reader, R_IAUPDATE_UPDATES_LIST ); |
|
130 iListBox->ConstructFromResourceL( reader ); |
|
131 CleanupStack::PopAndDestroy(); |
|
132 |
|
133 iListBox->EnableStretching( EFalse ); |
|
134 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
135 |
|
136 // Setup scroll bars |
|
137 iListBox->CreateScrollBarFrameL( ETrue ); |
|
138 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
139 CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); |
|
140 |
|
141 // Create item text array |
|
142 iItemTextArray = new (ELeave) CDesCArrayFlat(2); |
|
143 iListBox->Model()->SetItemTextArray( iItemTextArray ); |
|
144 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray) ; |
|
145 |
|
146 HBufC* text = KNullDesC().AllocLC(); |
|
147 iListBox->View()->SetListEmptyTextL( *text ); |
|
148 CleanupStack::PopAndDestroy( text ); |
|
149 |
|
150 // Create icon array |
|
151 |
|
152 CFbsBitmap* bitmap = 0; |
|
153 CFbsBitmap* mask = 0; |
|
154 |
|
155 CArrayPtr<CGulIcon>* iconArray = new (ELeave) CAknIconArray( 3 ); |
|
156 CleanupStack::PushL( iconArray ); |
|
157 |
|
158 AknIconUtils::CreateIconLC( |
|
159 bitmap, |
|
160 mask, |
|
161 AknIconUtils::AvkonIconFileName(), |
|
162 EMbmAvkonQgn_prop_checkbox_on, |
|
163 EMbmAvkonQgn_prop_checkbox_on_mask ); |
|
164 CGulIcon* icon = CGulIcon::NewLC(); |
|
165 icon->SetBitmap( bitmap ); |
|
166 icon->SetMask( mask ); |
|
167 icon->SetBitmapsOwnedExternally( EFalse ); |
|
168 iconArray->AppendL( icon ); |
|
169 |
|
170 CleanupStack::Pop( icon ); |
|
171 CleanupStack::Pop( mask ); |
|
172 CleanupStack::Pop( bitmap ); |
|
173 |
|
174 AknIconUtils::CreateIconLC( |
|
175 bitmap, |
|
176 mask, |
|
177 AknIconUtils::AvkonIconFileName(), |
|
178 EMbmAvkonQgn_prop_checkbox_off, |
|
179 EMbmAvkonQgn_prop_checkbox_off_mask ); |
|
180 icon = CGulIcon::NewLC(); |
|
181 icon->SetBitmap( bitmap ); |
|
182 icon->SetMask( mask ); |
|
183 icon->SetBitmapsOwnedExternally( EFalse ); |
|
184 iconArray->AppendL( icon ); |
|
185 |
|
186 CleanupStack::Pop( icon ); |
|
187 CleanupStack::Pop( mask ); |
|
188 CleanupStack::Pop( bitmap ); |
|
189 |
|
190 HBufC* iconFilePath = HBufC::NewLC( KDC_APP_BITMAP_DIR().Length() + |
|
191 KIAUpdateIconFileName().Length() +2 ); |
|
192 TPtr ptr = iconFilePath->Des(); |
|
193 ptr.Append( KDC_APP_BITMAP_DIR ); |
|
194 ptr.Append( KIAUpdateIconFileName ); |
|
195 |
|
196 TRAPD( err, CreateIconL( bitmap, |
|
197 mask, |
|
198 *iconFilePath, |
|
199 EMbmIaupdateQgn_indi_important_add, |
|
200 EMbmIaupdateQgn_indi_important_add_mask ) ); |
|
201 if ( err == KErrNone ) |
|
202 { |
|
203 CleanupStack::PushL( bitmap ); |
|
204 CleanupStack::PushL( mask ); |
|
205 } |
|
206 else if ( err == KErrEof ) |
|
207 { |
|
208 // icon does not exist in Z drive. I.e IAD eclipsed over phase 1 version. |
|
209 // So icon to be retrieved from C drive. |
|
210 ptr.Zero(); |
|
211 ptr.Append( _L("C:") ); |
|
212 ptr.Append( KDC_APP_BITMAP_DIR ); |
|
213 ptr.Append( KIAUpdateIconFileName ); |
|
214 AknIconUtils::CreateIconLC( |
|
215 bitmap, |
|
216 mask, |
|
217 *iconFilePath, |
|
218 EMbmIaupdateQgn_indi_important_add, |
|
219 EMbmIaupdateQgn_indi_important_add_mask ); |
|
220 } |
|
221 else |
|
222 { |
|
223 User::Leave( err ); |
|
224 } |
|
225 |
|
226 icon = CGulIcon::NewLC(); |
|
227 icon->SetBitmap( bitmap ); |
|
228 icon->SetMask( mask ); |
|
229 icon->SetBitmapsOwnedExternally( EFalse ); |
|
230 iconArray->AppendL( icon ); |
|
231 |
|
232 CleanupStack::Pop( icon ); |
|
233 CleanupStack::Pop( mask ); |
|
234 CleanupStack::Pop( bitmap ); |
|
235 CleanupStack::PopAndDestroy( iconFilePath ); |
|
236 |
|
237 CleanupStack::Pop( iconArray ); |
|
238 iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray ); |
|
239 |
|
240 iListBox->SetListBoxObserver( this ); |
|
241 |
|
242 // Set the windows size |
|
243 SetRect( aRect ); |
|
244 |
|
245 // Activate the window, which makes it ready to be drawn |
|
246 ActivateL(); |
|
247 } |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CIAUpdateMainContainer::HandleMarkCommandL |
|
251 // Handles Mark/Unmark commnds |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 void CIAUpdateMainContainer::HandleMarkCommandL( TInt aCommand ) |
|
255 { |
|
256 TInt index = iListBox->CurrentItemIndex(); |
|
257 |
|
258 TBool markingAccepted = EFalse; |
|
259 if( !iListBox->View()->ItemIsSelected( index ) ) |
|
260 { |
|
261 // aCommand is set to EAknCmdMark if current item is not selected. |
|
262 // That's because passed command id may be wrong when using touch UI |
|
263 aCommand = EAknCmdMark; |
|
264 markingAccepted = iObserver.MarkListItemL( ETrue, index ); |
|
265 } |
|
266 else |
|
267 { |
|
268 // aCommand is set to EAknCmdUnmark if current item is selected. |
|
269 // That's because passed command id may be wrong when using touch UI |
|
270 aCommand = EAknCmdUnmark; |
|
271 markingAccepted = iObserver.MarkListItemL( EFalse, index ); |
|
272 } |
|
273 |
|
274 if ( markingAccepted ) |
|
275 { |
|
276 AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox ); |
|
277 } |
|
278 } |
|
279 |
|
280 // ----------------------------------------------------------------------------- |
|
281 // CIAUpdateMainContainer::RefreshL |
|
282 // Refresh list |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 void CIAUpdateMainContainer::RefreshL( const RPointerArray<MIAUpdateAnyNode>& aNodes, |
|
286 TInt aError ) |
|
287 { |
|
288 iItemTextArray->Reset(); |
|
289 |
|
290 for( TInt i = 0; i < aNodes.Count(); ++i ) |
|
291 { |
|
292 MIAUpdateAnyNode* node = aNodes[i]; |
|
293 TInt sizeInBytes = node->Base().ContentSizeL(); |
|
294 |
|
295 TInt size = 0; |
|
296 TBool shownInMegabytes = EFalse; |
|
297 if ( sizeInBytes >= KMaxShownInKiloBytes ) |
|
298 { |
|
299 shownInMegabytes = ETrue; |
|
300 size = sizeInBytes / KMegaByte; |
|
301 if ( sizeInBytes % KMegaByte != 0 ) |
|
302 { |
|
303 size++; |
|
304 } |
|
305 } |
|
306 else |
|
307 { |
|
308 size = sizeInBytes / KKiloByte; |
|
309 if ( sizeInBytes % KKiloByte != 0 ) |
|
310 { |
|
311 size++; |
|
312 } |
|
313 } |
|
314 |
|
315 HBufC* importanceDescription( NULL ); |
|
316 switch( node->Base().Importance() ) |
|
317 { |
|
318 case MIAUpdateBaseNode::EMandatory: |
|
319 { |
|
320 if ( shownInMegabytes ) |
|
321 { |
|
322 importanceDescription = StringLoader::LoadLC( |
|
323 R_IAUPDATE_DES_REQUIRED_UPDATE_MB, size ); |
|
324 } |
|
325 else |
|
326 { |
|
327 importanceDescription = StringLoader::LoadLC( |
|
328 R_IAUPDATE_DES_REQUIRED_UPDATE_KB, size ); |
|
329 } |
|
330 break; |
|
331 } |
|
332 |
|
333 |
|
334 case MIAUpdateBaseNode::ECritical: |
|
335 { |
|
336 TBool isNSU = EFalse; |
|
337 if( node->NodeType() == MIAUpdateAnyNode::ENodeTypeFw ) |
|
338 { |
|
339 MIAUpdateFwNode* fwnode = static_cast<MIAUpdateFwNode*>( node ); |
|
340 if ( fwnode->FwType() == MIAUpdateFwNode::EFotiNsu ) |
|
341 { |
|
342 isNSU = ETrue; |
|
343 } |
|
344 } |
|
345 |
|
346 if ( isNSU ) |
|
347 { |
|
348 //for NSU firmware |
|
349 importanceDescription = StringLoader::LoadLC( |
|
350 R_IAUPDATE_UPDATE_WITH_PC ); |
|
351 } |
|
352 else if ( size == 0 ) |
|
353 { |
|
354 //for FOTA firmware when size info is not provided by server |
|
355 importanceDescription = StringLoader::LoadLC( |
|
356 R_IAUPDATE_DES_CRITICAL_UPDATE_NO_SIZE ); |
|
357 } |
|
358 else |
|
359 { |
|
360 if ( shownInMegabytes ) |
|
361 { |
|
362 importanceDescription = StringLoader::LoadLC( |
|
363 R_IAUPDATE_DES_CRITICAL_UPDATE_MB, size ); |
|
364 } |
|
365 else |
|
366 { |
|
367 importanceDescription = StringLoader::LoadLC( |
|
368 R_IAUPDATE_DES_CRITICAL_UPDATE_KB, size ); |
|
369 } |
|
370 } |
|
371 |
|
372 break; |
|
373 } |
|
374 |
|
375 case MIAUpdateBaseNode::ERecommended: |
|
376 { |
|
377 if ( shownInMegabytes ) |
|
378 { |
|
379 importanceDescription = StringLoader::LoadLC( |
|
380 R_IAUPDATE_DES_RECOMMENDED_UPDATE_MB, size ); |
|
381 } |
|
382 else |
|
383 { |
|
384 importanceDescription = StringLoader::LoadLC( |
|
385 R_IAUPDATE_DES_RECOMMENDED_UPDATE_KB, size ); |
|
386 } |
|
387 break; |
|
388 } |
|
389 |
|
390 case MIAUpdateBaseNode::ENormal: |
|
391 { |
|
392 if ( shownInMegabytes ) |
|
393 { |
|
394 importanceDescription = StringLoader::LoadLC( |
|
395 R_IAUPDATE_DES_NORMAL_UPDATE_MB, size ); |
|
396 } |
|
397 else |
|
398 { |
|
399 importanceDescription = StringLoader::LoadLC( |
|
400 R_IAUPDATE_DES_NORMAL_UPDATE_KB, size ); |
|
401 } |
|
402 break; |
|
403 } |
|
404 |
|
405 default: |
|
406 { |
|
407 importanceDescription = KNullDesC().AllocLC(); |
|
408 break; |
|
409 } |
|
410 } |
|
411 |
|
412 TPtr ptr = importanceDescription->Des(); |
|
413 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); |
|
414 |
|
415 |
|
416 |
|
417 if ( node->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal ) |
|
418 { |
|
419 HBufC* name = node->Base().Name().AllocLC(); |
|
420 HBufC* buffer = HBufC::NewLC( KOne.iTypeLength + |
|
421 KTabulator.iTypeLength + |
|
422 name->Length() + |
|
423 KTabulator.iTypeLength + |
|
424 importanceDescription->Length() ); |
|
425 buffer->Des() = KOne(); |
|
426 buffer->Des() += KTabulator(); |
|
427 buffer->Des() += *name; |
|
428 buffer->Des() += KTabulator(); |
|
429 buffer->Des() += *importanceDescription; |
|
430 |
|
431 iItemTextArray->AppendL( *buffer ); |
|
432 |
|
433 CleanupStack::PopAndDestroy( buffer ); |
|
434 CleanupStack::PopAndDestroy( name ); |
|
435 } |
|
436 |
|
437 if ( node->NodeType() == MIAUpdateAnyNode::ENodeTypeFw ) |
|
438 { |
|
439 HBufC* firmwareHeader = StringLoader::LoadLC(R_IAUPDATE_MAIN_DEVICE_FW); |
|
440 HBufC* firmwarename = HBufC::NewLC( node->Base().Name().Length() + |
|
441 KSpace.iTypeLength + |
|
442 firmwareHeader->Length() ); |
|
443 firmwarename->Des() = node->Base().Name(); |
|
444 firmwarename->Des() += KSpace(); |
|
445 firmwarename->Des() += *firmwareHeader; |
|
446 |
|
447 HBufC* buffer = HBufC::NewLC( KOne.iTypeLength + |
|
448 KTabulator.iTypeLength + |
|
449 firmwarename->Length() + |
|
450 KTabulator.iTypeLength + |
|
451 importanceDescription->Length() + |
|
452 KTabulator.iTypeLength + |
|
453 KTwo.iTypeLength ); |
|
454 buffer->Des() = KOne(); |
|
455 buffer->Des() += KTabulator(); |
|
456 buffer->Des() += *firmwarename; |
|
457 buffer->Des() += KTabulator(); |
|
458 buffer->Des() += *importanceDescription; |
|
459 buffer->Des() += KTabulator(); |
|
460 buffer->Des() += KTwo(); |
|
461 |
|
462 iItemTextArray->AppendL( *buffer ); |
|
463 CleanupStack::PopAndDestroy( buffer ); |
|
464 CleanupStack::PopAndDestroy( firmwarename ); |
|
465 CleanupStack::PopAndDestroy( firmwareHeader ); |
|
466 } |
|
467 |
|
468 CleanupStack::PopAndDestroy( importanceDescription ); |
|
469 } |
|
470 |
|
471 if ( aNodes.Count() == 0 ) |
|
472 { |
|
473 HBufC* emptyText = NULL; |
|
474 if ( aError ) |
|
475 { |
|
476 if ( aError == KErrCancel || aError == KErrAbort ) |
|
477 { |
|
478 emptyText = KNullDesC().AllocLC(); |
|
479 } |
|
480 else |
|
481 { |
|
482 emptyText = StringLoader::LoadLC( R_IAUPDATE_REFRESH_FAILED ); |
|
483 } |
|
484 } |
|
485 else |
|
486 { |
|
487 emptyText = StringLoader::LoadLC( R_IAUPDATE_TEXT_NO_UPDATES ); |
|
488 } |
|
489 |
|
490 iListBox->View()->SetListEmptyTextL( *emptyText ); |
|
491 CleanupStack::PopAndDestroy( emptyText ); |
|
492 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
493 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
494 } |
|
495 else |
|
496 { |
|
497 if ( iListBox->CurrentItemIndex() == KErrNotFound ) |
|
498 { |
|
499 iListBox->SetCurrentItemIndex( aNodes.Count() - 1 ); |
|
500 } |
|
501 } |
|
502 |
|
503 iListBox->HandleItemAdditionL(); |
|
504 } |
|
505 |
|
506 // ----------------------------------------------------------------------------- |
|
507 // CIAUpdateMainContainer::GetCurrentNode |
|
508 // |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 MIAUpdateAnyNode* CIAUpdateMainContainer::GetCurrentNode( |
|
512 const RPointerArray<MIAUpdateAnyNode>& aNodes ) |
|
513 { |
|
514 MIAUpdateAnyNode* currentNode = NULL; |
|
515 |
|
516 TInt currentIndex = iListBox->CurrentItemIndex(); |
|
517 |
|
518 if( currentIndex != -1 ) |
|
519 { |
|
520 |
|
521 currentNode = aNodes[currentIndex]; |
|
522 |
|
523 } |
|
524 return currentNode; |
|
525 } |
|
526 |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // CIAUpdateMainContainer::SetSelectedIndicesL |
|
530 // |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 void CIAUpdateMainContainer::SetSelectedIndicesL( |
|
534 const RArray<TInt>& aIndices ) |
|
535 { |
|
536 CArrayFixFlat<TInt>* indexes = new(ELeave) CArrayFixFlat<TInt>( aIndices.Count() + 1 ); |
|
537 |
|
538 CleanupStack::PushL( indexes ); |
|
539 |
|
540 for( TInt i = 0; i < aIndices.Count(); ++i ) |
|
541 { |
|
542 indexes->AppendL( aIndices[i] ); |
|
543 } |
|
544 |
|
545 iListBox->View()->SetSelectionIndexesL( indexes ); |
|
546 |
|
547 UpdateMSKTextL(); |
|
548 CleanupStack::PopAndDestroy( indexes ); |
|
549 } |
|
550 |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CIAUpdateMainContainer::CleanAllSelectionL |
|
554 // |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 void CIAUpdateMainContainer::CleanAllSelection() |
|
558 { |
|
559 iListBox->View()->ClearSelection(); |
|
560 } |
|
561 |
|
562 // ----------------------------------------------------------------------------- |
|
563 // CIAUpdateMainContainer::OfferKeyEventL |
|
564 // Some key events are passed to the list componenent |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 TKeyResponse CIAUpdateMainContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
568 TEventCode aType ) |
|
569 { |
|
570 TKeyResponse response = EKeyWasNotConsumed; |
|
571 |
|
572 |
|
573 if( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmFota ) ) //NFUI |
|
574 { |
|
575 if (aKeyEvent.iScanCode == EStdKeyDevice0 |
|
576 || aKeyEvent.iScanCode == EStdKeyDevice3 |
|
577 || aKeyEvent.iScanCode == EStdKeyHash ) |
|
578 { |
|
579 |
|
580 TBool value (EFalse); |
|
581 TInt err = RProperty::Get( KPSUidNSmlDMSyncApp, KFotaDLStatus, value ); |
|
582 if (!err && value == 1) |
|
583 { |
|
584 |
|
585 TApaTaskList taskList(CEikonEnv::Static()->WsSession()); |
|
586 TApaTask task=taskList.FindApp( KFOTAUid ); |
|
587 |
|
588 if(task.Exists()) |
|
589 { |
|
590 task.BringToForeground(); |
|
591 } |
|
592 return EKeyWasConsumed; |
|
593 } |
|
594 } |
|
595 } |
|
596 |
|
597 if( aType == EEventKey ) |
|
598 { |
|
599 switch( aKeyEvent.iCode ) |
|
600 { |
|
601 case EKeyUpArrow: |
|
602 case EKeyDownArrow: |
|
603 { |
|
604 response = iListBox->OfferKeyEventL(aKeyEvent, aType); |
|
605 UpdateMSKTextL(); |
|
606 break; |
|
607 } |
|
608 default: |
|
609 { |
|
610 break; |
|
611 } |
|
612 |
|
613 } |
|
614 } |
|
615 return response; |
|
616 } |
|
617 |
|
618 // ----------------------------------------------------------------------------- |
|
619 // CIAUpdateMainContainer::SizeChanged |
|
620 // |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 void CIAUpdateMainContainer::SizeChanged() |
|
624 { |
|
625 iListBox->SetRect( Rect() ); |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CIAUpdateMainContainer::CountComponentControls |
|
630 // |
|
631 // ----------------------------------------------------------------------------- |
|
632 // |
|
633 TInt CIAUpdateMainContainer::CountComponentControls() const |
|
634 { |
|
635 if ( iListBox ) |
|
636 { |
|
637 return 1; |
|
638 } |
|
639 else |
|
640 { |
|
641 return 0; |
|
642 } |
|
643 } |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // CIAUpdateMainContainer::ComponentControl |
|
647 // |
|
648 // ----------------------------------------------------------------------------- |
|
649 // |
|
650 CCoeControl* CIAUpdateMainContainer::ComponentControl( TInt aIndex ) const |
|
651 { |
|
652 CCoeControl* control = 0; |
|
653 |
|
654 switch( aIndex ) |
|
655 { |
|
656 case 0: |
|
657 control = iListBox; |
|
658 break; |
|
659 default: |
|
660 break; |
|
661 } |
|
662 return control; |
|
663 } |
|
664 |
|
665 |
|
666 // --------------------------------------------------------------------------- |
|
667 // CIAUpdateMainContainer::GetHelpContext |
|
668 // |
|
669 // --------------------------------------------------------------------------- |
|
670 // |
|
671 void CIAUpdateMainContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
672 { |
|
673 aContext.iMajor = KUidIAUpdateApp; |
|
674 aContext.iContext = KSWUPDATE_HLP_MAIN; |
|
675 } |
|
676 |
|
677 // --------------------------------------------------------------------------- |
|
678 // CIAUpdateMainContainer::HandleResourceChange |
|
679 // |
|
680 // --------------------------------------------------------------------------- |
|
681 // |
|
682 void CIAUpdateMainContainer::HandleResourceChange( TInt aType ) |
|
683 { |
|
684 CCoeControl::HandleResourceChange( aType ); |
|
685 |
|
686 if ( aType == KEikDynamicLayoutVariantSwitch ) //Handle change in layout orientation |
|
687 { |
|
688 TRect mainPaneRect; |
|
689 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
690 SetRect( mainPaneRect ); |
|
691 DrawNow(); |
|
692 } |
|
693 } |
|
694 |
|
695 // ----------------------------------------------------------------------------- |
|
696 // CIAUpdateMainContainer::UpdateMSKTextL |
|
697 // |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CIAUpdateMainContainer::UpdateMSKTextL() |
|
701 { |
|
702 TInt index = iListBox->CurrentItemIndex(); |
|
703 if (index < 0 ) |
|
704 { |
|
705 iObserver.SetMiddleSKTextL( EFalse, EFalse ); |
|
706 } |
|
707 else if ( iListBox->View()->ItemIsSelected( index ) ) |
|
708 { |
|
709 iObserver.SetMiddleSKTextL( ETrue, ETrue ); |
|
710 } |
|
711 else |
|
712 { |
|
713 iObserver.SetMiddleSKTextL( ETrue, EFalse ); |
|
714 } |
|
715 } |
|
716 |
|
717 |
|
718 // ----------------------------------------------------------------------------- |
|
719 // CIAUpdateMainContainer::HandleListBoxEventL |
|
720 // |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 void CIAUpdateMainContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
724 TListBoxEvent aEventType ) |
|
725 { |
|
726 |
|
727 switch ( aEventType ) |
|
728 { |
|
729 case EEventItemSingleClicked: |
|
730 case EEventEnterKeyPressed: |
|
731 { |
|
732 TInt index = iListBox->CurrentItemIndex(); |
|
733 if( iListBox->View()->ItemIsSelected( index ) ) |
|
734 { |
|
735 HandleMarkCommandL( EAknCmdUnmark ); |
|
736 } |
|
737 else |
|
738 { |
|
739 HandleMarkCommandL( EAknCmdMark ); |
|
740 } |
|
741 break; |
|
742 } |
|
743 default: |
|
744 { |
|
745 break; |
|
746 } |
|
747 } |
|
748 } |
|
749 |
|
750 // ----------------------------------------------------------------------------- |
|
751 // CIAUpdateMainContainer::CreateIconL |
|
752 // |
|
753 // ----------------------------------------------------------------------------- |
|
754 // |
|
755 void CIAUpdateMainContainer::CreateIconL( CFbsBitmap*& aBitmap, |
|
756 CFbsBitmap*& aMask, |
|
757 const TDesC& aFileName, |
|
758 TInt aBitmapId, |
|
759 TInt aMaskId ) |
|
760 { |
|
761 AknIconUtils::CreateIconLC( aBitmap, |
|
762 aMask, |
|
763 aFileName, |
|
764 aBitmapId, |
|
765 aMaskId ); |
|
766 CleanupStack::Pop( aMask ); |
|
767 CleanupStack::Pop( aBitmap ); |
|
768 } |
|