author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:02:05 +0300 | |
branch | RCL_3 |
changeset 29 | 755430a7d64b |
parent 28 | d38647835c2e |
child 33 | 2989b291cac7 |
permissions | -rw-r--r-- |
28 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 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 CSCSettingsUiMainView methods |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include <hlplch.h> |
|
20 |
#include <aknview.h> |
|
21 |
#include <featmgr.h> |
|
22 |
#include <akntitle.h> |
|
23 |
#include <aknlists.h> |
|
24 |
#include <cchclient.h> |
|
25 |
#include <e32property.h> |
|
26 |
#include <aknViewAppUi.h> |
|
27 |
#include <StringLoader.h> |
|
28 |
#include <cmsettingsui.h> |
|
29 |
#include <xSPViewServices.h> |
|
30 |
#include <aknnotewrappers.h> |
|
31 |
#include <cscsettingsui.rsg> |
|
32 |
#include <ctsydomainpskeys.h> |
|
33 |
#include <akntextsettingpage.h> |
|
34 |
#include <cvimpstsettingsstore.h> |
|
35 |
#include <DRMHelper.h> |
|
36 |
#include <mediafilelist.h> |
|
37 |
#include <aknpasswordsettingpage.h> |
|
38 |
#include <aknradiobuttonsettingpage.h> |
|
39 |
#include <aknnavi.h> |
|
40 |
#include <aknnavide.h> |
|
41 |
#include <vwsdef.h> |
|
42 |
#include <AknDef.h> |
|
43 |
||
44 |
#include "cscconstants.h" |
|
45 |
#include "cscsettingsui.hrh" |
|
46 |
#include "cscsettingsuimodel.h" |
|
47 |
#include "cscsettingsuilogger.h" |
|
48 |
#include "cscengservicehandler.h" |
|
49 |
#include "cscengbrandinghandler.h" |
|
50 |
#include "cscsettingsuimainview.h" |
|
51 |
#include "cscsettingsuiconstants.h" |
|
52 |
#include "cscengservicepluginhandler.h" |
|
53 |
#include "cscappui.h" |
|
54 |
||
55 |
||
56 |
#define AppUi() (static_cast<CAknViewAppUi*>(iAvkonAppUi) ) |
|
57 |
||
58 |
// Preferred service not set |
|
59 |
const TInt KPrefServiceNotSet = 0; |
|
60 |
||
61 |
// ======== MEMBER FUNCTIONS ======== |
|
62 |
||
63 |
// --------------------------------------------------------------------------- |
|
64 |
// --------------------------------------------------------------------------- |
|
65 |
// |
|
66 |
CCSCSettingsUiMainView::CCSCSettingsUiMainView( |
|
67 |
CCSCSettingsUiModel& aModel ) |
|
68 |
: iModel( aModel ) |
|
69 |
{ |
|
70 |
} |
|
71 |
||
72 |
||
73 |
// --------------------------------------------------------------------------- |
|
74 |
// --------------------------------------------------------------------------- |
|
75 |
// |
|
76 |
void CCSCSettingsUiMainView::ConstructL() |
|
77 |
{ |
|
78 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ConstructL - begin" ); |
|
79 |
||
80 |
BaseConstructL( R_CSCSETTINGSUI_MAINVIEW ); |
|
81 |
||
82 |
// Get handle to titlepane |
|
83 |
CEikStatusPane* statusPane = StatusPane(); |
|
84 |
iTitlePane = static_cast<CAknTitlePane*> |
|
85 |
( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
86 |
||
87 |
iImToneSelectionListOpen = EFalse; |
|
88 |
iSnapListOpen = EFalse; |
|
89 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ConstructL - end" ); |
|
90 |
} |
|
91 |
||
92 |
||
93 |
// --------------------------------------------------------------------------- |
|
94 |
// --------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
CCSCSettingsUiMainView* CCSCSettingsUiMainView::NewL( |
|
97 |
CCSCSettingsUiModel& aModel ) |
|
98 |
{ |
|
99 |
CCSCSettingsUiMainView* self = CCSCSettingsUiMainView::NewLC( aModel ); |
|
100 |
CleanupStack::Pop( self ); |
|
101 |
return self; |
|
102 |
} |
|
103 |
||
104 |
||
105 |
// --------------------------------------------------------------------------- |
|
106 |
// --------------------------------------------------------------------------- |
|
107 |
// |
|
108 |
CCSCSettingsUiMainView* CCSCSettingsUiMainView::NewLC( |
|
109 |
CCSCSettingsUiModel& aModel ) |
|
110 |
{ |
|
111 |
CCSCSettingsUiMainView* self = |
|
112 |
new ( ELeave ) CCSCSettingsUiMainView( aModel ); |
|
113 |
CleanupStack::PushL( self ); |
|
114 |
self->ConstructL(); |
|
115 |
return self; |
|
116 |
} |
|
117 |
||
118 |
||
119 |
// --------------------------------------------------------------------------- |
|
120 |
// --------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
CCSCSettingsUiMainView::~CCSCSettingsUiMainView() |
|
123 |
{ |
|
124 |
CSCSETUIDEBUG( |
|
125 |
"CCSCSettingsUiMainView::~CCSCSettingsUiMainView - begin" ); |
|
126 |
||
127 |
// Delete container when view is deactivated. |
|
128 |
if ( iContainer ) |
|
129 |
{ |
|
130 |
AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
131 |
delete iContainer; |
|
132 |
} |
|
133 |
||
134 |
delete iNaviDecorator; |
|
135 |
||
136 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::~CCSCSettingsUiMainView - end" ); |
|
137 |
} |
|
138 |
||
139 |
||
140 |
// --------------------------------------------------------------------------- |
|
141 |
// CCSCSettingsUiMainView::UpdateSoftkeysL |
|
142 |
// Processes situation when it�s notified that softkeys need to be changed. |
|
143 |
// --------------------------------------------------------------------------- |
|
144 |
// |
|
145 |
void CCSCSettingsUiMainView::UpdateSoftkeysL( ) |
|
146 |
{ |
|
147 |
// not used |
|
148 |
} |
|
149 |
||
150 |
||
151 |
// --------------------------------------------------------------------------- |
|
152 |
// From CAknView. |
|
153 |
// CCSCSettingsUiMainView::Id |
|
154 |
// --------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
TUid CCSCSettingsUiMainView::Id() const |
|
157 |
{ |
|
158 |
return KCSCSettingsUiMainViewId; |
|
159 |
} |
|
160 |
||
161 |
// --------------------------------------------------------------------------- |
|
162 |
// CCSCSettingsUiMainView::SetTitleTextL |
|
163 |
// Changes given service name to title pane. |
|
164 |
// --------------------------------------------------------------------------- |
|
165 |
// |
|
166 |
void CCSCSettingsUiMainView::SetTitleTextL() |
|
167 |
{ |
|
168 |
// Create text and set it to titlepane. |
|
169 |
TBuf<KCSCSettingsUiItemLength> titleText ( KNullDesC ); |
|
170 |
TUint entryId = iModel.CurrentSPEntryId(); |
|
171 |
titleText = iModel.SettingsHandler().ServiceNameL( entryId ); |
|
172 |
HBufC* text = StringLoader::LoadLC( |
|
173 |
R_CSCSETTINGSUI_MAINVIEW_TITLE, |
|
174 |
titleText ); |
|
175 |
iTitlePane->SetTextL( *text ); |
|
176 |
CleanupStack::PopAndDestroy( text ); |
|
177 |
} |
|
178 |
||
179 |
// --------------------------------------------------------------------------- |
|
180 |
// CCSCSettingsUiMainView::IsEditPreferredServiceSettingAllowedL |
|
181 |
// For checking if editing of preferred service setting is allowed |
|
182 |
// --------------------------------------------------------------------------- |
|
183 |
// |
|
184 |
TBool CCSCSettingsUiMainView::IsEditPreferredServiceSettingAllowedL() |
|
185 |
{ |
|
186 |
TBool allowed( EFalse ); |
|
187 |
TInt value( KErrNotFound ); |
|
188 |
||
189 |
User::LeaveIfError( |
|
190 |
RProperty::Get( |
|
191 |
KPSUidCtsyCallInformation, |
|
192 |
KCTsyCallState, |
|
193 |
value ) ); |
|
194 |
||
195 |
// Editing is allowed if no ongoing call. |
|
196 |
if ( EPSCTsyCallStateNone == value ) |
|
197 |
{ |
|
198 |
allowed = ETrue; |
|
199 |
} |
|
200 |
else |
|
201 |
{ |
|
202 |
// Show unable to change settings note |
|
203 |
HBufC* string = NULL; |
|
204 |
string = StringLoader::LoadL( |
|
205 |
R_CSCSETTINGSUI_UNABLE_TO_EDIT_SETTING_NOTE ); |
|
206 |
||
207 |
if ( string ) |
|
208 |
{ |
|
209 |
// Set text and show note. |
|
210 |
CleanupStack::PushL( string ); |
|
211 |
CAknInformationNote* note = |
|
212 |
new ( ELeave ) CAknInformationNote( ETrue ); |
|
213 |
note->ExecuteLD( *string ); |
|
214 |
CleanupStack::PopAndDestroy( string ); |
|
215 |
} |
|
216 |
} |
|
217 |
||
218 |
return allowed; |
|
219 |
} |
|
220 |
||
221 |
// --------------------------------------------------------------------------- |
|
222 |
// From CEikAppUi |
|
223 |
// CCSCSettingsUiMainView::HandleCommandL |
|
224 |
// --------------------------------------------------------------------------- |
|
225 |
// |
|
226 |
void CCSCSettingsUiMainView::HandleCommandL( TInt aCommand ) |
|
227 |
{ |
|
228 |
CSCSETUIDEBUG2( "CCSCSettingsUiMainView::HandleCommandL: command=%d", |
|
229 |
aCommand ); |
|
230 |
||
231 |
TMainListBoxItem listBoxItem = iContainer->CurrentItem(); |
|
232 |
||
233 |
switch ( aCommand ) |
|
234 |
{ |
|
235 |
case ECSCMSKSettingsUiChange: |
|
236 |
{ |
|
237 |
HandleMskChangeSelectionL( listBoxItem ); |
|
238 |
break; |
|
239 |
} |
|
240 |
case ECSCSettingsUiOpen: |
|
241 |
case ECSCSettingsUiChange: |
|
242 |
{ |
|
243 |
HandleListBoxSelectionL(); |
|
244 |
break; |
|
245 |
} |
|
246 |
case EAknCmdHelp: |
|
247 |
{ |
|
248 |
if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
249 |
{ |
|
250 |
CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL(); |
|
251 |
HlpLauncher::LaunchHelpApplicationL( |
|
252 |
iEikonEnv->WsSession(), buf ); |
|
253 |
} |
|
254 |
break; |
|
255 |
} |
|
256 |
case EAknSoftkeyBack: |
|
257 |
{ |
|
258 |
HandleReturnToPreviousViewL(); |
|
259 |
break; |
|
260 |
} |
|
261 |
case ECSCSettingsUiDelete: |
|
262 |
{ |
|
263 |
CSCSETUIDEBUG( " HandleCommandL - delete service" ); |
|
264 |
iDeleted = iContainer->DeleteServiceL(); |
|
265 |
HandleReturnToPreviousViewL( EFalse ); |
|
266 |
break; |
|
267 |
} |
|
268 |
case EEikCmdExit: |
|
269 |
case EAknSoftkeyExit: |
|
270 |
{ |
|
271 |
HandleSettingsUiExitL(); |
|
272 |
break; |
|
273 |
} |
|
274 |
default: |
|
275 |
{ |
|
276 |
AppUi()->HandleCommandL( aCommand ); |
|
277 |
break; |
|
278 |
} |
|
279 |
} |
|
280 |
} |
|
281 |
||
282 |
||
283 |
// --------------------------------------------------------------------------- |
|
284 |
// From CAknView |
|
285 |
// CCSCSettingsUiMainView::DoActivateL |
|
286 |
// --------------------------------------------------------------------------- |
|
287 |
// |
|
288 |
void CCSCSettingsUiMainView::DoActivateL( |
|
289 |
const TVwsViewId& /*aPrevViewId*/, |
|
290 |
TUid /*aCustomMessageId*/, |
|
291 |
const TDesC8& /*aCustomMessage*/ ) |
|
292 |
{ |
|
293 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - begin" ); |
|
294 |
||
295 |
// Create container when view is activated. |
|
296 |
if ( !iContainer ) |
|
297 |
{ |
|
298 |
iContainer = new ( ELeave ) CCSCSettingsUiMainContainer( iModel ); |
|
299 |
iContainer->SetMopParent( this ); |
|
300 |
iContainer->ConstructL( ClientRect() ); |
|
301 |
AppUi()->AddToStackL( *this, iContainer ); |
|
302 |
iContainer->ListBox()->SetListBoxObserver( this ); |
|
303 |
} |
|
304 |
||
305 |
SetTitleTextL(); |
|
306 |
UpdateSoftkeysL(); |
|
307 |
iContainer->UpdateContainerL(); |
|
308 |
||
309 |
if ( !iNaviPane ) |
|
310 |
{ |
|
311 |
iNaviPane = static_cast<CAknNavigationControlContainer*>( |
|
312 |
iAvkonAppUi->StatusPane()->ControlL( |
|
313 |
TUid::Uid(EEikStatusPaneUidNavi))); |
|
314 |
} |
|
315 |
||
316 |
if ( !iNaviDecorator ) |
|
317 |
{ |
|
318 |
iNaviDecorator = iNaviPane->CreateNavigationLabelL(); |
|
319 |
iNaviPane->PushL( *iNaviDecorator ); |
|
320 |
} |
|
321 |
||
322 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - end" ); |
|
323 |
} |
|
324 |
||
325 |
||
326 |
// --------------------------------------------------------------------------- |
|
327 |
// From CAknView |
|
328 |
// CCSCSettingsUiMainView::DoDeactivate() |
|
329 |
// --------------------------------------------------------------------------- |
|
330 |
// |
|
331 |
void CCSCSettingsUiMainView::DoDeactivate() |
|
332 |
{ |
|
333 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoDeactivate - begin" ); |
|
334 |
||
335 |
if ( iNaviPane && iNaviDecorator ) |
|
336 |
{ |
|
337 |
iNaviPane->Pop( iNaviDecorator ); |
|
338 |
} |
|
339 |
delete iNaviDecorator; |
|
340 |
iNaviDecorator = NULL; |
|
341 |
||
342 |
// Delete container when view is deactivated. |
|
343 |
if ( iContainer ) |
|
344 |
{ |
|
345 |
AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
346 |
delete iContainer; |
|
347 |
iContainer = NULL; |
|
348 |
} |
|
349 |
||
350 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoDeactivate - end" ); |
|
351 |
} |
|
352 |
||
353 |
||
354 |
// --------------------------------------------------------------------------- |
|
355 |
// From MEikListBoxObserver |
|
356 |
// CSCSettingsUiMainView::HandleListBoxEventL |
|
357 |
// --------------------------------------------------------------------------- |
|
358 |
// |
|
359 |
void CCSCSettingsUiMainView::HandleListBoxEventL( |
|
360 |
CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
361 |
{ |
|
362 |
TMainListBoxItem listBoxItem = iContainer->CurrentItem(); |
|
363 |
||
364 |
switch ( aEventType ) |
|
365 |
{ |
|
366 |
case EEventEnterKeyPressed: |
|
367 |
case EEventItemSingleClicked: |
|
368 |
{ |
|
369 |
if ( TMainListBoxItem::EPreferredService == listBoxItem.iItem || |
|
370 |
TMainListBoxItem::EVccPreferredService == listBoxItem.iItem || |
|
371 |
TMainListBoxItem::EHandoverNotifTone == listBoxItem.iItem ) |
|
372 |
{ |
|
373 |
HandleCommandL( ECSCMSKSettingsUiChange ); |
|
374 |
} |
|
375 |
else |
|
376 |
{ |
|
377 |
HandleListBoxSelectionL(); |
|
378 |
} |
|
379 |
break; |
|
380 |
} |
|
381 |
||
382 |
default: |
|
383 |
break; |
|
384 |
} |
|
385 |
} |
|
386 |
||
387 |
||
388 |
// --------------------------------------------------------------------------- |
|
389 |
// From MEikListBoxObserver |
|
390 |
// CCSCSettingsUiMainView::HandleListBoxSelectionL |
|
391 |
// --------------------------------------------------------------------------- |
|
392 |
// |
|
393 |
void CCSCSettingsUiMainView::HandleListBoxSelectionL() |
|
394 |
{ |
|
395 |
TMainListBoxItem listBoxItem = iContainer->CurrentItem(); |
|
396 |
||
397 |
switch( listBoxItem.iItem ) |
|
398 |
{ |
|
399 |
case TMainListBoxItem::EUsername: |
|
400 |
ShowUsernameSettingPageL(); |
|
401 |
break; |
|
402 |
case TMainListBoxItem::EPassword: |
|
403 |
ShowPasswordSettingPageL(); |
|
404 |
break; |
|
405 |
case TMainListBoxItem::EPreferredService: |
|
406 |
ShowPrefServiceSettingPageL(); |
|
407 |
break; |
|
408 |
case TMainListBoxItem::EVccPreferredService: |
|
409 |
ShowVccPrefServiceSettingPageL(); |
|
410 |
break; |
|
411 |
case TMainListBoxItem::EHandoverNotifTone: |
|
412 |
iContainer->HandoverNotificationToneQueryL(); |
|
413 |
break; |
|
414 |
case TMainListBoxItem::EImTone: |
|
415 |
ShowImToneSelectionListL(); |
|
416 |
break; |
|
417 |
case TMainListBoxItem::EAutoacceptInv: |
|
418 |
iContainer->PresenceReqPrefQueryL(); |
|
419 |
break; |
|
420 |
case TMainListBoxItem::EServiceConn: |
|
421 |
LaunchCMSettingsUiL(); |
|
422 |
break; |
|
423 |
default: |
|
424 |
User::Leave( KErrNotSupported ); |
|
425 |
break; |
|
426 |
} |
|
427 |
} |
|
428 |
||
429 |
||
430 |
// --------------------------------------------------------------------------- |
|
431 |
// From MEikListBoxObserver |
|
432 |
// CCSCSettingsUiMainView::DynInitMenuPaneL |
|
433 |
// --------------------------------------------------------------------------- |
|
434 |
// |
|
435 |
void CCSCSettingsUiMainView::DynInitMenuPaneL( |
|
436 |
TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
437 |
{ |
|
438 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::DynInitMenuPaneL - begin" ); |
|
439 |
||
440 |
if ( aMenuPane && R_CSCSETTINGSUI_MAINVIEW_MENU == aResourceId ) |
|
29
755430a7d64b
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
441 |
{ |
755430a7d64b
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
442 |
// Hide "Change" and "Open". |
755430a7d64b
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
443 |
// Because there is no highlight now. |
755430a7d64b
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
444 |
aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue ); |
755430a7d64b
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
445 |
aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, ETrue ); |
755430a7d64b
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
446 |
|
28 | 447 |
if ( !(iModel.CCHHandler().IsServiceDisabled( |
448 |
iModel.CurrentSPEntryId() ) ) ) |
|
449 |
{ |
|
450 |
aMenuPane->SetItemDimmed( ECSCSettingsUiDelete, ETrue ); |
|
451 |
} |
|
452 |
} |
|
453 |
||
454 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::DynInitMenuPaneL - end" ); |
|
455 |
} |
|
456 |
||
457 |
||
458 |
// --------------------------------------------------------------------------- |
|
459 |
// CCSCSettingsUiMainView::ShowUsernameSettingPageL() |
|
460 |
// Shows username setting page - for username input. |
|
461 |
// --------------------------------------------------------------------------- |
|
462 |
void CCSCSettingsUiMainView::ShowUsernameSettingPageL() |
|
463 |
{ |
|
464 |
// Editing is allowed if service is disabled. |
|
465 |
if ( iModel.CCHHandler().IsServiceDisabled( iModel.CurrentSPEntryId() ) ) |
|
466 |
{ |
|
467 |
RBuf username; |
|
468 |
CleanupClosePushL( username ); |
|
469 |
username.CreateL( KCCHMaxUsernameLength ); |
|
470 |
||
471 |
User::LeaveIfError( |
|
472 |
iModel.CCHHandler().GetConnectionParameter( |
|
473 |
iModel.CurrentSPEntryId(), ECchUsername, username ) ); |
|
474 |
||
475 |
CAknTextSettingPage* dlg = |
|
476 |
new(ELeave) CAknTextSettingPage( |
|
477 |
R_CSCSETTINGSUI_USERNAME_SETTING_PAGE, username ); |
|
478 |
||
479 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
480 |
{ |
|
481 |
// Set username |
|
482 |
User::LeaveIfError( |
|
483 |
iModel.CCHHandler().SetConnectionParameter( |
|
484 |
iModel.CurrentSPEntryId(), ECchUsername, username ) ); |
|
485 |
} |
|
486 |
||
487 |
CleanupStack::PopAndDestroy( &username ); |
|
488 |
||
489 |
iContainer->UpdateContainerL(); |
|
490 |
} |
|
491 |
else |
|
492 |
{ |
|
493 |
// Show unable to change settings note |
|
494 |
HBufC* string = NULL; |
|
495 |
string = StringLoader::LoadL( |
|
496 |
R_CSCSETTINGSUI_UNABLE_TO_EDIT_WHILE_ONLINE ); |
|
497 |
||
498 |
if ( string ) |
|
499 |
{ |
|
500 |
// Set text and show note. |
|
501 |
CleanupStack::PushL( string ); |
|
502 |
CAknInformationNote* note = |
|
503 |
new ( ELeave ) CAknInformationNote( ETrue ); |
|
504 |
note->ExecuteLD( *string ); |
|
505 |
CleanupStack::PopAndDestroy( string ); |
|
506 |
} |
|
507 |
} |
|
508 |
} |
|
509 |
||
510 |
||
511 |
||
512 |
// --------------------------------------------------------------------------- |
|
513 |
// CCSCSettingsUiMainView::ShowPasswordSettingPageL() |
|
514 |
// Shows password setting page - for password input. |
|
515 |
// --------------------------------------------------------------------------- |
|
516 |
void CCSCSettingsUiMainView::ShowPasswordSettingPageL() |
|
517 |
{ |
|
518 |
// Editing is allowed if service is disabled. |
|
519 |
if ( iModel.CCHHandler().IsServiceDisabled( iModel.CurrentSPEntryId() ) ) |
|
520 |
{ |
|
521 |
RBuf password; |
|
522 |
CleanupClosePushL( password ); |
|
523 |
password.CreateL( KCCHMaxPasswordLength ); |
|
524 |
||
525 |
CAknAlphaPasswordSettingPage* dlg = |
|
526 |
new ( ELeave ) CAknAlphaPasswordSettingPage( |
|
527 |
R_CSCSETTINGSUI_PASSWORD_SETTING_PAGE, |
|
528 |
password, |
|
529 |
KNullDesC ); |
|
530 |
||
531 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
532 |
{ |
|
533 |
// Set password |
|
534 |
User::LeaveIfError( |
|
535 |
iModel.CCHHandler().SetConnectionParameter( |
|
536 |
iModel.CurrentSPEntryId(), ECchPassword, password ) ); |
|
537 |
} |
|
538 |
||
539 |
CleanupStack::PopAndDestroy( &password ); |
|
540 |
||
541 |
iContainer->UpdateContainerL(); |
|
542 |
} |
|
543 |
else |
|
544 |
{ |
|
545 |
// Show unable to change settings note |
|
546 |
HBufC* string = NULL; |
|
547 |
string = StringLoader::LoadL( |
|
548 |
R_CSCSETTINGSUI_UNABLE_TO_EDIT_WHILE_ONLINE ); |
|
549 |
||
550 |
if ( string ) |
|
551 |
{ |
|
552 |
// Set text and show note. |
|
553 |
CleanupStack::PushL( string ); |
|
554 |
CAknInformationNote* note = |
|
555 |
new ( ELeave ) CAknInformationNote( ETrue ); |
|
556 |
note->ExecuteLD( *string ); |
|
557 |
CleanupStack::PopAndDestroy( string ); |
|
558 |
} |
|
559 |
} |
|
560 |
} |
|
561 |
||
562 |
||
563 |
// --------------------------------------------------------------------------- |
|
564 |
// CCSCSettingsUiMainView::ShowPrefServiceSettingPageL() |
|
565 |
// Shows Internet call preferred setting page - for ON/OFF setting items |
|
566 |
// --------------------------------------------------------------------------- |
|
567 |
void CCSCSettingsUiMainView::ShowPrefServiceSettingPageL() |
|
568 |
{ |
|
569 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowPrefServiceSettingPageL" ); |
|
570 |
||
571 |
if ( IsEditPreferredServiceSettingAllowedL() ) |
|
572 |
{ |
|
573 |
CDesCArrayFlat* items = |
|
574 |
new ( ELeave ) CDesCArrayFlat( 2 ); |
|
575 |
CleanupStack::PushL( items ); |
|
576 |
||
577 |
AppendItemL( *items, R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_ON ); |
|
578 |
AppendItemL( *items, R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_OFF ); |
|
579 |
||
580 |
// Get current value of the setting |
|
581 |
TInt value( iModel.SettingsHandler().IsPreferredTelephonyVoip() && |
|
582 |
iModel.SettingsHandler().IsPreferredService( |
|
583 |
iModel.CurrentSPEntryId() ) ? |
|
584 |
ECSCSettingsPrefServiceOn : |
|
585 |
ECSCSettingsPrefServiceOff); |
|
586 |
||
587 |
CAknRadioButtonSettingPage* dlg = new( ELeave ) |
|
588 |
CAknRadioButtonSettingPage( |
|
589 |
R_CSCSETTINGSUI_PREF_SERVICE_SETTING_PAGE, |
|
590 |
value, items ); |
|
591 |
||
592 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
593 |
{ |
|
594 |
// Change value of the preferred telephony setting and set |
|
595 |
// current preferred service id. If preferred telephony value |
|
596 |
// is changed as voip then we set this service as preferred |
|
597 |
// service. Otherwise we set preferred service as not set (=0) |
|
598 |
TUint serviceId( value == ECSCSettingsPrefServiceOn ? |
|
599 |
iModel.CurrentSPEntryId() : |
|
600 |
KPrefServiceNotSet ); |
|
601 |
||
602 |
iModel.SettingsHandler().SetVoipAsPrefTelephony( |
|
603 |
value == ECSCSettingsPrefServiceOn, |
|
604 |
serviceId ); |
|
605 |
} |
|
606 |
||
607 |
CleanupStack::PopAndDestroy( items ); |
|
608 |
iContainer->UpdateContainerL(); |
|
609 |
} |
|
610 |
} |
|
611 |
||
612 |
||
613 |
// --------------------------------------------------------------------------- |
|
614 |
// CCSCSettingsUiMainView::ShowVccPrefServiceSettingPageL() |
|
615 |
// Shows Internet call preferred setting page - for ON/OFF setting items |
|
616 |
// when VCC is supported |
|
617 |
// --------------------------------------------------------------------------- |
|
618 |
void CCSCSettingsUiMainView::ShowVccPrefServiceSettingPageL() |
|
619 |
{ |
|
620 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowVccPrefServiceSettingPageL" ); |
|
621 |
||
622 |
if ( IsEditPreferredServiceSettingAllowedL() ) |
|
623 |
{ |
|
624 |
CDesCArrayFlat* items = |
|
625 |
new ( ELeave ) CDesCArrayFlat( 2 ); |
|
626 |
CleanupStack::PushL( items ); |
|
627 |
||
628 |
AppendItemL( *items, R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_ON ); |
|
629 |
AppendItemL( *items, R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_OFF ); |
|
630 |
||
631 |
// Get current value of the setting |
|
632 |
TInt value( iModel.SettingsHandler().IsPreferredTelephonyVoip() && |
|
633 |
iModel.SettingsHandler().IsPreferredService( |
|
634 |
iModel.CurrentSPEntryId() ) ? |
|
635 |
ECSCSettingsPrefServiceOn : |
|
636 |
ECSCSettingsPrefServiceOff); |
|
637 |
||
638 |
CAknRadioButtonSettingPage* dlg = new( ELeave ) |
|
639 |
CAknRadioButtonSettingPage( |
|
640 |
R_CSCSETTINGSUI_VCC_PREF_SERVICE_SETTING_PAGE, |
|
641 |
value, items ); |
|
642 |
||
643 |
if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
644 |
{ |
|
645 |
// Change value of the preferred telephony setting and set |
|
646 |
// current preferred service id. If preferred telephony value |
|
647 |
// is changed as voip then we set this service as preferred |
|
648 |
// service. Otherwise we set preferred service as not set (=0) |
|
649 |
TUint serviceId( value == ECSCSettingsPrefServiceOn ? |
|
650 |
iModel.CurrentSPEntryId() : |
|
651 |
KPrefServiceNotSet ); |
|
652 |
||
653 |
iModel.SettingsHandler().SetVoipAsPrefTelephony( |
|
654 |
value == ECSCSettingsPrefServiceOn, |
|
655 |
serviceId ); |
|
656 |
} |
|
657 |
||
658 |
CleanupStack::PopAndDestroy( items ); |
|
659 |
iContainer->UpdateContainerL(); |
|
660 |
} |
|
661 |
} |
|
662 |
||
663 |
||
664 |
// --------------------------------------------------------------------------- |
|
665 |
// CCSCSettingsUiMainView::ShowImToneSelectionListL() |
|
666 |
// --------------------------------------------------------------------------- |
|
667 |
void CCSCSettingsUiMainView::ShowImToneSelectionListL() |
|
668 |
{ |
|
669 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowImToneSelectionListL - begin" ); |
|
670 |
||
671 |
if ( !iImToneSelectionListOpen ) |
|
672 |
{ |
|
673 |
iImToneSelectionListOpen = ETrue; |
|
674 |
CMediaFileList* list = CMediaFileList::NewL(); |
|
675 |
CleanupStack::PushL( list ); |
|
676 |
||
677 |
HBufC* popupTitle = StringLoader::LoadLC( |
|
678 |
R_CSCSETTINGSUI_IM_TONE_POPUP_HEADING ); |
|
679 |
||
680 |
HBufC* noTone = StringLoader::LoadLC( |
|
681 |
R_CSCSETTINGSUI_NO_IM_TONE_TEXT ); |
|
682 |
||
683 |
list->SetAttrL( |
|
684 |
CMediaFileList::EAttrAutomatedType, |
|
685 |
CDRMHelper::EAutomatedTypeIMAlert ); |
|
686 |
||
687 |
list->SetNullItemL( |
|
688 |
*noTone, |
|
689 |
KNullDesC, |
|
690 |
CMediaFileList::EMediaFileTypeAudio, |
|
691 |
CMediaFileList::ENullItemIconOff ); |
|
692 |
||
693 |
list->SetAttrL( CMediaFileList::EAttrTitle, *popupTitle ); |
|
694 |
||
695 |
TBuf<KCSCMaxImToneLength> toneName; |
|
696 |
TInt nullItem = KErrNotFound; |
|
697 |
||
698 |
TBool result = list->ShowMediaFileListL( |
|
699 |
&toneName, &nullItem , NULL, NULL ); |
|
700 |
||
701 |
CleanupStack::PopAndDestroy( noTone ); |
|
702 |
CleanupStack::PopAndDestroy( popupTitle ); |
|
703 |
CleanupStack::PopAndDestroy( list ); |
|
704 |
||
705 |
if ( result ) |
|
706 |
{ |
|
707 |
iContainer->SaveImTonePathL( toneName ); |
|
708 |
} |
|
709 |
else if( KErrNotFound != nullItem ) |
|
710 |
{ |
|
711 |
iContainer->SaveImTonePathL( KNullDesC ); |
|
712 |
} |
|
713 |
else |
|
714 |
{ |
|
715 |
// do nothing |
|
716 |
} |
|
717 |
||
718 |
iContainer->UpdateContainerL(); |
|
719 |
iImToneSelectionListOpen = EFalse; |
|
720 |
} |
|
721 |
||
722 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowImToneSelectionListL - end" ); |
|
723 |
} |
|
724 |
||
725 |
||
726 |
// --------------------------------------------------------------------------- |
|
727 |
// CCSCSettingsUiMainView::HandleMskChangeSelectionL() |
|
728 |
// Handles 'change' middle softkey selection. |
|
729 |
// --------------------------------------------------------------------------- |
|
730 |
void CCSCSettingsUiMainView::HandleMskChangeSelectionL( |
|
731 |
TMainListBoxItem aListBoxItem ) |
|
732 |
{ |
|
733 |
switch ( aListBoxItem.iItem ) |
|
734 |
{ |
|
735 |
case TMainListBoxItem::EPreferredService: |
|
736 |
case TMainListBoxItem::EVccPreferredService: |
|
737 |
{ |
|
738 |
ChangePrefTelephonyValueL(); |
|
739 |
} |
|
740 |
break; |
|
741 |
case TMainListBoxItem::EHandoverNotifTone: |
|
742 |
{ |
|
743 |
ChangeHandoverNotifToneValueL(); |
|
744 |
} |
|
745 |
break; |
|
746 |
default: |
|
747 |
{ |
|
748 |
User::Leave( KErrArgument ); |
|
749 |
} |
|
750 |
break; |
|
751 |
} |
|
752 |
} |
|
753 |
||
754 |
// --------------------------------------------------------------------------- |
|
755 |
// CCSCSettingsUiMainView::ChangePrefTelephonyValueL() |
|
756 |
// Changes the value of the preferred telephony setting |
|
757 |
// --------------------------------------------------------------------------- |
|
758 |
void CCSCSettingsUiMainView::ChangePrefTelephonyValueL() |
|
759 |
{ |
|
760 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ChangePrefTelephonyValueL" ); |
|
761 |
||
762 |
if ( IsEditPreferredServiceSettingAllowedL() ) |
|
763 |
{ |
|
764 |
// Check is this service preferred service |
|
765 |
TBool prefService( |
|
766 |
iModel.SettingsHandler().IsPreferredTelephonyVoip() && |
|
767 |
iModel.SettingsHandler().IsPreferredService( |
|
768 |
iModel.CurrentSPEntryId() )); |
|
769 |
||
770 |
// Set preferred service id as not set (=0) if preferred telephony |
|
771 |
// setting is changed as CS. |
|
772 |
TUint serviceId( prefService ? KPrefServiceNotSet : |
|
773 |
iModel.CurrentSPEntryId() ); |
|
774 |
||
775 |
// Set preferred telephony setting value and current preferred |
|
776 |
// service id |
|
777 |
iModel.SettingsHandler().SetVoipAsPrefTelephony( |
|
778 |
!prefService, |
|
779 |
serviceId ); |
|
780 |
||
781 |
iContainer->UpdateContainerL(); |
|
782 |
} |
|
783 |
} |
|
784 |
||
785 |
// --------------------------------------------------------------------------- |
|
786 |
// CCSCSettingsUiMainView::ChangeHandoverNotifToneValueL() |
|
787 |
// Changes the value of the handover notify tone setting. |
|
788 |
// --------------------------------------------------------------------------- |
|
789 |
void CCSCSettingsUiMainView::ChangeHandoverNotifToneValueL() |
|
790 |
{ |
|
791 |
TOnOff onOff = iModel.SettingsHandler().HandoverNotifTonePrefL( |
|
792 |
iModel.CurrentSPEntryId() ); |
|
793 |
||
794 |
if ( EOn == onOff ) |
|
795 |
{ |
|
796 |
iModel.SettingsHandler().SetHandoverNotifTonePrefL( |
|
797 |
iModel.CurrentSPEntryId(), EOff ); |
|
798 |
} |
|
799 |
else |
|
800 |
{ |
|
801 |
iModel.SettingsHandler().SetHandoverNotifTonePrefL( |
|
802 |
iModel.CurrentSPEntryId(), EOn ); |
|
803 |
} |
|
804 |
||
805 |
iContainer->UpdateContainerL(); |
|
806 |
} |
|
807 |
||
808 |
// ----------------------------------------------------------------------------- |
|
809 |
// CCSCSettingsUiMainView::AppendItemL |
|
810 |
// Appends resource texts to the des array. |
|
811 |
// ----------------------------------------------------------------------------- |
|
812 |
// |
|
813 |
void CCSCSettingsUiMainView::AppendItemL( |
|
814 |
CDesCArrayFlat& aList, TInt aItem ) |
|
815 |
{ |
|
816 |
HBufC* string = StringLoader::LoadLC( aItem ); |
|
817 |
aList.AppendL( *string ); |
|
818 |
CleanupStack::PopAndDestroy( string ); |
|
819 |
} |
|
820 |
||
821 |
// --------------------------------------------------------------------------- |
|
822 |
// CCSCSettingsUiMainView::LaunchCMSettingsUiL |
|
823 |
// Launches Connection Method Settings Ui for editing destinations. |
|
824 |
// --------------------------------------------------------------------------- |
|
825 |
// |
|
826 |
void CCSCSettingsUiMainView::LaunchCMSettingsUiL() |
|
827 |
{ |
|
828 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::LaunchCMSettingsUiL" ); |
|
829 |
if ( iSnapListOpen ) |
|
830 |
{ |
|
831 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::LaunchCMSettingsUiL end" ); |
|
832 |
return; |
|
833 |
} |
|
834 |
||
835 |
// Launch Connection Method Settings Ui. |
|
836 |
CCmSettingsUi* cmSettingsUi = CCmSettingsUi::NewL(); |
|
837 |
CleanupStack::PushL( cmSettingsUi ); |
|
838 |
iSnapListOpen = ETrue; |
|
839 |
if ( CCmSettingsUi::EExit == cmSettingsUi->RunSettingsL() ) |
|
840 |
{ |
|
841 |
HandleCommandL( EEikCmdExit ); |
|
842 |
} |
|
843 |
CleanupStack::PopAndDestroy( cmSettingsUi ); |
|
844 |
iSnapListOpen = EFalse; |
|
845 |
ResetViewL(); |
|
846 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::LaunchCMSettingsUiL end" ); |
|
847 |
} |
|
848 |
||
849 |
// --------------------------------------------------------------------------- |
|
850 |
// CCSCSettingsUiMainView::HandleReturnToPreviousViewL |
|
851 |
// Handles returning to previous view where settingsui was launced. |
|
852 |
// --------------------------------------------------------------------------- |
|
853 |
// |
|
854 |
void CCSCSettingsUiMainView::HandleReturnToPreviousViewL( TBool aViewBack ) |
|
855 |
{ |
|
856 |
CSCSETUIDEBUG( |
|
857 |
"CCSCSettingsUiMainView::HandleReturnToPreviousViewL - IN" ); |
|
858 |
||
859 |
if ( iModel.ReturnViewId() != KNullUid ) |
|
860 |
{ |
|
861 |
TUid tabview( KNullUid ); |
|
862 |
||
863 |
// Error code not needed. |
|
864 |
TRAP_IGNORE( |
|
865 |
tabview.iUid = iModel.SettingsHandler().ServiceTabViewIdL( |
|
866 |
iModel.CurrentSPEntryId() ) ) |
|
867 |
||
868 |
// Launched from phonebookview. |
|
869 |
// Press Back button, return PhoneBookTabView. |
|
870 |
if ( aViewBack && tabview.iUid == iModel.ReturnViewId().iUid ) |
|
871 |
{ |
|
872 |
RxSPViewServices viewServices; |
|
873 |
TInt err = viewServices.Activate( |
|
874 |
KPhoneBookTabUid.iUid, |
|
875 |
iModel.ReturnViewId().iUid ); |
|
876 |
||
877 |
CSCSETUIDEBUG2( " --> ACTIVATE ERR=%d", err ); |
|
878 |
||
879 |
AppUi()->HandleCommandL( EEikCmdExit ); |
|
880 |
} |
|
881 |
||
882 |
if ( iDeleted && KCSCServiceViewId != iModel.ReturnViewId() ) |
|
883 |
{ |
|
884 |
// Launched from phonebookview. |
|
885 |
// Press Ok button, return homescreen. |
|
886 |
TVwsViewId idleId; |
|
887 |
AknDef::GetPhoneIdleViewId( idleId ); |
|
888 |
ActivateViewL( idleId ); |
|
889 |
AppUi()->HandleCommandL( EEikCmdExit ); |
|
890 |
} |
|
891 |
else if( !iDeleted && KCSCServiceViewId != iModel.ReturnViewId() ) |
|
892 |
{ |
|
893 |
// Launched from phonebookview. |
|
894 |
// Press cancel button, return current view. |
|
895 |
TUid curview = Id(); |
|
896 |
AppUi()->ActivateLocalViewL( curview ); |
|
897 |
} |
|
898 |
else if( !aViewBack && !iDeleted && KCSCServiceViewId == iModel.ReturnViewId() ) |
|
899 |
{ |
|
900 |
// Launched from service view. |
|
901 |
// Press cancel button, return current view. |
|
902 |
TUid curview = Id(); |
|
903 |
AppUi()->ActivateLocalViewL( curview ); |
|
904 |
} |
|
905 |
else |
|
906 |
{ |
|
907 |
// Launched from service view. |
|
908 |
// Press Back button or Press Delete button, activate previous view. |
|
909 |
AppUi()->ActivateLocalViewL( iModel.ReturnViewId() ); |
|
910 |
} |
|
911 |
} |
|
912 |
||
913 |
CSCSETUIDEBUG( |
|
914 |
"CCSCSettingsUiMainView::HandleReturnToPreviousViewL - OUT" ); |
|
915 |
} |
|
916 |
||
917 |
// --------------------------------------------------------------------------- |
|
918 |
// CCSCSettingsUiMainView::HandleSettingsUiExitL |
|
919 |
// Handles exist from settingsui. |
|
920 |
// --------------------------------------------------------------------------- |
|
921 |
// |
|
922 |
void CCSCSettingsUiMainView::HandleSettingsUiExitL() |
|
923 |
{ |
|
924 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::HandleSettingsUiExitL - IN" ); |
|
925 |
||
926 |
if ( iModel.ReturnViewId() != KNullUid ) |
|
927 |
{ |
|
928 |
TUid tabview( KNullUid ); |
|
929 |
TRAPD( err, tabview.iUid = iModel.SettingsHandler().ServiceTabViewIdL( |
|
930 |
iModel.CurrentSPEntryId() ) ) |
|
931 |
||
932 |
if ( tabview.iUid == iModel.ReturnViewId().iUid && !err ) |
|
933 |
{ |
|
934 |
// Launched from service tab, go back there |
|
935 |
RxSPViewServices viewServices; |
|
936 |
viewServices.Activate( |
|
937 |
KPhoneBookTabUid.iUid, |
|
938 |
iModel.ReturnViewId().iUid ); |
|
939 |
||
940 |
AppUi()->HandleCommandL( EEikCmdExit ); |
|
941 |
} |
|
942 |
else |
|
943 |
{ |
|
944 |
// Not launched from service tab, just exit |
|
945 |
AppUi()->HandleCommandL( EEikCmdExit ); |
|
946 |
} |
|
947 |
} |
|
948 |
||
949 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::HandleSettingsUiExitL - OUT" ); |
|
950 |
} |
|
951 |
||
952 |
// --------------------------------------------------------------------------- |
|
953 |
// CCSCSettingsUiMainView::ResetViewL |
|
954 |
// Resets service settings when switching services |
|
955 |
// --------------------------------------------------------------------------- |
|
956 |
// |
|
957 |
void CCSCSettingsUiMainView::ResetViewL() |
|
958 |
{ |
|
959 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - IN" ); |
|
960 |
||
961 |
// Do not update view if SNAP list is open because in some cases |
|
962 |
// there will be problems with title and status bar. |
|
963 |
if ( iSnapListOpen ) |
|
964 |
{ |
|
965 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - OUT" ); |
|
966 |
return; |
|
967 |
} |
|
968 |
// Create container when view is activated. |
|
969 |
if ( !iContainer ) |
|
970 |
{ |
|
971 |
iContainer = new (ELeave) CCSCSettingsUiMainContainer( iModel ); |
|
972 |
iContainer->SetMopParent( this ); |
|
973 |
iContainer->ConstructL( ClientRect() ); |
|
974 |
AppUi()->AddToStackL( *this, iContainer ); |
|
975 |
iContainer->ListBox()->SetListBoxObserver( this ); |
|
976 |
} |
|
977 |
||
978 |
SetTitleTextL(); |
|
979 |
UpdateSoftkeysL(); |
|
980 |
iContainer->UpdateContainerL(); |
|
981 |
||
982 |
CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - OUT" ); |
|
983 |
} |
|
984 |
||
985 |
// End of file. |
|
986 |