20
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2007 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: Encapsulates the usage of s60 security UI component
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include "CPsu2SecUi.h"
|
|
22 |
|
|
23 |
#include <MVPbkSimPhone.h>
|
|
24 |
#include <secuisecuritysettings.h> // CSecuritySettings
|
|
25 |
#include <secui.h> // TSecUi
|
|
26 |
|
|
27 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
28 |
|
|
29 |
// -----------------------------------------------------------------------------
|
|
30 |
// CPsu2SecUi::CPsu2SecUi
|
|
31 |
// C++ default constructor can NOT contain any code, that
|
|
32 |
// might leave.
|
|
33 |
// -----------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
CPsu2SecUi::CPsu2SecUi(MVPbkSimPhone& aPhone)
|
|
36 |
: iPhone(aPhone)
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
// CPsu2SecUi::ConstructL
|
|
42 |
// Symbian 2nd phase constructor can leave.
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
void CPsu2SecUi::ConstructL()
|
|
46 |
{
|
|
47 |
TSecUi::InitializeLibL();
|
|
48 |
iSecuritySettings = CSecuritySettings::NewL();
|
|
49 |
iPhone.OpenL(*this);
|
|
50 |
}
|
|
51 |
|
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
// CPsu2SecUi::NewL
|
|
54 |
// Two-phased constructor.
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
CPsu2SecUi* CPsu2SecUi::NewL(MVPbkSimPhone& aPhone)
|
|
58 |
{
|
|
59 |
CPsu2SecUi* self = new( ELeave ) CPsu2SecUi(aPhone);
|
|
60 |
CleanupStack::PushL( self );
|
|
61 |
self->ConstructL();
|
|
62 |
CleanupStack::Pop( self );
|
|
63 |
return self;
|
|
64 |
}
|
|
65 |
|
|
66 |
// Destructor
|
|
67 |
CPsu2SecUi::~CPsu2SecUi()
|
|
68 |
{
|
|
69 |
iPhone.Close(*this);
|
|
70 |
delete iSecuritySettings;
|
|
71 |
TSecUi::UnInitializeLib();
|
|
72 |
}
|
|
73 |
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
// CPsu2SecUi::ActivateFDNL
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
void CPsu2SecUi::ActivateFDNL()
|
|
79 |
{
|
|
80 |
TBool isActive = IsFDNActive();
|
|
81 |
if ( !isActive )
|
|
82 |
{
|
|
83 |
iSecuritySettings->SetFdnModeL();
|
|
84 |
if ( IsFDNActive() )
|
|
85 |
{
|
|
86 |
// Activity has been changed which means that PIN2 was inserted
|
|
87 |
// correctly
|
|
88 |
iPin2Confirmed = ETrue;
|
|
89 |
}
|
|
90 |
}
|
|
91 |
}
|
|
92 |
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
// CPsu2SecUi::DeactivateFDNL
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
void CPsu2SecUi::DeactivateFDNL()
|
|
98 |
{
|
|
99 |
TBool isActive = IsFDNActive();
|
|
100 |
if ( isActive )
|
|
101 |
{
|
|
102 |
iSecuritySettings->SetFdnModeL();
|
|
103 |
if ( !IsFDNActive() )
|
|
104 |
{
|
|
105 |
// Activity has been changed which means that PIN2 was inserted
|
|
106 |
// correctly
|
|
107 |
iPin2Confirmed = ETrue;
|
|
108 |
}
|
|
109 |
}
|
|
110 |
}
|
|
111 |
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
// CPsu2SecUi::ConfirmPin2L
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
TBool CPsu2SecUi::ConfirmPin2L()
|
|
117 |
{
|
|
118 |
if ( !iPin2Confirmed )
|
|
119 |
{
|
|
120 |
iPin2Confirmed = iSecuritySettings->AskPin2L();
|
|
121 |
}
|
|
122 |
|
|
123 |
return iPin2Confirmed;
|
|
124 |
}
|
|
125 |
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
// CPsu2SecUi::AskPin2L
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
TBool CPsu2SecUi::AskPin2L()
|
|
131 |
{
|
|
132 |
return iSecuritySettings->AskPin2L();
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// CPsu2SecUi::IsFDNActive
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
TBool CPsu2SecUi::IsFDNActive()
|
|
140 |
{
|
|
141 |
MVPbkSimPhone::TFDNStatus fdnStatus = iPhone.FixedDialingStatus();
|
|
142 |
if ( fdnStatus == MVPbkSimPhone::EFdnIsActive ||
|
|
143 |
fdnStatus == MVPbkSimPhone::EFdnIsPermanentlyActive )
|
|
144 |
{
|
|
145 |
return ETrue;
|
|
146 |
}
|
|
147 |
return EFalse;
|
|
148 |
}
|
|
149 |
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
// CPsu2SecUi::PhoneOpened
|
|
152 |
// -----------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
void CPsu2SecUi::PhoneOpened(MVPbkSimPhone& /*aPhone*/)
|
|
155 |
{
|
|
156 |
}
|
|
157 |
|
|
158 |
// -----------------------------------------------------------------------------
|
|
159 |
// CPsu2SecUi::PhoneOpened
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
void CPsu2SecUi::PhoneError(MVPbkSimPhone& /*aPhone*/,
|
|
163 |
TErrorIdentifier /*aIdentifier*/, TInt /*aError*/)
|
|
164 |
{
|
|
165 |
}
|
|
166 |
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
// CPsu2SecUi::ServiceTableUpdated
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
void CPsu2SecUi::ServiceTableUpdated(TUint32 /*aServiceTable*/)
|
|
172 |
{
|
|
173 |
}
|
|
174 |
|
|
175 |
// -----------------------------------------------------------------------------
|
|
176 |
// CPsu2SecUi::FixedDiallingStatusChanged
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
void CPsu2SecUi::FixedDiallingStatusChanged(
|
|
180 |
TInt /*aFDNStatus*/ )
|
|
181 |
{
|
|
182 |
}
|
|
183 |
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
// CPsu2SecUi::Reset
|
|
186 |
// -----------------------------------------------------------------------------
|
|
187 |
//
|
|
188 |
void CPsu2SecUi::Reset()
|
|
189 |
{
|
|
190 |
iPin2Confirmed = EFalse;
|
|
191 |
}
|
|
192 |
// End of File
|