author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:19:59 +0100 | |
branch | RCL_3 |
changeset 50 | 03674e5abf46 |
parent 49 | 09b1ac925e3f |
permissions | -rw-r--r-- |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
50 | 2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Provides api for changing security settings. |
|
15 |
* |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <etelmm.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <exterror.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <textresolver.h> |
50 | 23 |
#include <SecUi.rsg> |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <aknnotedialog.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <mmtsy_names.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <centralrepository.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <gsmerror.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <SCPClient.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include <StringLoader.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#include <e32property.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <PSVariables.h> // Property values |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include <securityuisprivatepskeys.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include <startupdomainpskeys.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include "secuisecuritysettings.h" |
50 | 35 |
#include "SecUiAutoLockSettingPage.h" |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include "secui.hrh" |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
#include "secuisecurityhandler.h" |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include "secuicodequerydialog.h" |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
#include "SecUiWait.h" |
50 | 40 |
|
41 |
#ifdef RD_REMOTELOCK |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
#include <aknnotewrappers.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
#include <StringLoader.h> |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
#include <RemoteLockSettings.h> |
50 | 45 |
#include "SecUiRemoteLockSettingPage.h" |
46 |
#endif // RD_REMOTELOCK |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include <featmgr.h> |
50 | 48 |
/***************************************************** |
49 |
* Series 60 Customer / TSY |
|
50 |
* Needs customer TSY implementation |
|
51 |
*****************************************************/ |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
// LOCAL CONSTANTS AND MACROS |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
|
50 | 54 |
const TInt KTriesToConnectServer( 2 ); |
55 |
const TInt KTimeBeforeRetryingServerConnection( 50000 ); |
|
56 |
const TInt PhoneIndex( 0 ); |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
|
50 | 58 |
const TInt KMaxNumberOfPINAttempts(3); |
59 |
const TInt KLastRemainingInputAttempt(1); |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
// ================= MEMBER FUNCTIONS ======================= |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
// CSecuritySettings::NewL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
// ---------------------------------------------------------- |
50 | 66 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
EXPORT_C CSecuritySettings* CSecuritySettings::NewL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
CSecuritySettings* self = new (ELeave) CSecuritySettings(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
CleanupStack::PushL(self); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
self->ConstructL(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
CleanupStack::Pop(); //self |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
return self; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
// CSecuritySettings::CSecuritySettings() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
// constructor |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
// ---------------------------------------------------------- |
50 | 80 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
EXPORT_C CSecuritySettings::CSecuritySettings() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
84 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
// CSecuritySettings::ConstructL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
// Symbian OS constructor. |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
// ---------------------------------------------------------- |
50 | 89 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
EXPORT_C void CSecuritySettings::ConstructL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
/***************************************************** |
50 | 93 |
* Series 60 Customer / ETel |
94 |
* Series 60 ETel API |
|
95 |
*****************************************************/ |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
/***************************************************** |
50 | 97 |
* Series 60 Customer / TSY |
98 |
* Needs customer TSY implementation |
|
99 |
*****************************************************/ |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
|
50 | 101 |
TInt err( KErrGeneral ); |
102 |
TInt thisTry( 0 ); |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
iWait = CWait::NewL(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
RTelServer::TPhoneInfo PhoneInfo; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
/* All server connections are tried to be made KTriesToConnectServer times because occasional |
50 | 106 |
fails on connections are possible, at least on some servers */ |
107 |
#if defined(_DEBUG) |
|
108 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ConstructL()")); |
|
109 |
#endif |
|
110 |
||
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
FeatureManager::InitializeLibL(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
// connect to ETel server |
50 | 113 |
while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
{ |
50 | 115 |
User::After( KTimeBeforeRetryingServerConnection ); |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
} |
50 | 117 |
User::LeaveIfError( err ); |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
// load TSY |
50 | 120 |
err = iServer.LoadPhoneModule( KMmTsyModuleName ); |
121 |
if ( err != KErrAlreadyExists ) |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
// May return also KErrAlreadyExists if something else |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
// has already loaded the TSY module. And that is |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
// not an error. |
50 | 126 |
User::LeaveIfError( err ); |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
// open phones |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); |
50 | 132 |
User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
User::LeaveIfError(iCustomPhone.Open(iPhone)); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
|
50 | 135 |
iSecurityHandler = new( ELeave ) CSecurityHandler( iPhone ); |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
// CSecuritySettings::~CSecuritySettings() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
// Destructor |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
// ---------------------------------------------------------- |
50 | 142 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
EXPORT_C CSecuritySettings::~CSecuritySettings() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
/***************************************************** |
50 | 146 |
* Series 60 Customer / ETel |
147 |
* Series 60 ETel API |
|
148 |
*****************************************************/ |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
/***************************************************** |
50 | 150 |
* Series 60 Customer / TSY |
151 |
* Needs customer TSY implementation |
|
152 |
*****************************************************/ |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
delete iSecurityHandler; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
// Cancel active requests |
50 | 156 |
if(iWait->IsActive()) |
157 |
{ |
|
158 |
#if defined(_DEBUG) |
|
159 |
RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CSecuritySettings() CANCEL REQ")); |
|
160 |
#endif |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
iPhone.CancelAsyncRequest(iWait->GetRequestType()); |
50 | 162 |
|
163 |
switch(iWait->GetRequestType()) |
|
164 |
{ //inform query that it has beeen canceled |
|
165 |
case EMobilePhoneSetLockSetting: |
|
166 |
case EMobilePhoneSetFdnSetting: |
|
167 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestCanceled); |
|
168 |
break; |
|
169 |
default: |
|
170 |
break; |
|
171 |
} |
|
172 |
||
173 |
} |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
174 |
// close phone |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
if (iPhone.SubSessionHandle()) |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
176 |
iPhone.Close(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
// close custom phone |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
if (iCustomPhone.SubSessionHandle()) |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
iCustomPhone.Close(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
//close ETel connection |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
if (iServer.Handle()) |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
iServer.UnloadPhoneModule(KMmTsyModuleName); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
iServer.Close(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
delete iWait; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
FeatureManager::UnInitializeLib(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
// CSecuritySettings::ChangePinL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
// Changes PIN1 |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
// ---------------------------------------------------------- |
50 | 194 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
EXPORT_C void CSecuritySettings::ChangePinL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
{ |
50 | 197 |
/***************************************************** |
198 |
* Series 60 Customer / ETel |
|
199 |
* Series 60 ETel API |
|
200 |
*****************************************************/ |
|
201 |
||
202 |
TInt simState; |
|
203 |
TInt err( KErrGeneral ); |
|
204 |
err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
205 |
User::LeaveIfError( err ); |
|
206 |
TBool simRemoved(simState == ESimNotPresent); |
|
207 |
||
208 |
if ( simRemoved ) |
|
209 |
{ |
|
210 |
ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
211 |
return; |
|
212 |
} |
|
213 |
||
214 |
#if defined(_DEBUG) |
|
215 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinL()")); |
|
216 |
#endif |
|
217 |
RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
218 |
secCodeType = RMobilePhone::ESecurityCodePin1; |
|
219 |
||
220 |
RMobilePhone::TMobilePassword oldPassword; |
|
221 |
RMobilePhone::TMobilePassword newPassword; |
|
222 |
RMobilePhone::TMobilePassword verifcationPassword; |
|
223 |
RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
224 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
|
225 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
|
226 |
||
227 |
CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
228 |
CleanupStack::PushL(verdlg); |
|
229 |
||
230 |
CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
231 |
CleanupStack::PushL(newdlg); |
|
232 |
||
233 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
234 |
CleanupStack::PushL(dlg); |
|
235 |
||
236 |
RMobilePhone::TMobilePhoneLock lockType; |
|
237 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
238 |
||
239 |
lockType = RMobilePhone::ELockICC; |
|
240 |
||
241 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
242 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
243 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
244 |
TInt res = iWait->WaitForRequestL(); |
|
245 |
User::LeaveIfError(res); |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
|
50 | 247 |
if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
248 |
{ |
|
249 |
CleanupStack::PopAndDestroy(3,verdlg); |
|
250 |
ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
251 |
return; |
|
252 |
} |
|
253 |
||
254 |
CleanupStack::Pop(); // dlg |
|
255 |
iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
256 |
iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); |
|
257 |
res = iWait->WaitForRequestL(); |
|
258 |
User::LeaveIfError(res); |
|
259 |
// ask pin |
|
260 |
if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
|
261 |
res = dlg->ExecuteLD(R_PIN_QUERY); |
|
262 |
else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
263 |
{ |
|
264 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
265 |
res = dlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); |
|
266 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
267 |
} |
|
268 |
else |
|
269 |
{ |
|
270 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); |
|
271 |
res = dlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); |
|
272 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
273 |
} |
|
274 |
||
275 |
if( !res ) |
|
276 |
{ |
|
277 |
CleanupStack::PopAndDestroy(2,verdlg); |
|
278 |
return; |
|
279 |
} |
|
280 |
CleanupStack::Pop(); // newdlg |
|
281 |
// new pin code query |
|
282 |
if (!(newdlg->ExecuteLD(R_NEW_PIN_CODE_QUERY))) |
|
283 |
{ |
|
284 |
CleanupStack::PopAndDestroy(verdlg); |
|
285 |
return; |
|
286 |
} |
|
287 |
||
288 |
CleanupStack::Pop(); // verdlg |
|
289 |
// verification code query |
|
290 |
if (!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_QUERY))) |
|
291 |
return; |
|
292 |
||
293 |
while (newPassword.CompareF(verifcationPassword) != 0) |
|
294 |
{ |
|
295 |
// codes do not match -> note -> ask new pin and verification codes again |
|
296 |
ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
297 |
||
298 |
newPassword = _L(""); |
|
299 |
verifcationPassword = _L(""); |
|
300 |
||
301 |
// new pin code query |
|
302 |
CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
303 |
if (!(newdlg->ExecuteLD(R_NEW_PIN_CODE_QUERY))) |
|
304 |
return; |
|
305 |
||
306 |
// verification code query |
|
307 |
CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
308 |
if (!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_QUERY))) |
|
309 |
return; |
|
310 |
} |
|
311 |
||
312 |
// send code |
|
313 |
passwords.iOldPassword = oldPassword; |
|
314 |
passwords.iNewPassword = newPassword; |
|
315 |
iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
316 |
iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
317 |
res = iWait->WaitForRequestL(); |
|
318 |
#if defined(_DEBUG) |
|
319 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); |
|
320 |
#endif |
|
321 |
switch(res) |
|
322 |
{ |
|
323 |
case KErrNone: |
|
324 |
{ |
|
325 |
// code changed |
|
326 |
ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
327 |
break; |
|
328 |
} |
|
329 |
case KErrGsm0707IncorrectPassword: |
|
330 |
case KErrAccessDenied: |
|
331 |
{ |
|
332 |
// code was entered erroneously |
|
333 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
334 |
ChangePinL(); |
|
335 |
break; |
|
336 |
} |
|
337 |
case KErrGsmSSPasswordAttemptsViolation: |
|
338 |
case KErrLocked: |
|
339 |
{ |
|
340 |
// Pin1 blocked! |
|
341 |
return; |
|
342 |
} |
|
343 |
case KErrGsm0707OperationNotAllowed: |
|
344 |
{ |
|
345 |
// not allowed with this sim |
|
346 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
347 |
return; |
|
348 |
} |
|
349 |
case KErrAbort: |
|
350 |
{ |
|
351 |
break; |
|
352 |
} |
|
353 |
default: |
|
354 |
{ |
|
355 |
ShowErrorNoteL(res); |
|
356 |
ChangePinL(); |
|
357 |
break; |
|
358 |
} |
|
359 |
} |
|
360 |
||
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
361 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
362 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
363 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
364 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
// CSecuritySettings::ChangeUPinL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
// Changes Universal PIN |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
// ---------------------------------------------------------- |
50 | 368 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
EXPORT_C void CSecuritySettings::ChangeUPinL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
{ |
50 | 371 |
TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
372 |
TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
373 |
if(wcdmaSupported || upinSupported) |
|
374 |
{ |
|
375 |
#if defined(_DEBUG) |
|
376 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinL()")); |
|
377 |
#endif |
|
378 |
TInt simState; |
|
379 |
TInt err( KErrGeneral ); |
|
380 |
err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
381 |
User::LeaveIfError( err ); |
|
382 |
TBool simRemoved(simState == ESimNotPresent); |
|
383 |
||
384 |
if ( simRemoved ) |
|
385 |
{ |
|
386 |
ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
387 |
return; |
|
388 |
} |
|
389 |
||
390 |
RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
391 |
secCodeType = RMobilePhone::ESecurityUniversalPin; |
|
392 |
||
393 |
RMobilePhone::TMobilePassword oldPassword; |
|
394 |
RMobilePhone::TMobilePassword newPassword; |
|
395 |
RMobilePhone::TMobilePassword verifcationPassword; |
|
396 |
RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
397 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
|
398 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
|
399 |
||
400 |
CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
401 |
CleanupStack::PushL(verdlg); |
|
402 |
||
403 |
CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
404 |
CleanupStack::PushL(newdlg); |
|
405 |
||
406 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
407 |
CleanupStack::PushL(dlg); |
|
408 |
||
409 |
RMobilePhone::TMobilePhoneLock lockType; |
|
410 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
411 |
||
412 |
lockType = RMobilePhone::ELockUniversalPin; |
|
413 |
||
414 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
415 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
416 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
417 |
TInt res = iWait->WaitForRequestL(); |
|
418 |
User::LeaveIfError(res); |
|
419 |
||
420 |
if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
421 |
{ |
|
422 |
CleanupStack::PopAndDestroy(3,verdlg); |
|
423 |
ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
424 |
return; |
|
425 |
} |
|
426 |
||
427 |
CleanupStack::Pop(); // dlg |
|
428 |
// ask pin |
|
429 |
iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
430 |
iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); |
|
431 |
res = iWait->WaitForRequestL(); |
|
432 |
User::LeaveIfError(res); |
|
433 |
||
434 |
if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
|
435 |
res = dlg->ExecuteLD(R_UPIN_QUERY); |
|
436 |
else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
437 |
{ |
|
438 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
439 |
res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
|
440 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
441 |
} |
|
442 |
else |
|
443 |
{ |
|
444 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); |
|
445 |
res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
|
446 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
447 |
} |
|
448 |
||
449 |
||
450 |
||
451 |
if( !res ) |
|
452 |
{ |
|
453 |
CleanupStack::PopAndDestroy(2,verdlg); |
|
454 |
return; |
|
455 |
} |
|
456 |
CleanupStack::Pop(); // newdlg |
|
457 |
// new pin code query |
|
458 |
if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) |
|
459 |
{ |
|
460 |
CleanupStack::PopAndDestroy(verdlg); |
|
461 |
return; |
|
462 |
} |
|
463 |
||
464 |
CleanupStack::Pop(); // verdlg |
|
465 |
// verification code query |
|
466 |
if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) |
|
467 |
return; |
|
468 |
||
469 |
while (newPassword.CompareF(verifcationPassword) != 0) |
|
470 |
{ |
|
471 |
// codes do not match -> note -> ask new pin and verification codes again |
|
472 |
ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
473 |
||
474 |
newPassword = _L(""); |
|
475 |
verifcationPassword = _L(""); |
|
476 |
||
477 |
// new pin code query |
|
478 |
CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
479 |
if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) |
|
480 |
return; |
|
481 |
||
482 |
// verification code query |
|
483 |
CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
484 |
if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) |
|
485 |
return; |
|
486 |
} |
|
487 |
||
488 |
// send code |
|
489 |
passwords.iOldPassword = oldPassword; |
|
490 |
passwords.iNewPassword = newPassword; |
|
491 |
iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
492 |
iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
493 |
res = iWait->WaitForRequestL(); |
|
494 |
#if defined(_DEBUG) |
|
495 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); |
|
496 |
#endif |
|
497 |
switch(res) |
|
498 |
{ |
|
499 |
case KErrNone: |
|
500 |
{ |
|
501 |
// code changed |
|
502 |
ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
503 |
break; |
|
504 |
} |
|
505 |
case KErrGsm0707IncorrectPassword: |
|
506 |
case KErrAccessDenied: |
|
507 |
{ |
|
508 |
// code was entered erroneously |
|
509 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
510 |
ChangeUPinL(); |
|
511 |
break; |
|
512 |
} |
|
513 |
case KErrGsmSSPasswordAttemptsViolation: |
|
514 |
case KErrLocked: |
|
515 |
{ |
|
516 |
return; |
|
517 |
} |
|
518 |
case KErrGsm0707OperationNotAllowed: |
|
519 |
{ |
|
520 |
// not allowed with this sim |
|
521 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
522 |
return; |
|
523 |
} |
|
524 |
case KErrAbort: |
|
525 |
{ |
|
526 |
break; |
|
527 |
} |
|
528 |
default: |
|
529 |
{ |
|
530 |
ShowErrorNoteL(res); |
|
531 |
ChangeUPinL(); |
|
532 |
break; |
|
533 |
} |
|
534 |
} |
|
535 |
} |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
536 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
537 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
538 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
539 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
540 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
541 |
// CSecuritySettings::ChangePin2L() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
542 |
// Changes PIN2 |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
543 |
// ---------------------------------------------------------- |
50 | 544 |
// |
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
545 |
EXPORT_C void CSecuritySettings::ChangePin2L() |
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
546 |
{ |
50 | 547 |
/***************************************************** |
548 |
* Series 60 Customer / ETel |
|
549 |
* Series 60 ETel API |
|
550 |
*****************************************************/ |
|
551 |
#if defined(_DEBUG) |
|
552 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePin2L()")); |
|
553 |
#endif |
|
554 |
TInt simState; |
|
555 |
TInt err( KErrGeneral ); |
|
556 |
err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
557 |
User::LeaveIfError( err ); |
|
558 |
TBool simRemoved(simState == ESimNotPresent); |
|
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
559 |
|
50 | 560 |
if ( simRemoved ) |
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
561 |
{ |
50 | 562 |
ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
563 |
return; |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
564 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
565 |
|
50 | 566 |
RMmCustomAPI::TSecurityCodeType secCodeType; |
567 |
RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; |
|
568 |
secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
569 |
RMobilePhone::TMobilePassword oldPassword; |
|
570 |
RMobilePhone::TMobilePassword newPassword; |
|
571 |
RMobilePhone::TMobilePassword verifcationPassword; |
|
572 |
RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
573 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
574 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
50 | 575 |
|
576 |
// check if pin2 is blocked... |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
577 |
TBool isBlocked = EFalse; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
578 |
|
50 | 579 |
TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
580 |
||
581 |
if(isBlocked) |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
582 |
return; |
50 | 583 |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
584 |
if (ret != KErrNone) |
50 | 585 |
{ |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
586 |
switch (ret) |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
587 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
588 |
// PIN2 Blocked. |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
589 |
case KErrGsm0707SIMPuk2Required: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
590 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
591 |
case KErrGsmSSPasswordAttemptsViolation: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
592 |
case KErrLocked: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
// Pin2 features blocked permanently! |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
594 |
ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
595 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
596 |
case KErrGsm0707SimNotInserted: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
597 |
// not allowed with this sim |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
598 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
599 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
600 |
default: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
601 |
ShowErrorNoteL(ret); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
602 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
603 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
604 |
return; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
605 |
} |
50 | 606 |
|
607 |
CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
608 |
CleanupStack::PushL(verdlg); |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
609 |
|
50 | 610 |
CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
611 |
CleanupStack::PushL(newdlg); |
|
612 |
||
613 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
614 |
CleanupStack::PushL(dlg); |
|
615 |
||
616 |
||
617 |
// Security code must be changed to Etel API format |
|
618 |
// Custom API Pin1 and Pin2 have the same enum values as the Etel ones |
|
619 |
EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode)secCodeType; |
|
620 |
#ifndef __WINS__ |
|
621 |
iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
622 |
iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); |
|
623 |
ret = iWait->WaitForRequestL(); |
|
624 |
User::LeaveIfError(ret); |
|
625 |
#else |
|
626 |
codeInfo.iRemainingEntryAttempts = 1; |
|
627 |
#endif //__WINS__ |
|
628 |
||
629 |
if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
630 |
ret = dlg->ExecuteLD(R_PIN2_QUERY); |
|
631 |
else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
632 |
{ |
|
633 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
|
634 |
ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
|
635 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
636 |
} |
|
637 |
else |
|
638 |
{ |
|
639 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); |
|
640 |
ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
|
641 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
642 |
} |
|
643 |
||
644 |
CleanupStack::Pop(); // dlg |
|
645 |
if(!ret) |
|
646 |
{ |
|
647 |
CleanupStack::PopAndDestroy(2,verdlg); |
|
648 |
return; |
|
649 |
} |
|
650 |
||
651 |
// new pin code query |
|
652 |
CleanupStack::Pop(); // newdlg |
|
653 |
if(!(newdlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) |
|
654 |
{ |
|
655 |
CleanupStack::PopAndDestroy(verdlg); |
|
656 |
return; |
|
657 |
} |
|
658 |
||
659 |
// verification code query |
|
660 |
CleanupStack::Pop(); // verdlg |
|
661 |
if(!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) |
|
662 |
{ |
|
663 |
return; |
|
664 |
} |
|
665 |
||
666 |
while (newPassword.CompareF(verifcationPassword) != 0) |
|
667 |
{ |
|
668 |
// codes do not match -> note -> ask new pin and verification codes again |
|
669 |
ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
670 |
||
671 |
newPassword = _L(""); |
|
672 |
verifcationPassword = _L(""); |
|
673 |
||
674 |
// new pin code query |
|
675 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
676 |
if(!(dlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) |
|
677 |
return; |
|
678 |
||
679 |
// verification code query |
|
680 |
CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
681 |
if(!(dlg2->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) |
|
682 |
return; |
|
683 |
} |
|
684 |
||
685 |
||
686 |
passwords.iOldPassword = oldPassword; |
|
687 |
passwords.iNewPassword = newPassword; |
|
688 |
iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
689 |
iPhone.ChangeSecurityCode(iWait->iStatus,EtelsecCodeType,passwords); |
|
690 |
TInt res = iWait->WaitForRequestL(); |
|
691 |
#if defined(_DEBUG) |
|
692 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePin2L(): RETURN CODE: %d"), res); |
|
693 |
#endif |
|
694 |
switch(res) |
|
695 |
{ |
|
696 |
case KErrNone: |
|
697 |
{ |
|
698 |
// code changed |
|
699 |
ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
700 |
break; |
|
701 |
} |
|
702 |
case KErrGsm0707IncorrectPassword: |
|
703 |
case KErrAccessDenied: |
|
704 |
{ |
|
705 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
706 |
ChangePin2L(); |
|
707 |
break; |
|
708 |
} |
|
709 |
case KErrGsmSSPasswordAttemptsViolation: |
|
710 |
case KErrLocked: |
|
711 |
{ |
|
712 |
// Pin2 blocked! |
|
713 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
714 |
CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); |
|
715 |
CleanupStack::PushL(handler); |
|
716 |
handler->HandleEventL(RMobilePhone::EPuk2Required); |
|
717 |
CleanupStack::PopAndDestroy(handler); // handler |
|
718 |
return; |
|
719 |
} |
|
720 |
case KErrGsm0707OperationNotAllowed: |
|
721 |
{ |
|
722 |
// not allowed with this sim |
|
723 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
724 |
return; |
|
725 |
} |
|
726 |
case KErrAbort: |
|
727 |
{ |
|
728 |
break; |
|
729 |
} |
|
730 |
default: |
|
731 |
{ |
|
732 |
ShowErrorNoteL(res); |
|
733 |
ChangePin2L(); |
|
734 |
break; |
|
735 |
} |
|
736 |
} |
|
737 |
} |
|
738 |
// |
|
739 |
// ---------------------------------------------------------- |
|
740 |
// CSecuritySettings::ChangeSecCodeL() |
|
741 |
// Changes security code |
|
742 |
// ---------------------------------------------------------- |
|
743 |
// |
|
744 |
EXPORT_C void CSecuritySettings::ChangeSecCodeL() |
|
745 |
{ |
|
746 |
/***************************************************** |
|
747 |
* Series 60 Customer / ETel |
|
748 |
* Series 60 ETel API |
|
749 |
*****************************************************/ |
|
750 |
#if defined(_DEBUG) |
|
751 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSecCodeL()")); |
|
752 |
#endif |
|
753 |
TInt res; |
|
754 |
RMobilePhone::TMobilePassword newPassword; |
|
755 |
if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
756 |
(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) |
|
757 |
{ |
|
758 |
||
759 |
// Connect to the SCP server, and request the code change |
|
760 |
RSCPClient scpClient; |
|
761 |
User::LeaveIfError( scpClient.Connect() ); |
|
762 |
CleanupClosePushL( scpClient ); |
|
763 |
res = scpClient.ChangeCodeRequest(); |
|
764 |
CleanupStack::PopAndDestroy(); // scpClient |
|
765 |
||
766 |
} |
|
767 |
else |
|
768 |
{ |
|
769 |
||
770 |
RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
771 |
secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
772 |
RMobilePhone::TMobilePassword oldPassword; |
|
773 |
RMobilePhone::TMobilePassword verifcationPassword; |
|
774 |
RMobilePhone::TMobilePassword required_fourth; |
|
775 |
RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
776 |
||
777 |
CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
778 |
CleanupStack::PushL(verdlg); |
|
779 |
||
780 |
CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
781 |
CleanupStack::PushL(newdlg); |
|
782 |
||
783 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); |
|
784 |
CleanupStack::PushL(dlg); |
|
785 |
||
786 |
// ask security code |
|
787 |
CleanupStack::Pop(); // dlg |
|
788 |
if (!(dlg->ExecuteLD(R_SECURITY_QUERY))) |
|
789 |
{ |
|
790 |
CleanupStack::PopAndDestroy(2,verdlg); |
|
791 |
return; |
|
792 |
} |
|
793 |
// new security code query |
|
794 |
CleanupStack::Pop(); // newdlg |
|
795 |
if(!(newdlg->ExecuteLD(R_NEW_SECURITY_CODE_QUERY))) |
|
796 |
{ |
|
797 |
CleanupStack::PopAndDestroy(verdlg); |
|
798 |
return; |
|
799 |
} |
|
800 |
||
801 |
// verification code query |
|
802 |
CleanupStack::Pop(); // verdlg |
|
803 |
if(!(verdlg->ExecuteLD(R_VERIFY_NEW_SECURITY_CODE_QUERY))) |
|
804 |
{ |
|
805 |
return; |
|
806 |
} |
|
807 |
||
808 |
while (newPassword.CompareF(verifcationPassword) != 0) |
|
809 |
{ |
|
810 |
// codes do not match -> note -> ask new pin and verification codes again |
|
811 |
ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
812 |
||
813 |
newPassword = _L(""); |
|
814 |
verifcationPassword = _L(""); |
|
815 |
||
816 |
// new pin code query |
|
817 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
818 |
if(!(dlg->ExecuteLD(R_NEW_SECURITY_CODE_QUERY))) |
|
819 |
return; |
|
820 |
||
821 |
// verification code query |
|
822 |
CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
823 |
if(!(dlg2->ExecuteLD(R_VERIFY_NEW_SECURITY_CODE_QUERY))) |
|
824 |
return; |
|
825 |
} |
|
826 |
iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
|
827 |
// check code |
|
828 |
iPhone.VerifySecurityCode(iWait->iStatus,secCodeType, oldPassword, required_fourth); |
|
829 |
res = iWait->WaitForRequestL(); |
|
830 |
#if defined(_DEBUG) |
|
831 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCode(): CODE VERIFY RESP: %d"), res); |
|
832 |
#endif |
|
833 |
// change code |
|
834 |
if (res == KErrNone) |
|
835 |
{ |
|
836 |
passwords.iOldPassword = oldPassword; |
|
837 |
passwords.iNewPassword = newPassword; |
|
838 |
iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
839 |
iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,passwords); |
|
840 |
res = iWait->WaitForRequestL(); |
|
841 |
} |
|
842 |
||
843 |
} |
|
844 |
||
845 |
#if defined(_DEBUG) |
|
846 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCode(): RETURN CODE: %d"), res); |
|
847 |
#endif |
|
848 |
switch(res) |
|
849 |
{ |
|
850 |
case KErrNone: |
|
851 |
{ |
|
852 |
// code changed |
|
853 |
ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
854 |
if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
855 |
!(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) |
|
856 |
{ |
|
857 |
// Send the changed code to the SCP server. Not used with device lock enhancements. |
|
858 |
||
859 |
RSCPClient scpClient; |
|
860 |
TSCPSecCode newCode; |
|
861 |
newCode.Copy( newPassword ); |
|
862 |
if ( scpClient.Connect() == KErrNone ) |
|
863 |
{ |
|
864 |
scpClient.StoreCode( newCode ); |
|
865 |
scpClient.Close(); |
|
866 |
} |
|
867 |
} |
|
868 |
||
869 |
break; |
|
870 |
} |
|
871 |
case KErrGsmSSPasswordAttemptsViolation: |
|
872 |
case KErrLocked: |
|
873 |
{ |
|
874 |
ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
|
875 |
ChangeSecCodeL(); |
|
876 |
break; |
|
877 |
} |
|
878 |
case KErrGsm0707IncorrectPassword: |
|
879 |
case KErrAccessDenied: |
|
880 |
{ |
|
881 |
// code was entered erroneously |
|
882 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
883 |
ChangeSecCodeL(); |
|
884 |
break; |
|
885 |
} |
|
886 |
case KErrAbort: |
|
887 |
{ |
|
888 |
break; |
|
889 |
} |
|
890 |
default: |
|
891 |
{ |
|
892 |
ShowErrorNoteL(res); |
|
893 |
ChangeSecCodeL(); |
|
894 |
break; |
|
895 |
} |
|
896 |
} |
|
897 |
} |
|
898 |
// |
|
899 |
// ---------------------------------------------------------- |
|
900 |
// CSecuritySettings::ChangeAutoLockPeriodL() |
|
901 |
// Changes autolock period |
|
902 |
// ---------------------------------------------------------- |
|
903 |
// |
|
904 |
EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodL(TInt aPeriod) |
|
905 |
{ |
|
906 |
/***************************************************** |
|
907 |
* Series 60 Customer / ETel |
|
908 |
* Series 60 ETel API |
|
909 |
*****************************************************/ |
|
910 |
#if defined(_DEBUG) |
|
911 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodLXXXX()")); |
|
912 |
#endif |
|
913 |
RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); |
|
914 |
RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
915 |
TInt currentItem = 0; |
|
916 |
TInt oldPeriod = aPeriod; |
|
917 |
||
918 |
#if defined(_DEBUG) |
|
919 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() ReadDesC16ArrayResourceL")); |
|
920 |
#endif |
|
921 |
||
922 |
||
923 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
924 |
CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_AUTOLOCK_LBX); |
|
925 |
CleanupStack::PushL(items); |
|
926 |
||
927 |
if (aPeriod == 0) |
|
928 |
{ |
|
929 |
currentItem = 0; // autolock off |
|
930 |
} |
|
931 |
else |
|
932 |
{ |
|
933 |
currentItem = 1; // user defined |
|
934 |
} |
|
935 |
||
936 |
||
937 |
#if defined(_DEBUG) |
|
938 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() New autolocksettingpage")); |
|
939 |
#endif |
|
940 |
||
941 |
CAutoLockSettingPage* dlg = new (ELeave)CAutoLockSettingPage(R_AUTOLOCK_SETTING_PAGE, currentItem, items, aPeriod); |
|
942 |
CleanupStack::PushL(dlg); |
|
943 |
dlg->ConstructL(); |
|
944 |
TInt maxPeriod; |
|
945 |
if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
|
946 |
{ |
|
947 |
// Retrieve the current autolock period max. value from the SCP server, |
|
948 |
// and check that the value the user |
|
949 |
// selected is ok from the Corporate Policy point of view. |
|
950 |
RSCPClient scpClient; |
|
951 |
TInt ret = scpClient.Connect(); |
|
952 |
if ( ret == KErrNone ) |
|
953 |
{ |
|
954 |
CleanupClosePushL( scpClient ); |
|
955 |
TBuf<KSCPMaxIntLength> maxPeriodBuf; |
|
956 |
if ( scpClient.GetParamValue( ESCPMaxAutolockPeriod, maxPeriodBuf ) == KErrNone ) |
|
957 |
{ |
|
958 |
TLex lex( maxPeriodBuf ); |
|
959 |
if ( ( lex.Val( maxPeriod ) == KErrNone ) && ( maxPeriod > 0 ) ) |
|
960 |
{ |
|
961 |
dlg->SetPeriodMaximumValue(maxPeriod); |
|
962 |
} |
|
963 |
else |
|
964 |
{ |
|
965 |
maxPeriod = 0; |
|
966 |
dlg->SetPeriodMaximumValue(maxPeriod); |
|
967 |
} |
|
968 |
||
969 |
} |
|
970 |
else |
|
971 |
{ |
|
972 |
#if defined(_DEBUG) |
|
973 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ |
|
974 |
ERROR: Failed to retrieve max period")); |
|
975 |
#endif |
|
976 |
} |
|
977 |
} |
|
978 |
else |
|
979 |
{ |
|
980 |
#if defined(_DEBUG) |
|
981 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ |
|
982 |
ERROR: Failed to connect to SCP.")); |
|
983 |
#endif |
|
984 |
} |
|
985 |
CleanupStack::PopAndDestroy(); // scpClient |
|
986 |
} |
|
987 |
CleanupStack::Pop(); //dlg |
|
988 |
if (!dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) |
|
989 |
{ |
|
990 |
CleanupStack::PopAndDestroy(items); |
|
991 |
return oldPeriod; |
|
992 |
} |
|
993 |
||
994 |
CleanupStack::PopAndDestroy(); // items |
|
995 |
||
996 |
if ( FeatureManager::FeatureSupported( KFeatureIdSapTerminalControlFw ) ) |
|
997 |
{ |
|
998 |
// define a flag indicating whether disable autolock is allowed. |
|
999 |
TBool allowDisableAL = ETrue; |
|
1000 |
||
1001 |
if ( ( aPeriod == 0 ) && ( maxPeriod > 0 ) ) |
|
1002 |
{ |
|
1003 |
#if defined( _DEBUG ) |
|
1004 |
RDebug::Print( |
|
1005 |
_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() \ |
|
1006 |
The period: %d is not allowed by TARM; max: %d" ), |
|
1007 |
aPeriod, maxPeriod ); |
|
1008 |
#endif |
|
1009 |
allowDisableAL = EFalse; |
|
1010 |
HBufC* prompt = NULL; |
|
1011 |
prompt = StringLoader::LoadLC( |
|
1012 |
R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE ); |
|
1013 |
CAknNoteDialog* noteDlg = new ( ELeave ) CAknNoteDialog( |
|
1014 |
REINTERPRET_CAST( CEikDialog**,¬eDlg ) ); |
|
1015 |
noteDlg->PrepareLC( R_CODE_ERROR ); |
|
1016 |
noteDlg->SetTextL( *prompt ); |
|
1017 |
noteDlg->SetTimeout( CAknNoteDialog::ELongTimeout ); |
|
1018 |
noteDlg->SetTone( CAknNoteDialog::EErrorTone ); |
|
1019 |
noteDlg->RunLD(); |
|
1020 |
CleanupStack::PopAndDestroy( prompt ); |
|
1021 |
} |
|
1022 |
||
1023 |
if ( !allowDisableAL ) |
|
1024 |
{ |
|
1025 |
return ChangeAutoLockPeriodL( oldPeriod ); |
|
1026 |
} |
|
1027 |
} |
|
1028 |
||
1029 |
if (aPeriod == 0) |
|
1030 |
{ |
|
1031 |
||
1032 |
#ifdef RD_REMOTELOCK |
|
1033 |
||
1034 |
// If remote lock is enabled, don't disable the domestic OS device lock |
|
1035 |
// since that would render the RemoteLock useless. |
|
1036 |
// Instead just re-set the DOS lock to enabled which as a side effect |
|
1037 |
// requests the security code from the user. |
|
1038 |
||
1039 |
TBool remoteLockStatus( EFalse ); |
|
1040 |
CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
|
1041 |
||
1042 |
if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
|
1043 |
{ |
|
1044 |
if ( remoteLockStatus ) |
|
1045 |
{ |
|
1046 |
// Remote lock is enabled |
|
1047 |
#ifdef _DEBUG |
|
1048 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); |
|
1049 |
#endif // _DEBUG |
|
1050 |
||
1051 |
lockChange = RMobilePhone::ELockSetEnabled; |
|
1052 |
} |
|
1053 |
else |
|
1054 |
{ |
|
1055 |
// Remote lock is disabled |
|
1056 |
#ifdef _DEBUG |
|
1057 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); |
|
1058 |
#endif // _DEBUG |
|
1059 |
||
1060 |
lockChange = RMobilePhone::ELockSetDisabled; |
|
1061 |
} |
|
1062 |
} |
|
1063 |
else |
|
1064 |
{ |
|
1065 |
// Failed to get remote lock status |
|
1066 |
#ifdef _DEBUG |
|
1067 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - Failed to get RemoteLock status" ) ); |
|
1068 |
#endif // _DEBUG |
|
1069 |
} |
|
1070 |
||
1071 |
delete remoteLockSettings; |
|
1072 |
remoteLockSettings = NULL; |
|
1073 |
||
1074 |
#else // not defined RD_REMOTELOCK |
|
1075 |
||
1076 |
lockChange = RMobilePhone::ELockSetDisabled; |
|
1077 |
||
1078 |
#endif // RD_REMOTELOCK |
|
1079 |
} |
|
1080 |
else |
|
1081 |
{ |
|
1082 |
lockChange = RMobilePhone::ELockSetEnabled; |
|
1083 |
} |
|
1084 |
#if defined(_DEBUG) |
|
1085 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() SetLockSetting")); |
|
1086 |
#endif |
|
1087 |
iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1088 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1089 |
iPhone.SetLockSetting(iWait->iStatus,lockType,lockChange); |
|
1090 |
TInt status = iWait->WaitForRequestL(); |
|
1091 |
#if defined(_DEBUG) |
|
1092 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL(): RETURN CODE: %d"), status); |
|
1093 |
#endif |
|
1094 |
switch(status) |
|
1095 |
{ |
|
1096 |
case KErrNone: |
|
1097 |
#if defined(_DEBUG) |
|
1098 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() KErrNone")); |
|
1099 |
#endif |
|
1100 |
break; |
|
1101 |
case KErrGsmSSPasswordAttemptsViolation: |
|
1102 |
case KErrLocked: |
|
1103 |
#if defined(_DEBUG) |
|
1104 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() PasswordAttemptsViolation")); |
|
1105 |
#endif |
|
1106 |
return ChangeAutoLockPeriodL(oldPeriod); |
|
1107 |
case KErrGsm0707IncorrectPassword: |
|
1108 |
case KErrAccessDenied: |
|
1109 |
#if defined(_DEBUG) |
|
1110 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() IncorrectPassword")); |
|
1111 |
#endif |
|
1112 |
// code was entered erroneously |
|
1113 |
return ChangeAutoLockPeriodL(oldPeriod); |
|
1114 |
case KErrAbort: |
|
1115 |
// User pressed "cancel" in the code query dialog. |
|
1116 |
return oldPeriod; |
|
1117 |
default: |
|
1118 |
#if defined(_DEBUG) |
|
1119 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() default")); |
|
1120 |
#endif |
|
1121 |
return ChangeAutoLockPeriodL(oldPeriod); |
|
1122 |
} |
|
1123 |
#if defined(_DEBUG) |
|
1124 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() END")); |
|
1125 |
#endif |
|
1126 |
return aPeriod; |
|
1127 |
} |
|
1128 |
||
1129 |
||
1130 |
||
1131 |
// |
|
1132 |
// ---------------------------------------------------------- |
|
1133 |
// CSecuritySettings::ChangeRemoteLockStatusL() |
|
1134 |
// Changes remote lock status (on/off) |
|
1135 |
// ---------------------------------------------------------- |
|
1136 |
// |
|
1137 |
EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod ) |
|
1138 |
{ |
|
1139 |
#ifdef RD_REMOTELOCK |
|
1140 |
TInt retValue( KErrNone ); |
|
1141 |
||
1142 |
#ifdef _DEBUG |
|
1143 |
RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Enter, aRemoteLockStatus == %d, aAutoLockPeriod == %d" ), aRemoteLockStatus, aAutoLockPeriod ); |
|
1144 |
#endif // _DEBUG |
|
1145 |
||
1146 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1147 |
CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL( R_REMOTELOCK_LBX ); |
|
1148 |
CleanupStack::PushL( items ); |
|
1149 |
||
1150 |
// Store the current remote lock setting |
|
1151 |
TInt previousItem( 0 ); |
|
1152 |
TInt currentItem( 0 ); |
|
1153 |
||
1154 |
if ( aRemoteLockStatus ) |
|
1155 |
{ |
|
1156 |
previousItem = KRemoteLockSettingItemOn; |
|
1157 |
currentItem = KRemoteLockSettingItemOn; |
|
1158 |
} |
|
1159 |
else |
|
1160 |
{ |
|
1161 |
previousItem = KRemoteLockSettingItemOff; |
|
1162 |
currentItem = KRemoteLockSettingItemOff; |
|
1163 |
} |
|
1164 |
||
1165 |
// Create Remote Lock setting page for user to enable or disable remote locking |
|
1166 |
CRemoteLockSettingPage* remoteLockSettingPage = new( ELeave ) CRemoteLockSettingPage( R_REMOTELOCK_SETTING_PAGE, currentItem, items ); |
|
1167 |
||
1168 |
#ifdef _DEBUG |
|
1169 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Executing CRemoteLockSettingPage dialog" ) ); |
|
1170 |
#endif // _DEBUG |
|
1171 |
||
1172 |
// Execute the remote lock enable/disable dialog |
|
1173 |
TBool ret = remoteLockSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1174 |
||
1175 |
// Setting page list box items (texts) no longer needed |
|
1176 |
CleanupStack::PopAndDestroy( items ); |
|
1177 |
||
1178 |
if ( ret ) |
|
1179 |
{ |
|
1180 |
if ( currentItem == KRemoteLockSettingItemOn ) |
|
1181 |
{ |
|
1182 |
#ifdef _DEBUG |
|
1183 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to ON" ) ); |
|
1184 |
#endif // _DEBUG |
|
1185 |
||
1186 |
aRemoteLockStatus = ETrue; |
|
1187 |
||
1188 |
// If user wishes to enable remote lock |
|
1189 |
// a new remote lock code is required. |
|
1190 |
// RemoteLockCodeQueryL also |
|
1191 |
retValue = RemoteLockCodeQueryL( aRemoteLockCode ); |
|
1192 |
} |
|
1193 |
else if ( currentItem == KRemoteLockSettingItemOff ) |
|
1194 |
{ |
|
1195 |
#ifdef _DEBUG |
|
1196 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to OFF" ) ); |
|
1197 |
#endif // _DEBUG |
|
1198 |
||
1199 |
aRemoteLockStatus = EFalse; |
|
1200 |
retValue = KErrNone; |
|
1201 |
||
1202 |
// Check whether the status was already off |
|
1203 |
// If not don't make the user enter the security code |
|
1204 |
// (which occurs when setting the DOS lock setting) for no reason. |
|
1205 |
if ( currentItem != previousItem ) |
|
1206 |
{ |
|
1207 |
// Check whether AutoLock is enabled (timeout value greater |
|
1208 |
// than zero) or not. If AutoLock is enabled the domestic OS |
|
1209 |
// device lock should be left enabled. |
|
1210 |
if ( aAutoLockPeriod == 0 ) |
|
1211 |
{ |
|
1212 |
// Disable lock setting from domestic OS |
|
1213 |
retValue = RemoteLockSetLockSettingL( EFalse ); |
|
1214 |
} |
|
1215 |
else |
|
1216 |
{ |
|
1217 |
// If AutoLock is enabled, don't disable the DOS device lock |
|
1218 |
// Re-set (enable) the domestic OS device lock because as a |
|
1219 |
// side effect it requires the security code from the user |
|
1220 |
retValue = RemoteLockSetLockSettingL( ETrue ); |
|
1221 |
} |
|
1222 |
} |
|
1223 |
} |
|
1224 |
else |
|
1225 |
{ |
|
1226 |
// This should never happen. But if it does don't change anything |
|
1227 |
retValue = KErrUnknown; |
|
1228 |
} |
|
1229 |
} |
|
1230 |
else |
|
1231 |
{ |
|
1232 |
// Something went wrong with the RemoteLockSettingPage dialog |
|
1233 |
retValue = KErrGeneral; |
|
1234 |
||
1235 |
#ifdef _DEBUG |
|
1236 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - CRemoteLockSettingPage::ExecuteLD() failed" ) ); |
|
1237 |
#endif // _DEBUG |
|
1238 |
} |
|
1239 |
||
1240 |
#ifdef _DEBUG |
|
1241 |
RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Exit" ) ); |
|
1242 |
#endif |
|
1243 |
||
1244 |
return retValue; |
|
1245 |
#else //! RD_REMOTELOCK |
|
1246 |
return KErrNotSupported; |
|
1247 |
#endif //RD_REMOTELOCK |
|
1248 |
} |
|
1249 |
// |
|
1250 |
// ---------------------------------------------------------- |
|
1251 |
// CSecuritySettings::RemoteLockCodeQueryL() |
|
1252 |
// Pops up remote lock code query. Requires user to enter a new remote lock |
|
1253 |
// code twice and if they match enables the domestic OS device lock (which as |
|
1254 |
// a side effect pops up security code query). |
|
1255 |
// ---------------------------------------------------------- |
|
1256 |
// |
|
1257 |
TInt CSecuritySettings::RemoteLockCodeQueryL( TDes& aRemoteLockCode ) |
|
1258 |
{ |
|
1259 |
#ifdef RD_REMOTELOCK |
|
1260 |
TInt retValue( KErrNone ); |
|
1261 |
||
1262 |
#ifdef _DEBUG |
|
1263 |
RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Enter" ) ); |
|
1264 |
#endif // _DEBUG |
|
1265 |
||
1266 |
// Clear the remote lock code buffer |
|
1267 |
aRemoteLockCode.Zero(); |
|
1268 |
||
1269 |
// ----- Remote lock code query ------------------------------------------- |
|
1270 |
||
1271 |
// Execute Remote Lock code query |
|
1272 |
#ifdef _DEBUG |
|
1273 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code query" ) ); |
|
1274 |
#endif // _DEBUG |
|
1275 |
||
1276 |
// Load the query prompt from resources |
|
1277 |
CCodeQueryDialog* codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1278 |
TInt buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1279 |
if ( buttonId == EEikBidOk ) |
|
1280 |
{ |
|
1281 |
// Ok was pressed and the remote lock code seems fine |
|
1282 |
retValue = KErrNone; |
|
1283 |
} |
|
1284 |
else |
|
1285 |
{ |
|
1286 |
// User pressed Cancel |
|
1287 |
// Set the code length to zero leaving no trash for possible retry |
|
1288 |
aRemoteLockCode.Zero(); |
|
1289 |
retValue = KErrAbort; |
|
1290 |
} |
|
1291 |
||
1292 |
if ( retValue != KErrNone ) |
|
1293 |
{ |
|
1294 |
#ifdef _DEBUG |
|
1295 |
RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit, Remote lock code error" ) ); |
|
1296 |
#endif // _DEBUG |
|
1297 |
||
1298 |
// Can't continue beyond this |
|
1299 |
return retValue; |
|
1300 |
} |
|
1301 |
||
1302 |
// ----- Remote lock code confirm query ----------------------------------- |
|
1303 |
||
1304 |
// Confirm the code by asking it again |
|
1305 |
#ifdef _DEBUG |
|
1306 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code verify query" ) ); |
|
1307 |
#endif // _DEBUG |
|
1308 |
||
1309 |
// Buffer for the confirmation code |
|
1310 |
TBuf<KRLockMaxLockCodeLength> confirmCode; |
|
1311 |
||
1312 |
// Load the confirmation query prompt from resources |
|
1313 |
CCodeQueryDialog* codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1314 |
buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1315 |
||
1316 |
||
1317 |
if ( buttonId == EEikBidOk ) |
|
1318 |
{ |
|
1319 |
// Compare codes. Compare returns zero if descriptors have |
|
1320 |
// the same length and the same content |
|
1321 |
while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) |
|
1322 |
{ |
|
1323 |
//Codes didn't match; zero the bufffers and show the dialog again |
|
1324 |
aRemoteLockCode.Zero(); |
|
1325 |
confirmCode.Zero(); |
|
1326 |
// Codes don't match. Notify user |
|
1327 |
ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); |
|
1328 |
codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1329 |
buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1330 |
//Unless user pressed Cancel show the verification query |
|
1331 |
if(buttonId == EEikBidOk) |
|
1332 |
{ |
|
1333 |
codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1334 |
buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1335 |
} |
|
1336 |
||
1337 |
} |
|
1338 |
//User pressed cancel |
|
1339 |
if(buttonId != EEikBidOk) |
|
1340 |
{ |
|
1341 |
// Set the code length to zero leaving no trash for possible retry |
|
1342 |
// Report error and let the user try again |
|
1343 |
aRemoteLockCode.Zero(); |
|
1344 |
confirmCode.Zero(); |
|
1345 |
retValue = KErrAbort; |
|
1346 |
} |
|
1347 |
else |
|
1348 |
{ |
|
1349 |
// Codes match |
|
1350 |
confirmCode.Zero(); |
|
1351 |
||
1352 |
// ----- Check against security code ------------------------------ |
|
1353 |
||
1354 |
// Check that the new remote lock code doesn't match the security |
|
1355 |
// code of the device. |
|
1356 |
||
1357 |
RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
1358 |
secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
1359 |
RMobilePhone::TMobilePassword securityCode; |
|
1360 |
RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
|
1361 |
||
1362 |
if ( aRemoteLockCode.Length() <= RMobilePhone::KMaxMobilePasswordSize ) |
|
1363 |
{ |
|
1364 |
securityCode = aRemoteLockCode; |
|
1365 |
iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
|
1366 |
iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
|
1367 |
TInt res = iWait->WaitForRequestL(); |
|
1368 |
// The remote lock code matches the security code |
|
1369 |
// and that is not allowed |
|
1370 |
while ( (res == KErrNone) && (buttonId == EEikBidOk)) |
|
1371 |
{ |
|
1372 |
#ifdef _DEBUG |
|
1373 |
RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Unacceptable remote lock code" ) ); |
|
1374 |
#endif // _DEBUG |
|
1375 |
aRemoteLockCode.Zero(); |
|
1376 |
confirmCode.Zero(); |
|
1377 |
||
1378 |
ShowResultNoteL( R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone ); |
|
1379 |
||
1380 |
codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1381 |
buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1382 |
//Unless user pressed Cancel show the verification query |
|
1383 |
if(buttonId == EEikBidOk) |
|
1384 |
{ |
|
1385 |
codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1386 |
buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1387 |
||
1388 |
// Compare codes. Compare returns zero if descriptors have |
|
1389 |
// the same length and the same content |
|
1390 |
while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) |
|
1391 |
{ |
|
1392 |
//Codes didn't match; zero the bufffers and show the dialog again |
|
1393 |
aRemoteLockCode.Zero(); |
|
1394 |
confirmCode.Zero(); |
|
1395 |
// Codes don't match. Notify user |
|
1396 |
ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); |
|
1397 |
codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1398 |
buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1399 |
//Unless user pressed Cancel show the verification query |
|
1400 |
if(buttonId == EEikBidOk) |
|
1401 |
{ |
|
1402 |
codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1403 |
buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1404 |
} |
|
1405 |
||
1406 |
} |
|
1407 |
//User pressed cancel |
|
1408 |
if(buttonId != EEikBidOk) |
|
1409 |
{ |
|
1410 |
// Set the code length to zero leaving no trash for possible retry |
|
1411 |
// Report error and let the user try again |
|
1412 |
aRemoteLockCode.Zero(); |
|
1413 |
confirmCode.Zero(); |
|
1414 |
retValue = KErrAbort; |
|
1415 |
} |
|
1416 |
else //Check against security code |
|
1417 |
{ |
|
1418 |
securityCode = aRemoteLockCode; |
|
1419 |
iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
|
1420 |
iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
|
1421 |
res = iWait->WaitForRequestL(); |
|
1422 |
} |
|
1423 |
} |
|
1424 |
||
1425 |
} |
|
1426 |
//User pressed cancel |
|
1427 |
if(buttonId != EEikBidOk) |
|
1428 |
{ |
|
1429 |
// Set the code length to zero leaving no trash for possible retry |
|
1430 |
// Report error and let the user try again |
|
1431 |
aRemoteLockCode.Zero(); |
|
1432 |
confirmCode.Zero(); |
|
1433 |
retValue = KErrAbort; |
|
1434 |
} |
|
1435 |
} |
|
1436 |
||
1437 |
// ----- Enable DOS device lock (Security code query) ------------- |
|
1438 |
||
1439 |
if ( retValue == KErrNone ) |
|
1440 |
{ |
|
1441 |
// Enable lock setting in domestic OS. It is safe to enable the |
|
1442 |
// lock setting since RemoteLock API requires remote locking to |
|
1443 |
// be enabled when changing or setting the remote lock message. |
|
1444 |
retValue = RemoteLockSetLockSettingL( ETrue ); |
|
1445 |
} |
|
1446 |
} |
|
1447 |
} |
|
1448 |
else //User pressed Cancel |
|
1449 |
{ |
|
1450 |
// Set the code length to zero leaving no trash for possible retry |
|
1451 |
aRemoteLockCode.Zero(); |
|
1452 |
confirmCode.Zero(); |
|
1453 |
retValue = KErrAbort; |
|
1454 |
} |
|
1455 |
||
1456 |
#ifdef _DEBUG |
|
1457 |
RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); |
|
1458 |
#endif // _DEBUG |
|
1459 |
||
1460 |
return retValue; |
|
1461 |
#else //! RD_REMOTELOCK |
|
1462 |
return KErrNotSupported; |
|
1463 |
#endif //RD_REMOTELOCK |
|
1464 |
} |
|
1465 |
// |
|
1466 |
// ---------------------------------------------------------- |
|
1467 |
// CSecuritySettings::RemoteLockSetLockSettingL() |
|
1468 |
// Changes lock setting in domestic OS. Changing the domestic OS lock setting |
|
1469 |
// requires user to enter the security code. |
|
1470 |
// ---------------------------------------------------------- |
|
1471 |
// |
|
1472 |
TInt CSecuritySettings::RemoteLockSetLockSettingL( TBool aLockSetting ) |
|
1473 |
{ |
|
1474 |
#ifdef RD_REMOTELOCK |
|
1475 |
TInt retValue( KErrNone ); |
|
1476 |
||
1477 |
#ifdef _DEBUG |
|
1478 |
RDebug::Print(_L("(SecUi)CSecuritySettings::RemoteLockSetLockSettingL( %d ) - Enter" ), aLockSetting ); |
|
1479 |
#endif // _DEBUG |
|
1480 |
||
1481 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; |
|
1482 |
RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
1483 |
||
1484 |
if ( aLockSetting ) |
|
1485 |
{ |
|
1486 |
lockSetting = RMobilePhone::ELockSetEnabled; |
|
1487 |
} |
|
1488 |
else |
|
1489 |
{ |
|
1490 |
lockSetting = RMobilePhone::ELockSetDisabled; |
|
1491 |
} |
|
1492 |
||
1493 |
iWait->SetRequestType( EMobilePhoneSetLockSetting ); |
|
1494 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1495 |
iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); |
|
1496 |
||
1497 |
// Wait for code verify to complete |
|
1498 |
retValue = iWait->WaitForRequestL(); |
|
1499 |
||
1500 |
switch( retValue ) |
|
1501 |
{ |
|
1502 |
case KErrNone: |
|
1503 |
#ifdef _DEBUG |
|
1504 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrNone" ) ); |
|
1505 |
#endif // _DEBUG |
|
1506 |
break; |
|
1507 |
||
1508 |
case KErrGsmSSPasswordAttemptsViolation: |
|
1509 |
case KErrLocked: |
|
1510 |
#ifdef _DEBUG |
|
1511 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrLocked" ) ); |
|
1512 |
#endif // _DEBUG |
|
1513 |
//Error note is shown in CSecurityHandler::PassPhraseRequired() |
|
1514 |
break; |
|
1515 |
||
1516 |
case KErrGsm0707IncorrectPassword: |
|
1517 |
case KErrAccessDenied: |
|
1518 |
#ifdef _DEBUG |
|
1519 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrAccessDenied" ) ); |
|
1520 |
#endif // _DEBUG |
|
1521 |
// Security code was entered erroneously |
|
1522 |
//Error note is shown in CSecurityHandler::PassPhraseRequired() |
|
1523 |
break; |
|
1524 |
||
1525 |
case KErrAbort: |
|
1526 |
#ifdef _DEBUG |
|
1527 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrAbort" ) ); |
|
1528 |
#endif // _DEBUG |
|
1529 |
break; |
|
1530 |
||
1531 |
default: |
|
1532 |
#ifdef _DEBUG |
|
1533 |
RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned: %d"), retValue ); |
|
1534 |
#endif // _DEBUG |
|
1535 |
break; |
|
1536 |
} |
|
1537 |
||
1538 |
#ifdef _DEBUG |
|
1539 |
RDebug::Print(_L("(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - Exit" ) ); |
|
1540 |
#endif // _DEBUG |
|
1541 |
||
1542 |
return retValue; |
|
1543 |
#else //! RD_REMOTELOCK |
|
1544 |
return KErrNotSupported; |
|
1545 |
#endif //RD_REMOTELOCK |
|
1546 |
} |
|
1547 |
||
1548 |
||
1549 |
||
1550 |
// |
|
1551 |
// ---------------------------------------------------------- |
|
1552 |
// CSecuritySettings::ChangeSimSecurityL() |
|
1553 |
// Changes SIM security |
|
1554 |
// ---------------------------------------------------------- |
|
1555 |
// |
|
1556 |
EXPORT_C TBool CSecuritySettings::ChangeSimSecurityL() |
|
1557 |
{ |
|
1558 |
/***************************************************** |
|
1559 |
* Series 60 Customer / ETel |
|
1560 |
* Series 60 ETel API |
|
1561 |
*****************************************************/ |
|
1562 |
#if defined(_DEBUG) |
|
1563 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()")); |
|
1564 |
#endif |
|
1565 |
||
1566 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1567 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1568 |
RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; |
|
1569 |
RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
|
1570 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1571 |
CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_SECURITY_LBX); |
|
1572 |
CleanupStack::PushL(items); |
|
1573 |
||
1574 |
//get lock info |
|
1575 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1576 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1577 |
TInt status = iWait->WaitForRequestL(); |
|
1578 |
User::LeaveIfError(status); |
|
1579 |
TInt currentItem = 0; |
|
1580 |
||
1581 |
if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1582 |
{ |
|
1583 |
#if defined(_DEBUG) |
|
1584 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()lockInfo: ELockSetDisabled")); |
|
1585 |
#endif |
|
1586 |
currentItem = 1; // off |
|
1587 |
} |
|
1588 |
||
1589 |
TInt oldItem = currentItem; |
|
1590 |
||
1591 |
CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_SECURITY_SETTING_PAGE, currentItem, items); |
|
1592 |
CleanupStack::PushL(dlg); |
|
1593 |
||
1594 |
||
1595 |
CleanupStack::Pop(); // dlg |
|
1596 |
if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
1597 |
{ |
|
1598 |
CleanupStack::PopAndDestroy(); // items |
|
1599 |
return EFalse; |
|
1600 |
} |
|
1601 |
||
1602 |
||
1603 |
||
1604 |
if (currentItem == 1) |
|
1605 |
{ |
|
1606 |
lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1607 |
} |
|
1608 |
else |
|
1609 |
{ |
|
1610 |
lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
1611 |
} |
|
1612 |
||
1613 |
CleanupStack::PopAndDestroy(); // items |
|
1614 |
||
1615 |
iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1616 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1617 |
iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
1618 |
status = iWait->WaitForRequestL(); |
|
1619 |
||
1620 |
#if defined(_DEBUG) |
|
1621 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSimSecurityL(): RETURN CODE: %d"), status); |
|
1622 |
#endif |
|
1623 |
switch(status) |
|
1624 |
{ |
|
1625 |
case KErrNone: |
|
1626 |
{ |
|
1627 |
break; |
|
1628 |
} |
|
1629 |
case KErrGsm0707IncorrectPassword: |
|
1630 |
case KErrAccessDenied: |
|
1631 |
{ |
|
1632 |
// code was entered erroneously |
|
1633 |
return ChangeSimSecurityL(); |
|
1634 |
} |
|
1635 |
case KErrGsmSSPasswordAttemptsViolation: |
|
1636 |
case KErrLocked: |
|
1637 |
{ |
|
1638 |
return ChangeSimSecurityL(); |
|
1639 |
} |
|
1640 |
case KErrAbort: |
|
1641 |
{ |
|
1642 |
return EFalse; |
|
1643 |
} |
|
1644 |
default: |
|
1645 |
{ |
|
1646 |
ShowErrorNoteL(status); |
|
1647 |
return ChangeSimSecurityL(); |
|
1648 |
} |
|
1649 |
} |
|
1650 |
||
1651 |
return ETrue; |
|
1652 |
} |
|
1653 |
// |
|
1654 |
// ---------------------------------------------------------- |
|
1655 |
// CSecuritySettings::ChangePinRequestL() |
|
1656 |
// Changes PIN1 request |
|
1657 |
// ---------------------------------------------------------- |
|
1658 |
// |
|
1659 |
EXPORT_C TBool CSecuritySettings::ChangePinRequestL() |
|
1660 |
{ |
|
1661 |
/***************************************************** |
|
1662 |
* Series 60 Customer / ETel |
|
1663 |
* Series 60 ETel API |
|
1664 |
*****************************************************/ |
|
1665 |
#if defined(_DEBUG) |
|
1666 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL()")); |
|
1667 |
#endif |
|
1668 |
TInt simState; |
|
1669 |
TInt err( KErrGeneral ); |
|
1670 |
err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
1671 |
User::LeaveIfError( err ); |
|
1672 |
TBool simRemoved(simState == ESimNotPresent); |
|
1673 |
||
1674 |
if ( simRemoved ) |
|
1675 |
{ |
|
1676 |
ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1677 |
return EFalse;; |
|
1678 |
} |
|
1679 |
||
1680 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1681 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1682 |
RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC; |
|
1683 |
||
1684 |
RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
|
1685 |
||
1686 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1687 |
CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_PIN_LBX); |
|
1688 |
CleanupStack::PushL(items); |
|
1689 |
||
1690 |
//get lock info |
|
1691 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1692 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1693 |
TInt status = iWait->WaitForRequestL(); |
|
1694 |
User::LeaveIfError(status); |
|
1695 |
TInt currentItem = 0; |
|
1696 |
||
1697 |
#if defined(_DEBUG) |
|
1698 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() GetLockInfo")); |
|
1699 |
#endif |
|
1700 |
||
1701 |
if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1702 |
{ |
|
1703 |
#if defined(_DEBUG) |
|
1704 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() lockInfo: ELockSetDisabled")); |
|
1705 |
#endif |
|
1706 |
currentItem = 1; // off |
|
1707 |
} |
|
1708 |
||
1709 |
TInt oldItem = currentItem; |
|
1710 |
||
1711 |
CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_PIN_SETTING_PAGE, currentItem, items); |
|
1712 |
CleanupStack::PushL(dlg); |
|
1713 |
||
1714 |
||
1715 |
CleanupStack::Pop(); // dlg |
|
1716 |
if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
1717 |
{ |
|
1718 |
CleanupStack::PopAndDestroy(); // items |
|
1719 |
return EFalse; |
|
1720 |
} |
|
1721 |
||
1722 |
||
1723 |
if (currentItem == 1) |
|
1724 |
{ |
|
1725 |
#if defined(_DEBUG) |
|
1726 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); |
|
1727 |
#endif |
|
1728 |
lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1729 |
} |
|
1730 |
else |
|
1731 |
{ |
|
1732 |
#if defined(_DEBUG) |
|
1733 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); |
|
1734 |
#endif |
|
1735 |
lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
1736 |
} |
|
1737 |
||
1738 |
CleanupStack::PopAndDestroy(); // items |
|
1739 |
||
1740 |
// Raise a flag to indicate that the PIN |
|
1741 |
// request coming from ETEL has originated from SecUi and not from Engine. |
|
1742 |
TInt tRet = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
1743 |
if ( tRet != KErrNone ) |
|
1744 |
{ |
|
1745 |
#if defined(_DEBUG) |
|
1746 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL():\ |
|
1747 |
FAILED to set the SECUI query Flag: %d"), tRet); |
|
1748 |
#endif |
|
1749 |
} |
|
1750 |
// Change the lock setting |
|
1751 |
iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1752 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1753 |
iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
1754 |
status = iWait->WaitForRequestL(); |
|
1755 |
#if defined(_DEBUG) |
|
1756 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinRequestL(): RETURN CODE: %d"), status); |
|
1757 |
#endif |
|
1758 |
||
1759 |
// Lower the flag |
|
1760 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); |
|
1761 |
||
1762 |
switch(status) |
|
1763 |
{ |
|
1764 |
case KErrNone: |
|
1765 |
{ |
|
1766 |
break; |
|
1767 |
} |
|
1768 |
case KErrGsm0707OperationNotAllowed: |
|
1769 |
{ |
|
1770 |
// not allowed with this sim |
|
1771 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1772 |
return EFalse; |
|
1773 |
} |
|
1774 |
case KErrGsm0707IncorrectPassword: |
|
1775 |
case KErrAccessDenied: |
|
1776 |
{ |
|
1777 |
// code was entered erroneously |
|
1778 |
return ChangePinRequestL(); |
|
1779 |
} |
|
1780 |
case KErrGsmSSPasswordAttemptsViolation: |
|
1781 |
case KErrLocked: |
|
1782 |
{ |
|
1783 |
return ETrue; |
|
1784 |
} |
|
1785 |
case KErrAbort: |
|
1786 |
{ |
|
1787 |
return EFalse; |
|
1788 |
} |
|
1789 |
default: |
|
1790 |
{ |
|
1791 |
return ChangePinRequestL(); |
|
1792 |
} |
|
1793 |
} |
|
1794 |
||
1795 |
return ETrue; |
|
1796 |
} |
|
1797 |
||
1798 |
// |
|
1799 |
// ---------------------------------------------------------- |
|
1800 |
// CSecuritySettings::ChangeUPinRequestL() |
|
1801 |
// Changes UPIN request on/off |
|
1802 |
// ---------------------------------------------------------- |
|
1803 |
// |
|
1804 |
EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() |
|
1805 |
{ |
|
1806 |
TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
1807 |
TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
1808 |
if(wcdmaSupported || upinSupported) |
|
1809 |
{ |
|
1810 |
#if defined(_DEBUG) |
|
1811 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL()")); |
|
1812 |
#endif |
|
1813 |
||
1814 |
TInt simState; |
|
1815 |
TInt err( KErrGeneral ); |
|
1816 |
err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
1817 |
User::LeaveIfError( err ); |
|
1818 |
TBool simRemoved(simState == ESimNotPresent); |
|
1819 |
||
1820 |
if ( simRemoved ) |
|
1821 |
{ |
|
1822 |
ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1823 |
return EFalse; |
|
1824 |
} |
|
1825 |
||
1826 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1827 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1828 |
RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; |
|
1829 |
||
1830 |
RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1831 |
||
1832 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1833 |
CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_UPIN_LBX); |
|
1834 |
CleanupStack::PushL(items); |
|
1835 |
||
1836 |
//get lock info |
|
1837 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1838 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1839 |
TInt status = iWait->WaitForRequestL(); |
|
1840 |
User::LeaveIfError(status); |
|
1841 |
TInt currentItem = 0; |
|
1842 |
||
1843 |
#if defined(_DEBUG) |
|
1844 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() GetLockInfo")); |
|
1845 |
#endif |
|
1846 |
||
1847 |
if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1848 |
{ |
|
1849 |
#if defined(_DEBUG) |
|
1850 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() lockInfo: ELockSetDisabled")); |
|
1851 |
#endif |
|
1852 |
currentItem = 1; // off |
|
1853 |
} |
|
1854 |
||
1855 |
TInt oldItem = currentItem; |
|
1856 |
||
1857 |
CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_UPIN_SETTING_PAGE, currentItem, items); |
|
1858 |
CleanupStack::PushL(dlg); |
|
1859 |
||
1860 |
||
1861 |
CleanupStack::Pop(); // dlg |
|
1862 |
if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
1863 |
{ |
|
1864 |
CleanupStack::PopAndDestroy(); // items |
|
1865 |
return EFalse; |
|
1866 |
} |
|
1867 |
||
1868 |
||
1869 |
if (currentItem == 1) |
|
1870 |
{ |
|
1871 |
#if defined(_DEBUG) |
|
1872 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); |
|
1873 |
#endif |
|
1874 |
lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1875 |
} |
|
1876 |
else |
|
1877 |
{ |
|
1878 |
#if defined(_DEBUG) |
|
1879 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); |
|
1880 |
#endif |
|
1881 |
lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
1882 |
} |
|
1883 |
||
1884 |
CleanupStack::PopAndDestroy(); // items |
|
1885 |
||
1886 |
// Raise a flag to indicate that the UPIN |
|
1887 |
// request coming from ETEL has originated from SecUi and not from Engine. |
|
1888 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
1889 |
// Change the lock setting |
|
1890 |
iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1891 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1892 |
iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
1893 |
status = iWait->WaitForRequestL(); |
|
1894 |
#if defined(_DEBUG) |
|
1895 |
RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeUPinRequestL(): RETURN CODE: %d"), status); |
|
1896 |
#endif |
|
1897 |
||
1898 |
// Lower the flag |
|
1899 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); |
|
1900 |
||
1901 |
switch(status) |
|
1902 |
{ |
|
1903 |
case KErrNone: |
|
1904 |
{ |
|
1905 |
break; |
|
1906 |
} |
|
1907 |
case KErrGsm0707OperationNotAllowed: |
|
1908 |
{ |
|
1909 |
// not allowed with this sim |
|
1910 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1911 |
return EFalse; |
|
1912 |
} |
|
1913 |
case KErrGsm0707IncorrectPassword: |
|
1914 |
case KErrAccessDenied: |
|
1915 |
{ |
|
1916 |
// code was entered erroneously |
|
1917 |
return ChangeUPinRequestL(); |
|
1918 |
} |
|
1919 |
case KErrGsmSSPasswordAttemptsViolation: |
|
1920 |
case KErrLocked: |
|
1921 |
{ |
|
1922 |
return EFalse; |
|
1923 |
} |
|
1924 |
case KErrAbort: |
|
1925 |
{ |
|
1926 |
return EFalse; |
|
1927 |
} |
|
1928 |
default: |
|
1929 |
{ |
|
1930 |
ShowErrorNoteL(status); |
|
1931 |
return ChangeUPinRequestL(); |
|
1932 |
} |
|
1933 |
} |
|
1934 |
||
1935 |
return ETrue; |
|
1936 |
} |
|
1937 |
else |
|
1938 |
return EFalse; |
|
1939 |
||
1940 |
} |
|
1941 |
||
1942 |
// |
|
1943 |
// ---------------------------------------------------------- |
|
1944 |
// CSecuritySettings::SwitchPinCodesL() |
|
1945 |
// Changes the pin code currently in use (PIN/UPIN) |
|
1946 |
// ---------------------------------------------------------- |
|
1947 |
// |
|
1948 |
EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() |
|
1949 |
{ |
|
1950 |
TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
1951 |
TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
1952 |
if(wcdmaSupported || upinSupported) |
|
1953 |
{ |
|
1954 |
#if defined(_DEBUG) |
|
1955 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL()")); |
|
1956 |
#endif |
|
1957 |
||
1958 |
// If we are in simless offline mode the PIN codes can't obviously be switched |
|
1959 |
TInt simState; |
|
1960 |
TInt err( KErrGeneral ); |
|
1961 |
err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
1962 |
User::LeaveIfError( err ); |
|
1963 |
TBool simRemoved(simState == ESimNotPresent); |
|
1964 |
||
1965 |
if ( simRemoved ) |
|
1966 |
{ |
|
1967 |
ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1968 |
return EFalse; |
|
1969 |
} |
|
1970 |
||
1971 |
||
1972 |
RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; |
|
1973 |
RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced; |
|
1974 |
RMobilePhone::TMobilePhoneSecurityCode activeCode; |
|
1975 |
||
1976 |
iCustomPhone.GetActivePin(activeCode); |
|
1977 |
||
1978 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1979 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1980 |
#if defined(_DEBUG) |
|
1981 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); |
|
1982 |
#endif |
|
1983 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1984 |
||
1985 |
if (activeCode == RMobilePhone::ESecurityUniversalPin) |
|
1986 |
{ |
|
1987 |
lockType = RMobilePhone::ELockUniversalPin; |
|
1988 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1989 |
TInt res = iWait->WaitForRequestL(); |
|
1990 |
User::LeaveIfError(res); |
|
1991 |
#if defined(_DEBUG) |
|
1992 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: UPIN")); |
|
1993 |
#endif |
|
1994 |
} |
|
1995 |
else |
|
1996 |
{ |
|
1997 |
lockType = RMobilePhone::ELockICC; |
|
1998 |
iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1999 |
TInt res = iWait->WaitForRequestL(); |
|
2000 |
User::LeaveIfError(res); |
|
2001 |
#if defined(_DEBUG) |
|
2002 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: PIN")); |
|
2003 |
#endif |
|
2004 |
} |
|
2005 |
||
2006 |
// code request must be ON to change active code. |
|
2007 |
if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
2008 |
{ |
|
2009 |
#if defined(_DEBUG) |
|
2010 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON.")); |
|
2011 |
#endif |
|
2012 |
if (activeCode == RMobilePhone::ESecurityUniversalPin) |
|
2013 |
{ |
|
2014 |
ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2015 |
} |
|
2016 |
else |
|
2017 |
{ |
|
2018 |
ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2019 |
} |
|
2020 |
#if defined(_DEBUG) |
|
2021 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON NOTE END.")); |
|
2022 |
#endif |
|
2023 |
return EFalse; |
|
2024 |
} |
|
2025 |
||
2026 |
||
2027 |
||
2028 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
2029 |
CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_CODE_LBX); |
|
2030 |
CleanupStack::PushL(items); |
|
2031 |
||
2032 |
iCustomPhone.GetActivePin(activeCode); |
|
2033 |
TInt currentItem = 0; |
|
2034 |
||
2035 |
#if defined(_DEBUG) |
|
2036 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); |
|
2037 |
#endif |
|
2038 |
||
2039 |
if (activeCode == RMobilePhone::ESecurityUniversalPin) |
|
2040 |
{ |
|
2041 |
#if defined(_DEBUG) |
|
2042 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() active code: UPIN")); |
|
2043 |
#endif |
|
2044 |
currentItem = 1; // UPIN |
|
2045 |
} |
|
2046 |
||
2047 |
TInt oldItem = currentItem; |
|
2048 |
||
2049 |
CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_CODE_IN_USE_SETTING_PAGE, currentItem, items); |
|
2050 |
CleanupStack::PushL(dlg); |
|
2051 |
||
2052 |
||
2053 |
CleanupStack::Pop(); // dlg |
|
2054 |
if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
2055 |
{ |
|
2056 |
CleanupStack::PopAndDestroy(); // items |
|
2057 |
return EFalse; |
|
2058 |
} |
|
2059 |
||
2060 |
||
2061 |
if (currentItem == 1) |
|
2062 |
{ |
|
2063 |
#if defined(_DEBUG) |
|
2064 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: UPIN")); |
|
2065 |
#endif |
|
2066 |
lockType = RMobilePhone::ELockUniversalPin; |
|
2067 |
} |
|
2068 |
else |
|
2069 |
{ |
|
2070 |
#if defined(_DEBUG) |
|
2071 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: PIN1")); |
|
2072 |
#endif |
|
2073 |
lockType = RMobilePhone::ELockICC; |
|
2074 |
} |
|
2075 |
||
2076 |
CleanupStack::PopAndDestroy(); // items |
|
2077 |
||
2078 |
// Raise a flag to indicate that the code |
|
2079 |
// request coming from ETEL has originated from SecUi and not from Engine. |
|
2080 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
2081 |
// Change the lock setting |
|
2082 |
iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
2083 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
2084 |
iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
2085 |
TInt status = iWait->WaitForRequestL(); |
|
2086 |
#if defined(_DEBUG) |
|
2087 |
RDebug::Print( _L("(SECUI)CSecuritySettings::SwitchPinCodesL(): RETURN CODE: %d"), status); |
|
2088 |
#endif |
|
2089 |
// Lower the flag |
|
2090 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); |
|
2091 |
||
2092 |
switch(status) |
|
2093 |
{ |
|
2094 |
case KErrNone: |
|
2095 |
{ |
|
2096 |
break; |
|
2097 |
} |
|
2098 |
case KErrGsm0707OperationNotAllowed: |
|
2099 |
{ |
|
2100 |
// not allowed with this sim |
|
2101 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2102 |
return EFalse; |
|
2103 |
} |
|
2104 |
case KErrGsm0707IncorrectPassword: |
|
2105 |
case KErrAccessDenied: |
|
2106 |
{ |
|
2107 |
// code was entered erroneously |
|
2108 |
return SwitchPinCodesL(); |
|
2109 |
} |
|
2110 |
case KErrGsmSSPasswordAttemptsViolation: |
|
2111 |
case KErrLocked: |
|
2112 |
{ |
|
2113 |
return EFalse; |
|
2114 |
} |
|
2115 |
case KErrAbort: |
|
2116 |
{ |
|
2117 |
return EFalse; |
|
2118 |
} |
|
2119 |
default: |
|
2120 |
{ |
|
2121 |
ShowErrorNoteL(status); |
|
2122 |
return SwitchPinCodesL(); |
|
2123 |
} |
|
2124 |
} |
|
2125 |
||
2126 |
return ETrue; |
|
2127 |
} |
|
2128 |
else |
|
2129 |
return EFalse; |
|
2130 |
} |
|
2131 |
||
2132 |
// |
|
2133 |
// ---------------------------------------------------------- |
|
2134 |
// CSecuritySettings::IsLockEnabledL() |
|
2135 |
// Return is lock enabled/disabled |
|
2136 |
// ---------------------------------------------------------- |
|
2137 |
// |
|
2138 |
EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) |
|
2139 |
{ |
|
2140 |
/***************************************************** |
|
2141 |
* Series 60 Customer / ETel |
|
2142 |
* Series 60 ETel API |
|
2143 |
*****************************************************/ |
|
2144 |
#if defined(_DEBUG) |
|
2145 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsLockEnabledL()")); |
|
2146 |
#endif |
|
2147 |
#ifdef __WINS__ |
|
2148 |
||
2149 |
return EFalse; |
|
2150 |
||
2151 |
#else //WINS |
|
2152 |
||
2153 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
2154 |
||
2155 |
//get lock info |
|
2156 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
2157 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
2158 |
iPhone.GetLockInfo(iWait->iStatus, aLockType, lockInfoPkg); |
|
2159 |
TInt res = iWait->WaitForRequestL(); |
|
2160 |
||
2161 |
if (res != KErrNone) |
|
2162 |
return ETrue; |
|
2163 |
||
2164 |
//lock is enabled return true |
|
2165 |
if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) |
|
2166 |
{ |
|
2167 |
return ETrue; |
|
2168 |
} |
|
2169 |
||
2170 |
// lock is disabled return false |
|
2171 |
return EFalse; |
|
2172 |
||
2173 |
#endif |
|
2174 |
||
2175 |
} |
|
2176 |
// |
|
2177 |
// ---------------------------------------------------------- |
|
2178 |
// CSecuritySettings::AskSecCodeL() |
|
2179 |
// For asking security code e.g in settings |
|
2180 |
// ---------------------------------------------------------- |
|
2181 |
// |
|
2182 |
EXPORT_C TBool CSecuritySettings::AskSecCodeL() |
|
2183 |
{ |
|
2184 |
return iSecurityHandler->AskSecCodeL(); |
|
2185 |
} |
|
2186 |
// |
|
2187 |
// ---------------------------------------------------------- |
|
2188 |
// CSecuritySettings::AskPin2L() |
|
2189 |
// Asks PIN2 |
|
2190 |
// ---------------------------------------------------------- |
|
2191 |
// |
|
2192 |
EXPORT_C TBool CSecuritySettings::AskPin2L() |
|
2193 |
{ |
|
2194 |
/***************************************************** |
|
2195 |
* Series 60 Customer / ETel |
|
2196 |
* Series 60 ETel API |
|
2197 |
*****************************************************/ |
|
2198 |
#if defined(_DEBUG) |
|
2199 |
RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L()")); |
|
2200 |
#endif |
|
2201 |
TInt ret = 0; |
|
2202 |
// check if pin2 is blocked... |
|
2203 |
RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
2204 |
RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); |
|
2205 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
|
2206 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
|
2207 |
TBool isBlocked = EFalse; |
|
2208 |
//Check whether PIN2 is blocked |
|
2209 |
ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
|
2210 |
||
2211 |
#if defined(_DEBUG) |
|
2212 |
RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() IsBlocked return value: %d"), ret); |
|
2213 |
#endif |
|
2214 |
if(isBlocked) |
|
2215 |
return EFalse; |
|
2216 |
||
2217 |
if (ret != KErrNone) |
|
2218 |
{ |
|
2219 |
switch (ret) |
|
2220 |
{ |
|
2221 |
// PIN2 Blocked. |
|
2222 |
case KErrGsm0707SIMPuk2Required: |
|
2223 |
break; |
|
2224 |
case KErrGsmSSPasswordAttemptsViolation: |
|
2225 |
case KErrLocked: |
|
2226 |
// Pin2 features blocked permanently! |
|
2227 |
ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
|
2228 |
break; |
|
2229 |
case KErrGsm0707SimNotInserted: |
|
2230 |
// not allowed with this sim |
|
2231 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2232 |
break; |
|
2233 |
default: |
|
2234 |
ShowErrorNoteL(ret); |
|
2235 |
break; |
|
2236 |
} |
|
2237 |
return EFalse; |
|
2238 |
} |
|
2239 |
iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
2240 |
iPhone.GetSecurityCodeInfo(iWait->iStatus, etelsecCodeType, codeInfoPkg); |
|
2241 |
ret = iWait->WaitForRequestL(); |
|
2242 |
||
2243 |
#if defined(_DEBUG) |
|
2244 |
RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); |
|
2245 |
TInt attempts(codeInfo.iRemainingEntryAttempts); |
|
2246 |
RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); |
|
2247 |
#endif |
|
2248 |
User::LeaveIfError(ret); |
|
2249 |
||
2250 |
// ask pin2 code |
|
2251 |
RMobilePhone::TMobilePassword password; |
|
2252 |
CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
2253 |
if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
2254 |
ret = dlg->ExecuteLD(R_PIN2_QUERY); |
|
2255 |
else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
2256 |
{ |
|
2257 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
|
2258 |
ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
|
2259 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
2260 |
} |
|
2261 |
else |
|
2262 |
{ |
|
2263 |
HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); |
|
2264 |
ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
|
2265 |
CleanupStack::PopAndDestroy(queryPrompt); |
|
2266 |
} |
|
2267 |
||
2268 |
if (!ret) |
|
2269 |
{ |
|
2270 |
#if defined(_DEBUG) |
|
2271 |
RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L(): Cancel pressed")); |
|
2272 |
#endif |
|
2273 |
return EFalse; |
|
2274 |
} |
|
2275 |
||
2276 |
// verify code |
|
2277 |
RMobilePhone::TMobilePassword required_fourth; |
|
2278 |
iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
|
2279 |
iPhone.VerifySecurityCode(iWait->iStatus,etelsecCodeType, password, required_fourth); |
|
2280 |
TInt res = iWait->WaitForRequestL(); |
|
2281 |
||
2282 |
#if defined(_DEBUG) |
|
2283 |
RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() VerifySecurityCode return value: %d"), res); |
|
2284 |
#endif |
|
2285 |
||
2286 |
switch(res) |
|
2287 |
{ |
|
2288 |
case KErrNone: |
|
2289 |
break; |
|
2290 |
case KErrGsm0707IncorrectPassword: |
|
2291 |
case KErrAccessDenied: |
|
2292 |
// code was entered erroneously |
|
2293 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
2294 |
return AskPin2L(); |
|
2295 |
case KErrGsm0707OperationNotAllowed: |
|
2296 |
// not allowed with this sim |
|
2297 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2298 |
return EFalse; |
|
2299 |
case KErrGsmSSPasswordAttemptsViolation: |
|
2300 |
case KErrLocked: |
|
2301 |
// code was blocked |
|
2302 |
ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
2303 |
return EFalse; |
|
2304 |
default: |
|
2305 |
ShowErrorNoteL(res); |
|
2306 |
return AskPin2L(); |
|
2307 |
} |
|
2308 |
||
2309 |
return ETrue; |
|
2310 |
} |
|
2311 |
// |
|
2312 |
// ---------------------------------------------------------- |
|
2313 |
// CSecuritySettings::SetFdnModeL() |
|
2314 |
// Activates or deactivates Fixed Dialling Numbers (FDN) mode. |
|
2315 |
// ---------------------------------------------------------- |
|
2316 |
// |
|
2317 |
EXPORT_C void CSecuritySettings::SetFdnModeL() |
|
2318 |
{ |
|
2319 |
/***************************************************** |
|
2320 |
* Series 60 Customer / ETel |
|
2321 |
* Series 60 ETel API |
|
2322 |
*****************************************************/ |
|
2323 |
#if defined(_DEBUG) |
|
2324 |
RDebug::Print(_L("(SECUI)CSecuritySettings::SetFdnModeL()")); |
|
2325 |
#endif |
|
2326 |
RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
2327 |
||
2328 |
TBool isBlocked = EFalse; |
|
2329 |
TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
|
2330 |
||
2331 |
if(isBlocked) |
|
2332 |
return; |
|
2333 |
||
2334 |
if (ret != KErrNone) |
|
2335 |
{ |
|
2336 |
switch (ret) |
|
2337 |
{ |
|
2338 |
// PIN2 Blocked. |
|
2339 |
case KErrGsm0707SIMPuk2Required: |
|
2340 |
break; |
|
2341 |
case KErrGsmSSPasswordAttemptsViolation: |
|
2342 |
case KErrLocked: |
|
2343 |
// Pin2 features blocked permanently! |
|
2344 |
ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
|
2345 |
break; |
|
2346 |
case KErrGsm0707SimNotInserted: |
|
2347 |
// not allowed with this sim |
|
2348 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2349 |
break; |
|
2350 |
default: |
|
2351 |
ShowErrorNoteL(ret); |
|
2352 |
break; |
|
2353 |
} |
|
2354 |
return; |
|
2355 |
} |
|
2356 |
||
2357 |
||
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2358 |
TInt status = KErrNone; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2359 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2360 |
RMobilePhone::TMobilePhoneFdnStatus fdnMode; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2361 |
RMobilePhone::TMobilePhoneFdnSetting fdnSet; |
50 | 2362 |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2363 |
iPhone.GetFdnStatus(fdnMode); |
50 | 2364 |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2365 |
if (fdnMode == RMobilePhone::EFdnActive) |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2366 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2367 |
fdnSet = RMobilePhone::EFdnSetOff; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2368 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2369 |
else |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2370 |
{ |
50 | 2371 |
fdnSet = RMobilePhone::EFdnSetOn; |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2372 |
} |
50 | 2373 |
|
2374 |
// Change the FDN setting |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2375 |
iWait->SetRequestType(EMobilePhoneSetFdnSetting); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2376 |
RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2377 |
iPhone.SetFdnSetting(iWait->iStatus, fdnSet); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2378 |
status = iWait->WaitForRequestL(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2379 |
|
50 | 2380 |
#if defined(_DEBUG) |
2381 |
RDebug::Print( _L("(SECUI)CSecuritySettings::SetFdnModeL(): RETURN CODE: %d"), status); |
|
2382 |
#endif |
|
2383 |
switch(status) |
|
2384 |
{ |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2385 |
case KErrNone: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2386 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2387 |
case KErrGsm0707IncorrectPassword: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2388 |
case KErrAccessDenied: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2389 |
// code was entered erroneously |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2390 |
SetFdnModeL(); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2391 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2392 |
case KErrGsmSSPasswordAttemptsViolation: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2393 |
case KErrLocked: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2394 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2395 |
case KErrAbort: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2396 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2397 |
case KErrGsm0707OperationNotAllowed: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2398 |
// not allowed with this sim |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2399 |
ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2400 |
break; |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2401 |
default: |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2402 |
ShowErrorNoteL(status); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2403 |
break; |
50 | 2404 |
} |
2405 |
} |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2406 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2407 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2408 |
// CSecuritySettings::GetFndMode() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2409 |
// Retrieves the current Fixed Dialling Numbers mode |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2410 |
// ---------------------------------------------------------- |
50 | 2411 |
// |
2412 |
EXPORT_C TInt CSecuritySettings::GetFdnMode (RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2413 |
{ |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2414 |
/***************************************************** |
50 | 2415 |
* Series 60 Customer / ETel |
2416 |
* Series 60 ETel API |
|
2417 |
*****************************************************/ |
|
2418 |
#if defined(_DEBUG) |
|
2419 |
RDebug::Print(_L("(SECUI)CSecuritySettings::GetFdnMode()")); |
|
2420 |
#endif |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2421 |
return iPhone.GetFdnStatus(aFdnMode); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2422 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2423 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2424 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2425 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2426 |
// CSecuritySettings::ShowErrorNoteL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2427 |
// Shows error note |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2428 |
// ---------------------------------------------------------- |
50 | 2429 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2430 |
void CSecuritySettings::ShowErrorNoteL(TInt aError) |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2431 |
{ |
50 | 2432 |
#if defined(_DEBUG) |
2433 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ShowErrorNoteL()")); |
|
2434 |
#endif |
|
2435 |
// Let's create TextResolver instance for error resolving... |
|
2436 |
CTextResolver* textresolver = CTextResolver::NewLC(); |
|
2437 |
// Resolve the error |
|
2438 |
TPtrC errorstring; |
|
2439 |
errorstring.Set( textresolver->ResolveErrorString( aError ) ); |
|
2440 |
CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); |
|
2441 |
noteDlg->PrepareLC(R_CODE_ERROR); |
|
2442 |
noteDlg->SetTextL((TDesC&)errorstring); |
|
2443 |
noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
2444 |
noteDlg->SetTone(CAknNoteDialog::EErrorTone); |
|
2445 |
noteDlg->RunLD(); |
|
2446 |
CleanupStack::PopAndDestroy(); // resolver |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2447 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2448 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2449 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2450 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2451 |
// CSecuritySettings::ShowResultNoteL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2452 |
// Shows result note |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2453 |
// ---------------------------------------------------------- |
50 | 2454 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2455 |
void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) |
50 | 2456 |
{ |
2457 |
#if defined(_DEBUG) |
|
2458 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL()")); |
|
2459 |
RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL() Resource ID: %d"), aResourceID); |
|
2460 |
#endif |
|
2461 |
CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); |
|
2462 |
noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
2463 |
noteDlg->SetTone(aTone); |
|
2464 |
noteDlg->ExecuteLD(aResourceID); |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2465 |
} |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2466 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2467 |
// |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2468 |
// ---------------------------------------------------------- |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2469 |
// CSecuritySettings::IsUpinSupportedL() |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2470 |
// Return is UPIN supported |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2471 |
// ---------------------------------------------------------- |
50 | 2472 |
// |
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2473 |
EXPORT_C TBool CSecuritySettings::IsUpinSupportedL() |
50 | 2474 |
{ |
2475 |
TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
2476 |
TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
2477 |
if(wcdmaSupported || upinSupported) |
|
2478 |
{ |
|
2479 |
#if defined(_DEBUG) |
|
2480 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() BEGIN")); |
|
2481 |
#endif |
|
2482 |
#ifdef __WINS__ |
|
2483 |
||
2484 |
return EFalse; |
|
2485 |
||
2486 |
#else //WINS |
|
2487 |
||
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2488 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
50 | 2489 |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2490 |
//get lock info |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2491 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2492 |
iWait->SetRequestType(EMobilePhoneGetLockInfo); |
50 | 2493 |
#if defined(_DEBUG) |
2494 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo")); |
|
2495 |
#endif |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2496 |
iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, lockInfoPkg); |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2497 |
TInt res = iWait->WaitForRequestL(); |
50 | 2498 |
#if defined(_DEBUG) |
2499 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo DONE")); |
|
2500 |
#endif |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2501 |
if ((res == KErrNotSupported) || (res == KErrGsmInvalidParameter)) |
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2502 |
{ |
50 | 2503 |
#if defined(_DEBUG) |
2504 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): NOT SUPPORTED")); |
|
2505 |
#endif |
|
2506 |
return EFalse; |
|
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2507 |
} |
50 | 2508 |
#if defined(_DEBUG) |
2509 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): SUPPORTED: %d"), res); |
|
2510 |
#endif |
|
2511 |
#if defined(_DEBUG) |
|
2512 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() END")); |
|
2513 |
#endif |
|
2514 |
return ETrue; |
|
2515 |
||
2516 |
#endif //WINS |
|
2517 |
} |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2518 |
else |
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2519 |
return EFalse; |
50 | 2520 |
} |
2521 |
// |
|
2522 |
// ---------------------------------------------------------- |
|
2523 |
// CSecuritySettings::IsCodeBlocked() |
|
2524 |
// Return is a code blocked |
|
2525 |
// ---------------------------------------------------------- |
|
2526 |
// |
|
2527 |
EXPORT_C TBool CSecuritySettings::IsUpinBlocked() |
|
2528 |
{ |
|
2529 |
TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
2530 |
TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
2531 |
if(wcdmaSupported || upinSupported) |
|
2532 |
{ |
|
2533 |
#ifdef __WINS__ |
|
2534 |
return EFalse; |
|
2535 |
#else//__WINS__ |
|
2536 |
#if defined(_DEBUG) |
|
2537 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() BEGIN")); |
|
2538 |
#endif |
|
2539 |
RMmCustomAPI::TSecurityCodeType secCodeType; |
|
2540 |
secCodeType = RMmCustomAPI::ESecurityUniversalPin; |
|
2541 |
TBool isBlocked = EFalse; |
|
2542 |
#if defined(_DEBUG) |
|
2543 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() IsBlocked")); |
|
2544 |
#endif |
|
2545 |
TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
|
2546 |
#if defined(_DEBUG) |
|
2547 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() DONE.RETURN: %d"), ret); |
|
2548 |
#endif |
|
2549 |
#if defined(_DEBUG) |
|
2550 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked():isblocked: %d"), isBlocked); |
|
2551 |
#endif |
|
2552 |
#if defined(_DEBUG) |
|
2553 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() END")); |
|
2554 |
#endif |
|
2555 |
return isBlocked; |
|
2556 |
#endif //__WINS__ |
|
2557 |
} |
|
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2558 |
else |
50 | 2559 |
return EFalse; |
2560 |
} |
|
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2561 |
// |
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2562 |
// ---------------------------------------------------------- |
50 | 2563 |
// CSecuritySettings::GetActivePinCode() |
2564 |
// Return the code active in current application (PIN/UPIN) |
|
49
09b1ac925e3f
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
2565 |
// ---------------------------------------------------------- |
50 | 2566 |
// |
2567 |
EXPORT_C TBool CSecuritySettings::IsUpinActive() |
|
2568 |
{ |
|
2569 |
TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
2570 |
TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
2571 |
if(wcdmaSupported || upinSupported) |
|
2572 |
{ |
|
2573 |
#ifdef __WINS__ |
|
2574 |
return EFalse; |
|
2575 |
#else//__WINS__ |
|
2576 |
#if defined(_DEBUG) |
|
2577 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() BEGIN")); |
|
2578 |
#endif |
|
2579 |
RMobilePhone::TMobilePhoneSecurityCode activePin; |
|
2580 |
#if defined(_DEBUG) |
|
2581 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin")); |
|
2582 |
#endif |
|
2583 |
iCustomPhone.GetActivePin(activePin); |
|
2584 |
#if defined(_DEBUG) |
|
2585 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin DONE")); |
|
2586 |
#endif |
|
2587 |
if(activePin == RMobilePhone::ESecurityUniversalPin) |
|
2588 |
{ |
|
2589 |
#if defined(_DEBUG) |
|
2590 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN ACTIVE")); |
|
2591 |
#endif |
|
2592 |
return ETrue; |
|
2593 |
} |
|
2594 |
#if defined(_DEBUG) |
|
2595 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN NOT ACTIVE")); |
|
2596 |
#endif |
|
2597 |
#if defined(_DEBUG) |
|
2598 |
RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): END")); |
|
2599 |
#endif |
|
2600 |
return EFalse; |
|
2601 |
#endif //__WINS__ |
|
2602 |
} |
|
2603 |
else |
|
2604 |
return EFalse; |
|
2605 |
} |
|
0
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2606 |
|
164170e6151a
Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2607 |
// End of file |