author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:27:42 +0100 | |
branch | RCL_3 |
changeset 26 | 19bba8228ff0 |
parent 25 | b183ec05bd8c |
permissions | -rw-r--r-- |
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
26 | 2 |
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). |
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
26 | 14 |
* Description: This file contains the implementation of PolicyEngineUI |
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
26 | 18 |
|
19 |
// INCLUDE FILES |
|
20 |
#include "PolicyEngineUi.h" |
|
21 |
#include "debug.h" |
|
22 |
#include "policyengineui.hrh" |
|
23 |
#include <policyengineuidlgs.rsg> |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
26 | 25 |
#include <bautils.h> |
26 |
#include <eikenv.h> |
|
27 |
#include <StringLoader.h> |
|
28 |
#include <AknQueryDialog.h> |
|
29 |
#include <eikprogi.h> |
|
30 |
#include <aknnotewrappers.h> |
|
31 |
#include <aknmessagequerydialog.h> |
|
32 |
#include <data_caging_path_literals.hrh> |
|
33 |
#include "SyncService.h" |
|
34 |
||
35 |
#include <implementationproxy.h> |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
|
26 | 38 |
_LIT( KCUIResourceFileName, "PolicyEngineUIDlgs.rsc" ); |
39 |
const TUid KUidPolicyEngineUi = { 0x10207817 }; |
|
40 |
const TUid KScreenOutputChannel = { 0x0000781F }; |
|
41 |
||
42 |
LOCAL_C void CreateNotifiersL( CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers ); |
|
43 |
||
44 |
||
45 |
// --------------------------------------------------------- |
|
46 |
// CArrayPtr<MEikSrvNotifierBase2>* NotifierArray() |
|
47 |
// --------------------------------------------------------- |
|
48 |
// |
|
49 |
||
50 |
LOCAL_C void CreateNotifiersL( CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers ) |
|
51 |
{ |
|
52 |
MEikSrvNotifierBase2 *policyEngineNotifier = CPolicyEngineNotifier::NewL(); |
|
53 |
||
54 |
CleanupStack::PushL( policyEngineNotifier ); |
|
55 |
aNotifiers->AppendL( policyEngineNotifier ); |
|
56 |
CleanupStack::Pop( policyEngineNotifier ); // serNotify |
|
57 |
RDEBUG("PolicyEngineUI notifier created!"); |
|
58 |
} |
|
59 |
||
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
26 | 62 |
CArrayPtr<MEikSrvNotifierBase2>* NotifierArray() |
63 |
{ |
|
64 |
CArrayPtrFlat<MEikSrvNotifierBase2>* array = |
|
65 |
new CArrayPtrFlat<MEikSrvNotifierBase2>( 1 ); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
|
26 | 67 |
if (array) |
68 |
{ |
|
69 |
TRAPD( err, CreateNotifiersL( array ) ); |
|
70 |
if (err != KErrNone) |
|
71 |
{ |
|
72 |
delete array; |
|
73 |
array = NULL; |
|
74 |
} |
|
75 |
} |
|
76 |
return array; |
|
25
b183ec05bd8c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
77 |
} |
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
|
26 | 79 |
const TImplementationProxy ImplementationTable[] = { {{0x10207817},(TProxyNewLPtr)NotifierArray} }; |
80 |
||
81 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
82 |
{ |
|
83 |
RDEBUG("PolicyEngineUI notifier detected!"); |
|
84 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ; |
|
85 |
return ImplementationTable; |
|
86 |
} |
|
87 |
||
88 |
||
89 |
||
90 |
CPolicyEngineNotifier::CPolicyEngineNotifier() |
|
91 |
{ |
|
92 |
} |
|
93 |
||
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
|
26 | 95 |
CPolicyEngineNotifier::~CPolicyEngineNotifier() |
96 |
{ |
|
97 |
//delete and close policy engine ui |
|
98 |
delete iPolicyEngineUi; |
|
99 |
} |
|
100 |
||
101 |
||
102 |
CPolicyEngineNotifier* CPolicyEngineNotifier::NewL() |
|
103 |
{ |
|
104 |
CPolicyEngineNotifier* self = new (ELeave) CPolicyEngineNotifier(); |
|
105 |
||
106 |
CleanupStack::PushL( self); |
|
107 |
self->ConstructL(); |
|
108 |
CleanupStack::Pop(); |
|
109 |
||
110 |
return self; |
|
111 |
} |
|
112 |
||
113 |
void CPolicyEngineNotifier::ConstructL() |
|
114 |
{ |
|
115 |
} |
|
116 |
||
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
|
26 | 118 |
void CPolicyEngineNotifier::Release() |
119 |
{ |
|
120 |
delete this; |
|
121 |
} |
|
122 |
||
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
|
26 | 124 |
CPolicyEngineNotifier::TNotifierInfo CPolicyEngineNotifier::RegisterL() |
125 |
{ |
|
126 |
//Registration info |
|
127 |
iInfo.iUid = KUidPolicyEngineUi; |
|
128 |
iInfo.iPriority = ENotifierPriorityHigh; |
|
129 |
iInfo.iChannel = KScreenOutputChannel; |
|
130 |
||
131 |
return iInfo; |
|
132 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
|
26 | 134 |
|
135 |
CPolicyEngineNotifier::TNotifierInfo CPolicyEngineNotifier::Info() const |
|
136 |
{ |
|
137 |
//Registration info |
|
138 |
return iInfo; |
|
139 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
|
26 | 142 |
TPtrC8 CPolicyEngineNotifier::StartL(const TDesC8& /*aBuffer*/) |
143 |
{ |
|
144 |
return KNullDesC8().Ptr(); |
|
145 |
} |
|
146 |
||
147 |
||
148 |
void CPolicyEngineNotifier::Complete( TUserResponse aResponse) |
|
149 |
{ |
|
150 |
RDEBUG("CPolicyEngineNotifier::Complete"); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
|
26 | 152 |
//Write return value to message and compeltes it |
153 |
if ( aResponse == EUserAccept ) |
|
154 |
{ |
|
155 |
iMessage.Write( iReplySlot, KUserAcceptMark, 0); |
|
156 |
} |
|
157 |
else |
|
158 |
{ |
|
159 |
iMessage.Write( iReplySlot, KUserDenyMark, 0); |
|
160 |
} |
|
161 |
||
162 |
iManager->CancelNotifier( iInfo.iUid ); // Notify framework we've done |
|
163 |
iMessage.Complete( KErrNone); |
|
164 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
|
26 | 166 |
|
167 |
void CPolicyEngineNotifier::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) |
|
168 |
{ |
|
169 |
RDEBUG("CPolicyEngineNotifier::StartL!"); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
|
26 | 171 |
TInt index = aBuffer.Locate( KDelimeterChar); |
172 |
||
173 |
if ( index != KErrNotFound && !iPolicyEngineUi) |
|
174 |
{ |
|
175 |
//decode name and fingerprint from message |
|
176 |
TPtrC8 name = aBuffer.Left( index); |
|
177 |
TPtrC8 fingerPrint = aBuffer.Mid( index + 1); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
|
26 | 179 |
iReplySlot = aReplySlot; |
180 |
iMessage = aMessage; |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
|
26 | 182 |
//Show policy engine ui dialogs |
183 |
iPolicyEngineUi = CPolicyEngineUi::NewL(); |
|
184 |
iPolicyEngineUi->ActivateL( name, fingerPrint, this); |
|
185 |
} |
|
186 |
else |
|
187 |
{ |
|
188 |
Complete( EUserDeny); |
|
189 |
} |
|
190 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
|
26 | 192 |
|
193 |
void CPolicyEngineNotifier::Cancel() |
|
194 |
{ |
|
195 |
RDEBUG("CPolicyEngineNotifier::Cancel!"); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
|
26 | 197 |
//Delete policy engine ui |
198 |
delete iPolicyEngineUi; |
|
199 |
iPolicyEngineUi = 0; |
|
200 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
|
26 | 203 |
TPtrC8 CPolicyEngineNotifier::UpdateL(const TDesC8& /*aBuffer*/) |
204 |
{ |
|
205 |
return KNullDesC8().Ptr(); |
|
206 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
|
26 | 208 |
CPolicyEngineUi::CPolicyEngineUi() |
209 |
: CActive( EPriorityStandard) |
|
210 |
{ |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
} |
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
|
26 | 213 |
void CPolicyEngineUi::ConstructL() |
214 |
{ |
|
215 |
RDEBUG("CPolicyEngineUi::ConstructL!"); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
|
26 | 217 |
//get pointer to CEikonEnv |
218 |
iCoeEnv = CEikonEnv::Static(); |
|
219 |
||
220 |
if ( !iCoeEnv ) |
|
221 |
{ |
|
222 |
RDEBUG("Policy engine ui: CoeEnv not found!"); |
|
223 |
User::Leave( KErrGeneral ); |
|
224 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
|
26 | 226 |
//Open resource file |
227 |
TFileName fileName; |
|
228 |
fileName.Zero(); |
|
229 |
||
230 |
TFileName drivePath; |
|
231 |
Dll::FileName( drivePath ); |
|
232 |
||
233 |
fileName.Append( TParsePtrC( drivePath ).Drive() ); |
|
234 |
fileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
235 |
fileName.Append( KCUIResourceFileName ); |
|
236 |
||
237 |
BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
|
26 | 239 |
//handle to resource file |
240 |
iResourceFileOffset = iCoeEnv->AddResourceFileL( fileName ); |
|
241 |
||
242 |
RDEBUG("Policy engine ui resources loaded!"); |
|
243 |
} |
|
244 |
||
245 |
CPolicyEngineUi* CPolicyEngineUi::NewL() |
|
246 |
{ |
|
247 |
CPolicyEngineUi* self = new ( ELeave ) CPolicyEngineUi(); |
|
248 |
CleanupStack::PushL( self ); |
|
249 |
self->ConstructL(); |
|
250 |
CleanupStack::Pop( self ); |
|
251 |
return self; |
|
252 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
|
26 | 254 |
|
255 |
CPolicyEngineUi::~CPolicyEngineUi() |
|
256 |
{ |
|
257 |
RDEBUG("CPolicyEngineUi::~CPolicyEngineUi()"); |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
|
26 | 259 |
// Close non-modal dialogs |
260 |
if( iResourceFileOffset ) |
|
261 |
{ |
|
262 |
iCoeEnv->DeleteResourceFile( iResourceFileOffset ); |
|
263 |
} |
|
264 |
||
265 |
delete iCorporate; |
|
266 |
delete iRandomPart; |
|
267 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
|
26 | 270 |
void CPolicyEngineUi::ActivateL( const TDesC8& aCorporate, const TDesC8& aRandomPart, CPolicyEngineNotifier* aNotifier) |
271 |
{ |
|
272 |
RDEBUG("CPolicyEngineUi::ActivateL"); |
|
273 |
||
274 |
//reference to notifier (for message completion) |
|
275 |
iNotifier = aNotifier; |
|
276 |
||
277 |
//allocate new space for parameters and save them |
|
278 |
delete iCorporate; |
|
279 |
iCorporate = NULL; |
|
280 |
delete iRandomPart; |
|
281 |
iRandomPart = NULL; |
|
282 |
iCorporate = HBufC::NewL( aCorporate.Length()); |
|
283 |
iRandomPart = HBufC::NewL( aRandomPart.Length()); |
|
284 |
||
285 |
iCorporate->Des().Copy( aCorporate); |
|
286 |
iRandomPart->Des().Copy( aRandomPart); |
|
287 |
||
288 |
//add active object to active scheduler and set object active |
|
289 |
CActiveScheduler::Add( this); |
|
290 |
SetActive(); |
|
291 |
||
292 |
//complete request.... |
|
293 |
TRequestStatus * status = &iStatus; |
|
294 |
User::RequestComplete( status, KErrNone); |
|
295 |
} |
|
296 |
||
297 |
||
298 |
||
299 |
void CPolicyEngineUi::RunL() |
|
300 |
{ |
|
301 |
RDEBUG("CPolicyEngineUi::RunL()"); |
|
302 |
||
303 |
//in state ERemove user has already accepted query |
|
304 |
if ( ERemove == iState ) |
|
305 |
{ |
|
306 |
//show info, remove from scheduler |
|
307 |
ShowDialogL( ERemove); |
|
308 |
Deque(); |
|
309 |
iNotifier->Complete( EUserAccept); |
|
310 |
return; |
|
311 |
} |
|
312 |
||
313 |
if ( EDenied == iState ) |
|
314 |
{ |
|
315 |
//show info, remove from scheduler |
|
316 |
ShowDialogL( EDenied); |
|
317 |
Deque(); |
|
318 |
iNotifier->Complete( EUserDeny); |
|
319 |
return; |
|
320 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
|
26 | 322 |
//Control dialog |
323 |
if ( EUserAccept == ShowDialogL( (TDialog) iState)) |
|
324 |
{ |
|
325 |
//if user cancel dialog, show deny-dialog and return |
|
326 |
iState = iState + 1; |
|
327 |
} |
|
328 |
else |
|
329 |
{ |
|
330 |
//user press cancel -> state = EDenied |
|
331 |
iState = EDenied; |
|
332 |
} |
|
333 |
||
334 |
//set active and complete message |
|
335 |
SetActive(); |
|
336 |
TRequestStatus * status = &iStatus; |
|
337 |
User::RequestComplete( status, KErrNone); |
|
338 |
} |
|
339 |
||
340 |
// ---------------------------------------------------------------------------- |
|
341 |
// CPolicyEngineUi::RunError |
|
342 |
// ---------------------------------------------------------------------------- |
|
343 |
TInt CPolicyEngineUi::RunError ( TInt /*aError*/ ) |
|
344 |
{ |
|
345 |
return KErrNone; |
|
346 |
} |
|
347 |
||
348 |
void CPolicyEngineUi::DoCancel() |
|
349 |
{ |
|
350 |
} |
|
351 |
||
352 |
||
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
353 |
|
26 | 354 |
CPolicyEngineUi::TDlgResp CPolicyEngineUi::ShowConfirmationQueryL( |
355 |
const TDesC& aText, const TBool& aWithCancel) |
|
356 |
{ |
|
357 |
//create dialog |
|
358 |
CAknQueryDialog* note = |
|
359 |
CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); |
|
360 |
||
361 |
//select correct text resource |
|
362 |
TInt resource = R_POLICYENGINEUI_CONFIRMATION_QUERY; |
|
363 |
||
364 |
if ( !aWithCancel ) |
|
365 |
{ |
|
366 |
resource = R_POLICYENGINEUI_CONFIRMATION; |
|
367 |
} |
|
368 |
||
369 |
//execute dialog, dialog contains self destruction |
|
370 |
TInt response = note->ExecuteLD( resource, aText ); |
|
371 |
||
372 |
if ( response ) |
|
373 |
{ |
|
374 |
return EOkResp; |
|
375 |
} |
|
376 |
||
377 |
return ECancelResp; |
|
378 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
|
26 | 380 |
|
381 |
CPolicyEngineUi::TDlgResp CPolicyEngineUi::DataQueryL( const TDesC& aText, TDes& aInput ) |
|
382 |
{ |
|
383 |
||
384 |
//Create dialog with reference to input descriptor |
|
385 |
CAknTextQueryDialog* dlg = |
|
386 |
CAknTextQueryDialog::NewL( aInput, CAknQueryDialog::ENoTone); |
|
387 |
||
388 |
//set prompt |
|
389 |
CleanupStack::PushL( dlg); |
|
390 |
dlg->SetPromptL( aText); |
|
391 |
CleanupStack::Pop(); |
|
392 |
||
393 |
//execute dialog, dialog contains self destruction |
|
394 |
TInt response = dlg->ExecuteLD( R_POLICYENGINEUI_DATA_QUERY); |
|
395 |
||
396 |
if ( response ) |
|
397 |
{ |
|
398 |
return EOkResp; |
|
399 |
} |
|
400 |
||
401 |
return ECancelResp; |
|
402 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
|
26 | 405 |
TInt CPolicyEngineUi::ShowDialogL( const TDialog& aDialog) |
406 |
{ |
|
407 |
TInt response = EUserDeny; |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
|
26 | 409 |
//select correct dialog |
410 |
switch ( aDialog) |
|
411 |
{ |
|
412 |
case EControl : |
|
413 |
{ |
|
414 |
response = ShowPossessionMessageQueryL(); |
|
415 |
break; |
|
416 |
} |
|
417 |
case ERemove: |
|
418 |
{ |
|
419 |
//load resource |
|
420 |
HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_TRUST_ESTABLISHED ); |
|
421 |
||
422 |
TInt length1 = displayString->Length(); |
|
423 |
HBufC16* trustString = HBufC16::NewLC ( length1 ); |
|
424 |
TPtr bufPtr = trustString -> Des(); |
|
425 |
bufPtr.Append (*displayString); |
|
426 |
// Hide background connecting note |
|
427 |
CSyncService *syncService = |
|
428 |
CSyncService::NewL(NULL, KDevManServiceStart); |
|
429 |
if (syncService) |
|
430 |
{ |
|
431 |
syncService->EnableProgressNoteL(EFalse); |
|
432 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
|
26 | 434 |
delete syncService; |
435 |
||
436 |
response = ShowConfirmationQueryL( *trustString, EFalse); |
|
437 |
CleanupStack::PopAndDestroy(); |
|
438 |
CleanupStack::PopAndDestroy(); |
|
439 |
||
440 |
break; |
|
441 |
} |
|
442 |
case EDenied: |
|
443 |
{ |
|
444 |
//load resource |
|
445 |
TBuf<100> array(*iCorporate); |
|
446 |
HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_DENIED_NOTE, array); |
|
447 |
||
448 |
//show dialog and get response |
|
449 |
response = ShowConfirmationQueryL( *displayString, EFalse); |
|
450 |
//delete resource |
|
451 |
CleanupStack::PopAndDestroy(); |
|
452 |
||
453 |
break; |
|
454 |
} |
|
455 |
case EUnMatch: |
|
456 |
{ |
|
457 |
//load resource |
|
458 |
HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_UNMATCH_NOTE); |
|
459 |
||
460 |
//show dialog and get response |
|
461 |
response = ShowConfirmationQueryL( *displayString, ETrue); |
|
462 |
//delete resource |
|
463 |
CleanupStack::PopAndDestroy(); |
|
464 |
||
465 |
break; |
|
466 |
} |
|
467 |
case EQuestion: |
|
468 |
{ |
|
469 |
//question note prompt |
|
470 |
TBuf<100> array(*iCorporate); |
|
471 |
HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_QUESTION_NOTE,array); |
|
472 |
TBuf<RANDOM_PART_MAX_SIZE> input; |
|
473 |
TBool ready = EFalse; |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
474 |
|
26 | 475 |
//until cancel pressed or valid user gives valid certificate part |
476 |
while ( !ready) |
|
477 |
{ |
|
478 |
//data query |
|
479 |
CPolicyEngineUi::TDlgResp resp = DataQueryL( *displayString, input); |
|
480 |
if ( resp == EUserAccept ) |
|
481 |
{ |
|
482 |
if ( input.CompareF( *iRandomPart) != 0) |
|
483 |
{ |
|
484 |
//if user input doesn't match |
|
485 |
if ( EUserDeny == ShowDialogL( EUnMatch)) |
|
486 |
{ |
|
487 |
//if user cancel dialog, show deny-dialog and return |
|
488 |
response = EUserDeny; |
|
489 |
break; |
|
490 |
} |
|
491 |
} |
|
492 |
else |
|
493 |
{ |
|
494 |
response = EUserAccept; |
|
495 |
ready = ETrue; |
|
496 |
} |
|
497 |
} |
|
498 |
else |
|
499 |
{ |
|
500 |
//if user cancel dialog, show deny-dialog and return |
|
501 |
response = EUserDeny; |
|
502 |
break; |
|
503 |
} |
|
504 |
} |
|
505 |
||
506 |
//delete resource |
|
507 |
CleanupStack::PopAndDestroy(); |
|
508 |
break; |
|
509 |
} |
|
510 |
default: |
|
511 |
break; |
|
512 |
} |
|
513 |
||
514 |
return response; |
|
515 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
516 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
517 |
|
26 | 518 |
CPolicyEngineUi::TDlgResp CPolicyEngineUi::ShowPossessionMessageQueryL() |
519 |
{ |
|
520 |
HBufC* securityInfoString = StringLoader::LoadLC( R_POLICYENGINEUI_SECURITY_INFO_NOTE ); |
|
521 |
TBuf<60> buffer; |
|
522 |
buffer.Copy( *securityInfoString ); |
|
523 |
CleanupStack::PopAndDestroy( securityInfoString ); |
|
524 |
||
525 |
//load resource |
|
526 |
TBuf<100> array(*iCorporate); |
|
527 |
HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_CONTROL_NOTE, array); |
|
528 |
||
529 |
||
530 |
//show dialog and get response |
|
531 |
CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *displayString ); |
|
532 |
dlg->PrepareLC( R_POLICY_ENGINE_POSSESSION_INFO ); |
|
533 |
dlg->QueryHeading()->SetTextL( buffer ); |
|
534 |
TInt response = dlg->RunLD(); |
|
535 |
||
536 |
CleanupStack::PopAndDestroy(); |
|
537 |
||
538 |
if ( response ) |
|
539 |
{ |
|
540 |
return EOkResp; |
|
541 |
} |
|
542 |
||
543 |
return ECancelResp; |
|
544 |
} |
|
0
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
545 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
546 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
547 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
548 |
|
b497e44ab2fc
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
549 |