|
1 /* |
|
2 * Copyright (c) 2002-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 * Main settings dialog for Sms. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <SMUM.rsg> // resouce identifiers |
|
23 #include <smutset.h> // CSmsSettings |
|
24 #include <aknappui.h> // CEikStatusPane |
|
25 #include <akntitle.h> // CAknTitlePane |
|
26 #include <aknenv.h> // AppShutter |
|
27 #include <aknnotewrappers.h> // Avkon note wrappers |
|
28 #include <AknQueryDialog.h> // CAknQueryDialog |
|
29 #include <eikmenup.h> // CEikMenuPane |
|
30 #include <smuthdr.h> // CSmsHeader |
|
31 #include <StringLoader.h> // StringLoader |
|
32 #include <AknDlgShut.h> // AknDialogShutter |
|
33 #include <hlplch.h> // HlpLauncher |
|
34 #include <featmgr.h> // FeatureManager |
|
35 #include <bldvariant.hrh> |
|
36 #include <aknnavi.h> //CAknNavigationControlContainer |
|
37 #include <csxhelp/mce.hlp.hrh> |
|
38 #include <csxhelp/sms.hlp.hrh> |
|
39 #include <messagingvariant.hrh> |
|
40 #include <RCustomerServiceProfileCache.h> |
|
41 #include <centralrepository.h> // CRepository |
|
42 #include <messaginginternalcrkeys.h> // Keys |
|
43 |
|
44 // locals |
|
45 #include "smsui.pan" // for panics |
|
46 #include "SmumSettingsDialogGSM.h" // CSmumMainSettingsDialogGSM |
|
47 #include "SmumServiceCentreItemDialog.h"// CSmumAddEditServiceCentreDialog |
|
48 #include "SmumEmailServiceCentreItemDialog.h"// CSmumEmailServiceCentreDialog |
|
49 #include "SMSU.HRH" // resource header |
|
50 #include "SmumServiceCentresDialog.h" // CSmumServiceCentresDialog |
|
51 #include "SmumUtil.h" |
|
52 |
|
53 #include "SmumLogging.h" |
|
54 |
|
55 // CONSTANTS |
|
56 const TInt KMuiuSettingsArrayGranularity = 4; |
|
57 const TInt KSmumCharSettingDeduction = 2; |
|
58 // ================= MEMBER FUNCTIONS ======================= |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CSmumMainSettingsDialogGSM::NewL |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 CSmumMainSettingsDialog* CSmumMainSettingsDialogGSM::NewL( |
|
65 CSmsSettings& aSettings, |
|
66 TInt aTypeOfSettings, |
|
67 TInt& aExitCode, |
|
68 TInt& aCharSetSupportForSendingOptions, |
|
69 CSmsHeader* aSmsHeader ) |
|
70 { |
|
71 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::NewL"); |
|
72 CSmumMainSettingsDialogGSM* self = new ( ELeave ) CSmumMainSettingsDialogGSM( |
|
73 aSettings, aTypeOfSettings, aExitCode, |
|
74 aCharSetSupportForSendingOptions, aSmsHeader ); |
|
75 |
|
76 CleanupStack::PushL( self ); |
|
77 self->ConstructL(); |
|
78 CleanupStack::Pop(); |
|
79 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::NewL"); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CSmumMainSettingsDialogGSM::CSmumMainSettingsDialogGSM |
|
85 // C++ default constructor can NOT contain any code, that |
|
86 // might leave. |
|
87 // ----------------------------------------------------------------------------- |
|
88 CSmumMainSettingsDialogGSM::CSmumMainSettingsDialogGSM( |
|
89 CSmsSettings& aSettings, |
|
90 TInt aTypeOfSettings, |
|
91 TInt& aExitCode, |
|
92 TInt& aCharSetSupportForSendingOptions, |
|
93 CSmsHeader* aSmsHeader ) |
|
94 : iSettings ( aSettings ), |
|
95 iTypeOfSettings ( aTypeOfSettings ), |
|
96 iExitCode ( aExitCode ), |
|
97 iSmsHeader ( aSmsHeader ), |
|
98 iHelpFeatureSupported ( EFalse ), |
|
99 iCSPFeatures ( NULL ), |
|
100 iCharacterSupport ( aCharSetSupportForSendingOptions ), |
|
101 iIdle( NULL ), |
|
102 iUseSimSCsOnly( EFalse ), |
|
103 iEmailFeatureSupported( EFalse ), |
|
104 iMskId( NULL ) |
|
105 { |
|
106 } |
|
107 |
|
108 // Destructor |
|
109 CSmumMainSettingsDialogGSM::~CSmumMainSettingsDialogGSM() |
|
110 { |
|
111 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::~CSmumMainSettingsDialogGSM"); |
|
112 if ( iListBox ) |
|
113 { |
|
114 iListBox->SetScrollBarFrame( NULL, CEikListBox::EOwnedExternally ); |
|
115 } |
|
116 delete iPreviousTitleText; |
|
117 delete iSettingsArrayIndex; |
|
118 delete iCentralRapository; |
|
119 delete iIdle; |
|
120 // iSettingsArray, iListBox, iSettings(reference), iSettingsForReadingSCList, |
|
121 // iTitlePane, iPreviousTitleText, iSmumNaviPane are |
|
122 // plain pointers to objects owned by other classes which take |
|
123 // care also about deletion. |
|
124 // Remove default navi pane |
|
125 if ( iSmumNaviPane ) |
|
126 { |
|
127 iSmumNaviPane->Pop(); |
|
128 } |
|
129 // Not owned. For Lint |
|
130 iSettingsArray = NULL; |
|
131 iListBox = NULL; |
|
132 iSmsHeader = NULL; |
|
133 iTitlePane = NULL; |
|
134 iSmumNaviPane = NULL; |
|
135 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::~CSmumMainSettingsDialogGSM"); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CSmumMainSettingsDialogGSM::ConstructL |
|
140 // Symbian 2nd phase constructor can leave. |
|
141 // ----------------------------------------------------------------------------- |
|
142 void CSmumMainSettingsDialogGSM::ConstructL() |
|
143 { |
|
144 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::ConstructL"); |
|
145 CAknDialog::ConstructL( R_MAIN_SMS_SETTINGS_CHOICE_MENUBAR ); |
|
146 |
|
147 // Prepare FeatureManager, read values to members and uninitialize FeatureManager |
|
148 FeatureManager::InitializeLibL(); |
|
149 iHelpFeatureSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); |
|
150 FeatureManager::UnInitializeLib(); |
|
151 // Read the supported settings |
|
152 iEmailFeatureSupported = SmumUtil::CheckEmailOverSmsSupportL(); |
|
153 ReadCspSupportBitsL(); |
|
154 iCentralRapository = CRepository::NewL( KCRUidSmum ); |
|
155 iCentralRapository->Get( KSmumRemoveReplyViaSameCentre, iRemoveReplyScSetting ); |
|
156 // Check if Only Sim SC's variation is on |
|
157 if ( SmumUtil::CheckVariationFlagsL( KCRUidMuiuVariation, KMuiuSmsFeatures ) & |
|
158 KSmsFeatureIdSimServiceCentresOnly ) |
|
159 { |
|
160 iUseSimSCsOnly = ETrue; |
|
161 } |
|
162 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::ConstructL"); |
|
163 } |
|
164 |
|
165 // ---------------------------------------------------- |
|
166 // CSmumMainSettingsDialogGSM::OkToExitL |
|
167 // |
|
168 // ---------------------------------------------------- |
|
169 TInt CSmumMainSettingsDialogGSM::OkToExitL( TInt aButtonId ) |
|
170 { |
|
171 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::OkToExitL"); |
|
172 TInt returnValue; |
|
173 |
|
174 switch( aButtonId ) |
|
175 { |
|
176 case ESmsSettingsChoiceMenuOpen: |
|
177 case ESmsSettingsChoiceMenuChange: |
|
178 case ESmsSettingsChoiceMenuChangeMSK: |
|
179 { |
|
180 ProcessCommandL( aButtonId ); |
|
181 returnValue = EFalse; // Cannot exit, since MSK was pressed |
|
182 } |
|
183 break; |
|
184 // system / menu exit |
|
185 case EAknSoftkeyCancel: |
|
186 { |
|
187 if ( iExitCode != ESmumSmsSettingsMenuExit && |
|
188 iExitCode != ESmumSmsSettingsSystemExit ) |
|
189 { |
|
190 // system exit |
|
191 iExitCode = ESmumSmsSettingsSystemExit; |
|
192 } |
|
193 TRAP_IGNORE( ClosingDialogL() ); // to be sure of not leaving and exiting |
|
194 returnValue = ETrue; |
|
195 } |
|
196 break; |
|
197 // back-key |
|
198 case EAknSoftkeyBack: |
|
199 { |
|
200 iExitCode = ESmumSmsSettingsBack; |
|
201 ClosingDialogL(); |
|
202 returnValue = ETrue; |
|
203 } |
|
204 break; |
|
205 default : |
|
206 returnValue = CAknDialog::OkToExitL( aButtonId ); |
|
207 break; |
|
208 } |
|
209 |
|
210 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::OkToExitL"); |
|
211 return returnValue; |
|
212 } |
|
213 |
|
214 // ---------------------------------------------------- |
|
215 // CSmumMainSettingsDialogGSM::HandleListBoxEventL |
|
216 // |
|
217 // ---------------------------------------------------- |
|
218 void CSmumMainSettingsDialogGSM::HandleListBoxEventL( |
|
219 CEikListBox* /*aListBox*/, |
|
220 TListBoxEvent aEventType ) |
|
221 { |
|
222 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::HandleListBoxEventL"); |
|
223 switch( aEventType ) |
|
224 { |
|
225 case EEventItemDraggingActioned: |
|
226 UpdateMskL(); |
|
227 break; |
|
228 case EEventEnterKeyPressed: |
|
229 case EEventItemSingleClicked: |
|
230 CheckOpeningListBoxItemL( ETrue ); |
|
231 break; |
|
232 default : |
|
233 // nothing |
|
234 break; |
|
235 } |
|
236 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::HandleListBoxEventL"); |
|
237 } |
|
238 |
|
239 // ---------------------------------------------------- |
|
240 // CSmumMainSettingsDialogGSM::ProcessCommandL |
|
241 // |
|
242 // ---------------------------------------------------- |
|
243 void CSmumMainSettingsDialogGSM::ProcessCommandL( |
|
244 TInt aCommandId) |
|
245 { |
|
246 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::ProcessCommandL"); |
|
247 CAknDialog::ProcessCommandL( aCommandId ) ; |
|
248 switch ( aCommandId ) |
|
249 { |
|
250 case ESmsSettingsChoiceMenuOpen: |
|
251 case ESmsSettingsChoiceMenuChange: |
|
252 CheckOpeningListBoxItemL( EFalse ); |
|
253 break; |
|
254 case ESmsSettingsChoiceMenuChangeMSK: |
|
255 CheckOpeningListBoxItemL( ETrue ); |
|
256 break; |
|
257 case EAknCmdHelp: |
|
258 { |
|
259 LaunchHelpL(); |
|
260 } |
|
261 break; |
|
262 case ESmsSettingsChoiceMenuExit: |
|
263 { |
|
264 iExitCode = ESmumSmsSettingsMenuExit; |
|
265 TryExitL( EAknSoftkeyCancel ); |
|
266 } |
|
267 break; |
|
268 default : |
|
269 // nothing |
|
270 break ; |
|
271 } |
|
272 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::ProcessCommandL"); |
|
273 } |
|
274 |
|
275 // ---------------------------------------------------- |
|
276 // CSmumMainSettingsDialogGSM::OfferKeyEventL |
|
277 // |
|
278 // ---------------------------------------------------- |
|
279 TKeyResponse CSmumMainSettingsDialogGSM::OfferKeyEventL( |
|
280 const TKeyEvent& aKeyEvent, |
|
281 TEventCode aType ) |
|
282 { |
|
283 |
|
284 TKeyResponse returnValue = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
285 if( aType == EEventKeyUp ) |
|
286 { |
|
287 UpdateMskL( ); |
|
288 } |
|
289 |
|
290 return returnValue; |
|
291 } |
|
292 |
|
293 // ---------------------------------------------------- |
|
294 // CSmumMainSettingsDialogGSM::PreLayoutDynInitL |
|
295 // |
|
296 // ---------------------------------------------------- |
|
297 void CSmumMainSettingsDialogGSM::PreLayoutDynInitL() |
|
298 { |
|
299 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::PreLayoutDynInitL"); |
|
300 // Creating correct listbox depending Settings vs Sending Options |
|
301 iListBox = STATIC_CAST( CEikTextListBox*, Control( ESmsSettingsListBoxId )); |
|
302 iSettingsArray = CSmumSettingsArray::NewL( iTypeOfSettings ? |
|
303 R_SMS_SENDING_OPTIONS_ITEMS : R_SMS_MAIN_SETTINGS_ITEMS ); |
|
304 |
|
305 // The count of setting items depends of setting type |
|
306 TInt numberOfSettingItems = iTypeOfSettings ? |
|
307 ESmumSendOptReplyViaSameCentreLBI + 1 : ESmumReplyViaSameCentreLBI + 1; |
|
308 iSettingsArrayIndex = new(ELeave) CArrayFixFlat<TInt>( numberOfSettingItems ); |
|
309 // Iterate through settings |
|
310 for (TInt count = 0; count < numberOfSettingItems; count++) |
|
311 { |
|
312 iSettingsArrayIndex->AppendL( count ); // Indicates that setting is present |
|
313 } |
|
314 DeleteVariatedSettings(); |
|
315 |
|
316 iListBox->SetListBoxObserver( this ); |
|
317 |
|
318 // Arabic-indic conversion not to be done to SMSC Name |
|
319 if ( !iTypeOfSettings ) // For main settings |
|
320 { |
|
321 (*iSettingsArray)[ESmumServiceCentreInUseLBI].iLangSpecificNumConv = EFalse; |
|
322 } |
|
323 else |
|
324 { |
|
325 (*iSettingsArray)[ESmumSendOptServiceCentreInUseLBI].iLangSpecificNumConv = EFalse; |
|
326 } |
|
327 |
|
328 // Initialize listboxes to settings values |
|
329 OpeningDialogL(); |
|
330 |
|
331 // scroll bars |
|
332 iListBox->CreateScrollBarFrameL( ETrue ); |
|
333 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
334 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
335 |
|
336 CTextListBoxModel* model = iListBox->Model(); |
|
337 model->SetItemTextArray( iSettingsArray ); |
|
338 |
|
339 UpdateMskL(); |
|
340 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::PreLayoutDynInitL"); |
|
341 } |
|
342 |
|
343 // --------------------------------------------------------- |
|
344 // CSmumMainSettingsDialogGSM::DynInitMenuPaneL |
|
345 // |
|
346 // --------------------------------------------------------- |
|
347 void CSmumMainSettingsDialogGSM::DynInitMenuPaneL( |
|
348 TInt aMenuId, |
|
349 CEikMenuPane* aMenuPane ) |
|
350 { |
|
351 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::DynInitMenuPaneL"); |
|
352 switch ( aMenuId ) |
|
353 { |
|
354 case R_MAIN_SMS_SETTINGS_CHOICE_MENUPANE: |
|
355 // Check which one to show in Options-menu |
|
356 if ( ESmumServiceCentresLBI == iListBox->CurrentItemIndex() |
|
357 && !iTypeOfSettings ) |
|
358 { |
|
359 // Open option is left in the menu even if no SIM service |
|
360 // centres available and use only SIM service centres is in use. |
|
361 // If user selects it, he gets note: |
|
362 // No service centres, SMS service has been disabled |
|
363 /* |
|
364 if ( iUseSimSCsOnly && iSettings.ServiceCenterCount() == 0 ) |
|
365 { |
|
366 aMenuPane->DeleteMenuItem( ESmsSettingsChoiceMenuOpen ); |
|
367 } |
|
368 */ |
|
369 aMenuPane->DeleteMenuItem( ESmsSettingsChoiceMenuChange ); |
|
370 } |
|
371 else |
|
372 { |
|
373 aMenuPane->DeleteMenuItem( ESmsSettingsChoiceMenuOpen ); |
|
374 } |
|
375 |
|
376 // Help handling |
|
377 aMenuPane->SetItemDimmed( EAknCmdHelp,!iHelpFeatureSupported ); |
|
378 |
|
379 break; |
|
380 default : |
|
381 // panic |
|
382 break; |
|
383 } |
|
384 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::DynInitMenuPaneL"); |
|
385 } |
|
386 |
|
387 // ---------------------------------------------------- |
|
388 // CSmumMainSettingsDialogGSM::UpdateSCInUseArrayL |
|
389 // |
|
390 // ---------------------------------------------------- |
|
391 void CSmumMainSettingsDialogGSM::UpdateSCInUseArrayL() |
|
392 { |
|
393 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::UpdateSCInUseArrayL"); |
|
394 // Create an sc array |
|
395 CDesCArrayFlat* array = |
|
396 new ( ELeave ) CDesCArrayFlat( KMuiuSettingsArrayGranularity ); |
|
397 TBool arrayOwnershipChanged( EFalse ); |
|
398 CleanupStack::PushL( array ); |
|
399 TInt serviceCentres = 0; |
|
400 serviceCentres = iSettings.ServiceCenterCount(); |
|
401 const TInt listboxIndex = iTypeOfSettings ? |
|
402 ESmumSendOptServiceCentreInUseLBI : ESmumServiceCentreInUseLBI; |
|
403 |
|
404 if( serviceCentres ) |
|
405 { |
|
406 // We have service centres |
|
407 for ( TInt loop = 0; loop < serviceCentres; loop++ ) |
|
408 { |
|
409 array->AppendL( iSettings.GetServiceCenter( loop ).Name()); |
|
410 } |
|
411 // Delete old and replace array |
|
412 delete iSettingsArray->At( listboxIndex ).iMuiuSettingsItemArray; |
|
413 iSettingsArray->At( listboxIndex ).iMuiuSettingsItemArray = array; |
|
414 // Set the one in use visible |
|
415 SetItem( listboxIndex, iSettings.DefaultServiceCenter() ); |
|
416 arrayOwnershipChanged = ETrue; |
|
417 } |
|
418 else |
|
419 { |
|
420 if ( !iUseSimSCsOnly ) |
|
421 { |
|
422 // No service centres defined |
|
423 // Read value from resources |
|
424 HBufC* txt = StringLoader::LoadLC( R_QTN_SELEC_SETT_VAL_FIELD_NONE, iCoeEnv ); |
|
425 array->AppendL( *txt ); |
|
426 // Delete old and replace array |
|
427 delete iSettingsArray->At( listboxIndex ).iMuiuSettingsItemArray; |
|
428 iSettingsArray->At( listboxIndex ).iMuiuSettingsItemArray = array; |
|
429 // Confirm listbox value |
|
430 SetItem( listboxIndex, serviceCentres ); |
|
431 CleanupStack::PopAndDestroy(); // txt |
|
432 arrayOwnershipChanged = ETrue; |
|
433 } |
|
434 } |
|
435 if ( arrayOwnershipChanged ) |
|
436 { |
|
437 CleanupStack::Pop(); //array |
|
438 } |
|
439 else |
|
440 { |
|
441 CleanupStack::PopAndDestroy(); //array |
|
442 } |
|
443 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::UpdateSCInUseArrayL"); |
|
444 } |
|
445 |
|
446 // ---------------------------------------------------- |
|
447 // CSmumMainSettingsDialogGSM::OpeningDialogL |
|
448 // |
|
449 // ---------------------------------------------------- |
|
450 void CSmumMainSettingsDialogGSM::OpeningDialogL() |
|
451 { |
|
452 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::OpeningDialogL"); |
|
453 // Fetch pointer to titlepane |
|
454 CEikStatusPane *sp = ( STATIC_CAST( |
|
455 CAknAppUi*, ( CEikonEnv::Static()->EikAppUi())))->StatusPane(); |
|
456 iTitlePane = STATIC_CAST ( |
|
457 CAknTitlePane*, sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle))); |
|
458 |
|
459 // Take old titlepane text safe |
|
460 iPreviousTitleText = ( *iTitlePane->Text()).Alloc(); |
|
461 |
|
462 // Read new titletext and set it |
|
463 HBufC* text = StringLoader::LoadLC( iTypeOfSettings ? |
|
464 R_QTN_SMS_TITLE_SENDING : R_QTN_MCE_TITLE_SETTINGS_SMS, iCoeEnv ); |
|
465 iTitlePane->SetTextL( *text ); |
|
466 CleanupStack::PopAndDestroy(); // text |
|
467 |
|
468 // replace navi pane with empty one. |
|
469 iSmumNaviPane = static_cast<CAknNavigationControlContainer*> |
|
470 ( iEikonEnv->AppUiFactory()->StatusPane()->ControlL( |
|
471 TUid::Uid(EEikStatusPaneUidNavi) ) ); |
|
472 if ( iSmumNaviPane ) |
|
473 { |
|
474 iSmumNaviPane->PushDefaultL(); |
|
475 } |
|
476 |
|
477 // Settings : |
|
478 // Service Centre in Use |
|
479 // Sending options? |
|
480 TBool isReplyMessage = EFalse; |
|
481 |
|
482 if(iTypeOfSettings) |
|
483 { |
|
484 isReplyMessage = iSmsHeader->Submit().ReplyPath(); |
|
485 } |
|
486 |
|
487 if ( iTypeOfSettings == 1 && iCSPFeatures & EReplyPathSupport ) // 1 = sending options |
|
488 { |
|
489 // Replypath provided? |
|
490 if ( isReplyMessage && !iRemoveReplyScSetting) |
|
491 { // yes, it's provided |
|
492 iSettingsArray->SetReplyPath( ETrue ); |
|
493 } |
|
494 } |
|
495 // Update arrays |
|
496 if(!(iRemoveReplyScSetting && isReplyMessage)) |
|
497 { |
|
498 UpdateSCInUseArrayL(); |
|
499 } |
|
500 |
|
501 TInt index; |
|
502 TKeyArrayFix key(0, ECmpTInt); |
|
503 // Character Support 3.0 onwards |
|
504 if ( iTypeOfSettings ) // Sending options |
|
505 { |
|
506 if ( !iSettingsArrayIndex->Find ( ESmumSendOptCharSupportInUseLBI, key, index ) ) |
|
507 { |
|
508 TInt temp = iCharacterSupport; |
|
509 // Check if the value is modifiable |
|
510 // and modify setting value if needed |
|
511 if ( ECharSetFullLocked==temp || |
|
512 ECharSetReducedLocked==temp ) |
|
513 { |
|
514 temp -= KSmumCharSettingDeduction; |
|
515 } |
|
516 SetItem( index, temp ); |
|
517 } |
|
518 } |
|
519 else |
|
520 { |
|
521 if ( !iSettingsArrayIndex->Find ( ESmumCharSupportInUseLBI, key, index ) ) |
|
522 { |
|
523 SetItem( index, ReadCharSetSupport() ); |
|
524 } |
|
525 } |
|
526 |
|
527 if ( iCSPFeatures & EDeliveryReportSupport ) // Set value only if setting is supported |
|
528 { |
|
529 if ( !iSettingsArrayIndex->Find (iTypeOfSettings ? |
|
530 ESmumSendOptDeliveryReportLBI : ESmumDeliveryReportLBI, key, index ) ) |
|
531 { |
|
532 // Delivery Report |
|
533 SetItem( index, iSettings.DeliveryReport() ? |
|
534 ESmumSettingsYes : ESmumSettingsNo ); |
|
535 } |
|
536 } |
|
537 // Validity Period |
|
538 TInt choicelistIndex = KErrNotFound; |
|
539 if ( iCSPFeatures & EValidityPeriodSupport ) |
|
540 { |
|
541 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
542 ESmumSendOptValidityPeriodLBI : ESmumValidityPeriodLBI, key, index ) ) |
|
543 { |
|
544 switch( iSettings.ValidityPeriod().Int()) |
|
545 { |
|
546 case ESmsVPHour: |
|
547 choicelistIndex = ESmumValidityPeriodHour; |
|
548 break; |
|
549 case ESmsVPSixHours: |
|
550 choicelistIndex = ESmumValidityPeriodSixHours; |
|
551 break; |
|
552 case ESmsVP24Hours: |
|
553 choicelistIndex = ESmumValidityPeriod24Hours; |
|
554 break; |
|
555 case (3 * (TInt) ESmsVP24Hours): |
|
556 choicelistIndex = ESmumValidityPeriod3Days; |
|
557 break; |
|
558 case ESmsVPWeek: |
|
559 choicelistIndex = ESmumValidityPeriodWeek; |
|
560 break; |
|
561 case ESmsVPMaximum: |
|
562 choicelistIndex = ESmumValidityPeriodMaximum; |
|
563 break; |
|
564 default: |
|
565 #if defined (_DEBUG) |
|
566 Panic( ESmsetdlgUnknownValidity ); |
|
567 #else |
|
568 // drop through in release version |
|
569 case ESmsVPNotSupported: |
|
570 choicelistIndex = ESmumValidityPeriodMaximum; |
|
571 #endif |
|
572 break; |
|
573 } |
|
574 SetItem( index, choicelistIndex); |
|
575 } |
|
576 } |
|
577 |
|
578 // Message conversion |
|
579 if ( iCSPFeatures & EProtocolIDSupport ) |
|
580 { |
|
581 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
582 ESmumSendOptMessageConversionLBI : ESmumMessageConversionLBI, key, index ) ) |
|
583 { |
|
584 // Message Conversion |
|
585 switch(iSettings.MessageConversion()) |
|
586 { |
|
587 case ESmsConvPIDNone: |
|
588 choicelistIndex = ESmumConversionNone; |
|
589 break; |
|
590 case ESmsConvFax: |
|
591 choicelistIndex = ESmumConversionFax; |
|
592 break; |
|
593 case ESmsConvPaging: |
|
594 choicelistIndex = ESmumConversionPaging; |
|
595 break; |
|
596 case ESmsConvX400: |
|
597 case ESmsConvErmes: |
|
598 case ESmsConvSpeech: |
|
599 default: |
|
600 #if defined (_DEBUG) |
|
601 Panic( ESmsetdlgUnknownConversion ); |
|
602 #else |
|
603 // drop through in release version |
|
604 choicelistIndex = ESmumConversionNone; |
|
605 #endif |
|
606 break; |
|
607 } |
|
608 SetItem( index, choicelistIndex); |
|
609 } |
|
610 } |
|
611 |
|
612 // Preferred Connection |
|
613 if ( !iTypeOfSettings ) |
|
614 { |
|
615 if ( !iSettingsArrayIndex->Find ( ESmumPreferredConnectionLBI, key, index ) ) |
|
616 { |
|
617 const TInt preferredConnection = iSettings.SmsBearer(); |
|
618 switch( preferredConnection ) |
|
619 {// "prefer GPRS" |
|
620 case CSmsSettings::ESmsBearerPacketPreferred : |
|
621 SetItem( index, ESmumPreferGPRSConnection ); |
|
622 break; |
|
623 // In all other cases "prefer GSM" |
|
624 //case RMobileSmsMessaging::ESmsBearerCircuitPreferred : |
|
625 default: |
|
626 //case RMobileSmsMessaging::ESmsBearerCircuitOnly : |
|
627 //case RMobileSmsMessaging::ESmsBearerPacketOnly : |
|
628 SetItem( index, ESmumPreferGSMConnection ); |
|
629 break; |
|
630 } |
|
631 } |
|
632 } |
|
633 |
|
634 // Reply Path |
|
635 if ( iCSPFeatures & EReplyPathSupport && !iRemoveReplyScSetting) |
|
636 { |
|
637 // Reply Via Same Centre |
|
638 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
639 ESmumSendOptReplyViaSameCentreLBI : ESmumReplyViaSameCentreLBI, key, index ) ) |
|
640 { |
|
641 SetItem( index, iSettings.ReplyPath() ? ESmumSettingsYes : ESmumSettingsNo ); |
|
642 } |
|
643 } |
|
644 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::OpeningDialogL"); |
|
645 } |
|
646 |
|
647 // ---------------------------------------------------- |
|
648 // CSmumMainSettingsDialogGSM::ClosingDialogL |
|
649 // |
|
650 // ---------------------------------------------------- |
|
651 void CSmumMainSettingsDialogGSM::ClosingDialogL() |
|
652 { |
|
653 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::ClosingDialogL"); |
|
654 TBool replyMessage = EFalse; |
|
655 |
|
656 if ( iTypeOfSettings == 1 && iCSPFeatures & EReplyPathSupport ) // 1 = sending options |
|
657 { |
|
658 // Replypath provided? |
|
659 |
|
660 if ( iSmsHeader->Submit().ReplyPath() && iRemoveReplyScSetting) |
|
661 { // yes, it's provided |
|
662 replyMessage = ETrue; |
|
663 iSettingsArray->SetReplyPath( ETrue ); |
|
664 } |
|
665 } |
|
666 // Replace title with old title text |
|
667 if ( iExitCode == ESmumSmsSettingsBack ) |
|
668 { |
|
669 // Replace title with old title text |
|
670 iTitlePane->SetTextL( *iPreviousTitleText ); |
|
671 } |
|
672 TInt index; |
|
673 TKeyArrayFix key(0, ECmpTInt); |
|
674 // Settings : |
|
675 // Service Centre in Use |
|
676 if ( iSettings.ServiceCenterCount()) |
|
677 { |
|
678 if(!replyMessage && !iRemoveReplyScSetting) |
|
679 { |
|
680 //Make sure array is updated if user presses end-key |
|
681 UpdateSCInUseArrayL(); |
|
682 |
|
683 iSettings.SetDefaultServiceCenter( Item( |
|
684 iTypeOfSettings ? |
|
685 ESmumSendOptServiceCentreInUseLBI : ESmumServiceCentreInUseLBI )); |
|
686 } |
|
687 } |
|
688 // Character Support 3.0 onwards |
|
689 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
690 ESmumSendOptCharSupportInUseLBI : ESmumCharSupportInUseLBI, key, index ) ) |
|
691 { |
|
692 TInt setVal = Item( index ); |
|
693 // Take actions only if setting is not locked, |
|
694 // not ECharSetFullLocked or ECharSetReducedLocked |
|
695 if ( setVal != iCharacterSupport && |
|
696 iCharacterSupport < ECharSetFullLocked ) |
|
697 { |
|
698 if ( iTypeOfSettings ) // Sending option |
|
699 { |
|
700 iCharacterSupport = setVal; |
|
701 } |
|
702 else // Main setting, save to CenRep |
|
703 { |
|
704 iCentralRapository->Set( KSmumCharSupport, setVal ); |
|
705 } |
|
706 } |
|
707 } |
|
708 // Delivery Report |
|
709 if ( iCSPFeatures & EDeliveryReportSupport ) |
|
710 { |
|
711 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
712 ESmumSendOptDeliveryReportLBI : ESmumDeliveryReportLBI, key, index ) ) |
|
713 { |
|
714 iSettings.SetDeliveryReport( Item( index ) == ESmumSettingsYes ); |
|
715 } |
|
716 } |
|
717 |
|
718 // Validity Period |
|
719 if ( iCSPFeatures & EValidityPeriodSupport ) |
|
720 { |
|
721 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
722 ESmumSendOptValidityPeriodLBI : ESmumValidityPeriodLBI, key, index ) ) |
|
723 { |
|
724 TTimeIntervalMinutes validityPeriod = iSettings.ValidityPeriod().Int(); |
|
725 switch( Item( index ) ) |
|
726 { |
|
727 case ESmumValidityPeriodHour: |
|
728 validityPeriod = ( TInt ) ESmsVPHour; |
|
729 break; |
|
730 case ESmumValidityPeriodSixHours: |
|
731 validityPeriod = ( TInt ) ESmsVPSixHours; |
|
732 break; |
|
733 case ESmumValidityPeriod24Hours: |
|
734 validityPeriod = ( TInt ) ESmsVP24Hours; |
|
735 break; |
|
736 case ESmumValidityPeriod3Days: |
|
737 validityPeriod = ( 3 * ( TInt ) ESmsVP24Hours );// Instead of modifying smutset.h |
|
738 break; |
|
739 case ESmumValidityPeriodWeek: |
|
740 validityPeriod = ( TInt ) ESmsVPWeek; |
|
741 break; |
|
742 case ESmumValidityPeriodMaximum: |
|
743 validityPeriod = ( TInt ) ESmsVPMaximum; |
|
744 break; |
|
745 default: |
|
746 #if defined ( _DEBUG ) |
|
747 Panic( ESmsetdlgUnknownValidityChoice ); |
|
748 #else |
|
749 validityPeriod = ( TInt ) ESmsVP24Hours; |
|
750 #endif |
|
751 break; |
|
752 } |
|
753 iSettings.SetValidityPeriod( validityPeriod ); |
|
754 } |
|
755 } |
|
756 |
|
757 // Message Conversion |
|
758 if ( iCSPFeatures & EProtocolIDSupport ) |
|
759 { |
|
760 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
761 ESmumSendOptMessageConversionLBI : ESmumMessageConversionLBI, key, index ) ) |
|
762 { |
|
763 TInt choicelistIndex = KErrNotFound; |
|
764 switch( Item( index )) |
|
765 { |
|
766 case ESmumConversionNone: |
|
767 choicelistIndex = ESmsConvPIDNone; |
|
768 break; |
|
769 case ESmumConversionFax: |
|
770 choicelistIndex = ESmsConvFax; |
|
771 break; |
|
772 case ESmumConversionPaging: |
|
773 choicelistIndex = ESmsConvPaging; |
|
774 break; |
|
775 default: |
|
776 #if defined ( _DEBUG ) |
|
777 Panic( ESmsetdlgUnknownConversion ); |
|
778 #else |
|
779 // drop through in release version |
|
780 choicelistIndex = ESmsConvPIDNone; |
|
781 #endif |
|
782 break; |
|
783 } |
|
784 iSettings.SetMessageConversion(STATIC_CAST( |
|
785 TSmsPIDConversion, |
|
786 choicelistIndex )); |
|
787 } |
|
788 } |
|
789 |
|
790 // Preferred Connection |
|
791 if ( !iTypeOfSettings ) |
|
792 { |
|
793 if ( !iSettingsArrayIndex->Find ( ESmumPreferredConnectionLBI, key, index ) ) |
|
794 { |
|
795 switch( Item( index )) |
|
796 { |
|
797 // "prefer GPRS" |
|
798 case ESmumPreferGPRSConnection : |
|
799 iSettings.SetSmsBearer( CSmsSettings::ESmsBearerPacketPreferred ); |
|
800 break; |
|
801 // "prefer GSM" |
|
802 // case ESmumPreferGSMConnection : |
|
803 default : |
|
804 iSettings.SetSmsBearer( CSmsSettings::ESmsBearerCircuitPreferred ); |
|
805 break; |
|
806 } |
|
807 } |
|
808 } |
|
809 |
|
810 // Reply Via Same Centre |
|
811 if ( iCSPFeatures & EReplyPathSupport && !iRemoveReplyScSetting ) |
|
812 { |
|
813 if ( !iSettingsArrayIndex->Find ( iTypeOfSettings ? |
|
814 ESmumSendOptReplyViaSameCentreLBI : ESmumReplyViaSameCentreLBI, key, index ) ) |
|
815 { |
|
816 iSettings.SetReplyPath( Item( index ) == ESmumSettingsYes ); |
|
817 } |
|
818 } |
|
819 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::ClosingDialogL"); |
|
820 } |
|
821 |
|
822 // ---------------------------------------------------- |
|
823 // CSmumMainSettingsDialogGSM::SetItem |
|
824 // |
|
825 // ---------------------------------------------------- |
|
826 void CSmumMainSettingsDialogGSM::SetItem( TInt aSettingLBIndex, TInt aValue ) |
|
827 { |
|
828 iSettingsArray->At( aSettingLBIndex ).iUserText.Copy( |
|
829 ( *iSettingsArray->At( aSettingLBIndex ).iMuiuSettingsItemArray )[aValue]); |
|
830 ( *iSettingsArray )[ aSettingLBIndex ].iCurrentNumber = aValue; |
|
831 } |
|
832 |
|
833 // ---------------------------------------------------- |
|
834 // CSmumMainSettingsDialogGSM::Item |
|
835 // |
|
836 // ---------------------------------------------------- |
|
837 TInt CSmumMainSettingsDialogGSM::Item( TInt aSettingLBIndex ) const |
|
838 { |
|
839 return iSettingsArray->At( aSettingLBIndex ).iCurrentNumber; |
|
840 } |
|
841 |
|
842 // ---------------------------------------------------- |
|
843 // CSmumMainSettingsDialogGSM::CheckOpeningListBoxItemL |
|
844 // |
|
845 // ---------------------------------------------------- |
|
846 void CSmumMainSettingsDialogGSM::CheckOpeningListBoxItemL( TBool aEnterPressed ) |
|
847 { |
|
848 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::CheckOpeningListBoxItemL"); |
|
849 // First get the selected index |
|
850 TInt variatedSelectionIndex = GetVariatedSelectionIndex( iListBox->CurrentItemIndex() ); |
|
851 __ASSERT_DEBUG( variatedSelectionIndex >= 0 , Panic( ESmsetdlgInvalidIndex )); |
|
852 // Sending options |
|
853 if ( iTypeOfSettings ) |
|
854 { |
|
855 // Focus in "Service centre in use & no SC'es defined |
|
856 if ( ESmumSendOptServiceCentreInUseLBI == variatedSelectionIndex && |
|
857 iSettings.ServiceCenterCount() == 0 ) |
|
858 { |
|
859 if ( iUseSimSCsOnly ) // Only Sim SC's variation is on |
|
860 { // No centres -> No sms sending |
|
861 SmumUtil::ShowInformationNoteL( R_QTN_MCE_SETTINGS_SMS_SERVICE_DISABLED ); |
|
862 } |
|
863 else |
|
864 { |
|
865 SmumUtil::ShowInformationNoteL( R_QTN_SMS_SETTINGS_INFO_NO_SC ); |
|
866 } |
|
867 } |
|
868 // Focus in "Service centre in use & replypath provided |
|
869 else if ( ESmumSendOptServiceCentreInUseLBI == variatedSelectionIndex |
|
870 && iSettingsArray->ReplyPathProvided()) |
|
871 { |
|
872 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
873 if ( dlg->ExecuteLD( R_OVERRIDE_PROVIDED_REPLYPATH_QUERY )) |
|
874 { |
|
875 if (iSettingsArray->EditItemL( variatedSelectionIndex, EFalse ))// EFalse forcing opening |
|
876 { |
|
877 iSettingsArray->SetReplyPath( EFalse ); |
|
878 iSmsHeader->Message().SetServiceCenterAddressL( KNullDesC ); |
|
879 iListBox->DrawNow(); |
|
880 } |
|
881 } |
|
882 } |
|
883 // Focus in "Service centre in use |
|
884 else if ( ESmumSendOptServiceCentreInUseLBI == variatedSelectionIndex ) |
|
885 { |
|
886 iSettingsArray->EditItemL( |
|
887 iListBox->CurrentItemIndex(), |
|
888 EFalse );// EFalse forcing opening |
|
889 iListBox->DrawNow(); |
|
890 } |
|
891 // Simple listbox item |
|
892 else if ( ESmumSendOptCharSupportInUseLBI <= variatedSelectionIndex ) |
|
893 { |
|
894 if ( variatedSelectionIndex == ESmumSendOptCharSupportInUseLBI ) |
|
895 { |
|
896 // Check is the editing allowed |
|
897 if ( iCharacterSupport == ECharSetFullLocked || |
|
898 iCharacterSupport == ECharSetReducedLocked ) |
|
899 { |
|
900 // Display note and exit |
|
901 SmumUtil::ShowInformationNoteL( R_QTN_MCE_INFO_CANNOT_CHANGE_SMS_CHARS ); |
|
902 // return immediatelly |
|
903 return; |
|
904 } |
|
905 } |
|
906 iSettingsArray->EditItemL( |
|
907 iListBox->CurrentItemIndex(), |
|
908 aEnterPressed ); |
|
909 iListBox->DrawNow(); |
|
910 } |
|
911 else |
|
912 {// Lint |
|
913 } |
|
914 } |
|
915 // Sms Settings |
|
916 else |
|
917 { |
|
918 TBool goingToExit = EFalse; |
|
919 |
|
920 // Check if focus in two first ones and non sc defined |
|
921 if ( ESmumServiceCentreInUseLBI >= variatedSelectionIndex && |
|
922 iSettings.ServiceCenterCount() == 0 ) |
|
923 { |
|
924 //Save the used menu item to later use |
|
925 iStoreSettingsIndex = iListBox->CurrentItemIndex(); |
|
926 if ( iUseSimSCsOnly ) // Only Sim SC's variation is on |
|
927 { // No centres -> No sms sending |
|
928 SmumUtil::ShowInformationNoteL( R_QTN_MCE_SETTINGS_SMS_SERVICE_DISABLED ); |
|
929 } |
|
930 else |
|
931 { |
|
932 // Run "create new sc?" -query |
|
933 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
934 if ( dlg->ExecuteLD( R_CREATE_NEW_SC_QUERY )) |
|
935 { |
|
936 TBuf<KSmumStringLength> name; |
|
937 TBuf<KSmumStringLength> number; |
|
938 |
|
939 // Add SC dialog |
|
940 TInt addSCDlgExitCode = ESmumSmsSettingsInitialvalue; |
|
941 CSmumAddEditServiceCentreDialog* scItemDialog = |
|
942 new ( ELeave ) CSmumAddEditServiceCentreDialog( |
|
943 name, number, addSCDlgExitCode, iHelpFeatureSupported ); |
|
944 CleanupStack::PushL( scItemDialog ); |
|
945 scItemDialog->ConstructL( R_SMS_SERVICECENTRE_ITEM_CHOICE_MENUBAR ); |
|
946 CleanupStack::Pop();// scItemDialog |
|
947 scItemDialog->ExecuteLD( R_ADD_EDIT_SERVICECENTRES ); |
|
948 if ( addSCDlgExitCode == ESmumSmsSettingsMenuExit || |
|
949 addSCDlgExitCode == ESmumSmsSettingsSystemExit ) |
|
950 { // Exiting |
|
951 goingToExit = ETrue; |
|
952 } |
|
953 |
|
954 // Update sc array and launch service centres-dialog |
|
955 // if values ok, otherwise reset the listbox. |
|
956 if ( name.Size() && number.Size()) |
|
957 { |
|
958 iSettings.AddServiceCenterL( name, number ); |
|
959 if ( goingToExit ) |
|
960 { // Exiting |
|
961 iExitCode = addSCDlgExitCode; |
|
962 DoDelayedExitL( 0 ); |
|
963 return; |
|
964 } |
|
965 TInt centresDlgExitCode = LaunchServiceCentresDialogL(); |
|
966 if ( centresDlgExitCode == ESmumSmsSettingsMenuExit || |
|
967 centresDlgExitCode == ESmumSmsSettingsSystemExit ) |
|
968 { // Exiting |
|
969 iExitCode = centresDlgExitCode; |
|
970 DoDelayedExitL( 0 ); |
|
971 return; |
|
972 } |
|
973 if( !iRemoveReplyScSetting ) |
|
974 { |
|
975 UpdateSCInUseArrayL(); |
|
976 } |
|
977 iListBox->DrawNow(); |
|
978 } |
|
979 else |
|
980 { |
|
981 if ( goingToExit ) |
|
982 {// Exiting |
|
983 iExitCode = addSCDlgExitCode; |
|
984 DoDelayedExitL( 0 ); |
|
985 return; |
|
986 } |
|
987 else |
|
988 { |
|
989 iListBox->Reset(); |
|
990 //Set the correct item in previous menu |
|
991 iListBox->SetCurrentItemIndexAndDraw(iStoreSettingsIndex); |
|
992 } |
|
993 } |
|
994 } |
|
995 } |
|
996 } |
|
997 // Check if focus in "service centres" |
|
998 else if ( ESmumServiceCentresLBI == variatedSelectionIndex ) |
|
999 { |
|
1000 TInt centresDlgExitCode = LaunchServiceCentresDialogL(); |
|
1001 if ( centresDlgExitCode == ESmumSmsSettingsMenuExit || |
|
1002 centresDlgExitCode == ESmumSmsSettingsSystemExit ) |
|
1003 { // Exiting |
|
1004 iExitCode = centresDlgExitCode; |
|
1005 DoDelayedExitL( 0 ); |
|
1006 return; |
|
1007 } |
|
1008 if( !iRemoveReplyScSetting ) |
|
1009 { |
|
1010 UpdateSCInUseArrayL(); |
|
1011 } |
|
1012 iListBox->DrawNow(); |
|
1013 } |
|
1014 // Check if focus in "Service centre in use" |
|
1015 else if ( ESmumServiceCentreInUseLBI == variatedSelectionIndex ) |
|
1016 { |
|
1017 iSettingsArray->EditItemL( |
|
1018 iListBox->CurrentItemIndex(), |
|
1019 EFalse ); // EFalse forcing opening |
|
1020 // Save default Sc |
|
1021 iSettings.SetDefaultServiceCenter( Item( |
|
1022 iTypeOfSettings ? |
|
1023 ESmumSendOptServiceCentreInUseLBI : ESmumServiceCentreInUseLBI )); |
|
1024 iListBox->DrawNow(); |
|
1025 } |
|
1026 // EmailOverSms |
|
1027 else if ( iEmailFeatureSupported && |
|
1028 ESmumEmailServiceCentreLBI == variatedSelectionIndex ) |
|
1029 { |
|
1030 DisplayEmailOverSmsSettingsL(); |
|
1031 } |
|
1032 // Focus must be then elsewhere |
|
1033 else if ( ESmumCharSupportInUseLBI <= variatedSelectionIndex ) |
|
1034 { |
|
1035 if ( variatedSelectionIndex == ESmumCharSupportInUseLBI ) |
|
1036 { |
|
1037 // Check is the editing allowed |
|
1038 if ( iCharacterSupport == ECharSetFullLocked || |
|
1039 iCharacterSupport == ECharSetReducedLocked ) |
|
1040 { |
|
1041 // Display note and exit |
|
1042 SmumUtil::ShowInformationNoteL( R_QTN_MCE_INFO_CANNOT_CHANGE_SMS_CHARS ); |
|
1043 return; |
|
1044 } |
|
1045 } |
|
1046 // Simple listbox item |
|
1047 iSettingsArray->EditItemL( |
|
1048 iListBox->CurrentItemIndex(), |
|
1049 aEnterPressed); |
|
1050 iListBox->DrawNow(); |
|
1051 } |
|
1052 else |
|
1053 {// Lint |
|
1054 } |
|
1055 } |
|
1056 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::CheckOpeningListBoxItemL - LAST"); |
|
1057 // panic |
|
1058 } |
|
1059 |
|
1060 // ---------------------------------------------------- |
|
1061 // CSmumMainSettingsDialogGSM::LaunchServiceCentresDialogL |
|
1062 // |
|
1063 // ---------------------------------------------------- |
|
1064 TInt CSmumMainSettingsDialogGSM::LaunchServiceCentresDialogL() |
|
1065 { |
|
1066 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::LaunchServiceCentresDialogL"); |
|
1067 TInt exitCode = ESmumSmsSettingsInitialvalue; |
|
1068 // Launch Service Centres dialog |
|
1069 CSmumServiceCentresDialog* servicecentreDialog = |
|
1070 CSmumServiceCentresDialog::NewL( |
|
1071 iSettings, exitCode, R_SMS_SERVICECENTRES_CHOICE_MENUBAR, iHelpFeatureSupported, iUseSimSCsOnly ); |
|
1072 servicecentreDialog->ExecuteLD( R_SERVICECENTRELIST_DIALOG ); |
|
1073 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::LaunchServiceCentresDialogL"); |
|
1074 return exitCode; |
|
1075 } |
|
1076 |
|
1077 // ---------------------------------------------------- |
|
1078 // CSmumMainSettingsDialogGSM::LaunchHelpL |
|
1079 // launch help using context |
|
1080 // |
|
1081 // ---------------------------------------------------- |
|
1082 void CSmumMainSettingsDialogGSM::LaunchHelpL() |
|
1083 { |
|
1084 if ( iHelpFeatureSupported ) |
|
1085 { |
|
1086 CCoeAppUi* editorAppUi = STATIC_CAST(CCoeAppUi*, ControlEnv()->AppUi()); |
|
1087 CArrayFix<TCoeHelpContext>* helpContext = editorAppUi->AppHelpContextL(); |
|
1088 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext ); |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 |
|
1093 // ---------------------------------------------------- |
|
1094 // CSmumMainSettingsDialogGSM::GetHelpContext |
|
1095 // returns helpcontext as aContext |
|
1096 // |
|
1097 // ---------------------------------------------------- |
|
1098 void CSmumMainSettingsDialogGSM::GetHelpContext |
|
1099 (TCoeHelpContext& aContext) const |
|
1100 { |
|
1101 const TUid KUidMce ={0x100058C5}; |
|
1102 aContext.iMajor = KUidMce; |
|
1103 aContext.iContext = KMCE_HLP_SETTINGS_SMS; |
|
1104 } |
|
1105 |
|
1106 // ---------------------------------------------------- |
|
1107 // CSmumMainSettingsDialogGSM::GetVariatedSelectionIndex |
|
1108 // |
|
1109 // --------------------------------------------------------------------------- |
|
1110 TInt CSmumMainSettingsDialogGSM::GetVariatedSelectionIndex( |
|
1111 const TInt aListSelection ) const |
|
1112 { |
|
1113 TInt variatedValue ( aListSelection ); |
|
1114 TBool isScInUseRemoved( EFalse ); |
|
1115 if ( iUseSimSCsOnly && iSettings.ServiceCenterCount() == 0 ) |
|
1116 { |
|
1117 if ( iTypeOfSettings ? |
|
1118 aListSelection >= ESmumSendOptServiceCentreInUseLBI : |
|
1119 aListSelection >= ESmumServiceCentreInUseLBI ) |
|
1120 { |
|
1121 variatedValue += 1; // removed |
|
1122 isScInUseRemoved = ETrue; |
|
1123 } |
|
1124 } |
|
1125 if ( !iEmailFeatureSupported ) // EmailFeature on |
|
1126 { |
|
1127 // Modifies only main settings |
|
1128 if ( !iTypeOfSettings && isScInUseRemoved ? |
|
1129 aListSelection >= ( ESmumEmailServiceCentreLBI - 1 ) : |
|
1130 aListSelection >= ESmumEmailServiceCentreLBI ) |
|
1131 { |
|
1132 variatedValue += 1; // ESmumEmailServiceCentreLBI is removed |
|
1133 } |
|
1134 else if ( iRemoveReplyScSetting ) |
|
1135 { |
|
1136 if ( iTypeOfSettings ? |
|
1137 aListSelection >= ESmumSendOptServiceCentreInUseLBI : |
|
1138 aListSelection >= ESmumServiceCentreInUseLBI ) |
|
1139 { |
|
1140 variatedValue += 2; // ESmumEmailServiceCentreLBI |
|
1141 } // ServiceCentreInUseLBI are removed |
|
1142 } |
|
1143 } |
|
1144 return variatedValue; |
|
1145 } |
|
1146 |
|
1147 // --------------------------------------------------------------------------- |
|
1148 // CSmumMainSettingsDialogGSM::DeleteVariatedSettings |
|
1149 // |
|
1150 // --------------------------------------------------------------------------- |
|
1151 void CSmumMainSettingsDialogGSM::DeleteVariatedSettings() |
|
1152 { |
|
1153 SMUMLOGGER_ENTERFN("CSmumMainSettingsDialogGSM::DeleteVariatedSettings") |
|
1154 SMUMLOGGER_WRITE_FORMAT( |
|
1155 "DeleteVariatedSettings - Type of Settings :%d", |
|
1156 iTypeOfSettings ) |
|
1157 TBool needToBeCompressed = EFalse; |
|
1158 |
|
1159 if ( !( iCSPFeatures & EReplyPathSupport ) || iRemoveReplyScSetting ) |
|
1160 { |
|
1161 SMUMLOGGER_WRITE( |
|
1162 "DeleteVariatedSettings - EReplyPathSupport") |
|
1163 DeleteSettingItemFromArrays( iTypeOfSettings ? |
|
1164 ESmumSendOptReplyViaSameCentreLBI : ESmumReplyViaSameCentreLBI ); |
|
1165 needToBeCompressed = ETrue; |
|
1166 } |
|
1167 if ( !( iCSPFeatures & EProtocolIDSupport )) |
|
1168 { |
|
1169 SMUMLOGGER_WRITE( |
|
1170 "DeleteVariatedSettings - EProtocolIDSupport") |
|
1171 DeleteSettingItemFromArrays( iTypeOfSettings ? |
|
1172 ESmumSendOptMessageConversionLBI : ESmumMessageConversionLBI ); |
|
1173 needToBeCompressed = ETrue; |
|
1174 } |
|
1175 if ( !( iCSPFeatures & EValidityPeriodSupport )) |
|
1176 { |
|
1177 SMUMLOGGER_WRITE( |
|
1178 "DeleteVariatedSettings - EValidityPeriodSupport") |
|
1179 DeleteSettingItemFromArrays( iTypeOfSettings ? |
|
1180 ESmumSendOptValidityPeriodLBI : ESmumValidityPeriodLBI ); |
|
1181 needToBeCompressed = ETrue; |
|
1182 } |
|
1183 if ( !( iCSPFeatures & EDeliveryReportSupport )) |
|
1184 { |
|
1185 SMUMLOGGER_WRITE( |
|
1186 "DeleteVariatedSettings - EDeliveryReportSupport") |
|
1187 DeleteSettingItemFromArrays( iTypeOfSettings ? |
|
1188 ESmumSendOptDeliveryReportLBI : ESmumDeliveryReportLBI ); |
|
1189 needToBeCompressed = ETrue; |
|
1190 } |
|
1191 // Main settings and no email support |
|
1192 if ( !iEmailFeatureSupported && !iTypeOfSettings ) |
|
1193 { |
|
1194 SMUMLOGGER_WRITE( |
|
1195 "DeleteVariatedSettings - EmailFeatureSupport") |
|
1196 DeleteSettingItemFromArrays( ESmumEmailServiceCentreLBI ); |
|
1197 needToBeCompressed = ETrue; |
|
1198 } |
|
1199 TBool isReplyMessage = EFalse; |
|
1200 if(iTypeOfSettings) |
|
1201 { |
|
1202 isReplyMessage = iSmsHeader->Submit().ReplyPath(); |
|
1203 } |
|
1204 if ( iUseSimSCsOnly && iSettings.ServiceCenterCount() == 0 || |
|
1205 (iRemoveReplyScSetting && isReplyMessage )) |
|
1206 { |
|
1207 DeleteSettingItemFromArrays(iTypeOfSettings ? |
|
1208 ESmumSendOptServiceCentreInUseLBI : ESmumServiceCentreInUseLBI ); |
|
1209 needToBeCompressed = ETrue; |
|
1210 } |
|
1211 if ( needToBeCompressed ) |
|
1212 { |
|
1213 iSettingsArray->Compress(); |
|
1214 iSettingsArrayIndex->Compress(); |
|
1215 } |
|
1216 SMUMLOGGER_LEAVEFN("CSmumMainSettingsDialogGSM::DeleteVariatedSettings") |
|
1217 } |
|
1218 |
|
1219 // --------------------------------------------------------------------------- |
|
1220 // CSmumMainSettingsDialogGSM::DeleteSettingItemFromArrays |
|
1221 // |
|
1222 // --------------------------------------------------------------------------- |
|
1223 void CSmumMainSettingsDialogGSM::DeleteSettingItemFromArrays( TInt aIndex ) |
|
1224 { |
|
1225 SMUMLOGGER_ENTERFN("CSmumMainSettingsDialogGSM::DeleteSettingItemFromArrays") |
|
1226 // Delete from CMuiuSettingsArray |
|
1227 delete iSettingsArray->At( aIndex ).iMuiuSettingsItemArray; |
|
1228 iSettingsArray->Delete( aIndex ); |
|
1229 // Delete form index array |
|
1230 iSettingsArrayIndex->Delete( aIndex ); |
|
1231 SMUMLOGGER_WRITE_FORMAT( |
|
1232 "DeleteSettingItemFromArrays - Delete Setting :%d", |
|
1233 aIndex ) |
|
1234 SMUMLOGGER_LEAVEFN("CSmumMainSettingsDialogGSM::DeleteSettingItemFromArrays") |
|
1235 } |
|
1236 |
|
1237 // --------------------------------------------------------------------------- |
|
1238 // CSmumMainSettingsDialogGSM::ReadCspSupportBitsL |
|
1239 // |
|
1240 // --------------------------------------------------------------------------- |
|
1241 void CSmumMainSettingsDialogGSM::ReadCspSupportBitsL() |
|
1242 { |
|
1243 SMUMLOGGER_ENTERFN("CSmumMainSettingsDialogGSM::ReadCspSupportBitsL") |
|
1244 // Initialize as all features supported |
|
1245 iCSPFeatures = EValidityPeriodSupport |
|
1246 |EProtocolIDSupport |
|
1247 |EDeliveryReportSupport |
|
1248 |EReplyPathSupport; |
|
1249 // Bit values changed only if feature is supported |
|
1250 TInt tmpInt( KErrNotFound ); |
|
1251 |
|
1252 tmpInt = SmumUtil::CheckVariationFlagsL( KCRUidMuiuVariation, KMuiuMceFeatures ); |
|
1253 // Read from bits from sim cache |
|
1254 if ( tmpInt & KMceFeatureIdCSPSupport ) |
|
1255 { |
|
1256 SMUMLOGGER_WRITE( |
|
1257 "ReadCspSupportBitsL - KMceFeatureIdCSPSupport supported" ) |
|
1258 RCustomerServiceProfileCache* cspProfile = |
|
1259 new (ELeave) RCustomerServiceProfileCache; |
|
1260 __ASSERT_DEBUG( cspProfile, Panic( ESmsuNullPointer ) ); |
|
1261 TInt error = cspProfile->Open(); |
|
1262 if( KErrNone == error ) |
|
1263 { |
|
1264 // Get tele services flags from CSP |
|
1265 RMobilePhone::TCspTeleservices params; |
|
1266 // If not supported (-5) or any other error |
|
1267 // we assume all settings are supported |
|
1268 error = cspProfile->CspTeleServices( params ); |
|
1269 if ( KErrNone == error ) |
|
1270 { |
|
1271 SMUMLOGGER_WRITE_FORMAT( |
|
1272 "ReadCspSupportBitsL - RMobilePhone::TCspTeleservices #%d", params ) |
|
1273 if( 0 == ( params&RMobilePhone::KCspValidityPeriod ) ) |
|
1274 { |
|
1275 SMUMLOGGER_WRITE( |
|
1276 "ReadCspSupportBitsL - KCspValidityPeriod not supported" ) |
|
1277 iCSPFeatures &= ~EValidityPeriodSupport; |
|
1278 } |
|
1279 if( 0 == ( params&RMobilePhone::KCspProtocolID ) ) |
|
1280 { |
|
1281 SMUMLOGGER_WRITE( |
|
1282 "ReadCspSupportBitsL - KCspProtocolID not supported" ) |
|
1283 iCSPFeatures &= ~EProtocolIDSupport; |
|
1284 } |
|
1285 if( 0 == ( params&RMobilePhone::KCspDelConf ) ) |
|
1286 { |
|
1287 SMUMLOGGER_WRITE( |
|
1288 "ReadCspSupportBitsL - KCspDelConf not supported" ) |
|
1289 iCSPFeatures &= ~EDeliveryReportSupport; |
|
1290 } |
|
1291 if( 0 == ( params&RMobilePhone::KCspReplyPath ) ) |
|
1292 { |
|
1293 SMUMLOGGER_WRITE( |
|
1294 "ReadCspSupportBitsL - KCspReplyPath not supported" ) |
|
1295 iCSPFeatures &= ~EReplyPathSupport; |
|
1296 } |
|
1297 } |
|
1298 else |
|
1299 { |
|
1300 SMUMLOGGER_WRITE_FORMAT( |
|
1301 "ReadCspSupportBitsL - cspProfile->CspTeleServices() #%d", error ) |
|
1302 } |
|
1303 cspProfile->Close(); |
|
1304 } |
|
1305 else |
|
1306 { |
|
1307 SMUMLOGGER_WRITE_FORMAT( |
|
1308 "ReadCspSupportBitsL - cspProfile->Open() #%d", error ) |
|
1309 } |
|
1310 delete cspProfile; |
|
1311 } |
|
1312 SMUMLOGGER_LEAVEFN("CSmumMainSettingsDialogGSM::ReadCspSupportBitsL") |
|
1313 } |
|
1314 |
|
1315 // ---------------------------------------------------- |
|
1316 // CSmumMainSettingsDialogGSM::ReadCharSetSupport |
|
1317 // reads the setting value and sets it to member variable |
|
1318 // |
|
1319 // ---------------------------------------------------- |
|
1320 TInt CSmumMainSettingsDialogGSM::ReadCharSetSupport() |
|
1321 { |
|
1322 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::ReadCharSetSupport"); |
|
1323 __ASSERT_DEBUG( iCentralRapository, Panic( ESmsuNullPointer )); |
|
1324 TInt tempCharSupport( ECharSetReduced ); |
|
1325 if ( iCentralRapository ) |
|
1326 { |
|
1327 if ( KErrNone == iCentralRapository->Get( |
|
1328 KSmumCharSupport, tempCharSupport ) ) |
|
1329 { |
|
1330 // Sanity check for the read value ( accepted values between 0-3 ) |
|
1331 if ( ECharSetReducedLocked<tempCharSupport || ECharSetFull>tempCharSupport ) |
|
1332 { |
|
1333 // Set the member and the return value to Reduced mode |
|
1334 tempCharSupport = iCharacterSupport = ECharSetReduced; |
|
1335 } |
|
1336 else |
|
1337 { |
|
1338 // Use in member as it was read |
|
1339 iCharacterSupport = tempCharSupport; |
|
1340 // But we may have to modify the return value ... |
|
1341 // The return value is used as setting item index |
|
1342 // and it must be 0(ECharSetFull) or 1(ECharSetReduced) |
|
1343 // 2 -> 0, 3 -> 1 |
|
1344 if ( ECharSetFullLocked==tempCharSupport || |
|
1345 ECharSetReducedLocked==tempCharSupport ) |
|
1346 { |
|
1347 tempCharSupport -= KSmumCharSettingDeduction; |
|
1348 } |
|
1349 } |
|
1350 __ASSERT_DEBUG( tempCharSupport==ECharSetFull || |
|
1351 tempCharSupport==ECharSetReduced, |
|
1352 Panic( ESmsetdlgInvalidIndex )); |
|
1353 } |
|
1354 } |
|
1355 SMUMLOGGER_WRITE_FORMAT(" CSmumMainSettingsDialogGSM::ReadCharSetSupport - %d", tempCharSupport); |
|
1356 SMUMLOGGER_LEAVEFN(" CSmumMainSettingsDialogGSM::ReadCharSetSupport"); |
|
1357 return tempCharSupport; |
|
1358 } |
|
1359 |
|
1360 // --------------------------------------------------------------------------- |
|
1361 // CSmumMainSettingsDialogGSM::DisplayEmailOverSmsSettingsL |
|
1362 // |
|
1363 // --------------------------------------------------------------------------- |
|
1364 void CSmumMainSettingsDialogGSM::DisplayEmailOverSmsSettingsL() |
|
1365 { |
|
1366 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::DisplayEmailOverSmsSettingsL"); |
|
1367 // Add SC dialog |
|
1368 TBuf<KSmumStringLength> gateway; |
|
1369 TBuf<KSmumStringLength> sc; |
|
1370 TBool modifiable = ETrue; |
|
1371 // Read current values |
|
1372 TRAP_IGNORE( SmumUtil::ReadEmailOverSmsSettingsL( |
|
1373 sc, |
|
1374 gateway, |
|
1375 modifiable ) ); |
|
1376 |
|
1377 TInt addEmailSettingsDlgExitCode = ESmumSmsSettingsInitialvalue; |
|
1378 CSmumEmailServiceCentreDialog* scItemDialog = |
|
1379 new ( ELeave ) CSmumEmailServiceCentreDialog( |
|
1380 gateway, |
|
1381 sc, |
|
1382 modifiable, |
|
1383 addEmailSettingsDlgExitCode, |
|
1384 iHelpFeatureSupported ); |
|
1385 |
|
1386 CleanupStack::PushL( scItemDialog ); |
|
1387 scItemDialog->ConstructL( R_SMS_SERVICECENTRE_ITEM_CHOICE_MENUBAR ); |
|
1388 CleanupStack::Pop();// scItemDialog |
|
1389 scItemDialog->ExecuteLD( R_ADD_EDIT_SERVICECENTRES ); |
|
1390 if ( addEmailSettingsDlgExitCode == ESmumSmsSettingsSystemExit ) |
|
1391 { // Exiting |
|
1392 iExitCode = ESmumSmsSettingsMenuExit; |
|
1393 DoDelayedExitL( 0 ); |
|
1394 return; |
|
1395 } |
|
1396 else // ESmumSmsSettingsBack, ESmumSmsSettingsMenuExit |
|
1397 { |
|
1398 // Save settings if modifiable |
|
1399 if ( modifiable && gateway.Length() && sc.Length() ) |
|
1400 { |
|
1401 TRAP_IGNORE( SmumUtil::WriteEmailOverSmsSettingsL( |
|
1402 sc, |
|
1403 gateway, |
|
1404 modifiable ) ); |
|
1405 } |
|
1406 // Settings ok and saved - Exit messaging |
|
1407 if ( addEmailSettingsDlgExitCode == ESmumSmsSettingsMenuExit ) |
|
1408 { |
|
1409 iExitCode = ESmumSmsSettingsMenuExit; |
|
1410 DoDelayedExitL( 0 ); |
|
1411 return; |
|
1412 } |
|
1413 } |
|
1414 } |
|
1415 |
|
1416 // --------------------------------------------------------- |
|
1417 // CSmumMainSettingsDialogGSM::HandleResourceChange |
|
1418 // |
|
1419 // --------------------------------------------------------- |
|
1420 void CSmumMainSettingsDialogGSM::HandleResourceChange( TInt aType ) |
|
1421 { |
|
1422 CEikDialog::HandleResourceChange( aType ); |
|
1423 } |
|
1424 // --------------------------------------------------------- |
|
1425 // CSmumMainSettingsDialogGSM::UpdateMskL |
|
1426 // |
|
1427 // --------------------------------------------------------- |
|
1428 void CSmumMainSettingsDialogGSM::UpdateMskL( ) |
|
1429 { |
|
1430 TInt resId = 0; |
|
1431 TInt index = iListBox->CurrentItemIndex( ); |
|
1432 |
|
1433 if ( index == KErrNotFound ) |
|
1434 return; |
|
1435 |
|
1436 if( index == 0 ) |
|
1437 { // Message type |
|
1438 resId = R_SMUM_MSK_BUTTON_OPEN; |
|
1439 } |
|
1440 else |
|
1441 { // Char set |
|
1442 resId = R_SMUM_MSK_BUTTON_CHANGE; |
|
1443 } |
|
1444 |
|
1445 if (resId != iMskId ) |
|
1446 { |
|
1447 CEikButtonGroupContainer& cba = ButtonGroupContainer( ); |
|
1448 const TInt KMskPosition = 3; |
|
1449 cba.SetCommandL( KMskPosition, resId ); |
|
1450 cba.DrawDeferred( ); |
|
1451 iMskId = resId; |
|
1452 } |
|
1453 |
|
1454 } |
|
1455 |
|
1456 // --------------------------------------------------------- |
|
1457 // CSmumMainSettingsDialogGSM::DoDelayedExitL |
|
1458 // --------------------------------------------------------- |
|
1459 void CSmumMainSettingsDialogGSM::DoDelayedExitL( const TInt aDelay ) |
|
1460 { |
|
1461 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::DoDelayedExitL"); |
|
1462 delete iIdle; |
|
1463 iIdle = 0; |
|
1464 iIdle = CPeriodic::NewL( EPriorityNormal - 1 ); |
|
1465 iIdle->Start( aDelay, |
|
1466 aDelay, |
|
1467 TCallBack( DelayedExit, this ) ); |
|
1468 } |
|
1469 |
|
1470 // --------------------------------------------------------- |
|
1471 // CSmumMainSettingsDialogGSM::DelayedExit |
|
1472 // --------------------------------------------------------- |
|
1473 TInt CSmumMainSettingsDialogGSM::DelayedExit( TAny* aThis ) |
|
1474 { |
|
1475 SMUMLOGGER_ENTERFN(" CSmumMainSettingsDialogGSM::DelayedExit"); |
|
1476 CSmumMainSettingsDialogGSM* settings = static_cast<CSmumMainSettingsDialogGSM*>( aThis ); |
|
1477 TRAP_IGNORE( settings->ClosingDialogL() ); // to be sure of not leaving and exiting |
|
1478 CAknEnv::RunAppShutter( ); |
|
1479 return KErrNone; |
|
1480 } |
|
1481 // End of File |
|
1482 |