|
46
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of the License "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: Implementation of MsChapv2NotifDlg dialog plugin.
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
/*
|
|
|
19 |
* %version: 12.1.8 %
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
// INCLUDE FILES
|
|
|
23 |
#include <coemain.h>
|
|
|
24 |
#include <eikenv.h>
|
|
|
25 |
#include <bautils.h>
|
|
|
26 |
#include <data_caging_path_literals.hrh>
|
|
|
27 |
#include <mschapv2notifdlgui.rsg>
|
|
|
28 |
|
|
|
29 |
#include <e32property.h> // For RProperty
|
|
|
30 |
#include <UikonInternalPSKeys.h> // For KPSUidUikon and KUikGlobalNotesAllowed.
|
|
|
31 |
|
|
|
32 |
#include "MsChapv2NotifDlgPlugin.h"
|
|
|
33 |
#include "MsChapv2NotifDialog.h"
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
// ================= OTHER EXPORTED FUNCTIONS ==============
|
|
|
38 |
|
|
|
39 |
// -----------------------------------------------------------------------------
|
|
|
40 |
// CreateNotifiersL
|
|
|
41 |
// -----------------------------------------------------------------------------
|
|
|
42 |
//
|
|
|
43 |
LOCAL_C void CreateNotifiersL(
|
|
|
44 |
CArrayPtrFlat< MEikSrvNotifierBase2 >* aNotifiers )
|
|
|
45 |
{
|
|
|
46 |
MEikSrvNotifierBase2 *serNotify;
|
|
|
47 |
serNotify = CMsChapv2DialogPlugin::NewL();
|
|
|
48 |
CleanupStack::PushL( serNotify );
|
|
|
49 |
aNotifiers->AppendL( serNotify );
|
|
|
50 |
CleanupStack::Pop( serNotify );
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
// -----------------------------------------------------------------------------
|
|
|
55 |
// NotifierArray
|
|
|
56 |
// -----------------------------------------------------------------------------
|
|
|
57 |
//
|
|
|
58 |
EXPORT_C CArrayPtr< MEikSrvNotifierBase2 >* NotifierArray()
|
|
|
59 |
{
|
|
|
60 |
// NotifierArray() can't leave
|
|
|
61 |
CArrayPtrFlat< MEikSrvNotifierBase2 >* array =
|
|
|
62 |
new CArrayPtrFlat< MEikSrvNotifierBase2 >( KPluginGranularity );
|
|
|
63 |
|
|
|
64 |
if ( array )
|
|
|
65 |
{
|
|
|
66 |
TRAPD( err, CreateNotifiersL( array ) );
|
|
|
67 |
|
|
|
68 |
if( err )
|
|
|
69 |
{
|
|
|
70 |
TInt count = array->Count();
|
|
|
71 |
|
|
|
72 |
while( count-- )
|
|
|
73 |
{
|
|
|
74 |
( *array )[ count ]->Release();
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
delete array;
|
|
|
78 |
array = NULL;
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
return( array );
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
//////////////////////////////////////////////////////////////
|
|
|
87 |
// MsChapv2 dialog plugin
|
|
|
88 |
/////////////////////////////////////////////////////////////
|
|
|
89 |
|
|
|
90 |
// -----------------------------------------------------------------------------
|
|
|
91 |
// CMsChapv2DialogPlugin::CMsChapv2DialogPlugin
|
|
|
92 |
// -----------------------------------------------------------------------------
|
|
|
93 |
//
|
|
|
94 |
CMsChapv2DialogPlugin::CMsChapv2DialogPlugin()
|
|
|
95 |
: iCancelled( EFalse )
|
|
|
96 |
{
|
|
|
97 |
iManager = NULL;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
// -----------------------------------------------------------------------------
|
|
|
102 |
// CMsChapv2DialogPlugin::~CMsChapv2DialogPlugin
|
|
|
103 |
// -----------------------------------------------------------------------------
|
|
|
104 |
//
|
|
|
105 |
CMsChapv2DialogPlugin::~CMsChapv2DialogPlugin()
|
|
|
106 |
{
|
|
|
107 |
CCoeEnv::Static()->DeleteResourceFile( iResource );
|
|
|
108 |
|
|
|
109 |
if ( !iCancelled )
|
|
|
110 |
{
|
|
|
111 |
delete iMSCHAPV2Dialog;
|
|
|
112 |
}
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
// -----------------------------------------------------------------------------
|
|
|
118 |
// CMsChapv2DialogPlugin::RegisterL
|
|
|
119 |
// -----------------------------------------------------------------------------
|
|
|
120 |
//
|
|
|
121 |
CMsChapv2DialogPlugin::TNotifierInfo CMsChapv2DialogPlugin::RegisterL()
|
|
|
122 |
{
|
|
|
123 |
iInfo.iUid = KUidMsChapv2Dialog;
|
|
|
124 |
iInfo.iPriority = ENotifierPriorityHigh;
|
|
|
125 |
iInfo.iChannel = KUidMsChapv2Dialog;
|
|
|
126 |
return iInfo;
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
// -----------------------------------------------------------------------------
|
|
|
131 |
// CMsChapv2DialogPlugin::NewL
|
|
|
132 |
// -----------------------------------------------------------------------------
|
|
|
133 |
//
|
|
|
134 |
CMsChapv2DialogPlugin* CMsChapv2DialogPlugin::NewL()
|
|
|
135 |
{
|
|
|
136 |
CMsChapv2DialogPlugin* self = new( ELeave ) CMsChapv2DialogPlugin();
|
|
|
137 |
CleanupStack::PushL( self );
|
|
|
138 |
self->ConstructL();
|
|
|
139 |
CleanupStack::Pop( self );
|
|
|
140 |
return self;
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
// -----------------------------------------------------------------------------
|
|
|
145 |
// CMsChapv2DialogPlugin::ConstructL
|
|
|
146 |
// -----------------------------------------------------------------------------
|
|
|
147 |
//
|
|
|
148 |
void CMsChapv2DialogPlugin::ConstructL()
|
|
|
149 |
{
|
|
|
150 |
TFileName fileName;
|
|
|
151 |
|
|
|
152 |
fileName.Append( KDriveZ );
|
|
|
153 |
fileName.Append( KDC_RESOURCE_FILES_DIR );
|
|
|
154 |
fileName.Append( KResourceFileName );
|
|
|
155 |
|
|
|
156 |
BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), fileName );
|
|
|
157 |
iResource = CCoeEnv::Static()->AddResourceFileL( fileName );
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
// -----------------------------------------------------------------------------
|
|
|
162 |
// CMsChapv2DialogPlugin::StartL
|
|
|
163 |
// -----------------------------------------------------------------------------
|
|
|
164 |
//
|
|
|
165 |
TPtrC8 CMsChapv2DialogPlugin::StartL( const TDesC8& /*aBuffer*/ )
|
|
|
166 |
{
|
|
|
167 |
return KNullDesC8().Ptr();
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
// -----------------------------------------------------------------------------
|
|
|
172 |
// CMsChapv2DialogPlugin::StartL
|
|
|
173 |
// -----------------------------------------------------------------------------
|
|
|
174 |
//
|
|
|
175 |
void CMsChapv2DialogPlugin::StartL( const TDesC8& aBuffer,
|
|
|
176 |
TInt aReplySlot,
|
|
|
177 |
const RMessagePtr2& aMessage )
|
|
|
178 |
{
|
|
|
179 |
iCancelled = EFalse;
|
|
|
180 |
iReplySlot = aReplySlot;
|
|
|
181 |
iMessage = aMessage;
|
|
|
182 |
|
|
|
183 |
// This object gets constructed only once where as this gets called many
|
|
|
184 |
// times, if user is not answering the query.
|
|
|
185 |
// So initialize everything here itself.
|
|
|
186 |
iMSCHAPV2Dialog = NULL;
|
|
|
187 |
iDataPtr = NULL;
|
|
|
188 |
iDataPckgPtr = NULL;
|
|
|
189 |
|
|
|
190 |
// We are about to display the password prompt.
|
|
|
191 |
// Since this part of the code can be executed during the bootup, check if
|
|
|
192 |
// the UI has really started up to display notes/dialogs.
|
|
|
193 |
TInt notesAllowed = 0;
|
|
|
194 |
TInt error = RProperty::Get( KPSUidUikon, KUikGlobalNotesAllowed,
|
|
|
195 |
notesAllowed );
|
|
|
196 |
|
|
|
197 |
// The above call can return error. Don't care the error. What we care is
|
|
|
198 |
// if notesAllowed has turned to 1 from 0.
|
|
|
199 |
if ( notesAllowed )
|
|
|
200 |
{
|
|
|
201 |
iDataPtr = new( ELeave ) TEapMsChapv2UsernamePasswordInfo;
|
|
|
202 |
iDataPtr->iIsIdentityQuery = ETrue;
|
|
|
203 |
iDataPtr->iPasswordPromptEnabled = ETrue;
|
|
|
204 |
iDataPckgPtr = new( ELeave ) TPckg<TEapMsChapv2UsernamePasswordInfo>(
|
|
|
205 |
*iDataPtr );
|
|
|
206 |
iDataPckgPtr->Copy(aBuffer);
|
|
|
207 |
|
|
|
208 |
iMSCHAPV2Dialog = CMsChapv2Dialog::NewL( iDataPtr->iUsername,
|
|
|
209 |
iDataPtr->iPassword, this );
|
|
|
210 |
iMSCHAPV2Dialog->ExecuteLD( R_MSCHAPV2NOTIF_USERNAME_PASSWORD_QUERY );
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
// In case if the notes are not allowed, this message gets completed when
|
|
|
214 |
// EAPOL time out occurs and a subsequent call to cancel from
|
|
|
215 |
// eap_am_type_mschapv2_symbian_c::DoCancel().
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
// -----------------------------------------------------------------------------
|
|
|
219 |
// CMsChapv2DialogPlugin::UpdateL
|
|
|
220 |
// -----------------------------------------------------------------------------
|
|
|
221 |
//
|
|
|
222 |
TPtrC8 CMsChapv2DialogPlugin::UpdateL( const TDesC8& /*aBuffer*/ )
|
|
|
223 |
{
|
|
|
224 |
return KNullDesC8().Ptr();
|
|
|
225 |
}
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
// -----------------------------------------------------------------------------
|
|
|
229 |
// CMsChapv2DialogPlugin::Cancel
|
|
|
230 |
// -----------------------------------------------------------------------------
|
|
|
231 |
//
|
|
|
232 |
void CMsChapv2DialogPlugin::Cancel()
|
|
|
233 |
{
|
|
|
234 |
if ( !iCancelled )
|
|
|
235 |
{
|
|
|
236 |
iCancelled = ETrue;
|
|
|
237 |
if ( !iMessage.IsNull() )
|
|
|
238 |
{
|
|
|
239 |
iMessage.Complete( KErrCancel );
|
|
|
240 |
}
|
|
|
241 |
|
|
|
242 |
if ( iMSCHAPV2Dialog )
|
|
|
243 |
{
|
|
|
244 |
delete iMSCHAPV2Dialog;
|
|
|
245 |
iMSCHAPV2Dialog = NULL;
|
|
|
246 |
}
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
if ( iDataPtr )
|
|
|
250 |
{
|
|
|
251 |
delete iDataPtr;
|
|
|
252 |
iDataPtr = NULL;
|
|
|
253 |
}
|
|
|
254 |
|
|
|
255 |
if ( iDataPckgPtr )
|
|
|
256 |
{
|
|
|
257 |
delete iDataPckgPtr;
|
|
|
258 |
iDataPckgPtr = NULL;
|
|
|
259 |
}
|
|
|
260 |
}
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
// -----------------------------------------------------------------------------
|
|
|
264 |
// CMsChapv2DialogPlugin::CompleteL
|
|
|
265 |
// -----------------------------------------------------------------------------
|
|
|
266 |
//
|
|
|
267 |
void CMsChapv2DialogPlugin::CompleteL( TInt aStatus )
|
|
|
268 |
{
|
|
|
269 |
if ( aStatus == KErrNone && !iMessage.IsNull() )
|
|
|
270 |
{
|
|
|
271 |
iMessage.WriteL( iReplySlot, *iDataPckgPtr );
|
|
|
272 |
}
|
|
|
273 |
iCancelled = ETrue;
|
|
|
274 |
if ( !iMessage.IsNull() )
|
|
|
275 |
{
|
|
|
276 |
iMessage.Complete( aStatus );
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
if ( iDataPtr )
|
|
|
280 |
{
|
|
|
281 |
delete iDataPtr;
|
|
|
282 |
iDataPtr = NULL;
|
|
|
283 |
}
|
|
|
284 |
|
|
|
285 |
if ( iDataPckgPtr )
|
|
|
286 |
{
|
|
|
287 |
delete iDataPckgPtr;
|
|
|
288 |
iDataPckgPtr = NULL;
|
|
|
289 |
}
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
// -----------------------------------------------------------------------------
|
|
|
294 |
// CMsChapv2DialogPlugin::Release
|
|
|
295 |
// -----------------------------------------------------------------------------
|
|
|
296 |
//
|
|
|
297 |
void CMsChapv2DialogPlugin::Release()
|
|
|
298 |
{
|
|
|
299 |
delete this;
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
// -----------------------------------------------------------------------------
|
|
|
304 |
// CMsChapv2DialogPlugin::Info
|
|
|
305 |
// -----------------------------------------------------------------------------
|
|
|
306 |
//
|
|
|
307 |
CMsChapv2DialogPlugin::TNotifierInfo CMsChapv2DialogPlugin::Info() const
|
|
|
308 |
{
|
|
|
309 |
return iInfo;
|
|
|
310 |
}
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
// End of File
|