|
1 /* |
|
2 * Copyright (c) 2007-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: Implements CSCSettingsUiMainContainer methods |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknlists.h> |
|
20 #include <coecntrl.h> |
|
21 #include <cchclient.h> |
|
22 #include <csc.hlp.hrh> |
|
23 #include <cmmanagerext.h> |
|
24 #include <StringLoader.h> |
|
25 #include <spdefinitions.h> |
|
26 #include <cscsettingsui.rsg> |
|
27 #include <aknlistquerydialog.h> |
|
28 #include <cvimpstsettingsstore.h> |
|
29 |
|
30 #include "cscsettingsui.hrh" |
|
31 #include "cscsettingsuimodel.h" |
|
32 #include "cscsettingsuilogger.h" |
|
33 #include "cscengservicehandler.h" |
|
34 #include "cscsettingsuiconstants.h" |
|
35 #include "cscengdestinationshandler.h" |
|
36 #include "cipapputilsaddressresolver.h" |
|
37 #include "cscsettingsuimaincontainer.h" |
|
38 |
|
39 // Format of the setting item. |
|
40 _LIT( KCSCSettingsUiListItemTextFormat, "\t%S\t\t%S" ); |
|
41 |
|
42 _LIT( KDoubleBackSlash, "\\" ); |
|
43 _LIT( KEmptyPassword, "*****" ); |
|
44 |
|
45 // ======== MEMBER FUNCTIONS ======== |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CCSCSettingsUiMainContainer::CCSCSettingsUiMainContainer( |
|
51 CCSCSettingsUiModel& aModel ) |
|
52 : iModel( aModel ) |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 void CCSCSettingsUiMainContainer::ConstructL( |
|
61 const TRect& aRect ) |
|
62 { |
|
63 CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructL - begin" ); |
|
64 |
|
65 CreateWindowL(); |
|
66 ConstructListBoxL(); |
|
67 SetRect( aRect ); |
|
68 ActivateL(); |
|
69 |
|
70 CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructL - end" ); |
|
71 } |
|
72 |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CCSCSettingsUiMainContainer::~CCSCSettingsUiMainContainer() |
|
78 { |
|
79 CSCSETUIDEBUG( |
|
80 "CCSCSettingsUiMainContainer::~CCSCSettingsUiMainContainer - begin" ); |
|
81 |
|
82 iListBoxItemArray.Reset(); |
|
83 iListBoxItemArray.Close(); |
|
84 |
|
85 if ( iCaption ) |
|
86 { |
|
87 delete iCaption; |
|
88 } |
|
89 |
|
90 delete iListBox; |
|
91 |
|
92 CSCSETUIDEBUG( |
|
93 "CCSCSettingsUiMainContainer::~CCSCSettingsUiMainContainer - end" ); |
|
94 } |
|
95 |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CCSCSettingsUiMainContainer::UpdateContainerL |
|
99 // Updates container and redraws listbox items. |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CCSCSettingsUiMainContainer::UpdateContainerL() |
|
103 { |
|
104 CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::UpdateContainerL - begin" ); |
|
105 |
|
106 // Get listbox items from model. |
|
107 CTextListBoxModel* model = iListBox->Model(); |
|
108 MDesCArray* textArray = model->ItemTextArray(); |
|
109 CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray ); |
|
110 listBoxItems->Reset(); |
|
111 iListBoxItemArray.Reset(); |
|
112 |
|
113 // Initialize setting items. |
|
114 InitializeSettingItemsL(); |
|
115 |
|
116 CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::UpdateContainerL - end" ); |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // CCSCSettingsUiMainContainer::HandoverNotificationToneQueryL |
|
121 // Shows a query which changes handover notification tone setting for service. |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 void CCSCSettingsUiMainContainer::HandoverNotificationToneQueryL() |
|
125 { |
|
126 CDesCArrayFlat* items = new ( ELeave ) CDesCArrayFlat( 2 ); |
|
127 CleanupStack::PushL( items ); |
|
128 |
|
129 HBufC* onItem = StringLoader::LoadLC( |
|
130 R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_ON ); |
|
131 items->AppendL( *onItem ); |
|
132 CleanupStack::PopAndDestroy( onItem ); |
|
133 |
|
134 HBufC* offItem = StringLoader::LoadLC( |
|
135 R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_OFF ); |
|
136 items->AppendL( *offItem ); |
|
137 CleanupStack::PopAndDestroy( offItem ); |
|
138 |
|
139 TInt index( 0 ); |
|
140 CAknListQueryDialog* dialog = |
|
141 new ( ELeave ) CAknListQueryDialog( &index ); |
|
142 |
|
143 dialog->PrepareLC( R_CSCSETTINGSUI_HANDOVER_NOTIFICATION_TONE_QUERY ); |
|
144 dialog->SetItemTextArray( items ); |
|
145 dialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
146 |
|
147 if ( dialog->RunLD() ) |
|
148 { |
|
149 // Update setting according user selection |
|
150 if ( 0 == index ) |
|
151 { |
|
152 // Set handover notification tone setting value on |
|
153 iModel.SettingsHandler().SetHandoverNotifTonePrefL( |
|
154 iModel.CurrentSPEntryId(), EOn ); |
|
155 } |
|
156 else if ( 1 == index ) |
|
157 { |
|
158 // Set handover notification tone setting value off |
|
159 iModel.SettingsHandler().SetHandoverNotifTonePrefL( |
|
160 iModel.CurrentSPEntryId(), EOff ); |
|
161 } |
|
162 else |
|
163 { |
|
164 // invalid index |
|
165 User::Leave( KErrGeneral ); |
|
166 } |
|
167 } |
|
168 else |
|
169 { |
|
170 // cancelled |
|
171 } |
|
172 |
|
173 CleanupStack::PopAndDestroy( items ); |
|
174 UpdateContainerL(); |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------------------------- |
|
178 // CCSCSettingsUiMainContainer::PresenceReqPrefQueryL |
|
179 // Shows a query which changes presence request preference for service. |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 void CCSCSettingsUiMainContainer::PresenceReqPrefQueryL() |
|
183 { |
|
184 CDesCArrayFlat* items = new ( ELeave ) CDesCArrayFlat( 2 ); |
|
185 CleanupStack::PushL( items ); |
|
186 |
|
187 HBufC* alwaysAskItem = StringLoader::LoadLC( |
|
188 R_CSCSETTINGSUI_PRES_PREF_ALWAYS_ASK ); |
|
189 items->AppendL( *alwaysAskItem ); |
|
190 CleanupStack::PopAndDestroy( alwaysAskItem ); |
|
191 |
|
192 HBufC* autoAcceptItem = StringLoader::LoadLC( |
|
193 R_CSCSETTINGSUI_PRES_PREF_ACCEPT_AUTOMATICALLY ); |
|
194 items->AppendL( *autoAcceptItem ); |
|
195 CleanupStack::PopAndDestroy( autoAcceptItem ); |
|
196 |
|
197 TInt index( 0 ); |
|
198 CAknListQueryDialog* dialog = |
|
199 new ( ELeave ) CAknListQueryDialog( &index ); |
|
200 |
|
201 dialog->PrepareLC( R_CSCSETTINGSUI_PRESENCE_REQUEST_PREF_QUERY ); |
|
202 dialog->SetItemTextArray( items ); |
|
203 dialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
204 |
|
205 if ( dialog->RunLD() ) |
|
206 { |
|
207 // Update setting according user selection |
|
208 if ( 0 == index ) |
|
209 { |
|
210 // Set presence request preference setting value |
|
211 iModel.SettingsHandler().SetPresenceReqPrefL( |
|
212 iModel.CurrentSPEntryId(), EOff ); |
|
213 } |
|
214 else if ( 1 == index ) |
|
215 { |
|
216 // Set presence request preference setting value |
|
217 iModel.SettingsHandler().SetPresenceReqPrefL( |
|
218 iModel.CurrentSPEntryId(), EOn ); |
|
219 } |
|
220 else |
|
221 { |
|
222 // invalid index |
|
223 User::Leave( KErrGeneral ); |
|
224 } |
|
225 } |
|
226 else |
|
227 { |
|
228 // canceled |
|
229 } |
|
230 |
|
231 CleanupStack::PopAndDestroy( items ); |
|
232 UpdateContainerL(); |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // CCSCSettingsUiMainContainer::SaveImTonePathL |
|
237 // Saves Im tone path to permanent storage. |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 void CCSCSettingsUiMainContainer::SaveImTonePathL( const TDesC& aTonePath ) |
|
241 { |
|
242 MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC(); |
|
243 |
|
244 User::LeaveIfError( settings->SetL( |
|
245 iModel.CurrentSPEntryId(), EServiceToneFileName, aTonePath ) ); |
|
246 |
|
247 CleanupStack::PopAndDestroy(); |
|
248 } |
|
249 |
|
250 // --------------------------------------------------------------------------- |
|
251 // CCSCSettingsUiMainContainer::ListBox |
|
252 // Returns handle to the listbox. |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 CAknSettingStyleListBox* CCSCSettingsUiMainContainer::ListBox() |
|
256 { |
|
257 return iListBox; |
|
258 } |
|
259 |
|
260 |
|
261 // --------------------------------------------------------------------------- |
|
262 // CCSCSettingsUiMainContainer::CurrentItemIndex |
|
263 // Returns index of selected listbox item. |
|
264 // --------------------------------------------------------------------------- |
|
265 // |
|
266 TMainListBoxItem CCSCSettingsUiMainContainer::CurrentItem() const |
|
267 { |
|
268 TInt currentItemIndex( iListBox->CurrentItemIndex() ); |
|
269 return iListBoxItemArray[ currentItemIndex ]; |
|
270 } |
|
271 |
|
272 |
|
273 // --------------------------------------------------------------------------- |
|
274 // From class CoeControl |
|
275 // CCSCSettingsUiMainContainer::ComponentControl |
|
276 // --------------------------------------------------------------------------- |
|
277 // |
|
278 CCoeControl* CCSCSettingsUiMainContainer::ComponentControl( |
|
279 TInt /*aIndex*/ ) const |
|
280 { |
|
281 return iListBox; |
|
282 } |
|
283 |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // From class CoeControl |
|
287 // For getting help context |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 void CCSCSettingsUiMainContainer::GetHelpContext( |
|
291 TCoeHelpContext& aContext ) const |
|
292 { |
|
293 aContext.iMajor = KUidCscSettingsUiHelp; |
|
294 aContext.iContext = KSERVTAB_HLP_SETTINGS; |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------------------------- |
|
298 // From class CoeControl |
|
299 // CCSCSettingsUiMainContainer::OfferKeyEventL |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 TKeyResponse CCSCSettingsUiMainContainer::OfferKeyEventL( |
|
303 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
304 { |
|
305 TKeyResponse response = EKeyWasNotConsumed; |
|
306 response = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
307 |
|
308 if ( EKeyUpArrow == aKeyEvent.iCode || |
|
309 EKeyDownArrow == aKeyEvent.iCode ) |
|
310 { |
|
311 iModel.UpdateSoftkeys(); |
|
312 } |
|
313 |
|
314 return response; |
|
315 } |
|
316 |
|
317 |
|
318 // --------------------------------------------------------------------------- |
|
319 // From class CoeControl |
|
320 // CCSCSettingsUiMainContainer::HandleResourceChange |
|
321 // --------------------------------------------------------------------------- |
|
322 // |
|
323 void CCSCSettingsUiMainContainer::HandleResourceChange( TInt aType ) |
|
324 { |
|
325 if( aType == KAknsMessageSkinChange || |
|
326 aType == KEikDynamicLayoutVariantSwitch ) |
|
327 { |
|
328 TRect mainPaneRect; |
|
329 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
330 mainPaneRect ); |
|
331 SetRect( mainPaneRect ); |
|
332 DrawNow(); |
|
333 } |
|
334 |
|
335 CCoeControl::HandleResourceChange( aType ); |
|
336 } |
|
337 |
|
338 |
|
339 // --------------------------------------------------------------------------- |
|
340 // CCSCSettingsUiMainContainer::ConstructListBoxL |
|
341 // Creates listbox item for setting items. |
|
342 // --------------------------------------------------------------------------- |
|
343 // |
|
344 void CCSCSettingsUiMainContainer::ConstructListBoxL() |
|
345 { |
|
346 CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructListBoxL - begin" ); |
|
347 |
|
348 // Create listbox and array for listbox items. |
|
349 iListBox = new( ELeave ) CAknSettingStyleListBox; |
|
350 iListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
351 iListBox->CreateScrollBarFrameL( ETrue ); |
|
352 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
353 CEikScrollBarFrame::EOff, |
|
354 CEikScrollBarFrame::EAuto ); |
|
355 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
356 CDesCArrayFlat* itemsArray = |
|
357 new ( ELeave ) CDesCArrayFlat( KCSCSettingsUiArrayGranularity ); |
|
358 iListBox->Model()->SetItemTextArray( itemsArray ); |
|
359 |
|
360 // Initialize setting items. |
|
361 InitializeSettingItemsL(); |
|
362 |
|
363 CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructListBoxL - end" ); |
|
364 } |
|
365 |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // CCSCSettingsUiMainContainer::InitializeSettingItemsL |
|
369 // Draws setting items at the first time after the initialization is completed |
|
370 // --------------------------------------------------------------------------- |
|
371 // |
|
372 void CCSCSettingsUiMainContainer::InitializeSettingItemsL() |
|
373 { |
|
374 CSCSETUIDEBUG( |
|
375 "CCSCSettingsUiMainContainer::InitializeSettingItemsL - begin" ); |
|
376 |
|
377 // Get supported subservices |
|
378 TSupportedSubServices supSubServices; |
|
379 iModel.CCHHandler().SupportedSubServicesL( |
|
380 iModel.CurrentSPEntryId(), supSubServices ); |
|
381 |
|
382 // Make username setting |
|
383 MakeSettingItemL ( TMainListBoxItem::EUsername ); |
|
384 |
|
385 // Make password setting |
|
386 MakeSettingItemL ( TMainListBoxItem::EPassword ); |
|
387 |
|
388 // Make preferred service setting item if voip subservice is supported |
|
389 if ( supSubServices.iVoIP ) |
|
390 { |
|
391 TBool isSipVoip( EFalse ); |
|
392 TRAPD( err, isSipVoip = iModel.SettingsHandler().IsSipVoIPL( |
|
393 iModel.CurrentSPEntryId() ) ); |
|
394 |
|
395 if ( !err ) |
|
396 { |
|
397 if ( isSipVoip && iModel.SettingsHandler().IsVccSupportedL( |
|
398 iModel.CurrentSPEntryId() ) ) |
|
399 { |
|
400 // If VCC is supported make vcc preferred setting item |
|
401 // and handover notification tone setting item |
|
402 MakeSettingItemL ( TMainListBoxItem::EVccPreferredService ); |
|
403 MakeSettingItemL ( TMainListBoxItem::EHandoverNotifTone ); |
|
404 } |
|
405 else |
|
406 { |
|
407 // If VCC is not supported make just preferred service setting |
|
408 MakeSettingItemL ( TMainListBoxItem::EPreferredService ); |
|
409 } |
|
410 } |
|
411 } |
|
412 |
|
413 // Make setting item if IM is supported by service |
|
414 if ( supSubServices.iIm ) |
|
415 { |
|
416 // IM tone setting. |
|
417 MakeSettingItemL( TMainListBoxItem::EImTone ); |
|
418 } |
|
419 |
|
420 // Make setting item if presence is supported by service |
|
421 if ( supSubServices.iPresence ) |
|
422 { |
|
423 // Presence request preference |
|
424 MakeSettingItemL( TMainListBoxItem::EAutoacceptInv ); |
|
425 } |
|
426 |
|
427 // Connectivity setting (cannot be changed) |
|
428 MakeSettingItemL( TMainListBoxItem::EServiceConn ); |
|
429 |
|
430 |
|
431 CSCSETUIDEBUG( |
|
432 "CCSCSettingsUiMainContainer::InitializeSettingItemsL - end" ); |
|
433 } |
|
434 |
|
435 |
|
436 // --------------------------------------------------------------------------- |
|
437 // CCSCSettingsUiMainContainer::MakeSettingItemL |
|
438 // Constructs setting list items. |
|
439 // --------------------------------------------------------------------------- |
|
440 // |
|
441 void CCSCSettingsUiMainContainer::MakeSettingItemL( |
|
442 TMainListBoxItem::TSettingItems aItem ) |
|
443 { |
|
444 CSCSETUIDEBUG( |
|
445 "CCSCSettingsUiMainContainer::MakeSettingItemL - begin" ); |
|
446 |
|
447 // Get listbox items from model. |
|
448 CTextListBoxModel* model = iListBox->Model(); |
|
449 MDesCArray* textArray = model->ItemTextArray(); |
|
450 CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray ); |
|
451 |
|
452 TBuf<KCSCSettingsUiItemLength> listBoxItemText ( KNullDesC ); |
|
453 |
|
454 TMainListBoxItem listBoxItem; |
|
455 listBoxItem.iItem = aItem; |
|
456 |
|
457 RBuf value; |
|
458 CleanupClosePushL( value ); |
|
459 |
|
460 value.CreateL( 1 ); |
|
461 value.Copy( KNullDesC ); |
|
462 |
|
463 switch ( aItem ) |
|
464 { |
|
465 case TMainListBoxItem::EUsername: |
|
466 { |
|
467 GetUsernameL( value ); |
|
468 break; |
|
469 } |
|
470 case TMainListBoxItem::EPassword: |
|
471 { |
|
472 value.ReAllocL( KEmptyPassword().Length() ); |
|
473 value.Copy( KEmptyPassword ); |
|
474 break; |
|
475 } |
|
476 case TMainListBoxItem::EPreferredService: |
|
477 { |
|
478 GetPreferredServiceSettingL( value ); |
|
479 break; |
|
480 } |
|
481 case TMainListBoxItem::EVccPreferredService: |
|
482 { |
|
483 GetVccPreferredServiceSettingL( value ); |
|
484 break; |
|
485 } |
|
486 case TMainListBoxItem::EHandoverNotifTone: |
|
487 { |
|
488 GetHandoverNotificationTonePrefL( value ); |
|
489 break; |
|
490 } |
|
491 case TMainListBoxItem::EImTone: |
|
492 { |
|
493 GetImToneSettingL( value ); |
|
494 break; |
|
495 } |
|
496 case TMainListBoxItem::EAutoacceptInv: |
|
497 { |
|
498 GetPresencePrefSettingL( value ); |
|
499 break; |
|
500 } |
|
501 case TMainListBoxItem::EServiceConn: |
|
502 { |
|
503 TRAP_IGNORE( GetSnapSettingL( value ) ); |
|
504 break; |
|
505 } |
|
506 default: |
|
507 User::Leave( KErrArgument ); |
|
508 break; |
|
509 } |
|
510 |
|
511 listBoxItemText.Format( |
|
512 KCSCSettingsUiListItemTextFormat, |
|
513 GetCaptionL( aItem ), |
|
514 &value ); |
|
515 |
|
516 CleanupStack::PopAndDestroy( &value ); |
|
517 |
|
518 // Add to listbox |
|
519 iListBoxItemArray.Append( listBoxItem ); |
|
520 listBoxItems->AppendL( listBoxItemText ); |
|
521 iListBox->HandleItemAdditionL(); |
|
522 |
|
523 CSCSETUIDEBUG( |
|
524 "CCSCSettingsUiMainContainer::MakeSettingItemL - end" ); |
|
525 } |
|
526 |
|
527 |
|
528 // --------------------------------------------------------------------------- |
|
529 // CCSCSettingsUiMainContainer::GetCaptionL |
|
530 // Constructs setting list items. |
|
531 // --------------------------------------------------------------------------- |
|
532 // |
|
533 HBufC* CCSCSettingsUiMainContainer::GetCaptionL( |
|
534 TMainListBoxItem::TSettingItems aItem ) |
|
535 { |
|
536 if( iCaption != NULL ) |
|
537 { |
|
538 delete iCaption; |
|
539 iCaption = NULL; |
|
540 } |
|
541 |
|
542 switch ( aItem ) |
|
543 { |
|
544 case TMainListBoxItem::EUsername: |
|
545 { |
|
546 iCaption = StringLoader::LoadL( |
|
547 R_CSCSETTINGSUI_SETTING_USERNAME_TITLE ); |
|
548 break; |
|
549 } |
|
550 case TMainListBoxItem::EPassword: |
|
551 { |
|
552 iCaption = StringLoader::LoadL( |
|
553 R_CSCSETTINGSUI_SETTING_PASSWORD_TITLE ); |
|
554 break; |
|
555 } |
|
556 case TMainListBoxItem::EPreferredService: |
|
557 { |
|
558 iCaption = StringLoader::LoadL( |
|
559 R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_TITLE ); |
|
560 break; |
|
561 } |
|
562 case TMainListBoxItem::EVccPreferredService: |
|
563 { |
|
564 iCaption = StringLoader::LoadL( |
|
565 R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_TITLE ); |
|
566 break; |
|
567 } |
|
568 case TMainListBoxItem::EHandoverNotifTone: |
|
569 { |
|
570 iCaption = StringLoader::LoadL( |
|
571 R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_TITLE ); |
|
572 break; |
|
573 } |
|
574 case TMainListBoxItem::EImTone: |
|
575 { |
|
576 iCaption = StringLoader::LoadL( |
|
577 R_CSCSETTINGSUI_SETTING_IM_TONE_TITLE ); |
|
578 break; |
|
579 } |
|
580 case TMainListBoxItem::EAutoacceptInv: |
|
581 { |
|
582 iCaption = StringLoader::LoadL( |
|
583 R_CSCSETTINGSUI_PRESENCE_REQUEST_PREF_TEXT ); |
|
584 break; |
|
585 } |
|
586 case TMainListBoxItem::EServiceConn: |
|
587 { |
|
588 iCaption = StringLoader::LoadL( |
|
589 R_CSCSETTINGSUI_SERVICE_CONNECTIVITY_TEXT ); |
|
590 break; |
|
591 } |
|
592 default: |
|
593 User::Leave( KErrArgument ); |
|
594 break; |
|
595 } |
|
596 |
|
597 return iCaption; |
|
598 } |
|
599 |
|
600 // --------------------------------------------------------------------------- |
|
601 // CCSCSettingsUiMainContainer::GetUsername |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 void CCSCSettingsUiMainContainer::GetUsernameL( RBuf& aUsername ) |
|
605 { |
|
606 aUsername.ReAllocL( KCCHMaxUsernameLength ); |
|
607 User::LeaveIfError( iModel.CCHHandler().GetConnectionParameter( |
|
608 iModel.CurrentSPEntryId(), ECchUsername, aUsername ) ); |
|
609 } |
|
610 |
|
611 |
|
612 // --------------------------------------------------------------------------- |
|
613 // CCSCSettingsUiMainContainer::GetPresencePrefSettingL |
|
614 // --------------------------------------------------------------------------- |
|
615 // |
|
616 void CCSCSettingsUiMainContainer::GetPreferredServiceSettingL( RBuf& aValue ) |
|
617 { |
|
618 // Select text resource for the current pref telephony value |
|
619 TInt resource = ( iModel.SettingsHandler().IsPreferredTelephonyVoip() && |
|
620 iModel.SettingsHandler().IsPreferredService( |
|
621 iModel.CurrentSPEntryId() ) ) ? |
|
622 R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_ON : |
|
623 R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_OFF; |
|
624 |
|
625 HBufC* value = StringLoader::LoadLC( resource ); |
|
626 aValue.ReAllocL( value->Length() ); |
|
627 aValue.Copy( value->Des() ); |
|
628 CleanupStack::PopAndDestroy( value ); |
|
629 } |
|
630 |
|
631 |
|
632 // --------------------------------------------------------------------------- |
|
633 // CCSCSettingsUiMainContainer::GetVccPreferredServiceSettingL |
|
634 // --------------------------------------------------------------------------- |
|
635 // |
|
636 void CCSCSettingsUiMainContainer::GetVccPreferredServiceSettingL( RBuf& aValue ) |
|
637 { |
|
638 // Select text resource for the current pref telephony value |
|
639 TInt resource = ( iModel.SettingsHandler().IsPreferredTelephonyVoip() && |
|
640 iModel.SettingsHandler().IsPreferredService( |
|
641 iModel.CurrentSPEntryId() ) ) ? |
|
642 R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_ON : |
|
643 R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_OFF; |
|
644 |
|
645 HBufC* value = StringLoader::LoadLC( resource ); |
|
646 aValue.ReAllocL( value->Length() ); |
|
647 aValue.Copy( value->Des() ); |
|
648 CleanupStack::PopAndDestroy( value ); |
|
649 } |
|
650 |
|
651 |
|
652 // --------------------------------------------------------------------------- |
|
653 // CCSCSettingsUiMainContainer::GetHandoverNotificationToneL |
|
654 // --------------------------------------------------------------------------- |
|
655 // |
|
656 void CCSCSettingsUiMainContainer::GetHandoverNotificationTonePrefL( |
|
657 RBuf& aValue ) |
|
658 { |
|
659 HBufC* value = NULL; |
|
660 TOnOff onOff = EOff; |
|
661 |
|
662 TRAPD( err, onOff = iModel.SettingsHandler().HandoverNotifTonePrefL( |
|
663 iModel.CurrentSPEntryId() ) ); |
|
664 |
|
665 if ( KErrNotFound == err ) |
|
666 { |
|
667 iModel.SettingsHandler().SetHandoverNotifTonePrefL( |
|
668 iModel.CurrentSPEntryId(), EOff ); |
|
669 } |
|
670 else if ( err ) |
|
671 { |
|
672 User::Leave( err ); |
|
673 } |
|
674 else |
|
675 { |
|
676 // nothing to do |
|
677 } |
|
678 |
|
679 if ( EOff == onOff ) |
|
680 { |
|
681 value = StringLoader::LoadLC( |
|
682 R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_OFF ); |
|
683 } |
|
684 else if ( EOn == onOff) |
|
685 { |
|
686 value = StringLoader::LoadLC( |
|
687 R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_ON ); |
|
688 } |
|
689 else if ( EOONotSet == onOff ) |
|
690 { |
|
691 iModel.SettingsHandler().SetHandoverNotifTonePrefL( |
|
692 iModel.CurrentSPEntryId(), EOff ); |
|
693 |
|
694 value = StringLoader::LoadLC( |
|
695 R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_OFF ); |
|
696 } |
|
697 else |
|
698 { |
|
699 User::Leave( KErrGeneral ); |
|
700 } |
|
701 |
|
702 aValue.ReAllocL( value->Length() ); |
|
703 aValue.Copy( value->Des() ); |
|
704 |
|
705 CleanupStack::PopAndDestroy( value ); |
|
706 } |
|
707 |
|
708 |
|
709 // --------------------------------------------------------------------------- |
|
710 // CCSCSettingsUiMainContainer::GetImToneSettingL |
|
711 // --------------------------------------------------------------------------- |
|
712 // |
|
713 void CCSCSettingsUiMainContainer::GetImToneSettingL( RBuf& aValue ) |
|
714 { |
|
715 aValue.ReAllocL( KCSCMaxImToneLength ); |
|
716 |
|
717 MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC(); |
|
718 |
|
719 TInt err = settings->GetL( |
|
720 iModel.CurrentSPEntryId(), EServiceToneFileName, aValue ); |
|
721 |
|
722 // If tone path is not found from settings, set Off text |
|
723 if ( KErrNotFound == err || aValue.Length() < 2 ) |
|
724 { |
|
725 HBufC* noToneSelected = StringLoader::LoadLC( |
|
726 R_CSCSETTINGSUI_IM_TONE_OFF ); |
|
727 |
|
728 User::LeaveIfError( settings->SetL( |
|
729 iModel.CurrentSPEntryId(), EServiceToneFileName, *noToneSelected ) ); |
|
730 |
|
731 // Get tone. |
|
732 User::LeaveIfError( settings->GetL( |
|
733 iModel.CurrentSPEntryId(), EServiceToneFileName, aValue ) ); |
|
734 |
|
735 CleanupStack::PopAndDestroy( noToneSelected ); |
|
736 } |
|
737 else if ( err ) |
|
738 { |
|
739 User::Leave( err ); |
|
740 } |
|
741 else |
|
742 { |
|
743 // KErrNone -> do nothing |
|
744 } |
|
745 |
|
746 TInt pos( 0 ); |
|
747 while ( KErrNotFound != pos ) |
|
748 { |
|
749 pos = aValue.Find( KDoubleBackSlash ); |
|
750 aValue.Delete( 0, pos+1 ); |
|
751 } |
|
752 |
|
753 CleanupStack::PopAndDestroy(); |
|
754 } |
|
755 |
|
756 |
|
757 // --------------------------------------------------------------------------- |
|
758 // CCSCSettingsUiMainContainer::GetPresencePrefSettingL |
|
759 // --------------------------------------------------------------------------- |
|
760 // |
|
761 void CCSCSettingsUiMainContainer::GetPresencePrefSettingL( RBuf& aValue ) |
|
762 { |
|
763 HBufC* value = NULL; |
|
764 TOnOff onOff = EOff; |
|
765 |
|
766 TRAPD( err, onOff = iModel.SettingsHandler().PresenceReqPrefL( |
|
767 iModel.CurrentSPEntryId() ) ); |
|
768 |
|
769 if ( KErrNotFound == err ) |
|
770 { |
|
771 iModel.SettingsHandler().SetPresenceReqPrefL( |
|
772 iModel.CurrentSPEntryId(), EOff ); |
|
773 } |
|
774 else if ( err ) |
|
775 { |
|
776 User::Leave( err ); |
|
777 } |
|
778 else |
|
779 { |
|
780 // nothing to do |
|
781 } |
|
782 |
|
783 if ( EOff == onOff ) |
|
784 { |
|
785 value = StringLoader::LoadLC( |
|
786 R_CSCSETTINGSUI_PRES_PREF_ALWAYS_ASK ); |
|
787 } |
|
788 else if ( EOn == onOff) |
|
789 { |
|
790 value = StringLoader::LoadLC( |
|
791 R_CSCSETTINGSUI_PRES_PREF_ACCEPT_AUTOMATICALLY ); |
|
792 } |
|
793 else if ( EOONotSet == onOff ) |
|
794 { |
|
795 // Set presence request preference setting default value "off" |
|
796 iModel.SettingsHandler().SetPresenceReqPrefL( |
|
797 iModel.CurrentSPEntryId(), EOff ); |
|
798 |
|
799 value = StringLoader::LoadLC( |
|
800 R_CSCSETTINGSUI_PRES_PREF_ALWAYS_ASK ); |
|
801 } |
|
802 else |
|
803 { |
|
804 User::Leave( KErrGeneral ); |
|
805 } |
|
806 |
|
807 aValue.ReAllocL( value->Length() ); |
|
808 aValue.Copy( value->Des() ); |
|
809 |
|
810 CleanupStack::PopAndDestroy( value ); |
|
811 } |
|
812 |
|
813 |
|
814 // --------------------------------------------------------------------------- |
|
815 // CCSCSettingsUiMainContainer::GetSnapSettingL |
|
816 // --------------------------------------------------------------------------- |
|
817 // |
|
818 void CCSCSettingsUiMainContainer::GetSnapSettingL( RBuf& aValue ) |
|
819 { |
|
820 // Get Snap name |
|
821 HBufC* snapName = NULL; |
|
822 TInt snapId( 0 ); |
|
823 TInt err = iModel.CCHHandler().GetConnectionParameter( |
|
824 iModel.CurrentSPEntryId(), ECchSnapId, snapId ); |
|
825 |
|
826 // If no error, try to get snap name. |
|
827 if ( KErrNone == err ) |
|
828 { |
|
829 snapName = iModel.DestinationsHandler().SnapNameL( snapId ); |
|
830 |
|
831 if ( snapName ) |
|
832 { |
|
833 CleanupStack::PushL( snapName ); |
|
834 aValue.ReAllocL( snapName->Length() ); |
|
835 aValue.Copy( snapName->Des() ); |
|
836 CleanupStack::PopAndDestroy( snapName ); |
|
837 } |
|
838 } |
|
839 } |
|
840 |
|
841 |
|
842 // --------------------------------------------------------------------------- |
|
843 // From class CoeControl |
|
844 // CCSCSettingsUiMainContainer::CountComponentControls |
|
845 // --------------------------------------------------------------------------- |
|
846 // |
|
847 TInt CCSCSettingsUiMainContainer::CountComponentControls() const |
|
848 { |
|
849 return 1; |
|
850 } |
|
851 |
|
852 |
|
853 // --------------------------------------------------------------------------- |
|
854 // From class CoeControl |
|
855 // CCSCSettingsUiMainContainer::SizeChanged |
|
856 // --------------------------------------------------------------------------- |
|
857 // |
|
858 void CCSCSettingsUiMainContainer::SizeChanged() |
|
859 { |
|
860 iListBox->SetRect( Rect() ); |
|
861 } |
|
862 |
|
863 |
|
864 // --------------------------------------------------------------------------- |
|
865 // From class CoeControl |
|
866 // CCSCSettingsUiMainContainer::FocusChanged |
|
867 // --------------------------------------------------------------------------- |
|
868 // |
|
869 void CCSCSettingsUiMainContainer::FocusChanged( |
|
870 TDrawNow aDrawNow ) |
|
871 { |
|
872 CCoeControl::FocusChanged( aDrawNow ); |
|
873 |
|
874 if( iListBox ) |
|
875 { |
|
876 iListBox->SetFocus( IsFocused() ); |
|
877 } |
|
878 } |