|
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 the License "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: Member definitions of CPushSettingsDialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include "browser_platform_variant.hrh" |
|
22 #include "PushSettingsDialog.h" |
|
23 #include "PushMtmUiDef.h" |
|
24 #include "PushMtmUiPanic.h" |
|
25 #include <PushMtmUi.rsg> |
|
26 #include "PushMtmUi.hrh" |
|
27 #include "PushMtmDef.hrh" |
|
28 #include <akntitle.h> |
|
29 #include <akncontext.h> |
|
30 #include <AknQueryDialog.h> |
|
31 #include <barsread.h> |
|
32 #include <AknRadioButtonSettingPage.h> |
|
33 #include <bldvariant.hrh> |
|
34 #ifdef __SERIES60_HELP |
|
35 // Context-Sensitve Help File |
|
36 #include <hlplch.h> |
|
37 #include <csxhelp/wpush.hlp.hrh> |
|
38 #endif // __SERIES60_HELP |
|
39 #include <msvapi.h> |
|
40 #include <data_caging_path_literals.hrh> |
|
41 #include <f32file.h> |
|
42 #include "PushMtmPrivateCRKeys.h" |
|
43 #include <centralrepository.h> |
|
44 // ================= MEMBER FUNCTIONS ======================= |
|
45 |
|
46 // --------------------------------------------------------- |
|
47 // CPushSettingsDialog::CPushSettingsDialog |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 CPushSettingsDialog::CPushSettingsDialog( CMsvSession& aMsvSession ) |
|
51 : CAknDialog(), |
|
52 iMsvSession( aMsvSession ), |
|
53 iResourceLoader( *iCoeEnv ), |
|
54 iNewTitleTextUsed( EFalse ), |
|
55 iRestoreSP( ETrue ) |
|
56 { |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // CPushSettingsDialog::ExecuteLD |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 void CPushSettingsDialog::ExecuteLD() |
|
64 { |
|
65 CleanupStack::PushL( this ); |
|
66 ConstructL(); |
|
67 CAknDialog::ConstructL( R_PUSHSD_MENU ); |
|
68 CleanupStack::Pop( this ); |
|
69 CAknDialog::ExecuteLD( R_PUSHSD_DIALOG ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CPushSettingsDialog::ConstructL |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 void CPushSettingsDialog::ConstructL() |
|
77 { |
|
78 // Add resource file. |
|
79 CRepository* PushSL = CRepository::NewL( KCRUidPushMtm ); |
|
80 CleanupStack::PushL( PushSL ); |
|
81 User::LeaveIfError( PushSL->Get( KPushMtmServiceEnabled , iPushSLEnabled ) ); |
|
82 CleanupStack::PopAndDestroy( PushSL ); |
|
83 |
|
84 TParse* fileParser = new (ELeave) TParse; |
|
85 // Unnecessary to call CleanupStack::PushL( fileParser ); |
|
86 fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); |
|
87 iResourceFile = fileParser->FullName(); |
|
88 delete fileParser; |
|
89 fileParser = NULL; |
|
90 iResourceLoader.OpenL( iResourceFile ); |
|
91 |
|
92 // Construct model. |
|
93 ConstructModelL(); |
|
94 |
|
95 // Now model is ready for view. |
|
96 const TInt KGranularity( 8 ); |
|
97 iSettingType = new (ELeave) CArrayFixFlat<TSettingType>( KGranularity ); |
|
98 |
|
99 // Set up Title Pane and Context Pane. |
|
100 SetUpStatusPaneL(); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------- |
|
104 // CPushSettingsDialog::~CPushSettingsDialog |
|
105 // --------------------------------------------------------- |
|
106 // |
|
107 CPushSettingsDialog::~CPushSettingsDialog() |
|
108 { |
|
109 if ( iRestoreSP ) |
|
110 { |
|
111 TRAP_IGNORE( RestoreStatusPaneL() ); |
|
112 } |
|
113 iResourceLoader.Close(); |
|
114 delete iPreviousTitleText; |
|
115 delete iModel; |
|
116 delete iSettingType; |
|
117 iSettingListBox = NULL; |
|
118 iSettingListBoxItemTextArray = NULL; |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // CPushSettingsDialog::SetUpStatusPaneL |
|
123 // --------------------------------------------------------- |
|
124 // |
|
125 void CPushSettingsDialog::SetUpStatusPaneL() |
|
126 { |
|
127 if ( !iNewTitleTextUsed ) |
|
128 { |
|
129 __ASSERT_DEBUG( !iPreviousTitleText, |
|
130 UiPanic( EPushMtmUiPanAlreadyExistingTitle ) ); |
|
131 // Set up Title Pane. |
|
132 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
133 CAknTitlePane* titlePane = |
|
134 STATIC_CAST( CAknTitlePane*, |
|
135 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
136 // Save content. |
|
137 iPreviousTitleText = titlePane->Text()->AllocL(); |
|
138 // Set new content. |
|
139 TResourceReader reader; |
|
140 iCoeEnv->CreateResourceReaderLC( reader, R_PUSHSD_TITLE_PANE ); |
|
141 titlePane->SetFromResourceL( reader ); |
|
142 CleanupStack::PopAndDestroy(); // reader |
|
143 iNewTitleTextUsed = ETrue; |
|
144 } |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------- |
|
148 // CPushSettingsDialog::RestoreStatusPaneL |
|
149 // --------------------------------------------------------- |
|
150 // |
|
151 void CPushSettingsDialog::RestoreStatusPaneL() |
|
152 { |
|
153 if ( iNewTitleTextUsed ) |
|
154 { |
|
155 __ASSERT_DEBUG( iPreviousTitleText, |
|
156 UiPanic( EPushMtmUiPanMissingTitle ) ); |
|
157 // Restore Title Pane. |
|
158 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
159 CAknTitlePane* titlePane = |
|
160 STATIC_CAST( CAknTitlePane*, |
|
161 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
162 titlePane->SetTextL( *iPreviousTitleText ); |
|
163 delete iPreviousTitleText; |
|
164 iPreviousTitleText = NULL; |
|
165 iNewTitleTextUsed = EFalse; |
|
166 } |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------- |
|
170 // CPushSettingsDialog::ConstructModelL |
|
171 // --------------------------------------------------------- |
|
172 // |
|
173 void CPushSettingsDialog::ConstructModelL() |
|
174 { |
|
175 __ASSERT_DEBUG( !iModel, UiPanic( EPushMtmUiPanAlreadyExistingModel ) ); |
|
176 |
|
177 // This will be the model. |
|
178 iModel = CPushMtmSettings::NewL(); |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------- |
|
182 // CPushSettingsDialog::UpdateSettingListBoxModelL |
|
183 // --------------------------------------------------------- |
|
184 // |
|
185 void CPushSettingsDialog::UpdateSettingListBoxModelL() |
|
186 { |
|
187 __ASSERT_DEBUG( iModel && |
|
188 iSettingListBox && |
|
189 iSettingListBoxItemTextArray && |
|
190 iSettingType, UiPanic( EPushMtmUiPanNotInitialized ) ); |
|
191 |
|
192 // Reset the list box' item text array and the setting type array. |
|
193 iSettingListBoxItemTextArray->Reset(); |
|
194 iSettingType->Reset(); |
|
195 |
|
196 // Service reception. |
|
197 ConstructAndAppendItemTextL |
|
198 ( EServiceReception, R_PUSHSD_RECEPT, |
|
199 iModel->ServiceReception() ? R_PUSHSD_RECEP_ON : R_PUSHSD_RECEP_OFF ); |
|
200 |
|
201 |
|
202 if(iPushSLEnabled) |
|
203 { |
|
204 // Service loading (SL specific). |
|
205 ConstructAndAppendItemTextL |
|
206 ( EServiceLoadingType, R_PUSHSD_LOADING, |
|
207 ( iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic ) ? |
|
208 R_PUSHSD_LOAD_AUTOM : R_PUSHSD_LOAD_MAN ); |
|
209 } |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------- |
|
213 // CPushSettingsDialog::UpdateSettingListBoxViewL |
|
214 // --------------------------------------------------------- |
|
215 // |
|
216 void CPushSettingsDialog::UpdateSettingListBoxViewL() const |
|
217 { |
|
218 __ASSERT_DEBUG( iSettingListBox, UiPanic( EPushMtmUiPanMissingListBox ) ); |
|
219 //iSettingListBox->DrawItem( iSettingListBox->CurrentItemIndex() ); |
|
220 TInt currentItemIndex( iSettingListBox->CurrentItemIndex() ); |
|
221 iSettingListBox->DrawNow(); |
|
222 iSettingListBox->SetCurrentItemIndex( currentItemIndex ); |
|
223 } |
|
224 |
|
225 // --------------------------------------------------------- |
|
226 // CPushSettingsDialog::ApplyModelChangesL |
|
227 // --------------------------------------------------------- |
|
228 // |
|
229 void CPushSettingsDialog::ApplyModelChangesL() |
|
230 { |
|
231 UpdateSettingListBoxModelL(); |
|
232 UpdateSettingListBoxViewL(); |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------- |
|
236 // CPushSettingsDialog::ShowRadioButtonSettingPageL |
|
237 // --------------------------------------------------------- |
|
238 // |
|
239 void CPushSettingsDialog::ShowRadioButtonSettingPageL |
|
240 ( const TSettingType aSettingType ) |
|
241 { |
|
242 __ASSERT_DEBUG( iModel, UiPanic( EPushMtmUiPanMissingModel ) ); |
|
243 |
|
244 TInt index; |
|
245 HBufC* settingTitle = ConstructSettingTitleL( aSettingType ); |
|
246 CleanupStack::PushL( settingTitle ); |
|
247 CDesCArrayFlat* itemArray = |
|
248 ConstructSettingValueArrayL( aSettingType, index ); |
|
249 CleanupStack::PushL( itemArray ); |
|
250 CAknRadioButtonSettingPage* settingPage = |
|
251 new (ELeave) CAknRadioButtonSettingPage |
|
252 ( R_PUSHSD_SP_RADIOBUTTON, index, itemArray ); |
|
253 CleanupStack::PushL( settingPage ); |
|
254 settingPage->SetSettingTextL( *settingTitle ); |
|
255 |
|
256 const TInt previousIndex = index; |
|
257 CleanupStack::Pop(); // settingPage |
|
258 if ( settingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
259 { |
|
260 if ( previousIndex != index ) |
|
261 { |
|
262 // Set the changes in the model. |
|
263 UpdateSettingL( aSettingType, index ); |
|
264 } |
|
265 } |
|
266 |
|
267 CleanupStack::PopAndDestroy( 2 ); // itemArray, settingTitle |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------- |
|
271 // CPushSettingsDialog::ShowServiceLoadingTypeConfirmationL |
|
272 // --------------------------------------------------------- |
|
273 // |
|
274 TBool CPushSettingsDialog::ShowServiceLoadingTypeConfirmationL() const |
|
275 { |
|
276 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
277 return dlg->ExecuteLD( R_PUSHSD_AUTOLOAD_SETT_CONFIRM ) == EAknSoftkeyYes; |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------- |
|
281 // CPushSettingsDialog::ChangeCurrentSettingWithoutSettingPageL |
|
282 // --------------------------------------------------------- |
|
283 // |
|
284 void CPushSettingsDialog::ChangeCurrentSettingWithoutSettingPageL() |
|
285 { |
|
286 __ASSERT_DEBUG( iModel && iSettingListBox, |
|
287 UiPanic( EPushMtmUiPanNotInitialized ) ); |
|
288 |
|
289 switch ( iSettingType->At( iSettingListBox->CurrentItemIndex() ) ) |
|
290 { |
|
291 case EServiceReception: |
|
292 { |
|
293 iModel->SetServiceReception( !iModel->ServiceReception() ); |
|
294 break; |
|
295 } |
|
296 |
|
297 case EServiceLoadingType: |
|
298 { |
|
299 if(iPushSLEnabled){ |
|
300 if ( iModel->ServiceLoadingType() == CPushMtmSettings::EManual ) |
|
301 { |
|
302 // Display a confirmation dialog first. |
|
303 if ( ShowServiceLoadingTypeConfirmationL() ) |
|
304 { |
|
305 iModel->SetServiceLoadingType |
|
306 ( CPushMtmSettings::EAutomatic ); |
|
307 } |
|
308 } |
|
309 else |
|
310 { |
|
311 // Do not show confirmation dialog. |
|
312 iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); |
|
313 } |
|
314 }//End iPushSLEnabled |
|
315 break; |
|
316 } |
|
317 |
|
318 |
|
319 default: |
|
320 { |
|
321 __ASSERT_DEBUG( EFalse, |
|
322 UiPanic( EPushMtmUiPanCommandNotSupported ) ); |
|
323 break; |
|
324 } |
|
325 } |
|
326 |
|
327 // Apply changes. |
|
328 iModel->SaveL(); |
|
329 ApplyModelChangesL(); |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------- |
|
333 // CPushSettingsDialog::ChangeCurrentSettingL |
|
334 // --------------------------------------------------------- |
|
335 // |
|
336 void CPushSettingsDialog::ChangeCurrentSettingL() |
|
337 { |
|
338 __ASSERT_DEBUG( iModel && iSettingListBox, |
|
339 UiPanic( EPushMtmUiPanNotInitialized ) ); |
|
340 ShowRadioButtonSettingPageL |
|
341 ( iSettingType->At( iSettingListBox->CurrentItemIndex() ) ); |
|
342 // Apply changes. |
|
343 iModel->SaveL(); |
|
344 ApplyModelChangesL(); |
|
345 } |
|
346 |
|
347 // --------------------------------------------------------- |
|
348 // CPushSettingsDialog::ConstructAndAppendItemTextL |
|
349 // --------------------------------------------------------- |
|
350 // |
|
351 void CPushSettingsDialog::ConstructAndAppendItemTextL |
|
352 ( const TSettingType aSettingType, |
|
353 const TInt aTitleResId, const TInt aValueResId, |
|
354 const TDesC& aTitleText, const TDesC& aValueText ) |
|
355 { |
|
356 __ASSERT_DEBUG( iSettingListBoxItemTextArray && iSettingType, |
|
357 UiPanic( EPushMtmUiPanNotInitialized ) ); |
|
358 |
|
359 // Define separator text. |
|
360 _LIT( KHeadOfItemText, " \t" ); |
|
361 // Define separator text. |
|
362 _LIT( KSeparatorOfItemText, "\t\t" ); |
|
363 |
|
364 HBufC* titleText = ( aTitleResId != KErrNotFound ) ? |
|
365 iEikonEnv->AllocReadResourceLC( aTitleResId ) : aTitleText.AllocLC(); |
|
366 HBufC* valueText = ( aValueResId != KErrNotFound ) ? |
|
367 iEikonEnv->AllocReadResourceLC( aValueResId ) : aValueText.AllocLC(); |
|
368 |
|
369 // Define a heap descriptor to hold all the item text. |
|
370 HBufC* itemText = HBufC::NewMaxLC( |
|
371 KHeadOfItemText().Length() + titleText->Length() + |
|
372 KSeparatorOfItemText().Length() + valueText->Length() ); |
|
373 TPtr itemTextPtr = itemText->Des(); |
|
374 itemTextPtr = KHeadOfItemText; |
|
375 itemTextPtr += *titleText; |
|
376 itemTextPtr += KSeparatorOfItemText; |
|
377 itemTextPtr += *valueText; |
|
378 iSettingListBoxItemTextArray->AppendL( itemTextPtr ); |
|
379 iSettingType->AppendL( aSettingType ); |
|
380 |
|
381 CleanupStack::PopAndDestroy( 3 ); // itemText, valueText, titleText |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------- |
|
385 // CPushSettingsDialog::ConstructSettingTitleL |
|
386 // --------------------------------------------------------- |
|
387 // |
|
388 HBufC* CPushSettingsDialog::ConstructSettingTitleL |
|
389 ( const TSettingType aSettingType ) const |
|
390 { |
|
391 TInt titleResId = 0; |
|
392 |
|
393 if(aSettingType == EServiceReception ) |
|
394 titleResId = R_PUSHSD_RECEPT; |
|
395 |
|
396 else if (aSettingType == EServiceLoadingType) |
|
397 { |
|
398 if(iPushSLEnabled ) |
|
399 titleResId = R_PUSHSD_LOADING; |
|
400 } |
|
401 |
|
402 else |
|
403 titleResId = KErrNotFound; |
|
404 |
|
405 |
|
406 __ASSERT_DEBUG( titleResId != KErrNotFound, |
|
407 UiPanic( EPushMtmUiPanNotInitialized ) ); |
|
408 |
|
409 return iEikonEnv->AllocReadResourceL( titleResId ); |
|
410 } |
|
411 |
|
412 // --------------------------------------------------------- |
|
413 // CPushSettingsDialog::ConstructSettingValueArray |
|
414 // --------------------------------------------------------- |
|
415 // |
|
416 void CPushSettingsDialog::ConstructSettingValueArray |
|
417 ( |
|
418 const TSettingType aSettingType, |
|
419 TInt& aVal1ResId, |
|
420 TInt& aVal2ResId |
|
421 ) const |
|
422 { |
|
423 if( aSettingType == EServiceReception) |
|
424 aVal1ResId = R_PUSHSD_RECEP_ON; |
|
425 |
|
426 else if((aSettingType == EServiceLoadingType) && iPushSLEnabled ) |
|
427 { |
|
428 aVal1ResId = R_PUSHSD_LOAD_AUTOM; |
|
429 } |
|
430 else |
|
431 aVal1ResId = KErrNotFound; |
|
432 |
|
433 |
|
434 if( aSettingType == EServiceReception ) |
|
435 aVal2ResId = R_PUSHSD_RECEP_OFF; |
|
436 else if( aSettingType == EServiceLoadingType && iPushSLEnabled) |
|
437 aVal2ResId = R_PUSHSD_LOAD_MAN; |
|
438 else |
|
439 aVal2ResId = KErrNotFound; |
|
440 |
|
441 |
|
442 __ASSERT_DEBUG( aVal1ResId != KErrNotFound && |
|
443 aVal2ResId != KErrNotFound, |
|
444 UiPanic( EPushMtmUiPanNotInitialized ) ); |
|
445 } |
|
446 |
|
447 // --------------------------------------------------------- |
|
448 // CPushSettingsDialog::CurrentlySelectedSettingValueResId |
|
449 // --------------------------------------------------------- |
|
450 // |
|
451 TInt CPushSettingsDialog::CurrentlySelectedSettingValueResId |
|
452 ( const TSettingType aSettingType, TInt& aIndex ) const |
|
453 { |
|
454 TInt val1ResId( KErrNotFound ); |
|
455 TInt val2ResId( KErrNotFound ); |
|
456 ConstructSettingValueArray( aSettingType, val1ResId, val2ResId ); |
|
457 |
|
458 TBool firstSelected; |
|
459 |
|
460 if(aSettingType == EServiceReception ) |
|
461 firstSelected = iModel->ServiceReception(); |
|
462 |
|
463 else if( aSettingType == EServiceLoadingType && iPushSLEnabled ) |
|
464 { |
|
465 firstSelected = (iModel->ServiceLoadingType() == CPushMtmSettings::EAutomatic); |
|
466 } |
|
467 else |
|
468 firstSelected = EFalse; |
|
469 |
|
470 |
|
471 |
|
472 aIndex = firstSelected ? 0 : 1; |
|
473 return firstSelected ? val1ResId : val2ResId; |
|
474 } |
|
475 |
|
476 // --------------------------------------------------------- |
|
477 // CPushSettingsDialog::ConstructSettingValueArrayL |
|
478 // --------------------------------------------------------- |
|
479 // |
|
480 CDesCArrayFlat* CPushSettingsDialog::ConstructSettingValueArrayL |
|
481 ( const TSettingType aSettingType, TInt& aIndex ) const |
|
482 { |
|
483 CDesCArrayFlat* valueArray = new (ELeave) CDesCArrayFlat( 2 ); |
|
484 CleanupStack::PushL( valueArray ); |
|
485 |
|
486 TInt val1ResId( KErrNotFound ); |
|
487 TInt val2ResId( KErrNotFound ); |
|
488 ConstructSettingValueArray( aSettingType, val1ResId, val2ResId ); |
|
489 HBufC* value1Text = iEikonEnv->AllocReadResourceLC( val1ResId ); |
|
490 HBufC* value2Text = iEikonEnv->AllocReadResourceLC( val2ResId ); |
|
491 valueArray->AppendL( *value1Text ); |
|
492 valueArray->AppendL( *value2Text ); |
|
493 CleanupStack::PopAndDestroy( 2 ); // value2Text, value1Text |
|
494 |
|
495 // Returned val. is ignored. |
|
496 CurrentlySelectedSettingValueResId( aSettingType, aIndex ); |
|
497 |
|
498 CleanupStack::Pop(); // valueArray |
|
499 return valueArray; |
|
500 } |
|
501 |
|
502 // --------------------------------------------------------- |
|
503 // CPushSettingsDialog::UpdateSettingL |
|
504 // --------------------------------------------------------- |
|
505 // |
|
506 void CPushSettingsDialog::UpdateSettingL |
|
507 ( const TSettingType aSettingType, const TInt aIndex ) const |
|
508 { |
|
509 switch ( aSettingType ) |
|
510 { |
|
511 case EServiceReception: |
|
512 { |
|
513 iModel->SetServiceReception( aIndex == 0 ? ETrue : EFalse ); |
|
514 break; |
|
515 } |
|
516 |
|
517 case EServiceLoadingType: |
|
518 { |
|
519 if(iPushSLEnabled) |
|
520 { |
|
521 if ( aIndex == 0 ) |
|
522 // iModel->ServiceLoadingType() == CPushMtmSettings::EManual |
|
523 { |
|
524 // Display a confirmation dialog first. |
|
525 if ( ShowServiceLoadingTypeConfirmationL() ) |
|
526 { |
|
527 iModel->SetServiceLoadingType |
|
528 ( CPushMtmSettings::EAutomatic ); |
|
529 } |
|
530 } |
|
531 else |
|
532 { |
|
533 // Do not show confirmation dialog. |
|
534 iModel->SetServiceLoadingType( CPushMtmSettings::EManual ); |
|
535 } |
|
536 } |
|
537 break; |
|
538 } |
|
539 |
|
540 default: |
|
541 { |
|
542 __ASSERT_DEBUG( EFalse, |
|
543 UiPanic( EPushMtmUiPanCommandNotSupported ) ); |
|
544 break; |
|
545 } |
|
546 } |
|
547 } |
|
548 |
|
549 // --------------------------------------------------------- |
|
550 // CPushSettingsDialog::OfferKeyEventL |
|
551 // --------------------------------------------------------- |
|
552 // |
|
553 TKeyResponse CPushSettingsDialog::OfferKeyEventL |
|
554 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
555 { |
|
556 if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) |
|
557 { |
|
558 // Shutting down. Do not restore SP. |
|
559 iRestoreSP = EFalse; |
|
560 } |
|
561 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
562 } |
|
563 |
|
564 // --------------------------------------------------------- |
|
565 // CPushSettingsDialog::DynInitMenuPaneL |
|
566 // --------------------------------------------------------- |
|
567 // |
|
568 void CPushSettingsDialog::DynInitMenuPaneL |
|
569 ( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) |
|
570 { |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------- |
|
574 // CPushSettingsDialog::PreLayoutDynInitL |
|
575 // --------------------------------------------------------- |
|
576 // |
|
577 void CPushSettingsDialog::PreLayoutDynInitL() |
|
578 { |
|
579 __ASSERT_DEBUG( !iSettingListBox && |
|
580 !iSettingListBoxItemTextArray, |
|
581 UiPanic( EPushMtmUiPanAlreadyInitialized ) ); |
|
582 |
|
583 iSettingListBox = STATIC_CAST( CAknSettingStyleListBox*, |
|
584 Control( EPushSettingsDialogCntrlListBox ) ); |
|
585 iSettingListBoxItemTextArray = STATIC_CAST( CDesCArrayFlat*, |
|
586 iSettingListBox->Model()->ItemTextArray() ); |
|
587 iSettingListBox->SetListBoxObserver( this ); |
|
588 TRect rect = Rect(); |
|
589 iSettingListBox->SetRect( rect ); |
|
590 // Set up scroll bar. |
|
591 iSettingListBox->CreateScrollBarFrameL( ETrue ); |
|
592 iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL |
|
593 ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
594 |
|
595 // Update setting list box model. |
|
596 UpdateSettingListBoxModelL(); |
|
597 } |
|
598 |
|
599 // --------------------------------------------------------- |
|
600 // CPushSettingsDialog::ProcessCommandL |
|
601 // --------------------------------------------------------- |
|
602 // |
|
603 void CPushSettingsDialog::ProcessCommandL( TInt aCommand ) |
|
604 { |
|
605 HideMenu(); |
|
606 |
|
607 switch ( aCommand ) |
|
608 { |
|
609 case EPushSettingsDialogCmdChangeWithoutSettingPage: |
|
610 { |
|
611 ChangeCurrentSettingWithoutSettingPageL(); |
|
612 break; |
|
613 } |
|
614 |
|
615 case EPushSettingsDialogCmdChange: |
|
616 { |
|
617 ChangeCurrentSettingL(); |
|
618 break; |
|
619 } |
|
620 |
|
621 #ifdef __SERIES60_HELP |
|
622 |
|
623 case EPushSettingsDialogCmdHelp: |
|
624 { |
|
625 HlpLauncher::LaunchHelpApplicationL |
|
626 ( iEikonEnv->WsSession(), |
|
627 iEikonEnv->EikAppUi()->AppHelpContextL() ); |
|
628 break; |
|
629 } |
|
630 |
|
631 #endif //__SERIES60_HELP |
|
632 |
|
633 case EPushSettingsDialogCmdBack: |
|
634 case EPushSettingsDialogCmdExit: |
|
635 { |
|
636 TryExitL( EPushSettingsDialogCmdAknExit ); |
|
637 break; |
|
638 } |
|
639 |
|
640 case EPushSettingsDialogCmdAknExit: |
|
641 { |
|
642 STATIC_CAST( MEikCommandObserver*, iEikonEnv->EikAppUi() )-> |
|
643 ProcessCommandL( EPushSettingsDialogCmdAknExit ); |
|
644 break; |
|
645 } |
|
646 |
|
647 default: |
|
648 { |
|
649 break; |
|
650 } |
|
651 } |
|
652 } |
|
653 |
|
654 // --------------------------------------------------------- |
|
655 // CPushSettingsDialog::OkToExitL |
|
656 // --------------------------------------------------------- |
|
657 // |
|
658 TBool CPushSettingsDialog::OkToExitL( TInt aButtonId ) |
|
659 { |
|
660 TBool ret( EFalse ); |
|
661 |
|
662 switch ( aButtonId ) |
|
663 { |
|
664 case EPushSettingsDialogCmdOptions: |
|
665 { |
|
666 if ( !MenuShowing() ) |
|
667 { |
|
668 DisplayMenuL(); |
|
669 } |
|
670 break; |
|
671 } |
|
672 case EPushSettingsDialogCmdChangeWithoutSettingPage: |
|
673 { |
|
674 ChangeCurrentSettingWithoutSettingPageL(); |
|
675 break; |
|
676 } |
|
677 case EPushSettingsDialogCmdBack: |
|
678 case EPushSettingsDialogCmdExit: |
|
679 case EPushSettingsDialogCmdAknExit: |
|
680 { |
|
681 RestoreStatusPaneL(); |
|
682 ret = ETrue; |
|
683 break; |
|
684 } |
|
685 default: |
|
686 { |
|
687 break; |
|
688 } |
|
689 } |
|
690 |
|
691 return ret; |
|
692 } |
|
693 |
|
694 // --------------------------------------------------------- |
|
695 // CPushSettingsDialog::HandleListBoxEventL |
|
696 // --------------------------------------------------------- |
|
697 // |
|
698 void CPushSettingsDialog::HandleListBoxEventL |
|
699 ( CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
700 { |
|
701 // Generate change command only if double tapped/center key is pressed. |
|
702 //Removed single tap check from here |
|
703 if ( aEventType == EEventEnterKeyPressed || |
|
704 aEventType == EEventItemDoubleClicked |
|
705 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF |
|
706 || aEventType == EEventItemSingleClicked |
|
707 #endif |
|
708 ) |
|
709 { |
|
710 ProcessCommandL( EPushSettingsDialogCmdChangeWithoutSettingPage ); |
|
711 } |
|
712 } |
|
713 |
|
714 #ifdef __SERIES60_HELP |
|
715 // --------------------------------------------------------- |
|
716 // CPushSettingsDialog::GetHelpContext |
|
717 // --------------------------------------------------------- |
|
718 // |
|
719 void CPushSettingsDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
720 { |
|
721 aContext.iMajor = TUid::Uid( EUidPushViewerApp ); |
|
722 aContext.iContext = KWPUSH_HLP_SETTINGS; |
|
723 } |
|
724 #endif //__SERIES60_HELP |
|
725 |
|
726 // End of file. |