1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <barsread.h> |
|
19 #include <stringloader.h> |
|
20 #include <aknlists.h> |
|
21 #include <eikenv.h> |
|
22 #include <akniconarray.h> |
|
23 #include <eikclbd.h> |
|
24 #include <aknviewappui.h> |
|
25 #include <eikappui.h> |
|
26 #include <atconfigurationappgui.rsg> |
|
27 #include <aknnotewrappers.h> |
|
28 |
|
29 #include "atconfigurationappguilistbox.h" |
|
30 #include "atconfigurationappguilistboxview.h" |
|
31 #include "atconfigurationappgui.hrh" |
|
32 #include "atconfigurationappguilistbox.hrh" |
|
33 #include "atconfigurationappguiappui.h" |
|
34 #include "atlog.h" |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CATConfigurationAppGuiListBox::CATConfigurationAppGuiListBox() |
|
38 // First phase of Symbian two-phase construction. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CATConfigurationAppGuiListBox::CATConfigurationAppGuiListBox() |
|
42 { |
|
43 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::CATConfigurationAppGuiListBox()" ); |
|
44 |
|
45 iListBox = NULL; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CATConfigurationAppGuiListBox::~CATConfigurationAppGuiListBox() |
|
50 // Destroy child controls. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 CATConfigurationAppGuiListBox::~CATConfigurationAppGuiListBox() |
|
54 { |
|
55 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::~CATConfigurationAppGuiListBox()" ); |
|
56 |
|
57 if ( iListBox ) |
|
58 { |
|
59 delete iListBox; |
|
60 iListBox = NULL; |
|
61 } |
|
62 iProcesses.Close(); |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CATConfigurationAppGuiListBox::NewL() |
|
67 // Construct the control (first phase). |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CATConfigurationAppGuiListBox* CATConfigurationAppGuiListBox::NewL( |
|
71 const TRect& aRect, CATConfigurationAppGuiListBoxView* aParent, |
|
72 MEikCommandObserver* aCommandObserver ) |
|
73 { |
|
74 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::NewL()" ); |
|
75 |
|
76 CATConfigurationAppGuiListBox* self = CATConfigurationAppGuiListBox::NewLC( |
|
77 aRect, |
|
78 aParent, |
|
79 aCommandObserver ); |
|
80 CleanupStack::Pop( self ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CATConfigurationAppGuiListBox::NewLC() |
|
86 // Construct the control (first phase). |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CATConfigurationAppGuiListBox* CATConfigurationAppGuiListBox::NewLC( |
|
90 const TRect& aRect, CATConfigurationAppGuiListBoxView* aParent, |
|
91 MEikCommandObserver* aCommandObserver ) |
|
92 { |
|
93 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::NewLC()" ); |
|
94 |
|
95 CATConfigurationAppGuiListBox* self = new ( ELeave ) CATConfigurationAppGuiListBox(); |
|
96 CleanupStack::PushL( self ); |
|
97 self->ConstructL( aRect, aParent, aCommandObserver ); |
|
98 return self; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CATConfigurationAppGuiListBox::ConstructL() |
|
103 // Construct the control (second phase). |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CATConfigurationAppGuiListBox::ConstructL( |
|
107 const TRect& aRect, CATConfigurationAppGuiListBoxView* aParent, |
|
108 MEikCommandObserver* aCommandObserver ) |
|
109 { |
|
110 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::ConstructL()" ); |
|
111 |
|
112 //if ( aParent == NULL ) |
|
113 //{ |
|
114 CreateWindowL(); |
|
115 //} |
|
116 /*else |
|
117 { |
|
118 SetContainerWindowL( *aParent ); |
|
119 }*/ |
|
120 iFocusControl = NULL; |
|
121 iCommandObserver = aCommandObserver; |
|
122 iParent = aParent; |
|
123 InitializeControlsL(); |
|
124 SetRect( aRect ); |
|
125 ActivateL(); |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CATConfigurationAppGuiListBox::CountComponentControls() |
|
130 // Returns the number of controls in the container. |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 TInt CATConfigurationAppGuiListBox::CountComponentControls() const |
|
134 { |
|
135 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::CountComponentControls()" ); |
|
136 |
|
137 return ( int ) ELastControl; |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CATConfigurationAppGuiListBox::ComponentControl() |
|
142 // Get the control with the given index. |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 CCoeControl* CATConfigurationAppGuiListBox::ComponentControl( |
|
146 TInt aIndex ) const |
|
147 { |
|
148 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::ComponentControl()" ); |
|
149 |
|
150 switch ( aIndex ) |
|
151 { |
|
152 case EListBox: |
|
153 return iListBox; |
|
154 } |
|
155 return NULL; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CATConfigurationAppGuiListBox::SizeChanged() |
|
160 // Handle resizing of the container. |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void CATConfigurationAppGuiListBox::SizeChanged() |
|
164 { |
|
165 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::SizeChanged()" ); |
|
166 |
|
167 CCoeControl::SizeChanged(); |
|
168 LayoutControls(); |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CATConfigurationAppGuiListBox::LayoutControls() |
|
173 // Layout components. |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CATConfigurationAppGuiListBox::LayoutControls() |
|
177 { |
|
178 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::LayoutControls()" ); |
|
179 |
|
180 iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize() ); |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CATConfigurationAppGuiListBox::HandleListBoxEventL() |
|
185 // Handle listbox events. |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void CATConfigurationAppGuiListBox::HandleListBoxEventL( |
|
189 CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
190 { |
|
191 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::HandleListBoxEventL()" ); |
|
192 |
|
193 switch ( aEventType ) |
|
194 { |
|
195 case EEventEnterKeyPressed: |
|
196 case EEventItemDoubleClicked: |
|
197 { |
|
198 iParent->HandleCommandL( |
|
199 EATConfigurationAppGuiListBoxViewDetailsMenuItemCommand ); |
|
200 } |
|
201 break; |
|
202 default: |
|
203 break; |
|
204 } |
|
205 } |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // CATConfigurationAppGuiListBox::OfferKeyEventL() |
|
209 // Handle key events. |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 TKeyResponse CATConfigurationAppGuiListBox::OfferKeyEventL( |
|
213 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
214 { |
|
215 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::OfferKeyEventL()" ); |
|
216 |
|
217 if ( aKeyEvent.iCode == EKeyLeftArrow |
|
218 || aKeyEvent.iCode == EKeyRightArrow ) |
|
219 { |
|
220 // Listbox takes all events even if it doesn't use them |
|
221 return EKeyWasNotConsumed; |
|
222 } |
|
223 |
|
224 if ( iFocusControl != NULL |
|
225 && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed ) |
|
226 { |
|
227 return EKeyWasConsumed; |
|
228 } |
|
229 |
|
230 return CCoeControl::OfferKeyEventL( aKeyEvent, aType ); |
|
231 } |
|
232 |
|
233 // ----------------------------------------------------------------------------- |
|
234 // CATConfigurationAppGuiListBox::HandlePointerEventL |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 void CATConfigurationAppGuiListBox::HandlePointerEventL( |
|
238 const TPointerEvent& aPointerEvent) |
|
239 { |
|
240 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::HandlePointerEventL()" ); |
|
241 |
|
242 if ( !AknLayoutUtils::PenEnabled() ) |
|
243 { |
|
244 return; |
|
245 } |
|
246 |
|
247 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
248 } |
|
249 |
|
250 // ----------------------------------------------------------------------------- |
|
251 // CATConfigurationAppGuiListBox::InitializeControlsL() |
|
252 // Initialize each control upon creation. |
|
253 // ----------------------------------------------------------------------------- |
|
254 // |
|
255 void CATConfigurationAppGuiListBox::InitializeControlsL() |
|
256 { |
|
257 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::InitializeControlsL()" ); |
|
258 |
|
259 iListBox = new ( ELeave ) CAknDoubleStyleListBox; |
|
260 iListBox->SetContainerWindowL( *this ); |
|
261 { |
|
262 TResourceReader reader; |
|
263 iEikonEnv->CreateResourceReaderLC( reader, R_ATCONFIGURATION_APP_GUI_LIST_BOX_LIST_BOX ); |
|
264 iListBox->ConstructFromResourceL( reader ); |
|
265 CleanupStack::PopAndDestroy(); // Reader internal state |
|
266 } |
|
267 // The listbox owns the items in the list and will free them |
|
268 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
269 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
270 |
|
271 iListBox->CreateScrollBarFrameL( ETrue ); |
|
272 iListBox->ScrollBarFrame()-> |
|
273 SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn ); |
|
274 iListBox->SetListBoxObserver(this); |
|
275 |
|
276 HBufC* noProcesses = StringLoader::LoadLC( R_ATCONFIGURATION_APP_GUI_LBX_NO_PROCESSES ); |
|
277 iListBox->View()->SetListEmptyTextL( noProcesses->Des() ); |
|
278 CleanupStack::PopAndDestroy( noProcesses ); |
|
279 |
|
280 // Setup the icon array so graphics-style boxes work |
|
281 SetupListBoxIconsL(); |
|
282 |
|
283 // Update processes array |
|
284 UpdateProcessesL(); |
|
285 CATConfigurationAppGuiAppUi* appUi = ( CATConfigurationAppGuiAppUi* )iEikonEnv->AppUi(); |
|
286 |
|
287 for ( TInt count = 0 ; count < iProcesses.Count() ; count++ ) |
|
288 { |
|
289 // This is intended to be large enough, but if you get |
|
290 // a USER 11 panic, consider reducing string sizes. |
|
291 TATProcessInfo processInfo = iProcesses[ count ]; |
|
292 TUint processId = processInfo.iProcessId; |
|
293 TBuf<KMaxProcessName> processName; |
|
294 processName.Copy( processInfo.iProcessName ); |
|
295 TATLogOption loggingMode;//lint !e644 |
|
296 appUi->StorageServer().GetLoggingModeL( processId, loggingMode ); |
|
297 TBuf<512> listString; |
|
298 if ( EATLoggingOff != loggingMode ) |
|
299 { |
|
300 // Check is if this process's subtest is running |
|
301 TInt subTest = appUi->IsSubTestRunning( processId ); |
|
302 if ( subTest > KErrNotFound ) |
|
303 { |
|
304 HBufC* running = StringLoader::LoadLC( R_ATCONFIGURATION_APP_GUI_LISTBOX_SUBTEST ); |
|
305 CreateListBoxItemL( listString, processName, running->Des() ); |
|
306 CleanupStack::PopAndDestroy( running ); |
|
307 } |
|
308 else |
|
309 { |
|
310 CreateListBoxItemL( listString, processName, KNullDesC ); |
|
311 // TEST START |
|
312 /*if ( count == KErrNone ) |
|
313 CreateListBoxItemL( listString, processName, KNullDesC ); |
|
314 else if ( count == 1 ) |
|
315 CreateListBoxItemL( listString, processName, _L("logging cancelled") ); |
|
316 else if ( count == 2 ) |
|
317 CreateListBoxItemL( listString, processName, _L("subtest running") ); |
|
318 */ |
|
319 //TEST END |
|
320 } |
|
321 } |
|
322 else |
|
323 { |
|
324 HBufC* cancelled = StringLoader::LoadLC( R_ATCONFIGURATION_APP_GUI_LISTBOX_LOGGING_CANCELLED ); |
|
325 CreateListBoxItemL( listString, processName, cancelled->Des() ); |
|
326 CleanupStack::PopAndDestroy( cancelled ); |
|
327 } |
|
328 |
|
329 AddListBoxItemL( iListBox, listString ); |
|
330 } |
|
331 iListBox->SetFocus( ETrue ); |
|
332 iFocusControl = iListBox; |
|
333 } |
|
334 |
|
335 // ----------------------------------------------------------------------------- |
|
336 // CATConfigurationAppGuiListBox::HandleResourceChange() |
|
337 // Handle global resource changes. |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 void CATConfigurationAppGuiListBox::HandleResourceChange( TInt aType ) |
|
341 { |
|
342 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::HandleResourceChange()" ); |
|
343 |
|
344 CCoeControl::HandleResourceChange( aType ); |
|
345 SetRect( iAvkonViewAppUi->View( TUid::Uid( |
|
346 EATConfigurationAppGuiListBoxViewId ) )->ClientRect() ); |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CATConfigurationAppGuiListBox::Draw() |
|
351 // Draw container contents. |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 void CATConfigurationAppGuiListBox::Draw( const TRect& aRect ) const |
|
355 { |
|
356 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::Draw()" ); |
|
357 |
|
358 CWindowGc& gc = SystemGc(); |
|
359 gc.Clear( aRect ); |
|
360 } |
|
361 |
|
362 // ----------------------------------------------------------------------------- |
|
363 // CATConfigurationAppGuiListBox::AddListBoxItemL() |
|
364 // Add a list box item to a list. |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 void CATConfigurationAppGuiListBox::AddListBoxItemL( |
|
368 CEikTextListBox* aListBox, const TDesC& aString ) |
|
369 { |
|
370 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::AddListBoxItemL()" ); |
|
371 |
|
372 CTextListBoxModel* model = aListBox->Model(); |
|
373 CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() ); |
|
374 itemArray->AppendL( aString ); |
|
375 aListBox->HandleItemAdditionL(); |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CATConfigurationAppGuiListBox::GetSelectedListBoxItemsLC() |
|
380 // Get the array of selected item indices. |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 RArray< TInt >* CATConfigurationAppGuiListBox::GetSelectedListBoxItemsLC( |
|
384 CEikTextListBox* aListBox ) |
|
385 { |
|
386 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::GetSelectedListBoxItemsLC()" ); |
|
387 |
|
388 CAknFilteredTextListBoxModel* model = |
|
389 static_cast< CAknFilteredTextListBoxModel *> ( aListBox->Model() ); |
|
390 if ( model->NumberOfItems() == 0 ) |
|
391 return NULL; |
|
392 |
|
393 // Get currently selected indices |
|
394 const CListBoxView::CSelectionIndexArray* selectionIndexes = |
|
395 aListBox->SelectionIndexes(); |
|
396 TInt selectedIndexesCount = selectionIndexes->Count(); |
|
397 if ( selectedIndexesCount == 0 ) |
|
398 return NULL; |
|
399 |
|
400 // Copy the indices and sort numerically |
|
401 RArray<TInt>* orderedSelectedIndices = |
|
402 new (ELeave) RArray< TInt >( selectedIndexesCount ); |
|
403 |
|
404 // Push the allocated array |
|
405 CleanupStack::PushL( orderedSelectedIndices ); |
|
406 |
|
407 // Dispose the array resource |
|
408 CleanupClosePushL( *orderedSelectedIndices ); |
|
409 |
|
410 // See if the search field is enabled |
|
411 CAknListBoxFilterItems* filter = model->Filter(); |
|
412 if ( filter != NULL ) |
|
413 { |
|
414 // When filtering enabled, translate indices back to underlying model |
|
415 for ( TInt idx = 0; idx < selectedIndexesCount; idx++ ) |
|
416 { |
|
417 TInt filteredItem = ( *selectionIndexes ) [ idx ]; |
|
418 TInt actualItem = filter->FilteredItemIndex ( filteredItem ); |
|
419 orderedSelectedIndices->InsertInOrder( actualItem ); |
|
420 } |
|
421 } |
|
422 else |
|
423 { |
|
424 // The selection indices refer directly to the model |
|
425 for ( TInt idx = 0; idx < selectedIndexesCount; idx++ ) |
|
426 orderedSelectedIndices->InsertInOrder( ( *selectionIndexes ) [ idx ] ); |
|
427 } |
|
428 |
|
429 return orderedSelectedIndices; |
|
430 } |
|
431 |
|
432 // ----------------------------------------------------------------------------- |
|
433 // CATConfigurationAppGuiListBox::DeleteSelectedListBoxItemsL() |
|
434 // Delete the selected item or items from the list box. |
|
435 // ----------------------------------------------------------------------------- |
|
436 // |
|
437 void CATConfigurationAppGuiListBox::DeleteSelectedListBoxItemsL( |
|
438 CEikTextListBox* aListBox ) |
|
439 { |
|
440 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::DeleteSelectedListBoxItemsL()" ); |
|
441 |
|
442 CAknFilteredTextListBoxModel* model = |
|
443 static_cast< CAknFilteredTextListBoxModel *> ( aListBox->Model() ); |
|
444 if ( model->NumberOfItems() == 0 ) |
|
445 return; |
|
446 |
|
447 RArray< TInt >* orderedSelectedIndices = GetSelectedListBoxItemsLC( aListBox ); |
|
448 if ( !orderedSelectedIndices ) |
|
449 return; |
|
450 |
|
451 // Delete selected items from bottom up so indices don't change on us |
|
452 CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() ); |
|
453 TInt currentItem = 0; |
|
454 |
|
455 for ( TInt idx = orderedSelectedIndices->Count(); idx-- > 0; ) |
|
456 { |
|
457 currentItem = ( *orderedSelectedIndices )[ idx ]; |
|
458 itemArray->Delete ( currentItem ); |
|
459 } |
|
460 |
|
461 // Dispose the array resources |
|
462 CleanupStack::PopAndDestroy(); |
|
463 |
|
464 // Dispose the array pointer |
|
465 CleanupStack::PopAndDestroy( orderedSelectedIndices ); |
|
466 |
|
467 // Refresh listbox's cursor now that items are deleted |
|
468 AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( |
|
469 aListBox, currentItem, ETrue ); |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CATConfigurationAppGuiListBox::ListBox() |
|
474 // Get the listbox. |
|
475 // ----------------------------------------------------------------------------- |
|
476 // |
|
477 CAknDoubleStyleListBox* CATConfigurationAppGuiListBox::ListBox() |
|
478 { |
|
479 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::ListBox()" ); |
|
480 |
|
481 return iListBox; |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CATConfigurationAppGuiListBox::CreateListBoxItemL() |
|
486 // Create a list box item with the given column values. |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 void CATConfigurationAppGuiListBox::CreateListBoxItemL( TDes& aBuffer, |
|
490 const TDesC& aMainText, |
|
491 const TDesC& aSecondaryText ) |
|
492 { |
|
493 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::CreateListBoxItemL()" ); |
|
494 |
|
495 _LIT ( KStringHeader, "\t%S\t%S" ); |
|
496 |
|
497 aBuffer.Format( KStringHeader(), &aMainText, &aSecondaryText ); |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CATConfigurationAppGuiListBox::AddListBoxResourceArrayItemL() |
|
502 // Add an item to the list by reading the text items from the array resource. |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 void CATConfigurationAppGuiListBox::AddListBoxResourceArrayItemL( |
|
506 TInt aResourceId ) |
|
507 { |
|
508 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::AddListBoxResourceArrayItemL()" ); |
|
509 |
|
510 CDesCArray* array = iCoeEnv->ReadDesCArrayResourceL( aResourceId ); |
|
511 CleanupStack::PushL( array ); |
|
512 // This is intended to be large enough, but if you get |
|
513 // a USER 11 panic, consider reducing string sizes. |
|
514 TBuf<512> listString; |
|
515 CreateListBoxItemL( listString, ( *array ) [ 0 ], ( *array ) [ 1 ] ); |
|
516 AddListBoxItemL( iListBox, listString ); |
|
517 CleanupStack::PopAndDestroy( array ); |
|
518 } |
|
519 |
|
520 // ----------------------------------------------------------------------------- |
|
521 // CATConfigurationAppGuiListBox::SetupListBoxIconsL() |
|
522 // Set up the list's icon array. |
|
523 // ----------------------------------------------------------------------------- |
|
524 // |
|
525 void CATConfigurationAppGuiListBox::SetupListBoxIconsL() |
|
526 { |
|
527 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::SetupListBoxIconsL()" ); |
|
528 |
|
529 CArrayPtr< CGulIcon >* icons = NULL; |
|
530 |
|
531 if ( icons != NULL ) |
|
532 { |
|
533 iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
534 } |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // CATConfigurationAppGuiListBox::HandleMarkableListCommandL() |
|
539 // Handle commands relating to markable lists. |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 TBool CATConfigurationAppGuiListBox::HandleMarkableListCommandL( |
|
543 TInt /*aCommand*/ ) |
|
544 { |
|
545 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::HandleMarkableListCommandL()" ); |
|
546 |
|
547 return EFalse; |
|
548 } |
|
549 |
|
550 // ----------------------------------------------------------------------------- |
|
551 // CATConfigurationAppGuiListBox::GetCurrentItemIndex() |
|
552 // Returns current listbox index. |
|
553 // ----------------------------------------------------------------------------- |
|
554 // |
|
555 TInt CATConfigurationAppGuiListBox::GetCurrentItemIndex() |
|
556 { |
|
557 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::GetCurrentItemIndex()" ); |
|
558 |
|
559 return iListBox->CurrentItemIndex(); |
|
560 } |
|
561 |
|
562 // ----------------------------------------------------------------------------- |
|
563 // CATConfigurationAppGuiListBox::UpdateProcessesL() |
|
564 // Updates processes array. |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 void CATConfigurationAppGuiListBox::UpdateProcessesL() |
|
568 { |
|
569 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::UpdateProcessesL()" ); |
|
570 |
|
571 // Update processes array from the storage server |
|
572 CATConfigurationAppGuiAppUi* appUi = |
|
573 ( CATConfigurationAppGuiAppUi* )iEikonEnv->AppUi(); |
|
574 appUi->StorageServer().GetProcessesL( iProcesses ); |
|
575 // TEST |
|
576 /*TATProcessInfo pr1; |
|
577 pr1.iProcessId = 1; |
|
578 TBuf8<KMaxProcessName> pr1Name; |
|
579 pr1Name.Copy( _L("MemoryLeaker.exe") ); |
|
580 pr1.iProcessName.Copy( pr1Name ); |
|
581 pr1.iStartTime = 1234556789; |
|
582 iProcesses.Append( pr1 ); |
|
583 |
|
584 TATProcessInfo pr2; |
|
585 pr2.iProcessId = 2; |
|
586 TBuf8<KMaxProcessName> pr2Name; |
|
587 pr2Name.Copy( _L("ConsoleApp.exe") ); |
|
588 pr2.iProcessName.Copy( pr2Name ); |
|
589 pr2.iStartTime = 2234556789; |
|
590 iProcesses.Append( pr2 ); |
|
591 |
|
592 TATProcessInfo pr3; |
|
593 pr3.iProcessId = 3; |
|
594 TBuf8<KMaxProcessName> pr3Name; |
|
595 pr3Name.Copy( _L("MediaPlayer.exe") ); |
|
596 pr3.iProcessName.Copy( pr3Name ); |
|
597 pr3.iStartTime = 3234556789; |
|
598 iProcesses.Append( pr3 );*/ |
|
599 // TEST END |
|
600 } |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // CATConfigurationAppGuiListBox::UpdateViewL() |
|
604 // Updates views controls. |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 void CATConfigurationAppGuiListBox::UpdateViewL() |
|
608 { |
|
609 LOGSTR1( "ATCU CATConfigurationAppGuiListBox::UpdateViewL()" ); |
|
610 |
|
611 CTextListBoxModel* model = iListBox->Model(); |
|
612 CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() ); |
|
613 itemArray->Reset(); |
|
614 |
|
615 // Update processes array |
|
616 UpdateProcessesL(); |
|
617 for ( TInt count = 0 ; count < iProcesses.Count() ; count++ ) |
|
618 { |
|
619 // This is intended to be large enough, but if you get |
|
620 // a USER 11 panic, consider reducing string sizes. |
|
621 TATProcessInfo processInfo = iProcesses[ count ]; |
|
622 TUint processId = processInfo.iProcessId; |
|
623 TBuf<KMaxProcessName> processName; |
|
624 processName.Copy( processInfo.iProcessName ); |
|
625 TBuf<512> listString; |
|
626 // Check is if this process's subtest is running |
|
627 CATConfigurationAppGuiAppUi* appUi = ( CATConfigurationAppGuiAppUi* )iEikonEnv->AppUi(); |
|
628 |
|
629 TATLogOption loggingMode;//lint !e644 |
|
630 appUi->StorageServer().GetLoggingModeL( processId, loggingMode ); |
|
631 if ( EATLoggingOff != loggingMode ) |
|
632 { |
|
633 // Check is if this process's subtest is running |
|
634 TInt subTest = appUi->IsSubTestRunning( processId ); |
|
635 if ( subTest > KErrNotFound ) |
|
636 { |
|
637 HBufC* running = StringLoader::LoadLC( R_ATCONFIGURATION_APP_GUI_LISTBOX_SUBTEST ); |
|
638 CreateListBoxItemL( listString, processName, running->Des() ); |
|
639 CleanupStack::PopAndDestroy( running ); |
|
640 } |
|
641 else |
|
642 { |
|
643 CreateListBoxItemL( listString, processName, KNullDesC ); |
|
644 // TEST START |
|
645 /*if ( count == KErrNone ) |
|
646 CreateListBoxItemL( listString, processName, KNullDesC ); |
|
647 else if ( count == 1 ) |
|
648 CreateListBoxItemL( listString, processName, _L("logging cancelled") ); |
|
649 else if ( count == 2 ) |
|
650 CreateListBoxItemL( listString, processName, _L("subtest running") ); |
|
651 */ |
|
652 //TEST END |
|
653 } |
|
654 } |
|
655 else |
|
656 { |
|
657 HBufC* cancelled = StringLoader::LoadLC( R_ATCONFIGURATION_APP_GUI_LISTBOX_LOGGING_CANCELLED ); |
|
658 CreateListBoxItemL( listString, processName, cancelled->Des() ); |
|
659 CleanupStack::PopAndDestroy( cancelled ); |
|
660 } |
|
661 AddListBoxItemL( iListBox, listString ); |
|
662 } |
|
663 iListBox->DrawNow(); |
|
664 } |
|
665 |
|
666 // End of File |
|