|
1 /* |
|
2 * Copyright (c) 2007-2007 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 diagnostics components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "devdiagplugincontainer.h" |
|
22 #include "devdiagengine.h" |
|
23 #include "devdiag.pan" |
|
24 #include "devdiagutil.h" //Time conversion functions |
|
25 |
|
26 #include <DiagFrameworkDebug.h> |
|
27 #include <devdiagapp.rsg> |
|
28 #include <DiagPlugin.h> |
|
29 #include <DiagPluginPool.h> |
|
30 #include <DiagSuitePlugin.h> |
|
31 #include <DiagResultsDatabaseItem.h> |
|
32 #include <eikclbd.h> // CColumnListBoxData |
|
33 #include <aknmessagequerydialog.h> |
|
34 #include <data_caging_path_literals.hrh> |
|
35 #include <aknPopup.h> // popup dialogs |
|
36 #include <StringLoader.h> |
|
37 #include <AknQueryDialog.h> |
|
38 #include <textresolver.h> |
|
39 #include <AknIconArray.h> |
|
40 #include <AknsUtils.h> |
|
41 #include <featmgr.h> |
|
42 #include <AknWaitDialog.h> |
|
43 #include <devdiagapp.mbg> |
|
44 |
|
45 |
|
46 #include <AknsUtils.h> |
|
47 ///@@@KSR: changes for BAD Warnings - #177-D: variable "KDiagSpace" was declared but never referenced |
|
48 //_LIT( KDiagSpace, " " ); |
|
49 _LIT( KListTestElementFormatDouble, "%d\t%S\t%S" ); |
|
50 _LIT( KDevDiagAppIconFileName, "\\resource\\apps\\devdiagapp.mif"); |
|
51 |
|
52 const TInt KLastResultTextLength(256); |
|
53 const TInt KIconArrayGranularity(20); |
|
54 |
|
55 //INCORRECT! |
|
56 const MDiagPlugin::TNameLayoutType KLayoutType( MDiagPlugin::ENameLayoutListSingle ); |
|
57 |
|
58 |
|
59 // ========================== MEMBER FUNCTIONS ================================= |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CDevDiagPluginContainer::NewL |
|
63 // Two-phased constructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CDevDiagPluginContainer* CDevDiagPluginContainer::NewL( CDevDiagPluginView* aView, |
|
67 CDevDiagEngine& aEngine, |
|
68 const TRect& aRect ) |
|
69 { |
|
70 CDevDiagPluginContainer* self = new( ELeave ) |
|
71 CDevDiagPluginContainer( aView, aEngine ); |
|
72 |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL( aRect ); |
|
75 CleanupStack::Pop(); |
|
76 |
|
77 return self; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CDevDiagPluginContainer::CDevDiagPluginContainer |
|
82 // C++ default constructor can NOT contain any code, that |
|
83 // might leave. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CDevDiagPluginContainer::CDevDiagPluginContainer( CDevDiagPluginView* aView, |
|
87 CDevDiagEngine& aEngine ) |
|
88 : iView( aView ), iEngine(aEngine), iModelUpdated( EFalse ) |
|
89 { |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CDevDiagPluginContainer::ConstructL |
|
94 // Symbian 2nd phase constructor can leave. |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CDevDiagPluginContainer::ConstructL( const TRect& aRect ) |
|
98 { |
|
99 LOGSTRING( "CDevDiagPluginContainer::ConstructL" ); |
|
100 CreateWindowL(); |
|
101 |
|
102 iListBox = new ( ELeave ) CAknDoubleLargeStyleListBox; |
|
103 |
|
104 iListBox->SetContainerWindowL( *this ); |
|
105 iListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
106 |
|
107 iListBox->CreateScrollBarFrameL( ETrue ); |
|
108 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
109 CEikScrollBarFrame::EOff, |
|
110 CEikScrollBarFrame::EAuto ); |
|
111 |
|
112 AddIconsL(); |
|
113 |
|
114 iListBox->UpdateScrollBarsL(); |
|
115 //iListBox->ScrollBarFrame()->MoveVertThumbTo( 0 ); |
|
116 |
|
117 iListBox->SetListBoxObserver( this ); |
|
118 |
|
119 SetRect( aRect ); |
|
120 ActivateL(); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CDevDiagPluginContainer::~CDevDiagPluginContainer |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 CDevDiagPluginContainer::~CDevDiagPluginContainer() |
|
128 { |
|
129 delete iListBox; |
|
130 |
|
131 //Do not call ResetAndDestroy, because plug-ins are not owned. |
|
132 iChildren.Close(); |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CDevDiagPluginContainer::SizeChanged |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void CDevDiagPluginContainer::SizeChanged() |
|
140 { |
|
141 iListBox->SetRect( Rect() ); // Mandatory, otherwise not drawn |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CDevDiagPluginContainer::HandleResourceChange |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void CDevDiagPluginContainer::HandleResourceChange( TInt aType ) |
|
149 { |
|
150 CCoeControl::HandleResourceChange( aType ); |
|
151 |
|
152 //Handle change in layout orientation |
|
153 if ( aType == KEikDynamicLayoutVariantSwitch || |
|
154 aType == KAknsMessageSkinChange ) |
|
155 { |
|
156 if ( aType == KAknsMessageSkinChange ) |
|
157 { |
|
158 // Skin changed; we'll have to reload the icon array |
|
159 CArrayPtr<CGulIcon>* iconArray = |
|
160 iListBox->ItemDrawer()->FormattedCellData()->IconArray(); |
|
161 if ( iconArray ) |
|
162 { |
|
163 iconArray->ResetAndDestroy(); |
|
164 delete iconArray; |
|
165 iconArray = NULL; |
|
166 } |
|
167 TRAP_IGNORE( AddIconsL() ); |
|
168 } |
|
169 |
|
170 TRect mainPaneRect; |
|
171 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
172 SetRect( mainPaneRect ); |
|
173 DrawDeferred(); |
|
174 } |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CDevDiagPluginContainer::CountComponentControls |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TInt CDevDiagPluginContainer::CountComponentControls() const |
|
182 { |
|
183 TInt retval( 0 ); |
|
184 if ( iListBox ) |
|
185 { |
|
186 retval = 1; |
|
187 } |
|
188 return retval; // return nbr of controls inside this container |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CDevDiagPluginContainer::ComponentControl |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 CCoeControl* CDevDiagPluginContainer::ComponentControl( TInt aIndex ) const |
|
196 { |
|
197 switch ( aIndex ) |
|
198 { |
|
199 case 0: |
|
200 { |
|
201 return iListBox; |
|
202 } |
|
203 default: |
|
204 { |
|
205 return NULL; |
|
206 } |
|
207 } |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CDevDiagPluginContainer::Draw |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 void CDevDiagPluginContainer::Draw( const TRect& /* aRect */ ) const |
|
215 { |
|
216 } |
|
217 |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CDevDiagPluginContainer::HandleControlEventL |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 |
|
224 void CDevDiagPluginContainer::HandleControlEventL( CCoeControl* /* aControl */, |
|
225 TCoeEvent /* aEventType */ ) |
|
226 { |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // CDevDiagPluginContainer::OfferKeyEventL |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 |
|
234 TKeyResponse CDevDiagPluginContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
235 TEventCode aType ) |
|
236 { |
|
237 |
|
238 if ( iListBox && aType == EEventKey ) |
|
239 { |
|
240 switch ( aKeyEvent.iCode ) |
|
241 { |
|
242 case EStdKeyHome: |
|
243 { |
|
244 |
|
245 break; |
|
246 |
|
247 } |
|
248 |
|
249 case EKeyEscape: |
|
250 { |
|
251 |
|
252 iAvkonAppUi->ProcessCommandL( EEikCmdExit ); |
|
253 |
|
254 break; |
|
255 } |
|
256 case EKeyUpArrow: |
|
257 case EKeyDownArrow: |
|
258 { |
|
259 TKeyResponse retVal = |
|
260 iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
261 return retVal; |
|
262 } |
|
263 case EKeyLeftArrow: |
|
264 case EKeyRightArrow: |
|
265 { |
|
266 break; // AppUi handles the tab changes |
|
267 } |
|
268 default: |
|
269 { |
|
270 return iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
271 } |
|
272 } |
|
273 } |
|
274 |
|
275 return EKeyWasNotConsumed; |
|
276 } |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CDevDiagPluginContainer::HandleListBoxEventL |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 void CDevDiagPluginContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
286 TListBoxEvent aEventType ) |
|
287 { |
|
288 // if the Select Key has been pressed |
|
289 if ((aEventType == MEikListBoxObserver::EEventEnterKeyPressed) || |
|
290 (aEventType == MEikListBoxObserver::EEventItemClicked)) |
|
291 { |
|
292 |
|
293 } |
|
294 } |
|
295 |
|
296 #ifdef __SERIES60_HELP |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CDevDiagPluginContainer::GetHelpContext |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 void CDevDiagPluginContainer::GetHelpContext( TCoeHelpContext& /*aContext */ ) const |
|
302 { |
|
303 //aContext.iMajor = KUidSmlSyncApp; |
|
304 //aContext.iContext = KDM_HLP_DIAGNOSTICS_APPLICATION; |
|
305 } |
|
306 |
|
307 #else |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CDevDiagPluginContainer::GetHelpContext |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 void CDevDiagPluginContainer::GetHelpContext( TCoeHelpContext& /*aContext*/ ) const |
|
314 { |
|
315 } |
|
316 #endif // __SERIES60_HELP |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CDevDiagPluginContainer::FocusChanged |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 void CDevDiagPluginContainer::FocusChanged( TDrawNow /*aDrawNow*/ ) |
|
323 { |
|
324 if ( iListBox ) |
|
325 { |
|
326 iListBox->SetFocus( IsFocused() ); |
|
327 } |
|
328 } |
|
329 |
|
330 |
|
331 // ----------------------------------------------------------------------------- |
|
332 // Change text of the focused item into "Testing ..." |
|
333 // ----------------------------------------------------------------------------- |
|
334 // |
|
335 void CDevDiagPluginContainer::DisplayStartTestingL() |
|
336 { |
|
337 LOGSTRING( "CDevDiagPluginContainer::DisplayStartTestingL" ); |
|
338 __ASSERT_ALWAYS( iModelUpdated, |
|
339 Panic( EDevDiagListboxModelNotUpdated ) ); |
|
340 |
|
341 // Add listbox items. |
|
342 CDesCArray* pluginTextArray = static_cast< CDesCArray* >( |
|
343 iListBox->Model()->ItemTextArray() ); |
|
344 |
|
345 __ASSERT_ALWAYS( pluginTextArray->Count() == iChildren.Count(), |
|
346 Panic( EDevDiagListboxContainerModel ) ); |
|
347 |
|
348 MDiagPlugin* plugin; |
|
349 HBufC* formattedName = NULL; |
|
350 |
|
351 SelectedPlugin ( plugin ); |
|
352 |
|
353 HBufC* name = plugin->GetPluginNameL( KLayoutType ); |
|
354 CleanupStack::PushL( name ); |
|
355 |
|
356 HBufC* testingText = StringLoader::LoadL( R_DIAG_LST_TEST_ONGOING ); |
|
357 CleanupStack::PushL ( testingText ); |
|
358 |
|
359 formattedName = HBufC::NewLC( name->Length() + |
|
360 KListTestElementFormatDouble().Length() + |
|
361 testingText->Length() ); |
|
362 formattedName->Des().Format( KListTestElementFormatDouble(), 0, name, testingText ); |
|
363 |
|
364 TInt index = iListBox->CurrentItemIndex(); |
|
365 pluginTextArray->Delete( index ); |
|
366 |
|
367 pluginTextArray->InsertL( index, *formattedName ); |
|
368 |
|
369 CleanupStack::PopAndDestroy( formattedName ); |
|
370 CleanupStack::PopAndDestroy( testingText ); |
|
371 CleanupStack::PopAndDestroy( name ); |
|
372 |
|
373 iListBox->SetFocus( ETrue ); |
|
374 iListBox->HandleItemAdditionL(); |
|
375 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
376 iListBox->DrawDeferred(); |
|
377 } |
|
378 |
|
379 // ----------------------------------------------------------------------------- |
|
380 // Move "Testing ..." one step lower. This is needed when a group of plug-ins |
|
381 // are executed. |
|
382 // ----------------------------------------------------------------------------- |
|
383 // |
|
384 void CDevDiagPluginContainer::MoveStartTestingDownL() |
|
385 { |
|
386 if ( iListBox->CurrentItemIndex() + 1 < iChildren.Count() ) |
|
387 { |
|
388 iListBox->SetCurrentItemIndex ( iListBox->CurrentItemIndex() +1 ); |
|
389 DisplayStartTestingL(); |
|
390 } |
|
391 } |
|
392 |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // Set focus at the beginning of the listbox. |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 void CDevDiagPluginContainer::ResetL() |
|
399 { |
|
400 iListBox->SetCurrentItemIndexAndDraw ( 0 ); |
|
401 } |
|
402 |
|
403 |
|
404 // ----------------------------------------------------------------------------- |
|
405 // Create the plug-in model. |
|
406 // The function needs to know the parent uid and its children are loaded. |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
|
409 void CDevDiagPluginContainer::UpdateModelL( TUid aParentSuiteUid ) |
|
410 { |
|
411 LOGSTRING( "CDevDiagPluginContainer::UpdateModelL" ); |
|
412 MDiagPlugin* plugin; |
|
413 if ( iEngine.PluginPool().FindPlugin( aParentSuiteUid, plugin ) == KErrNone ) |
|
414 { |
|
415 iChildren.Reset(); //plug-ins are owned by the engine. |
|
416 |
|
417 MDiagSuitePlugin* suite = static_cast< MDiagSuitePlugin* >( plugin ); |
|
418 suite->GetChildrenL( iChildren, MDiagSuitePlugin::ESortByPosition ); |
|
419 |
|
420 iModelUpdated = ETrue; |
|
421 } |
|
422 else |
|
423 { |
|
424 Panic( EDevDiagListboxFindPluginFailure ); |
|
425 } |
|
426 } |
|
427 |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // The plug-in execution was not performed. Display the text on the listbox. |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 void CDevDiagPluginContainer::DisplayNotPerformedL( CDesCArray& aListboxModel, |
|
434 MDiagPlugin*& aPlugin ) |
|
435 { |
|
436 LOGSTRING( "CDevDiagPluginContainer::DisplayNotPerformedL" ); |
|
437 HBufC* name = aPlugin->GetPluginNameL( KLayoutType ); |
|
438 |
|
439 CleanupStack::PushL( name ); |
|
440 |
|
441 HBufC* result = GetPluginResultL( ENotPerformed ); |
|
442 CleanupStack::PushL( result ); |
|
443 |
|
444 HBufC* formattedName = HBufC::NewLC( name->Length() + |
|
445 result->Length() + |
|
446 KListTestElementFormatDouble().Length() ); |
|
447 formattedName->Des().Format( KListTestElementFormatDouble(), 0, name, result); |
|
448 |
|
449 aListboxModel.AppendL( *formattedName ); |
|
450 |
|
451 CleanupStack::PopAndDestroy( formattedName ); |
|
452 CleanupStack::PopAndDestroy( result ); |
|
453 |
|
454 CleanupStack::PopAndDestroy( name ); |
|
455 } |
|
456 |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // Display icon and test result for the plug-in. |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void CDevDiagPluginContainer::DisplayLastResultL( CDesCArray& aListboxModel, |
|
463 MDiagPlugin*& aPlugin, |
|
464 CDiagResultsDatabaseItem& aItem ) |
|
465 { |
|
466 LOGSTRING( "CDevDiagPluginContainer::DisplayLastResultL" ); |
|
467 |
|
468 HBufC* name = aPlugin->GetPluginNameL( KLayoutType ); |
|
469 CleanupStack::PushL( name ); |
|
470 |
|
471 TBuf<KLastResultTextLength> execTime; |
|
472 |
|
473 TTime started = aItem.TimeStarted(); |
|
474 |
|
475 if ( TDevDiagUtil::IsToday(started)) |
|
476 { |
|
477 TDevDiagUtil::GetTimeTextL( execTime, started ); |
|
478 LOGTEXT( execTime ); |
|
479 } |
|
480 else |
|
481 { |
|
482 TDevDiagUtil::GetDateTextL( execTime, started ); |
|
483 LOGTEXT( execTime ); |
|
484 } |
|
485 |
|
486 TInt iconIndex = -1; |
|
487 |
|
488 HBufC* result = ConvertResultLC( execTime, iconIndex, &aItem ); |
|
489 |
|
490 HBufC* formattedName = HBufC::NewLC( name->Length() + |
|
491 result->Length() + |
|
492 KListTestElementFormatDouble().Length()); |
|
493 |
|
494 // Format icon index, then the name of the plug-in and then time. |
|
495 formattedName->Des().Format( KListTestElementFormatDouble(), |
|
496 iconIndex, |
|
497 name, |
|
498 result); |
|
499 |
|
500 aListboxModel.AppendL( *formattedName ); |
|
501 |
|
502 CleanupStack::PopAndDestroy( formattedName ); |
|
503 CleanupStack::PopAndDestroy( result ); |
|
504 CleanupStack::PopAndDestroy( name ); |
|
505 } |
|
506 |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // Refresh the listbox with last results. |
|
510 // ----------------------------------------------------------------------------- |
|
511 // |
|
512 void CDevDiagPluginContainer::DisplayChildrenWithResultsL( |
|
513 RPointerArray<CDiagResultsDatabaseItem>& aArray ) |
|
514 { |
|
515 LOGSTRING( "CDevDiagPluginContainer::DisplayChildrenWithResultsL" ); |
|
516 |
|
517 __ASSERT_ALWAYS( iModelUpdated, |
|
518 Panic( EDevDiagListboxModelNotUpdated ) ); |
|
519 |
|
520 // arrays must match |
|
521 __ASSERT_ALWAYS( aArray.Count() == iChildren.Count(), |
|
522 Panic( EDevDiagContainerArrayMismatch ) ); |
|
523 |
|
524 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
525 |
|
526 // Add listbox items. |
|
527 CDesCArray* pluginTextArray = static_cast< CDesCArray* >( |
|
528 iListBox->Model()->ItemTextArray() ); |
|
529 pluginTextArray->Reset(); |
|
530 |
|
531 // Go through the last result list |
|
532 for (TInt i = 0; i < aArray.Count(); ++i) |
|
533 { |
|
534 if ( !aArray[i] ) //Item has not been performed (last result not found) |
|
535 { |
|
536 LOGSTRING2("Item number: %d was null", i ); |
|
537 DisplayNotPerformedL( *pluginTextArray, iChildren[i] ); |
|
538 } |
|
539 else //last result found, display a test result |
|
540 { |
|
541 LOGSTRING2("Result found: %d", i ); |
|
542 DisplayLastResultL( *pluginTextArray, iChildren[i], *aArray[i] ); |
|
543 } |
|
544 } |
|
545 |
|
546 iListBox->SetFocus( ETrue ); |
|
547 iListBox->HandleItemAdditionL(); |
|
548 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
549 iListBox->DrawDeferred(); |
|
550 |
|
551 LOGSTRING( "CDevDiagPluginContainer::DisplayChildrenWithResultsL end" ); |
|
552 } |
|
553 |
|
554 |
|
555 // ----------------------------------------------------------------------------- |
|
556 // Get localised test result text. |
|
557 // ----------------------------------------------------------------------------- |
|
558 // |
|
559 HBufC* CDevDiagPluginContainer::GetPluginResultL( TContainerResult aResult ) const |
|
560 { |
|
561 LOGSTRING( "CDevDiagPluginContainer::GetPluginResultL" ); |
|
562 |
|
563 switch ( aResult ) |
|
564 { |
|
565 case ESuccess: |
|
566 return StringLoader::LoadL( R_DIAG_LST_TEST_PASS ); |
|
567 |
|
568 case EFailed: |
|
569 return StringLoader::LoadL ( R_DIAG_LST_TEST_FAILED ); |
|
570 |
|
571 case ENotPerformed: |
|
572 return StringLoader::LoadL( R_DIAG_LIST_NOT_PERFORMED ); |
|
573 |
|
574 default: |
|
575 Panic( EDevDiagApplicationInvalidResultIndex ); |
|
576 } |
|
577 |
|
578 return NULL; |
|
579 } |
|
580 |
|
581 |
|
582 // ----------------------------------------------------------------------------- |
|
583 // Get localised test result text and the icon array |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 HBufC* CDevDiagPluginContainer::ConvertResultLC( const TDesC& aString, |
|
587 TInt& aIconIndex, |
|
588 CDiagResultsDatabaseItem* aResult ) const |
|
589 { |
|
590 LOGSTRING( "CDevDiagPluginContainer::ConvertResultL" ); |
|
591 if ( !aResult ) |
|
592 { |
|
593 return StringLoader::LoadLC( R_DIAG_LIST_NOT_PERFORMED ); |
|
594 } |
|
595 |
|
596 switch ( aResult->TestResult() ) |
|
597 { |
|
598 case CDiagResultsDatabaseItem::ESuccess: |
|
599 aIconIndex = 1; |
|
600 return StringLoader::LoadLC( R_DIAG_LST_TEST_PASS, aString ); |
|
601 |
|
602 case CDiagResultsDatabaseItem::EFailed: |
|
603 aIconIndex = 2; |
|
604 return StringLoader::LoadLC ( R_DIAG_LST_TEST_FAILED, aString ); |
|
605 case CDiagResultsDatabaseItem::ESkipped: |
|
606 case CDiagResultsDatabaseItem::ECancelled: |
|
607 case CDiagResultsDatabaseItem::EQueuedToRun: |
|
608 { |
|
609 return StringLoader::LoadLC( R_DIAG_LIST_NOT_PERFORMED ); |
|
610 } |
|
611 |
|
612 default: |
|
613 LOGSTRING2("PANIC: Results item had a result: %d ", aResult->TestResult() ); |
|
614 Panic( EDevDiagApplicationInvalidResultIndex ); |
|
615 } |
|
616 |
|
617 return NULL; |
|
618 } |
|
619 |
|
620 void CDevDiagPluginContainer::SelectedPlugin(MDiagPlugin*& aPlugin) |
|
621 { |
|
622 LOGSTRING( "CDevDiagPluginContainer::SelectedPluginL" ); |
|
623 aPlugin = iChildren[ iListBox->CurrentItemIndex() ]; |
|
624 } |
|
625 |
|
626 // ----------------------------------------------------------------------------- |
|
627 // Load icons. |
|
628 // |
|
629 // Icons are: |
|
630 // Not performed |
|
631 // Passed |
|
632 // Failed |
|
633 // ----------------------------------------------------------------------------- |
|
634 // |
|
635 void CDevDiagPluginContainer::AddIconsL() |
|
636 { |
|
637 LOGSTRING( "CDevDiagPluginContainer::AddIconsL" ); |
|
638 CArrayPtr<CGulIcon>* icons = new (ELeave) CArrayPtrFlat<CGulIcon> |
|
639 (KIconArrayGranularity); |
|
640 |
|
641 iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons ); |
|
642 |
|
643 CFbsBitmap* bitmap = NULL; |
|
644 CFbsBitmap* mask = NULL; |
|
645 |
|
646 LOGSTRING( "CDevDiagPluginContainer::AddIconsL 1" ); |
|
647 |
|
648 AknIconUtils::CreateIconL( |
|
649 bitmap, |
|
650 mask, |
|
651 KDevDiagAppIconFileName(), |
|
652 EMbmDevdiagappQgn_prop_cp_diag_not, |
|
653 EMbmDevdiagappQgn_prop_cp_diag_not_mask ); |
|
654 |
|
655 icons->AppendL( CGulIcon::NewL( bitmap, mask )); |
|
656 |
|
657 LOGSTRING( "CDevDiagPluginContainer::AddIconsL 2" ); |
|
658 |
|
659 AknIconUtils::CreateIconL( |
|
660 bitmap, |
|
661 mask, |
|
662 KDevDiagAppIconFileName(), |
|
663 EMbmDevdiagappQgn_prop_cp_diag_pass, |
|
664 EMbmDevdiagappQgn_prop_cp_diag_pass_mask ); |
|
665 |
|
666 LOGSTRING( "CDevDiagPluginContainer::AddIconsL 3" ); |
|
667 |
|
668 icons->AppendL( CGulIcon::NewL( bitmap, mask )); |
|
669 |
|
670 AknIconUtils::CreateIconL( |
|
671 bitmap, |
|
672 mask, |
|
673 KDevDiagAppIconFileName(), |
|
674 EMbmDevdiagappQgn_prop_cp_diag_fail, |
|
675 EMbmDevdiagappQgn_prop_cp_diag_fail_mask ); |
|
676 |
|
677 // Create the icon. |
|
678 icons->AppendL( CGulIcon::NewL( bitmap, mask )); |
|
679 |
|
680 LOGSTRING( "CDevDiagPluginContainer::AddIconsL end" ); |
|
681 } |
|
682 |
|
683 // End of File |