|
1 /* |
|
2 * Copyright (c) 2002 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 * Logs application "Settings" view class implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <aknnotedialog.h> |
|
22 #include <AknQueryDialog.h> |
|
23 |
|
24 #include <gsfwviewuids.h> |
|
25 #include "LogsUID.h" |
|
26 |
|
27 #include <bautils.h> //parser |
|
28 #include <featmgr.h> |
|
29 |
|
30 #include <Logs.rsg> |
|
31 #include <StringLoader.h> // Series 60 localisation stringloader |
|
32 #include <hlplch.h> |
|
33 |
|
34 #include "CLogsSettingsView.h" |
|
35 #include "CLogsSettingsControlContainer.h" |
|
36 #include "CLogsEngine.h" |
|
37 #include "MLogsSharedData.h" |
|
38 #include "MLogsConfig.h" |
|
39 #include "MLogsClearLog.h" |
|
40 #include "CLogsAocObjFactory.h" |
|
41 #include "MLogsCallStatus.h" |
|
42 #include "LogsConsts.h" |
|
43 #include "LogsConstants.hrh" //KLogsPluginImplUID |
|
44 #include "MLogsStateHolder.h" |
|
45 |
|
46 #include "Logs.hrh" |
|
47 #include "LogsIcons.hrh" |
|
48 #include <logs.mbg> // Logs icons |
|
49 |
|
50 #include "LogsDebug.h" |
|
51 #include "LogsTraces.h" |
|
52 |
|
53 const TInt KMaxEventCount = 1000; |
|
54 const TInt KZeroEventCount = 0; |
|
55 |
|
56 |
|
57 |
|
58 // =========================== From CGSPluginInterface ======================== |
|
59 |
|
60 // ---------------------------------------------------------------------------- |
|
61 // CLogsSettingsView::NewPluginL |
|
62 // |
|
63 // From CGSPluginInterface |
|
64 // ---------------------------------------------------------------------------- |
|
65 // |
|
66 CGSPluginInterface* CLogsSettingsView::NewPluginL( |
|
67 TUid /* aImplementationUid */, |
|
68 TAny* /* aInitParams */ ) |
|
69 { |
|
70 TRACE_ENTRY_POINT; |
|
71 CLogsSettingsView* self = new ( ELeave ) CLogsSettingsView(); |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL(); |
|
74 CleanupStack::Pop(); // self |
|
75 |
|
76 TRACE_EXIT_POINT; |
|
77 return self; |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CLogsSettingsView::GetCaptionL |
|
82 // |
|
83 // From CGSPluginInterface. Text for GS's list of applicatons |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 void CLogsSettingsView::GetCaptionL( TDes& aCaption ) const |
|
87 { |
|
88 TRACE_ENTRY_POINT; |
|
89 // Resource file is already opened in ConstructL. |
|
90 HBufC* text = iCoeEnv->AllocReadResourceLC( R_SET_FOLDER_LOGS ); |
|
91 aCaption.Copy( *text ); |
|
92 CleanupStack::PopAndDestroy( text ); |
|
93 TRACE_EXIT_POINT; |
|
94 } |
|
95 |
|
96 // ---------------------------------------------------------------------------- |
|
97 // CLogsSettingsView::PluginProviderCategory |
|
98 // |
|
99 // From CGSPluginInterface |
|
100 // ---------------------------------------------------------------------------- |
|
101 // |
|
102 int CLogsSettingsView::PluginProviderCategory(void) const |
|
103 { |
|
104 TRACE_ENTRY_POINT; |
|
105 TRACE_EXIT_POINT; |
|
106 return CGSPluginInterface::EGSPluginProviderOEM; |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------------------------------- |
|
110 // CLogsSettingsView::CreateIconL |
|
111 // |
|
112 // From CGSPluginInterface |
|
113 // ---------------------------------------------------------------------------- |
|
114 // |
|
115 CGulIcon* CLogsSettingsView::CreateIconL( const TUid aIconType ) |
|
116 { |
|
117 TRACE_ENTRY_POINT; |
|
118 TFileName iconFileWithPath; |
|
119 iconFileWithPath += KLogsIconFileDrive; |
|
120 iconFileWithPath += KDC_APP_BITMAP_DIR; |
|
121 iconFileWithPath += KLogsIconFile; |
|
122 |
|
123 CGulIcon* icon = AknsUtils::CreateGulIconL( |
|
124 AknsUtils::SkinInstance(), |
|
125 KAknsIIDQgnPropSetAppsLog, |
|
126 iconFileWithPath, |
|
127 EMbmLogsQgn_prop_set_apps_log, |
|
128 EMbmLogsQgn_prop_set_apps_log_mask ); |
|
129 |
|
130 if( aIconType == KGSIconTypeLbxItem ) |
|
131 { |
|
132 //nop currently |
|
133 } |
|
134 else if( aIconType == KGSIconTypeTab ) |
|
135 { |
|
136 //nop |
|
137 } |
|
138 |
|
139 TRACE_EXIT_POINT; |
|
140 return icon; |
|
141 } |
|
142 |
|
143 // ---------------------------------------------------------------------------- |
|
144 // CLogsSettingsView::CustomOperationL |
|
145 // |
|
146 // From CGSPluginInterface |
|
147 // ---------------------------------------------------------------------------- |
|
148 // |
|
149 TAny* CLogsSettingsView::CustomOperationL( |
|
150 TAny* /* aParam1 */, |
|
151 TAny* /* aParam2 */ ) |
|
152 { |
|
153 TRACE_ENTRY_POINT; |
|
154 //Called only from Logs, so we can use this to swich off GS specific title |
|
155 iForGs = EFalse; |
|
156 TRACE_EXIT_POINT; |
|
157 return NULL; |
|
158 } |
|
159 //============================================================================= |
|
160 |
|
161 |
|
162 // ---------------------------------------------------------------------------- |
|
163 // CLogsSettingsView::CLogsSettingsView |
|
164 // ---------------------------------------------------------------------------- |
|
165 // |
|
166 CLogsSettingsView::CLogsSettingsView() : |
|
167 iState( EStateUndefined ) |
|
168 { |
|
169 TRACE_ENTRY_POINT; |
|
170 iConfig.iMaxEventAge = ELogsConfigAge30Days; |
|
171 TRACE_EXIT_POINT; |
|
172 } |
|
173 |
|
174 |
|
175 // ---------------------------------------------------------------------------- |
|
176 // CLogsSettingsView::ConstructL |
|
177 // ---------------------------------------------------------------------------- |
|
178 // |
|
179 void CLogsSettingsView::ConstructL() |
|
180 { |
|
181 TRACE_ENTRY_POINT; |
|
182 iForGs = ETrue; |
|
183 iDialog = NULL; |
|
184 iEikEnv = CEikonEnv::Static(); |
|
185 iEngine = CLogsEngine::NewL(); |
|
186 iEngine->ConfigL()->SetObserver( this ); |
|
187 iEngine->SharedDataL()->SetObserver( this ); |
|
188 iCoeEnv->AddForegroundObserverL( *this ); |
|
189 |
|
190 _LIT( KLogsPluginResourceFileName, "z:\\resource\\Apps\\Logs.RSC" ); |
|
191 TFileName fileName( KLogsPluginResourceFileName ); |
|
192 |
|
193 // Get language of resource file |
|
194 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
195 |
|
196 // Open resource file |
|
197 iResourceFileOffset=iEikEnv->AddResourceFileL( fileName ); |
|
198 BaseConstructL( R_LOGS_SETTINGS_VIEW ); |
|
199 TRACE_EXIT_POINT; |
|
200 } |
|
201 |
|
202 // ---------------------------------------------------------------------------- |
|
203 // CLogsSettingsView::~CLogsSettingsView |
|
204 // ---------------------------------------------------------------------------- |
|
205 // |
|
206 CLogsSettingsView::~CLogsSettingsView() |
|
207 { |
|
208 TRACE_ENTRY_POINT; |
|
209 |
|
210 if( iContainer ) |
|
211 { |
|
212 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
213 delete iContainer; |
|
214 } |
|
215 |
|
216 iEikEnv->DeleteResourceFile(iResourceFileOffset); |
|
217 delete iEngine; |
|
218 |
|
219 TRACE_EXIT_POINT; |
|
220 } |
|
221 |
|
222 // ---------------------------------------------------------------------------- |
|
223 // CLogsSettingsView::Id |
|
224 // ---------------------------------------------------------------------------- |
|
225 // |
|
226 TUid CLogsSettingsView::Id() const |
|
227 { |
|
228 TRACE_ENTRY_POINT; |
|
229 TRACE_EXIT_POINT; |
|
230 return TUid::Uid( KLogsPluginImplUID );//Impl UID for CGSPluginInterface |
|
231 } |
|
232 |
|
233 // ---------------------------------------------------------------------------- |
|
234 // CLogsSettingsView::DoActivateL |
|
235 // ---------------------------------------------------------------------------- |
|
236 // |
|
237 void CLogsSettingsView::DoActivateL( |
|
238 const TVwsViewId& aPrevViewId , |
|
239 TUid /*aCustomMessageId*/, |
|
240 const TDesC8& /*aCustomMessage*/ ) |
|
241 { |
|
242 TRACE_ENTRY_POINT; |
|
243 iPrevViewId = aPrevViewId; |
|
244 |
|
245 // Create the control container |
|
246 if( iContainer == NULL ) |
|
247 { |
|
248 iContainer = CLogsSettingsControlContainer::NewL( this, ClientRect(), iForGs ); |
|
249 iContainer->SetMopParent( this ); |
|
250 AppUi()->AddToViewStackL( *this, iContainer ); |
|
251 } |
|
252 |
|
253 iContainer->ListBox()->SetListBoxObserver( this ); |
|
254 |
|
255 iEngine->ConfigL()->GetConfig( iConfig ); |
|
256 |
|
257 TRACE_EXIT_POINT; |
|
258 } |
|
259 |
|
260 // ---------------------------------------------------------------------------- |
|
261 // CLogsSettingsView::DoDeactivate |
|
262 // ---------------------------------------------------------------------------- |
|
263 // |
|
264 void CLogsSettingsView::DoDeactivate() |
|
265 { |
|
266 TRACE_ENTRY_POINT; |
|
267 if( iContainer ) |
|
268 { |
|
269 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
270 delete iContainer; |
|
271 iContainer = NULL; |
|
272 } |
|
273 TRACE_EXIT_POINT; |
|
274 } |
|
275 |
|
276 // ---------------------------------------------------------------------------- |
|
277 // CLogsSettingsView::HandleGainingForeground |
|
278 // ---------------------------------------------------------------------------- |
|
279 // |
|
280 void CLogsSettingsView::HandleGainingForeground() |
|
281 { |
|
282 TRACE_ENTRY_POINT; |
|
283 |
|
284 // There can be Settings view open from general settings and Logs |
|
285 // at the same time so we need to re-read the config for possible |
|
286 // changes. |
|
287 // |
|
288 TRAPD(err, iEngine->ConfigL()->GetConfig( iConfig ) ); |
|
289 if (err) |
|
290 { |
|
291 iCoeEnv->HandleError(err); |
|
292 } |
|
293 |
|
294 TRACE_EXIT_POINT; |
|
295 } |
|
296 |
|
297 // ---------------------------------------------------------------------------- |
|
298 // CLogsSettingsView::HandleLosingForeground |
|
299 // ---------------------------------------------------------------------------- |
|
300 // |
|
301 void CLogsSettingsView::HandleLosingForeground() |
|
302 { |
|
303 TRACE_ENTRY_POINT; |
|
304 // Do nothing |
|
305 TRACE_EXIT_POINT; |
|
306 } |
|
307 |
|
308 // ---------------------------------------------------------------------------- |
|
309 // CLogsSettingsView::ProcessCommandL |
|
310 // |
|
311 // Called from FW when e.g. cba pressed |
|
312 // ---------------------------------------------------------------------------- |
|
313 // |
|
314 void CLogsSettingsView::ProcessCommandL( TInt aCommand ) |
|
315 { |
|
316 TRACE_ENTRY_POINT; |
|
317 CAknView::ProcessCommandL( aCommand ); |
|
318 TRACE_EXIT_POINT; |
|
319 } |
|
320 |
|
321 // ---------------------------------------------------------------------------- |
|
322 // CLogsSettingsView::ProcessKeyEventL |
|
323 // ---------------------------------------------------------------------------- |
|
324 // |
|
325 TBool CLogsSettingsView::ProcessKeyEventL( |
|
326 const TKeyEvent& aKeyEvent, |
|
327 TEventCode aType) |
|
328 { |
|
329 TRACE_ENTRY_POINT; |
|
330 |
|
331 //Copied for base view |
|
332 if( aType == EEventKey ) |
|
333 { |
|
334 switch( aKeyEvent.iCode ) |
|
335 { |
|
336 case EKeyApplication0: |
|
337 iCoeEnv->Flush( KDelayMicroSeconds ); |
|
338 TRACE_EXIT_POINT; |
|
339 return EFalse; |
|
340 } |
|
341 } |
|
342 |
|
343 TRACE_EXIT_POINT; |
|
344 return EFalse; |
|
345 } |
|
346 |
|
347 // |
|
348 // ---------------------------------------------------------------------------- |
|
349 // CLogsSettingsView::ProcessPointerEventL |
|
350 // |
|
351 // Handler for pointer events, when the current focused item is tapped |
|
352 // ---------------------------------------------------------------------------- |
|
353 // |
|
354 void CLogsSettingsView::ProcessPointerEventL( TInt /* aIndex */ ) |
|
355 { |
|
356 TRACE_ENTRY_POINT; |
|
357 HandleCommandL( ELogsCmdChange ); |
|
358 TRACE_EXIT_POINT; |
|
359 } |
|
360 |
|
361 // ---------------------------------------------------------------------------- |
|
362 // CLogsSettingsView::FocusChangedL |
|
363 // |
|
364 // Informs subclass that focus is changed in listbox (item is tapped) |
|
365 // ---------------------------------------------------------------------------- |
|
366 // |
|
367 // void CLogsSettingsView::FocusChangedL() |
|
368 // { |
|
369 // } |
|
370 |
|
371 // ---------------------------------------------------------------------------- |
|
372 // CLogsSettingsView::TabObserver |
|
373 // ---------------------------------------------------------------------------- |
|
374 // |
|
375 MAknTabObserver* CLogsSettingsView::TabObserver() |
|
376 { |
|
377 TRACE_ENTRY_POINT; |
|
378 TRACE_EXIT_POINT; |
|
379 return NULL; // |
|
380 } |
|
381 |
|
382 |
|
383 // ---------------------------------------------------------------------------- |
|
384 // CLogsSettingsView::HandleCommandL |
|
385 // ---------------------------------------------------------------------------- |
|
386 // |
|
387 void CLogsSettingsView::HandleCommandL( TInt aCommandId ) |
|
388 { |
|
389 TRACE_ENTRY_POINT; |
|
390 switch( aCommandId ) |
|
391 { |
|
392 // |
|
393 // Menu commands |
|
394 // |
|
395 case ELogsCmdChange: // settings item selected from options menu |
|
396 { |
|
397 switch( iContainer->ListBox()->CurrentItemIndex() ) |
|
398 { |
|
399 case ELogSettingsLogLength: |
|
400 if( iState == EStateFinished ) |
|
401 { |
|
402 CmdLogLengthL(); |
|
403 } |
|
404 |
|
405 break; |
|
406 /************************************************ |
|
407 "Show Call Duration" moved General Settings application, not in use any more in Logs |
|
408 case ELogSettingsShowCallDurationPhone: |
|
409 if( !CallIsActiveL() ) |
|
410 { |
|
411 CmdShowCallDurationPhoneL(); |
|
412 } |
|
413 else |
|
414 { |
|
415 |
|
416 CAknNoteDialog* noteDlg = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone, |
|
417 CAknNoteDialog::ELongTimeout ); |
|
418 noteDlg->ExecuteLD( R_LOGS_NOTE_DURING_CALL_OPTION_NOT_ALLOWED ); |
|
419 } |
|
420 break; |
|
421 ************************************************/ |
|
422 } // switch |
|
423 break; |
|
424 } // case |
|
425 |
|
426 case EEikCmdExit: // flow-through |
|
427 case ELogsCmdMenuExit: // flow-through |
|
428 case EAknSoftkeyExit: |
|
429 if (iForGs) |
|
430 { // Fix for error EAWG-6UGBGV: If opened from general settings we need to change |
|
431 // the command id to EEikCmdExit |
|
432 aCommandId = EEikCmdExit; |
|
433 } |
|
434 AppUi()->HandleCommandL( aCommandId ); |
|
435 break; |
|
436 |
|
437 case EAknSoftkeyBack: |
|
438 //Return to previous view if it is from GS or Logs |
|
439 if( iPrevViewId.iAppUid == TUid( KUidGS ) || |
|
440 iPrevViewId.iAppUid == TUid::Uid( KLogsAppUID3 )) |
|
441 { |
|
442 AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
443 } |
|
444 else |
|
445 //Put Logs to background as unknown application is owner of previous view (e.g. Help) |
|
446 { |
|
447 AppUi()->HandleCommandL( ELogsCmdMenuExit ); |
|
448 } |
|
449 |
|
450 break; |
|
451 |
|
452 case EAknCmdHelp: |
|
453 |
|
454 if( iContainer ) |
|
455 { |
|
456 TCoeHelpContext context; |
|
457 iContainer->GetHelpContext( context ); |
|
458 CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1); |
|
459 array->AppendL( context ); |
|
460 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), array ); |
|
461 } |
|
462 break; |
|
463 |
|
464 default: |
|
465 AppUi()->HandleCommandL( aCommandId ); |
|
466 break; |
|
467 } |
|
468 TRACE_EXIT_POINT; |
|
469 } |
|
470 |
|
471 |
|
472 // ---------------------------------------------------------------------------- |
|
473 // CLogsSettingsView::DynInitMenuPaneL |
|
474 // ---------------------------------------------------------------------------- |
|
475 // |
|
476 void CLogsSettingsView::DynInitMenuPaneL( |
|
477 TInt /* aResourceId */, |
|
478 CEikMenuPane* aMenuPane ) |
|
479 { |
|
480 TRACE_ENTRY_POINT; |
|
481 TInt position = -1; |
|
482 |
|
483 if( aMenuPane->MenuItemExists( EAknCmdHelp, position ) ) |
|
484 { |
|
485 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
486 { |
|
487 aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); |
|
488 } |
|
489 else |
|
490 { |
|
491 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
492 } |
|
493 } |
|
494 TRACE_EXIT_POINT; |
|
495 } |
|
496 |
|
497 |
|
498 // ---------------------------------------------------------------------------- |
|
499 // CLogsSettingsView::HandleClientRectChange |
|
500 // ---------------------------------------------------------------------------- |
|
501 // |
|
502 void CLogsSettingsView::HandleClientRectChange() |
|
503 { |
|
504 TRACE_ENTRY_POINT; |
|
505 |
|
506 if (iContainer) |
|
507 { |
|
508 iContainer->SetRect( ClientRect() ); |
|
509 } |
|
510 |
|
511 TRACE_EXIT_POINT; |
|
512 } |
|
513 |
|
514 // ---------------------------------------------------------------------------- |
|
515 // CLogsSettingsView::HandleListBoxEventL |
|
516 // ---------------------------------------------------------------------------- |
|
517 // |
|
518 void CLogsSettingsView::HandleListBoxEventL( |
|
519 CEikListBox* /*aListBox*/, |
|
520 TListBoxEvent aEventType ) |
|
521 { |
|
522 TRACE_ENTRY_POINT; |
|
523 // Handle pointer events |
|
524 if( AknLayoutUtils::PenEnabled() ) |
|
525 { |
|
526 switch ( aEventType ) |
|
527 { |
|
528 case EEventItemSingleClicked: |
|
529 case EEventEnterKeyPressed: |
|
530 HandleCommandL( ELogsCmdChange ); |
|
531 break; |
|
532 default: |
|
533 break; |
|
534 } |
|
535 } |
|
536 TRACE_EXIT_POINT; |
|
537 } |
|
538 |
|
539 // ---------------------------------------------------------------------------- |
|
540 // CLogsSettingsView::MakeSettingLineL |
|
541 // ---------------------------------------------------------------------------- |
|
542 // |
|
543 void CLogsSettingsView::MakeSettingLineL( |
|
544 CDesCArrayFlat* aItems, |
|
545 TInt aResourceText ) |
|
546 { |
|
547 TRACE_ENTRY_POINT; |
|
548 |
|
549 HBufC* text = iCoeEnv->AllocReadResourceLC( aResourceText ); |
|
550 TPtr ptr = text->Des(); |
|
551 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
552 aItems->AppendL( ptr ); |
|
553 CleanupStack::PopAndDestroy(); // textFromResourceFile |
|
554 |
|
555 TRACE_EXIT_POINT; |
|
556 } |
|
557 |
|
558 // ---------------------------------------------------------------------------- |
|
559 // CLogsSettingsView::CmdLogLengthL |
|
560 // ---------------------------------------------------------------------------- |
|
561 // |
|
562 void CLogsSettingsView::CmdLogLengthL() |
|
563 { |
|
564 TRACE_ENTRY_POINT; |
|
565 // If dialog already exist, do nothing. Avoids for example |
|
566 // multiple dialogs opening from multiple quick taps. |
|
567 if (iDialog == NULL) |
|
568 { |
|
569 TLogConfig temp; |
|
570 |
|
571 // 4 is number of options in query |
|
572 iSettingItems = new( ELeave ) CDesCArrayFlat( 4 ); |
|
573 |
|
574 MakeSettingLineL( iSettingItems, R_LOGS_SV_LOG_LENGTH_0_TEXT ); |
|
575 MakeSettingLineL( iSettingItems, R_LOGS_SV_LOG_LENGTH_1_TEXT ); |
|
576 MakeSettingLineL( iSettingItems, R_LOGS_SV_LOG_LENGTH_10_TEXT ); |
|
577 MakeSettingLineL( iSettingItems, R_LOGS_SV_LOG_LENGTH_30_TEXT ); |
|
578 |
|
579 TInt current( 0 ); |
|
580 |
|
581 switch( iConfig.iMaxEventAge ) |
|
582 { |
|
583 case ELogsConfigAgeNoLog: |
|
584 current = 0; |
|
585 break; |
|
586 |
|
587 case ELogsConfigAge1Days: |
|
588 current = 1; |
|
589 break; |
|
590 |
|
591 case ELogsConfigAge10Days: |
|
592 current = 2; |
|
593 break; |
|
594 |
|
595 case ELogsConfigAge30Days: |
|
596 current = 3; |
|
597 break; |
|
598 |
|
599 default: |
|
600 break; |
|
601 } |
|
602 |
|
603 iDialog = new ( ELeave ) CAknRadioButtonSettingPage( R_LOGS_SETTINGS_LOG_LENGTH_PAGE, |
|
604 current , iSettingItems ); |
|
605 |
|
606 if ( iDialog->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
607 { |
|
608 switch( current ) |
|
609 { |
|
610 case 0: |
|
611 temp.iMaxEventAge = ELogsConfigAgeNoLog; |
|
612 temp.iMaxLogSize = KZeroEventCount; |
|
613 break; |
|
614 |
|
615 case 1: |
|
616 temp.iMaxEventAge = ELogsConfigAge1Days; |
|
617 temp.iMaxLogSize = KMaxEventCount; |
|
618 break; |
|
619 |
|
620 case 2: |
|
621 temp.iMaxEventAge = ELogsConfigAge10Days; |
|
622 temp.iMaxLogSize = KMaxEventCount; |
|
623 break; |
|
624 |
|
625 case 3: |
|
626 temp.iMaxEventAge = ELogsConfigAge30Days; |
|
627 temp.iMaxLogSize = KMaxEventCount; |
|
628 break; |
|
629 |
|
630 default: |
|
631 break; |
|
632 } |
|
633 |
|
634 if( current == 0 ) |
|
635 { |
|
636 // if No Log had been before, don't need pop No Log Confirm Quary and |
|
637 // clear log again. |
|
638 if( iConfig.iMaxEventAge != ELogsConfigAgeNoLog ) |
|
639 { |
|
640 if( NoLogQueryL() ) |
|
641 { |
|
642 iConfig.iMaxEventAge = temp.iMaxEventAge; |
|
643 iConfig.iMaxLogSize = temp.iMaxLogSize; |
|
644 iEngine->ConfigL()->SetConfig( iConfig ); |
|
645 iEngine->SharedDataL()->SetLoggingEnabled( EFalse ); |
|
646 iEngine->ClearLogsL()->ClearModelL( ELogsMainModel ); |
|
647 iState = EStateActive; |
|
648 } |
|
649 } |
|
650 } |
|
651 else |
|
652 { |
|
653 iConfig.iMaxEventAge = temp.iMaxEventAge; |
|
654 iConfig.iMaxLogSize = temp.iMaxLogSize; |
|
655 iEngine->ConfigL()->SetConfig( iConfig ); |
|
656 iEngine->SharedDataL()->SetLoggingEnabled( ETrue ); |
|
657 iState = EStateActive; |
|
658 } |
|
659 |
|
660 iContainer->UpdateListBoxContentL(); |
|
661 } |
|
662 delete iSettingItems; |
|
663 iSettingItems = NULL; |
|
664 iDialog = NULL; //ExecuteLD handles destruction |
|
665 } |
|
666 TRACE_EXIT_POINT; |
|
667 } |
|
668 |
|
669 |
|
670 /************************************************ |
|
671 "Show Call Duration" moved to General Settings application, not in use any more in Logs |
|
672 |
|
673 void CLogsSettingsView::CmdShowCallDurationPhoneL() |
|
674 { |
|
675 // 2 is number of options in query |
|
676 CDesCArrayFlat* items = new( ELeave ) CDesCArrayFlat( 2 ); |
|
677 CleanupStack::PushL( items ); |
|
678 |
|
679 TBool currentItem( iEngine->SharedDataL()->ShowCallDurationPhone() ); |
|
680 |
|
681 // Timer OFF |
|
682 MakeSettingLineL( items, R_QTN_LOGS_LDV3_TIMER_OFF_TEXT ); |
|
683 |
|
684 // Timer ON |
|
685 MakeSettingLineL( items, R_QTN_LOGS_LDV3_TIMER_ON_TEXT ); |
|
686 |
|
687 CAknRadioButtonSettingPage* dlg = new ( ELeave ) |
|
688 CAknRadioButtonSettingPage( R_LOGS_SETTINGS_CALL_DURATION_PAGE, |
|
689 ( TInt & )currentItem, items ); |
|
690 |
|
691 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
692 { |
|
693 MakeCallDurationChangeL( currentItem ); |
|
694 } |
|
695 CleanupStack::PopAndDestroy(); // items |
|
696 } |
|
697 |
|
698 void CLogsSettingsView::MakeCallDurationOppositeL() |
|
699 { |
|
700 MakeCallDurationChangeL( ! iEngine->SharedDataL()->ShowCallDurationPhone() ); |
|
701 } |
|
702 |
|
703 void CLogsSettingsView::MakeCallDurationChangeL( TBool aChange ) |
|
704 { |
|
705 iEngine->SharedDataL()->SetShowCallDurationPhone( aChange ); |
|
706 //iContainer->CreateListBoxL(); |
|
707 iContainer->UpdateListBoxContentL(); |
|
708 |
|
709 } |
|
710 ************************************************/ |
|
711 |
|
712 |
|
713 // Sets logging enabled/disabled |
|
714 // ---------------------------------------------------------------------------- |
|
715 // CLogsSettingsView::NoLogQueryL |
|
716 // ---------------------------------------------------------------------------- |
|
717 // |
|
718 TBool CLogsSettingsView::NoLogQueryL() |
|
719 { |
|
720 TRACE_ENTRY_POINT; |
|
721 TBool ret; |
|
722 iNoLogQueryDlg = CAknQueryDialog::NewL(); |
|
723 |
|
724 ret = iNoLogQueryDlg->ExecuteLD( R_LL_NO_LOG_CONFIRMATION_QUERY ); |
|
725 iNoLogQueryDlg = NULL; |
|
726 |
|
727 TRACE_EXIT_POINT; |
|
728 return ret; |
|
729 } |
|
730 |
|
731 // ---------------------------------------------------------------------------- |
|
732 // CLogsSettingsView::ShowNoteL |
|
733 // ---------------------------------------------------------------------------- |
|
734 // |
|
735 void CLogsSettingsView::ShowNoteL(TInt aResourceID) |
|
736 { |
|
737 TRACE_ENTRY_POINT; |
|
738 CAknNoteDialog* noteDlg = new ( ELeave ) |
|
739 CAknNoteDialog( |
|
740 CAknNoteDialog::ENoTone, |
|
741 CAknNoteDialog::ELongTimeout ); |
|
742 noteDlg->ExecuteLD( aResourceID ); |
|
743 TRACE_EXIT_POINT; |
|
744 } |
|
745 |
|
746 |
|
747 /************************************************ |
|
748 "Show Call Duration" moved General Settings application, not in use any more in Logs |
|
749 |
|
750 TBool CLogsSettingsView::CallIsActiveL() |
|
751 { |
|
752 MLogsCallStatus* callStatus = CLogsAocObjFactory::CallStatusLC(); |
|
753 TBool activeCall( EFalse ); |
|
754 User::LeaveIfError( callStatus->CallIsActive( activeCall ) ); |
|
755 CleanupStack::PopAndDestroy(); // call status |
|
756 return activeCall; |
|
757 } |
|
758 ************************************************/ |
|
759 |
|
760 |
|
761 // ---------------------------------------------------------------------------- |
|
762 // CLogsSettingsView::StateChangedL |
|
763 // ---------------------------------------------------------------------------- |
|
764 // |
|
765 void CLogsSettingsView::StateChangedL( MLogsStateHolder* aHolder ) |
|
766 { |
|
767 TRACE_ENTRY_POINT; |
|
768 // void panic as the sharedata may pass the NULL to observer |
|
769 if (!aHolder ) |
|
770 { |
|
771 return; |
|
772 } |
|
773 iState = aHolder->State(); |
|
774 |
|
775 TVwsViewId activeViewId; |
|
776 TInt ActiveViewExists = AppUi()->GetActiveViewId(activeViewId); |
|
777 |
|
778 if (ActiveViewExists == KErrNone && |
|
779 activeViewId == ViewId() && IsForeground() ) |
|
780 { |
|
781 //------------------------------------------------------------- |
|
782 if( iContainer && iState == EStateFinished ) |
|
783 { |
|
784 iContainer->UpdateListBoxContentL(); |
|
785 } |
|
786 |
|
787 // If log lenght has changed and there is a dialog open, update dialog to change |
|
788 // focus and selected item as there can be Settings view open from general settings |
|
789 // and Logs at the same time. |
|
790 if (!iNoLogQueryDlg && (iLastMaxEventAge != iConfig.iMaxEventAge) ) |
|
791 { |
|
792 if (iDialog && iSettingItems) |
|
793 { |
|
794 TInt current( 0 ); |
|
795 switch( iConfig.iMaxEventAge ) |
|
796 { |
|
797 case ELogsConfigAgeNoLog: |
|
798 current = 0; |
|
799 break; |
|
800 |
|
801 case ELogsConfigAge1Days: |
|
802 current = 1; |
|
803 break; |
|
804 |
|
805 case ELogsConfigAge10Days: |
|
806 current = 2; |
|
807 break; |
|
808 |
|
809 case ELogsConfigAge30Days: |
|
810 current = 3; |
|
811 break; |
|
812 |
|
813 default: |
|
814 break; |
|
815 } |
|
816 |
|
817 // Update setting item selection and listbox focus |
|
818 iDialog->SetItemArrayAndSelectionL(iSettingItems, current); |
|
819 iDialog->ListBoxControl()->SetCurrentItemIndex(current); |
|
820 iDialog->ListBoxControl()->FocusChanged( EDrawNow ); |
|
821 } |
|
822 } |
|
823 } |
|
824 // for Error EMHU-7PLCXX, close the No Log Quary dialog to avoid the Redundant |
|
825 // when GS log setting and logs setting open at the same time |
|
826 else |
|
827 { |
|
828 if(iState == EStateLogEnableChanged && iNoLogQueryDlg) |
|
829 { |
|
830 if ( !iEngine->SharedDataL()->IsLoggingEnabled() ) |
|
831 { |
|
832 delete iNoLogQueryDlg; |
|
833 iNoLogQueryDlg = NULL; |
|
834 } |
|
835 } |
|
836 } //------------------------------------------------------------- |
|
837 |
|
838 // Finally store the current config for future reference value. |
|
839 iLastMaxEventAge = iConfig.iMaxEventAge; |
|
840 TRACE_EXIT_POINT; |
|
841 } |
|
842 |
|
843 // ---------------------------------------------------------------------------- |
|
844 // CLogsSettingsView::LogAge |
|
845 // ---------------------------------------------------------------------------- |
|
846 // |
|
847 TLogAge CLogsSettingsView::LogAge() const |
|
848 { |
|
849 TRACE_ENTRY_POINT; |
|
850 TRACE_EXIT_POINT; |
|
851 return iConfig.iMaxEventAge; |
|
852 } |
|
853 |
|
854 // ---------------------------------------------------------------------------- |
|
855 // CLogsSettingsView::Engine |
|
856 // ---------------------------------------------------------------------------- |
|
857 // |
|
858 CLogsEngine* CLogsSettingsView::Engine() |
|
859 { |
|
860 TRACE_ENTRY_POINT; |
|
861 TRACE_EXIT_POINT; |
|
862 return iEngine; |
|
863 } |
|
864 |
|
865 |
|
866 |
|
867 // End of File |