author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:40:28 +0300 | |
branch | RCL_3 |
changeset 49 | 10852b179f64 |
parent 45 | 6b6920c56e2f |
child 55 | ea98413ce11f |
permissions | -rw-r--r-- |
45 | 1 |
/* |
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implements the CLocSUPLServerEditor class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#include <aknappui.h> |
|
21 |
#include <AknIconArray.h> // Icon Array |
|
22 |
#include <aknlocationed.h> |
|
23 |
#include <aknlistquerydialog.h> |
|
24 |
#include <AknPopupFieldText.h> |
|
25 |
#include <aknnotewrappers.h> |
|
26 |
#include <AknsUtils.h> |
|
27 |
#include <AknsSkinInstance.h> |
|
28 |
#include <aknselectionlist.h> |
|
29 |
#include <akntitle.h> // CAknTitlePane |
|
30 |
#include <AknWaitDialog.h> |
|
31 |
#include <aknuniteditor.h> |
|
32 |
#include <avkon.rsg> |
|
33 |
#include <avkon.hrh> |
|
34 |
#include <e32math.h> |
|
35 |
#include <eikapp.h> |
|
36 |
#include <eikaufty.h> |
|
37 |
#include <eikcapc.h> |
|
38 |
#include <eikedwin.h> |
|
39 |
#include <eikenv.h> |
|
40 |
#include <eikmenup.h> |
|
41 |
#include <eikmenub.h> |
|
42 |
#include <eikserverapp.h> |
|
43 |
#include <eikspane.h> // Status pane |
|
44 |
#include <barsread.h> // For TResourceReader |
|
45 |
#include <bautils.h> |
|
46 |
#include <data_caging_path_literals.hrh> |
|
47 |
#include <gulicon.h> // Gul Icon |
|
48 |
#include <StringLoader.h> |
|
49 |
#include <hlplch.h> |
|
50 |
||
51 |
#include <epos_csuplsettingsconstants.h> |
|
52 |
#include <epos_csuplsettingparams.h> |
|
53 |
||
54 |
#include <locsuplsettingsui.rsg> |
|
55 |
#include "locsuplsettings.hrh" |
|
56 |
#include "locsuplservereditor.h" |
|
57 |
#include "locsuplsettingsuiengine.h" |
|
58 |
#include "locsupldebug.h" |
|
59 |
||
60 |
// ============================ LOCAL FUNCTIONS =============================== |
|
61 |
||
62 |
// ============================ MEMBER FUNCTIONS =============================== |
|
63 |
||
64 |
// ----------------------------------------------------------------------------- |
|
65 |
// CLocSUPLServerEditor::CLocSUPLServerEditor() |
|
66 |
// ----------------------------------------------------------------------------- |
|
67 |
// |
|
68 |
CLocSUPLServerEditor::CLocSUPLServerEditor( |
|
69 |
TBool aIsEditable, |
|
70 |
CLocSUPLSettingsUiEngine& aEngine, |
|
71 |
TInt64 aSlpId |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
72 |
):iIsEditMode( aIsEditable ), iEngine( aEngine ), iSlpId( aSlpId ), iIsAccessPointDefined(EFalse) |
45 | 73 |
{ |
74 |
if( aIsEditable ) |
|
75 |
{ |
|
76 |
iIsNewServer = ETrue; |
|
77 |
iSlpId = NULL; |
|
78 |
} |
|
79 |
} |
|
80 |
||
81 |
// ----------------------------------------------------------------------------- |
|
82 |
// CLocSUPLServerEditor::ConstructL() |
|
83 |
// ----------------------------------------------------------------------------- |
|
84 |
// |
|
85 |
void CLocSUPLServerEditor::ConstructL() |
|
86 |
{ |
|
87 |
DEBUG( + CLocSUPLServerEditor::ConstructL ); |
|
88 |
CAknForm::ConstructL( R_SUPLSERVER_EDITOR_MENU_BAR ); |
|
89 |
||
90 |
// Save original title |
|
91 |
CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
|
92 |
iTitlePane = ( CAknTitlePane* ) statusPane->ControlL( |
|
93 |
TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
94 |
iOriginalTitle = iTitlePane->Text()->AllocL(); |
|
95 |
||
96 |
// Allocate memory for Server address buffer & Access point buffer |
|
97 |
iServerAddress = HBufC16::NewL( KMaxHSLPAddrLen ); |
|
98 |
iIap = HBufC16::NewL( KMaxIAPLen ); |
|
99 |
||
100 |
DEBUG( - CLocSUPLServerEditor::ConstructL ); |
|
101 |
} |
|
102 |
||
103 |
// ----------------------------------------------------------------------------- |
|
104 |
// CLocSUPLServerEditor::NewL() |
|
105 |
// ----------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
CLocSUPLServerEditor* CLocSUPLServerEditor::NewL( |
|
108 |
TBool aIsEditable, |
|
109 |
CLocSUPLSettingsUiEngine& aEngine, |
|
110 |
TInt64 aSlpId |
|
111 |
) |
|
112 |
{ |
|
113 |
CLocSUPLServerEditor* self = NewLC( aIsEditable, aEngine, aSlpId ); |
|
114 |
CleanupStack::Pop( self ); |
|
115 |
return self; |
|
116 |
} |
|
117 |
||
118 |
// ----------------------------------------------------------------------------- |
|
119 |
// CLocSUPLServerEditor::NewLC() |
|
120 |
// ----------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
CLocSUPLServerEditor* CLocSUPLServerEditor::NewLC( |
|
123 |
TBool aIsEditable, |
|
124 |
CLocSUPLSettingsUiEngine& aEngine, |
|
125 |
TInt64 aSlpId |
|
126 |
) |
|
127 |
{ |
|
128 |
CLocSUPLServerEditor* self = new ( ELeave ) |
|
129 |
CLocSUPLServerEditor( aIsEditable, aEngine, aSlpId ); |
|
130 |
CleanupStack::PushL( self ); |
|
131 |
self->ConstructL(); |
|
132 |
return self; |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// CLocSUPLServerEditor::~CLocSUPLServerEditor() |
|
137 |
// ----------------------------------------------------------------------------- |
|
138 |
// |
|
139 |
CLocSUPLServerEditor::~CLocSUPLServerEditor() |
|
140 |
{ |
|
141 |
DEBUG( + CLocSUPLServerEditor::~CLocSUPLServerEditor ); |
|
142 |
// Restore title pane. Ownership of iTitlePane transferred. |
|
143 |
if ( iTitlePane && iOriginalTitle ) |
|
144 |
{ |
|
145 |
iTitlePane->SetText( iOriginalTitle ); |
|
146 |
} |
|
147 |
delete iServerAddress; |
|
148 |
iServerAddress = NULL; |
|
149 |
||
150 |
delete iIap; |
|
151 |
iIap = NULL; |
|
152 |
DEBUG( - CLocSUPLServerEditor::~CLocSUPLServerEditor ); |
|
153 |
} |
|
154 |
||
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// CLocSUPLServerEditor::DynInitMenuPaneL() |
|
157 |
// ----------------------------------------------------------------------------- |
|
158 |
// |
|
159 |
void CLocSUPLServerEditor::DynInitMenuPaneL( |
|
160 |
TInt aResourceId, |
|
161 |
CEikMenuPane* aMenuPane ) |
|
162 |
{ |
|
163 |
DEBUG( + CLocSUPLServerEditor::DynInitMenuPaneL ); |
|
164 |
CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
165 |
||
166 |
if ( aResourceId == R_AVKON_FORM_MENUPANE ) |
|
167 |
{ |
|
168 |
// We do not want to allow the user to modify our Form therefore |
|
169 |
// Disable the Label, Add, Delete, and Save Field |
|
170 |
aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); |
|
171 |
aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); |
|
172 |
aMenuPane->SetItemDimmed( EAknFormCmdDelete,ETrue ); |
|
173 |
aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue ); |
|
174 |
||
175 |
if( IsEditable() ) |
|
176 |
{ |
|
177 |
aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue ); |
|
178 |
aMenuPane->SetItemDimmed( ELocServerEditorDisable, ETrue ); |
|
179 |
aMenuPane->SetItemDimmed( ELocServerEditorEnable, ETrue ); |
|
180 |
aMenuPane->SetItemDimmed( ELocServerEditorDelete, ETrue ); |
|
181 |
||
182 |
switch( IdOfFocusControl() ) |
|
183 |
{ |
|
184 |
case ELocSuplServerIdServerAddr: |
|
185 |
{ |
|
186 |
aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
|
187 |
break; |
|
188 |
} |
|
189 |
case ELocSuplServerIdAccessPoint: |
|
190 |
{ |
|
191 |
break; |
|
192 |
} |
|
193 |
case ELocSuplServerIdUsageInHomeNw: |
|
194 |
{ |
|
195 |
aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
|
196 |
||
197 |
TBool editableFlag = ETrue; |
|
198 |
if( iSlpId ) |
|
199 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
200 |
||
201 |
break; |
|
202 |
} |
|
203 |
default: |
|
204 |
break; |
|
205 |
} |
|
206 |
} |
|
207 |
else |
|
208 |
{ |
|
209 |
TBool enabledFlag; |
|
210 |
TRAP_IGNORE( iEngine.GetServerEnabledFlagL( iSlpId, enabledFlag ) ); |
|
211 |
||
212 |
if( enabledFlag ) |
|
213 |
aMenuPane->SetItemDimmed( ELocServerEditorEnable, ETrue ); |
|
214 |
else |
|
215 |
aMenuPane->SetItemDimmed( ELocServerEditorDisable, ETrue ); |
|
216 |
||
217 |
||
218 |
TBool editableFlag = ETrue; |
|
219 |
if( iSlpId ) |
|
220 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
221 |
if( editableFlag == EFalse ) |
|
222 |
{ |
|
223 |
switch( IdOfFocusControl() ) |
|
224 |
{ |
|
225 |
case ELocSuplServerIdServerAddr: |
|
226 |
case ELocSuplServerIdUsageInHomeNw: |
|
227 |
{ |
|
228 |
aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue ); |
|
229 |
break; |
|
230 |
} |
|
231 |
default: |
|
232 |
break; |
|
233 |
} |
|
234 |
} |
|
235 |
||
236 |
aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
|
237 |
aMenuPane->SetItemDimmed( ELocServerEditorRemove, ETrue ); |
|
238 |
} |
|
239 |
} |
|
240 |
DEBUG( - CLocSUPLServerEditor::DynInitMenuPaneL ); |
|
241 |
} |
|
242 |
||
243 |
// ----------------------------------------------------------------------------- |
|
244 |
// CLocSUPLServerEditor::ProcessCommandL() |
|
245 |
// ----------------------------------------------------------------------------- |
|
246 |
// |
|
247 |
void CLocSUPLServerEditor::ProcessCommandL( TInt aCommandId ) |
|
248 |
{ |
|
249 |
DEBUG1( + CLocSUPLServerEditor::ProcessCommandL aCommandId=%d, aCommandId ); |
|
250 |
CAknForm::ProcessCommandL( aCommandId ); |
|
251 |
||
252 |
switch (aCommandId) |
|
253 |
{ |
|
254 |
case EAknFormCmdEdit: |
|
255 |
{ |
|
256 |
iIsEditMode = ETrue; |
|
257 |
SetCursorToEndL(); |
|
258 |
HandleMSKCaptionL(); |
|
259 |
break; |
|
260 |
} |
|
261 |
case ELocServerEditorDelete: |
|
262 |
case ELocServerEditorRemove: |
|
263 |
{ |
|
264 |
if (DeleteConfirmationQueryL()) |
|
265 |
{ |
|
266 |
TRAP_IGNORE( iEngine.RemoveServerL( iSlpId ) ); |
|
267 |
// Return back to server view |
|
268 |
TryExitL(EAknSoftkeyBack); |
|
269 |
} |
|
270 |
break; |
|
271 |
} |
|
272 |
case ELocServerEditorDisable: |
|
273 |
{ |
|
274 |
TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, EFalse ) ); |
|
275 |
break; |
|
276 |
} |
|
277 |
case ELocServerEditorEnable: |
|
278 |
{ |
|
279 |
TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, ETrue ) ); |
|
280 |
break; |
|
281 |
} |
|
282 |
case ELocServerEditorMSKChange: |
|
283 |
{ |
|
284 |
CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
|
285 |
ELocSuplServerIdUsageInHomeNw); |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
286 |
HBufC* string; |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
287 |
string = StringLoader::LoadLC( |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
288 |
R_LOC_SERVER_USAGEINHOMENETWORK_NO, iCoeEnv); |
45 | 289 |
if (iIsNewServer) |
290 |
{ |
|
291 |
TBuf<KMaxUsageTextSize> des; |
|
292 |
usageInHomeNWPopupFieldText->GetText(des); |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
293 |
if (!des.CompareC(string->Des())) |
45 | 294 |
{ |
295 |
SetUsageinHomeNetwork(ETrue); |
|
296 |
} |
|
297 |
else |
|
298 |
{ |
|
299 |
SetUsageinHomeNetwork(EFalse); |
|
300 |
} |
|
301 |
} |
|
302 |
else |
|
303 |
{ |
|
304 |
TBool editableFlag; |
|
305 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
306 |
if (editableFlag) |
|
307 |
{ |
|
308 |
TBuf<KMaxUsageTextSize> des; |
|
309 |
usageInHomeNWPopupFieldText->GetText(des); |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
310 |
if (!des.CompareC(string->Des())) |
45 | 311 |
{ |
312 |
SetUsageinHomeNetwork(ETrue); |
|
313 |
} |
|
314 |
else |
|
315 |
{ |
|
316 |
SetUsageinHomeNetwork(EFalse); |
|
317 |
} |
|
318 |
} |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
319 |
CleanupStack::PopAndDestroy(string); |
45 | 320 |
} |
321 |
break; |
|
322 |
} |
|
323 |
case EAknCmdHelp: |
|
324 |
{ |
|
325 |
HlpLauncher::LaunchHelpApplicationL(iCoeEnv->WsSession(), |
|
326 |
iAvkonAppUi->AppHelpContextL()); |
|
327 |
break; |
|
328 |
} |
|
329 |
case EEikCmdExit: |
|
330 |
{ |
|
331 |
// The Exit is handled by the Application UI |
|
332 |
TryExitL(EEikCmdExit); |
|
333 |
break; |
|
334 |
} |
|
335 |
default: |
|
336 |
break; |
|
337 |
}DEBUG( - CLocSUPLServerEditor::ProcessCommandL ); |
|
338 |
} |
|
339 |
||
340 |
// --------------------------------------------------------------------------- |
|
341 |
// Derived from CEikDialog |
|
342 |
// --------------------------------------------------------------------------- |
|
343 |
||
344 |
// ----------------------------------------------------------------------------- |
|
345 |
// CLocSUPLServerEditor::OfferKeyEventL |
|
346 |
// Receives and handles key events |
|
347 |
// ----------------------------------------------------------------------------- |
|
348 |
// |
|
349 |
TKeyResponse CLocSUPLServerEditor::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
350 |
TEventCode aType ) |
|
351 |
{ |
|
352 |
DEBUG( CLocSUPLServerEditor::OfferKeyEventL ); |
|
353 |
if ( aType == EEventKey ) |
|
354 |
{ |
|
355 |
if( aKeyEvent.iCode == EKeyBackspace && IsEditable() == EFalse ) |
|
356 |
{ |
|
357 |
ProcessCommandL( ELocServerEditorDelete ); |
|
358 |
return EKeyWasConsumed; |
|
359 |
} |
|
360 |
||
361 |
if( !iIsNewServer && IsEditable() ) |
|
362 |
{ |
|
363 |
// check if current opened server is editable |
|
364 |
// if its not editable then return with no action on it. |
|
365 |
TBool editableFlag = ETrue; |
|
366 |
if( iSlpId ) |
|
367 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
368 |
||
369 |
if( editableFlag == EFalse ) |
|
370 |
{ |
|
371 |
if( ( aKeyEvent.iScanCode != EStdKeyUpArrow || aKeyEvent.iScanCode != EStdKeyDownArrow ) |
|
372 |
== EFalse ) |
|
373 |
{ |
|
374 |
switch( IdOfFocusControl() ) |
|
375 |
{ |
|
376 |
case ELocSuplServerIdServerAddr: |
|
377 |
case ELocSuplServerIdUsageInHomeNw: |
|
378 |
{ |
|
379 |
return EKeyWasConsumed; |
|
380 |
} |
|
381 |
default: |
|
382 |
break; |
|
383 |
} |
|
384 |
} |
|
385 |
} |
|
386 |
} |
|
387 |
||
388 |
if ( aKeyEvent.iCode == EKeyEnter || aKeyEvent.iScanCode == EStdKeyEnter ) |
|
389 |
{ |
|
390 |
if ( !( IsEditable() && IdOfFocusControl() == ELocSuplServerIdServerAddr ) ) |
|
391 |
{ |
|
392 |
TKeyEvent enterKeyEvent( aKeyEvent ); |
|
393 |
enterKeyEvent.iCode = EKeyOK; |
|
394 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
395 |
return cba->OfferKeyEventL( enterKeyEvent, aType ); |
|
396 |
} |
|
397 |
} |
|
398 |
} |
|
399 |
TKeyResponse response= CAknForm::OfferKeyEventL( aKeyEvent, aType ); |
|
400 |
return response; |
|
401 |
} |
|
402 |
||
403 |
// --------------------------------------------------------------------------- |
|
404 |
// CLocSUPLServerEditor ::OkToExitL() |
|
405 |
// --------------------------------------------------------------------------- |
|
406 |
// |
|
407 |
TBool CLocSUPLServerEditor::OkToExitL( TInt aButtonId ) |
|
408 |
{ |
|
409 |
DEBUG1( + CLocSUPLServerEditor::OkToExitL aButtonId=%d, aButtonId ); |
|
410 |
TBool retVal = ETrue; |
|
411 |
||
412 |
switch( aButtonId ) |
|
413 |
{ |
|
414 |
case EAknFormCmdEdit: // when MSK is pressed |
|
415 |
{ |
|
416 |
//Handle MSK operation based on focused line. |
|
417 |
if( IsEditable() == EFalse ) |
|
418 |
{ |
|
419 |
ProcessCommandL( EAknFormCmdEdit ); |
|
420 |
HandleMSKCaptionL(); |
|
421 |
} |
|
422 |
//dont close editor |
|
423 |
retVal = EFalse; |
|
424 |
break; |
|
425 |
} |
|
426 |
case ELocServerEditorNoCmd: |
|
427 |
{ |
|
428 |
//dont close editor |
|
429 |
retVal = EFalse; |
|
430 |
break; |
|
431 |
} |
|
432 |
case ELocServerEditorMSKChange: |
|
433 |
{ |
|
434 |
ProcessCommandL( ELocServerEditorMSKChange ); |
|
435 |
//dont close editor |
|
436 |
retVal = EFalse; |
|
437 |
break; |
|
438 |
} |
|
439 |
case EAknSoftkeyOptions: //when LSK is pressed |
|
440 |
{ |
|
441 |
//display menu specific to editor |
|
442 |
DisplayMenuL(); |
|
443 |
//don't close editor |
|
444 |
retVal = EFalse; |
|
445 |
break; |
|
446 |
} |
|
447 |
case EAknSoftkeyBack: |
|
448 |
{ |
|
449 |
break; |
|
450 |
} |
|
451 |
case EAknSoftkeyDone: // when RSK is pressed in edit mode |
|
452 |
{ |
|
453 |
if( SaveFormDataL() ) |
|
454 |
{ |
|
455 |
if( iIsNewServer ) |
|
456 |
{ |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
457 |
// iap name is always set as KNullDesC since defining the access point is |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
458 |
// not allowed while creating a new server manually |
45 | 459 |
TRAPD( err, iEngine.AddNewServerL( |
460 |
iServerAddress->Des(), |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
461 |
KNullDesC, |
45 | 462 |
iUsageInHomeNw ) ); |
463 |
if( err == KErrNone ) |
|
464 |
{ |
|
465 |
iIsNewServer = EFalse; |
|
466 |
} |
|
467 |
else if( err == KErrAlreadyExists ) |
|
468 |
{ |
|
469 |
ShowServerValidationInfoNoteL( R_LOC_SERVER_ALREADY_EXIST_INFO_NOTE ); |
|
470 |
iIsEditMode = ETrue; |
|
471 |
SetEditableL( iIsEditMode ); |
|
472 |
SetInitialCurrentLine(); |
|
473 |
SetCursorToEndL(); |
|
474 |
//dont close editor |
|
475 |
retVal = EFalse; |
|
476 |
} |
|
477 |
else if( err == KErrArgument ) |
|
478 |
{ |
|
479 |
ShowServerValidationInfoNoteL( R_LOC_SERVER_INFO_NOTE ); |
|
480 |
iIsEditMode = ETrue; |
|
481 |
SetEditableL( iIsEditMode ); |
|
482 |
SetInitialCurrentLine(); |
|
483 |
SetCursorToEndL(); |
|
484 |
//dont close editor |
|
485 |
retVal = EFalse; |
|
486 |
} |
|
487 |
} |
|
488 |
else |
|
489 |
{ // save the existing slp entry info |
|
490 |
if( iSlpId ) |
|
491 |
{ |
|
492 |
TRAPD( err, iEngine.SetServerAddressL( |
|
493 |
iSlpId, iServerAddress->Des() ) ); |
|
494 |
if( err == KErrNone ) |
|
495 |
{ |
|
496 |
if( iIap->Length() > 0 ) |
|
497 |
iEngine.SetIapNameL( iSlpId, iIap->Des() ); |
|
498 |
iEngine.SetUsageInHomwNwFlagL( iSlpId, iUsageInHomeNw ); |
|
499 |
||
500 |
iIsEditMode = EFalse; |
|
501 |
SetEditableL( iIsEditMode ); |
|
502 |
} |
|
503 |
else if( err == KErrAlreadyExists ) |
|
504 |
{ |
|
505 |
ShowServerValidationInfoNoteL( R_LOC_SERVER_ALREADY_EXIST_INFO_NOTE ); |
|
506 |
iIsEditMode = ETrue; |
|
507 |
SetEditableL( iIsEditMode ); |
|
508 |
SetInitialCurrentLine(); |
|
509 |
SetCursorToEndL(); |
|
510 |
} |
|
511 |
else if( err == KErrArgument ) |
|
512 |
{ |
|
513 |
ShowServerValidationInfoNoteL( R_LOC_SERVER_INFO_NOTE ); |
|
514 |
iIsEditMode = ETrue; |
|
515 |
SetEditableL( iIsEditMode ); |
|
516 |
SetInitialCurrentLine(); |
|
517 |
SetCursorToEndL(); |
|
518 |
//dont close editor |
|
519 |
retVal = EFalse; |
|
520 |
} |
|
521 |
} |
|
522 |
HandleMSKCaptionL(); |
|
523 |
//dont close editor |
|
524 |
retVal = EFalse; |
|
525 |
} |
|
526 |
} |
|
527 |
else |
|
528 |
{ |
|
529 |
//if control's state is changed and manadatory contain is not added then show the popup message |
|
530 |
if( iIsModified ) |
|
531 |
{ |
|
532 |
ShowServerValidationInfoNoteL( R_LOC_SERVER_INFO_NOTE ); |
|
533 |
iIsEditMode = ETrue; |
|
534 |
SetEditableL( iIsEditMode ); |
|
535 |
SetInitialCurrentLine(); |
|
536 |
SetCursorToEndL(); |
|
537 |
//dont close editor |
|
538 |
retVal = EFalse; |
|
539 |
} |
|
540 |
else |
|
541 |
{ |
|
542 |
retVal = ETrue; |
|
543 |
} |
|
544 |
} |
|
545 |
break; |
|
546 |
} |
|
547 |
default: // close editor in all other cases |
|
548 |
{ |
|
549 |
break; |
|
550 |
} |
|
551 |
} |
|
552 |
DEBUG1( - CLocSUPLServerEditor::OkToExitL retVal=%d, retVal ); |
|
553 |
return retVal; |
|
554 |
} |
|
555 |
||
556 |
// ----------------------------------------------------------------------------- |
|
557 |
// CLocSUPLServerEditor::SaveFormDataL() |
|
558 |
// Deals with the occasion of a change from edit->view mode and the user wishes |
|
559 |
// to save the changes. |
|
560 |
// ----------------------------------------------------------------------------- |
|
561 |
// |
|
562 |
TBool CLocSUPLServerEditor::SaveFormDataL() |
|
563 |
{ |
|
564 |
DEBUG( + CLocSUPLServerEditor::SaveFormDataL ); |
|
565 |
TBool retVal = EFalse; |
|
566 |
||
567 |
//Retrieve server address text |
|
568 |
CEikEdwin* serverAddress = |
|
569 |
static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) ); |
|
570 |
if( serverAddress ) |
|
571 |
{ |
|
572 |
HBufC* address = serverAddress->GetTextInHBufL(); |
|
573 |
if( address ) |
|
574 |
{ |
|
575 |
iServerAddress->Des().Copy( address->Des() ); |
|
576 |
} |
|
577 |
else |
|
578 |
iServerAddress->Des().Copy( KNullDesC ); |
|
579 |
delete address; |
|
580 |
} |
|
581 |
||
582 |
//Retrieve Access Point |
|
583 |
CEikEdwin* accessPoint = |
|
584 |
static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) ); |
|
585 |
if( accessPoint ) |
|
586 |
{ |
|
587 |
HBufC* apText = accessPoint->GetTextInHBufL(); |
|
588 |
if( apText ) |
|
589 |
{ |
|
590 |
iIap->Des().Copy( apText->Des() ); |
|
591 |
} |
|
592 |
delete apText; |
|
593 |
||
594 |
HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE ); |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
595 |
if (apString->CompareC(iIap->Des()) == 0) |
45 | 596 |
{ |
597 |
iIap->Des().Copy( KNullDesC ); |
|
598 |
} |
|
599 |
delete apString; |
|
600 |
} |
|
601 |
||
602 |
//Retrieve Usage In Home Nw Field value |
|
603 |
CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
|
604 |
ELocSuplServerIdUsageInHomeNw); |
|
605 |
if (usageInHomeNWPopupFieldText) |
|
606 |
{ |
|
607 |
TBuf<KMaxUsageTextSize> des; |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
608 |
HBufC* string; |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
609 |
string = StringLoader::LoadLC( |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
610 |
R_LOC_SERVER_USAGEINHOMENETWORK_NO, iCoeEnv); |
45 | 611 |
usageInHomeNWPopupFieldText->GetText(des); |
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
612 |
if (!des.CompareC(string->Des())) |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
613 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
614 |
iUsageInHomeNw = EFalse; |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
615 |
} |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
616 |
else |
45 | 617 |
{ |
618 |
iUsageInHomeNw = ETrue; |
|
619 |
} |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
620 |
CleanupStack::PopAndDestroy(string); |
45 | 621 |
} |
622 |
||
623 |
if( iServerAddress->Length() > 0 ) |
|
624 |
{ |
|
625 |
retVal = ETrue; |
|
626 |
} |
|
627 |
||
628 |
DEBUG( - CLocSUPLServerEditor::SaveFormDataL ); |
|
629 |
return retVal; |
|
630 |
} |
|
631 |
||
632 |
// ----------------------------------------------------------------------------- |
|
633 |
// LocSUPLServerEditor::PreLayoutDynInitL() |
|
634 |
// Initialises the dialog's controls before the dialog is sized and layed out. |
|
635 |
// ----------------------------------------------------------------------------- |
|
636 |
// |
|
637 |
void CLocSUPLServerEditor::PreLayoutDynInitL() |
|
638 |
{ |
|
639 |
DEBUG( + CLocSUPLServerEditor::PreLayoutDynInitL ); |
|
640 |
CAknForm::PreLayoutDynInitL(); |
|
641 |
||
642 |
DEBUG( - CLocSUPLServerEditor::PreLayoutDynInitL ); |
|
643 |
} |
|
644 |
||
645 |
// ----------------------------------------------------------------------------- |
|
646 |
// CLocSUPLServerEditor::PostLayoutDynInitL |
|
647 |
// Initialises the dialog's controls after the dialog |
|
648 |
// has been sized but before it has been activated. |
|
649 |
// ----------------------------------------------------------------------------- |
|
650 |
// |
|
651 |
void CLocSUPLServerEditor::PostLayoutDynInitL() |
|
652 |
{ |
|
653 |
DEBUG( + CLocSUPLServerEditor::PostLayoutDynInitL ); |
|
654 |
CAknForm::PostLayoutDynInitL(); |
|
655 |
SetEditableL( iIsEditMode ); |
|
656 |
LoadFormValuesFromDataL(); |
|
657 |
||
658 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
659 |
CleanupStack::PushL( cba ); |
|
660 |
if( IsEditable() ) |
|
661 |
{ |
|
662 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE ); |
|
663 |
} |
|
664 |
else |
|
665 |
{ |
|
666 |
TBool editableFlag = ETrue; |
|
667 |
if( iSlpId ) |
|
668 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
669 |
||
670 |
if( editableFlag ) |
|
671 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_EDIT_BACK ); |
|
672 |
else |
|
673 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_BACK ); |
|
674 |
} |
|
675 |
CleanupStack::Pop( cba ); |
|
676 |
||
677 |
DEBUG( - CLocSUPLServerEditor::PostLayoutDynInitL ); |
|
678 |
} |
|
679 |
||
680 |
// ----------------------------------------------------------------------------- |
|
681 |
// CLocSUPLServerEditor::LineChangedL() |
|
682 |
// ----------------------------------------------------------------------------- |
|
683 |
// |
|
684 |
void CLocSUPLServerEditor::LineChangedL(TInt /*aControlId*/) |
|
685 |
{ |
|
686 |
HandleMSKCaptionL(); |
|
687 |
} |
|
688 |
||
689 |
// ----------------------------------------------------------------------------- |
|
690 |
// CLocSUPLServerEditor::SetInitialCurrentLine() |
|
691 |
// Selects desired line on startup |
|
692 |
// ----------------------------------------------------------------------------- |
|
693 |
// |
|
694 |
void CLocSUPLServerEditor::SetInitialCurrentLine() |
|
695 |
{ |
|
696 |
CAknForm::SetInitialCurrentLine(); |
|
697 |
||
698 |
// set focus to server address field |
|
699 |
if ( ControlOrNull( ELocSuplServerIdServerAddr ) ) |
|
700 |
{ |
|
701 |
TRAP_IGNORE( TryChangeFocusToL( ELocSuplServerIdServerAddr ) ); |
|
702 |
} |
|
703 |
} |
|
704 |
||
705 |
// ----------------------------------------------------------------------------- |
|
706 |
// CLocSUPLServerEditor::HandleResourceChange() |
|
707 |
// Handles layout switch |
|
708 |
// ----------------------------------------------------------------------------- |
|
709 |
// |
|
710 |
void CLocSUPLServerEditor::HandleResourceChange( TInt aType ) |
|
711 |
{ |
|
712 |
if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
713 |
{ |
|
714 |
CAknForm::HandleResourceChange( aType ); |
|
715 |
} |
|
716 |
} |
|
717 |
||
718 |
// ----------------------------------------------------------------------------- |
|
719 |
// CLocSUPLServerEditor::ExecuteLD |
|
720 |
// Executes the Dialog |
|
721 |
// ----------------------------------------------------------------------------- |
|
722 |
// |
|
723 |
TInt CLocSUPLServerEditor::ExecuteLD() |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
724 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
725 |
if (!iIsAccessPointDefined) |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
726 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
727 |
return CAknForm::ExecuteLD(R_SUPLSERVER_EDITOR_FORM_DIALOG_NOAP); |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
728 |
} |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
729 |
else |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
730 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
731 |
return CAknForm::ExecuteLD(R_SUPLSERVER_EDITOR_FORM_DIALOG); |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
732 |
} |
45 | 733 |
} |
734 |
||
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
735 |
|
45 | 736 |
// ----------------------------------------------------------------------------- |
737 |
// CLocSUPLServerEditor::HandleControlStateChangeL |
|
738 |
// ----------------------------------------------------------------------------- |
|
739 |
// |
|
740 |
void CLocSUPLServerEditor::HandleControlStateChangeL( TInt aControlId ) |
|
741 |
{ |
|
742 |
DEBUG( + CLocSUPLServerEditor::HandleControlStateChangeL ); |
|
743 |
iIsModified = ETrue; |
|
744 |
switch( aControlId ) |
|
745 |
{ |
|
746 |
case ELocSuplServerIdServerAddr: |
|
747 |
{ |
|
748 |
//Retrieve server address text |
|
749 |
CEikEdwin* serverAddress = |
|
750 |
static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) ); |
|
751 |
if( serverAddress ) |
|
752 |
{ |
|
753 |
HBufC* address = serverAddress->GetTextInHBufL(); |
|
754 |
if( address ) |
|
755 |
{ |
|
756 |
CleanupStack::PushL( address ); |
|
757 |
// update the title pane caption |
|
758 |
ChangeTitlePaneTextL( *address ); |
|
759 |
CleanupStack::PopAndDestroy( address ); |
|
760 |
} |
|
761 |
else |
|
762 |
{ |
|
763 |
// update the title pane caption |
|
764 |
TBuf<1> nullDes; |
|
765 |
nullDes.Copy( KNullDesC ); |
|
766 |
ChangeTitlePaneTextL( nullDes ); |
|
767 |
} |
|
768 |
} |
|
769 |
break; |
|
770 |
} |
|
771 |
default: |
|
772 |
break; |
|
773 |
} |
|
774 |
DEBUG( - CLocSUPLServerEditor::HandleControlStateChangeL ); |
|
775 |
} |
|
776 |
||
777 |
// --------------------------------------------------------------------------- |
|
778 |
// CLocSUPLServerEditor ::LoadFormValuesFromDataL() |
|
779 |
// Called when the form is executed and when the user chooses to discard changes |
|
780 |
// in QuerySaveChangesL (via DoNotSaveFormDataL). |
|
781 |
// --------------------------------------------------------------------------- |
|
782 |
// |
|
783 |
void CLocSUPLServerEditor::LoadFormValuesFromDataL() |
|
784 |
{ |
|
785 |
DEBUG( + CLocSUPLServerEditor::LoadFormValuesFromDataL ); |
|
786 |
if( IsEditable() && iIsNewServer ) //if create new server |
|
787 |
{ |
|
788 |
||
789 |
CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control( |
|
790 |
ELocSuplServerIdUsageInHomeNw); |
|
791 |
if (usageInHNWPopupFieldText) |
|
792 |
{ |
|
793 |
HBufC* usageString = StringLoader::LoadL( |
|
794 |
R_LOC_SERVER_USAGEINHOMENETWORK_YES); |
|
795 |
usageInHNWPopupFieldText->SetTextL(usageString); |
|
796 |
delete usageString; |
|
797 |
} |
|
798 |
usageInHNWPopupFieldText->DrawNow(); |
|
799 |
||
800 |
// update the title pane caption |
|
801 |
HBufC* serverTitle = StringLoader::LoadL( R_LOC_SERVER_EDITOR_TITLE ); |
|
802 |
if( serverTitle ) |
|
803 |
{ |
|
804 |
ChangeTitlePaneTextL( *serverTitle ); |
|
805 |
} |
|
806 |
delete serverTitle; |
|
807 |
serverTitle=NULL; |
|
808 |
} |
|
809 |
else |
|
810 |
{ |
|
811 |
CServerParams *params = CServerParams::NewL(); |
|
812 |
CleanupStack::PushL( params ); |
|
813 |
TRAP_IGNORE( iEngine.GetSlpInfoFromIdL( iSlpId, params ) ); |
|
814 |
||
815 |
HBufC* hslpAddr = HBufC::NewL( KMaxHSLPAddrLen ); |
|
816 |
HBufC* iapName = HBufC::NewL( KMaxIAPLen ); |
|
817 |
TInt64 slpId; |
|
818 |
TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag; |
|
819 |
||
820 |
TInt errParams = params->Get( |
|
821 |
slpId, |
|
822 |
hslpAddr->Des(), |
|
823 |
iapName->Des(), |
|
824 |
enabledFlag, |
|
825 |
simChangeFlag, |
|
826 |
usageInHomeNwFlag, |
|
827 |
editFlag |
|
828 |
); |
|
829 |
if ( errParams != KErrNone ) |
|
830 |
{ |
|
831 |
// Error has occured |
|
832 |
} |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
833 |
|
45 | 834 |
CEikEdwin* serverAddress = |
835 |
static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) ); |
|
836 |
if( serverAddress ) |
|
837 |
{ |
|
838 |
serverAddress->SetTextL( hslpAddr ); |
|
839 |
if( editFlag == EFalse ) |
|
840 |
serverAddress->SetReadOnly( ETrue ); |
|
841 |
serverAddress->DrawDeferred(); |
|
842 |
iServerAddress->Des().Copy( hslpAddr->Des() ); |
|
843 |
} |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
844 |
|
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
845 |
if (iIsAccessPointDefined) |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
846 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
847 |
CEikEdwin* apSelector = static_cast<CEikEdwin*> (ControlOrNull( |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
848 |
ELocSuplServerIdAccessPoint)); |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
849 |
if (apSelector) |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
850 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
851 |
apSelector->SetTextL(iapName); |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
852 |
apSelector->DrawNow(); |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
853 |
iIap->Des().Copy(iapName->Des()); |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
854 |
} |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
855 |
} |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
856 |
|
45 | 857 |
CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control( |
858 |
ELocSuplServerIdUsageInHomeNw); |
|
859 |
if (usageInHNWPopupFieldText) |
|
860 |
{ |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
861 |
if (!usageInHomeNwFlag) |
45 | 862 |
SetUsageinHomeNetwork(EFalse); |
863 |
else |
|
864 |
SetUsageinHomeNetwork(ETrue); |
|
865 |
||
866 |
UpdatePageL(ETrue); |
|
867 |
iUsageInHomeNw = usageInHomeNwFlag; |
|
868 |
} |
|
869 |
||
870 |
delete iapName; |
|
871 |
delete hslpAddr; |
|
872 |
CleanupStack::PopAndDestroy( params ); |
|
873 |
||
874 |
// update the title pane caption |
|
875 |
ChangeTitlePaneTextL( *iServerAddress ); |
|
876 |
||
877 |
} |
|
878 |
DEBUG( - CLocSUPLServerEditor::LoadFormValuesFromDataL ); |
|
879 |
} |
|
880 |
||
881 |
// --------------------------------------------------------------------------- |
|
882 |
// CLocSUPLServerEditor::ChangeTitlePaneTextL() |
|
883 |
// Set the Title Text |
|
884 |
// --------------------------------------------------------------------------- |
|
885 |
// |
|
886 |
void CLocSUPLServerEditor::ChangeTitlePaneTextL( TDesC& aText ) |
|
887 |
{ |
|
888 |
DEBUG( + CLocSUPLServerEditor::ChangeTitlePaneTextL ); |
|
889 |
// Obtain the title from the Status Pane |
|
890 |
CAknTitlePane* title = static_cast < CAknTitlePane* >( iEikonEnv->AppUiFactory()-> |
|
891 |
StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
892 |
||
893 |
// Set the Title's buffer |
|
894 |
HBufC* buf = aText.AllocL(); |
|
895 |
title->SetText( buf ); // Takes ownership of buf |
|
896 |
title->DrawNow(); |
|
897 |
DEBUG( - CLocSUPLServerEditor::ChangeTitlePaneTextL ); |
|
898 |
} |
|
899 |
||
900 |
// --------------------------------------------------------------------------- |
|
901 |
// CLocSUPLServerEditor::TogglePopupFieldControlL() |
|
902 |
// it toggles value of popupfield control |
|
903 |
// This method is no longer in use since TB 9.2 |
|
904 |
// --------------------------------------------------------------------------- |
|
905 |
// |
|
906 |
void CLocSUPLServerEditor::TogglePopupFieldControlL( TInt aControlId ) |
|
907 |
{ |
|
908 |
DEBUG( + CLocSUPLServerEditor::TogglePopupFieldControlL ); |
|
909 |
CAknPopupFieldText* popupFieldText = |
|
910 |
( CAknPopupFieldText* ) Control( aControlId ); |
|
911 |
||
912 |
if( popupFieldText ) |
|
913 |
{ |
|
914 |
if( popupFieldText->CurrentValueIndex() == 0 ) |
|
915 |
popupFieldText->SetCurrentValueIndex( 1 ); |
|
916 |
else |
|
917 |
popupFieldText->SetCurrentValueIndex( 0 ); |
|
918 |
||
919 |
UpdatePageL( ETrue ); |
|
920 |
} |
|
921 |
DEBUG( - CLocSUPLServerEditor::TogglePopupFieldControlL ); |
|
922 |
} |
|
923 |
||
924 |
// ----------------------------------------------------------------------------- |
|
925 |
// CLocSUPLServerEditor::HandleMSKCaptionL() |
|
926 |
// It changes caption of MSK key |
|
927 |
// ----------------------------------------------------------------------------- |
|
928 |
// |
|
929 |
void CLocSUPLServerEditor::HandleMSKCaptionL() |
|
930 |
{ |
|
931 |
DEBUG( + CLocSUPLServerEditor::HandleMSKCaptionL ); |
|
932 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
933 |
CleanupStack::PushL( cba ); |
|
934 |
//attribute specific cba |
|
935 |
if( IsEditable() ) |
|
936 |
{ |
|
937 |
switch ( IdOfFocusControl() ) |
|
938 |
{ |
|
939 |
case ELocSuplServerIdServerAddr: |
|
940 |
{ |
|
941 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE ); |
|
942 |
break; |
|
943 |
} |
|
944 |
case ELocSuplServerIdAccessPoint: |
|
945 |
{ |
|
946 |
break; |
|
947 |
} |
|
948 |
case ELocSuplServerIdUsageInHomeNw: |
|
949 |
{ |
|
950 |
TBool editableFlag = ETrue; |
|
951 |
if( iSlpId ) |
|
952 |
{ |
|
953 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
954 |
} |
|
955 |
if( editableFlag ) |
|
956 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_CHANGE_DONE ); |
|
957 |
else |
|
958 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE ); |
|
959 |
break; |
|
960 |
} |
|
961 |
default: |
|
962 |
break; |
|
963 |
} |
|
964 |
} |
|
965 |
else |
|
966 |
{ |
|
967 |
TBool editableFlag = ETrue; |
|
968 |
TBool changeMSK = ETrue; |
|
969 |
||
970 |
if( iSlpId ) |
|
971 |
TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
|
972 |
||
973 |
if( editableFlag == EFalse && ( IdOfFocusControl() == ELocSuplServerIdServerAddr || |
|
974 |
IdOfFocusControl() == ELocSuplServerIdUsageInHomeNw ) ) |
|
975 |
changeMSK = EFalse; |
|
976 |
||
977 |
if( changeMSK ) |
|
978 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_EDIT_BACK ); |
|
979 |
else |
|
980 |
cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_BACK ); |
|
981 |
} |
|
982 |
cba->DrawDeferred(); |
|
983 |
CleanupStack::Pop( cba ); |
|
984 |
DEBUG( - CLocSUPLServerEditor::HandleMSKCaptionL ); |
|
985 |
} |
|
986 |
||
987 |
// ----------------------------------------------------------------------------- |
|
988 |
// CLocSUPLServerEditor::UpdateIapL() |
|
989 |
// It changes IAP value in AP field |
|
990 |
// ----------------------------------------------------------------------------- |
|
991 |
// |
|
992 |
void CLocSUPLServerEditor::UpdateIapL( const TDesC& aIapName ) |
|
993 |
{ |
|
994 |
DEBUG( + CLocSUPLServerEditor::UpdateIapL ); |
|
995 |
if( aIapName.Length() > 0 ) |
|
996 |
{ |
|
997 |
iIap->Des().Copy( aIapName ); |
|
998 |
CEikEdwin* apSelector = |
|
999 |
static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) ); |
|
1000 |
if( apSelector ) |
|
1001 |
{ |
|
1002 |
apSelector->SetTextL( iIap ); |
|
1003 |
} |
|
1004 |
apSelector->DrawNow(); |
|
1005 |
HandleMSKCaptionL(); |
|
1006 |
if (iIsNewServer) |
|
1007 |
{ |
|
1008 |
iIsModified = ETrue; |
|
1009 |
} |
|
1010 |
} |
|
1011 |
DEBUG( - CLocSUPLServerEditor::UpdateIapL ); |
|
1012 |
} |
|
1013 |
||
1014 |
// ----------------------------------------------------------------------------- |
|
1015 |
// CLocSUPLServerEditor::DeleteConfirmationQueryL |
|
1016 |
// Pops the delete confirmation query note |
|
1017 |
// ---------------------------------------------------------------------------- |
|
1018 |
// |
|
1019 |
TInt CLocSUPLServerEditor::DeleteConfirmationQueryL() |
|
1020 |
{ |
|
1021 |
HBufC* noteText = NULL; |
|
1022 |
noteText = StringLoader::LoadL( R_LOC_DETAIL_CONF_DELETE_SERVER ); |
|
1023 |
CAknQueryDialog* query = new( ELeave ) CAknQueryDialog( *noteText ); |
|
1024 |
TInt ret = query->ExecuteLD( R_LOC_SUPL_DELETE_QUERY ); |
|
1025 |
delete noteText; //noteText |
|
1026 |
noteText = NULL; |
|
1027 |
return ret; |
|
1028 |
} |
|
1029 |
||
1030 |
// ----------------------------------------------------------------------------- |
|
1031 |
// CLocSUPLServerEditor::ShowServerValidationInfoNoteL |
|
1032 |
// Shows Validation Info note for server address entry |
|
1033 |
// ---------------------------------------------------------------------------- |
|
1034 |
// |
|
1035 |
void CLocSUPLServerEditor::ShowServerValidationInfoNoteL( TInt aResourceId ) |
|
1036 |
{ |
|
1037 |
// Show the information note to add server address before closing |
|
1038 |
HBufC* noteText = StringLoader::LoadL( aResourceId ); |
|
1039 |
CAknInformationNote* dialog = |
|
1040 |
new( ELeave ) CAknInformationNote( R_AKN_INFORMATION_NOTE_WAIT ); |
|
1041 |
dialog->ExecuteLD( *noteText ); |
|
1042 |
delete noteText; //noteText |
|
1043 |
noteText = NULL; |
|
1044 |
} |
|
1045 |
||
1046 |
// ---------------------------------------------------------------------------------- |
|
1047 |
// CLocSUPLServerEditor::SetCursorToEndL |
|
1048 |
// Moves the cursor position at end if focus is on server address field in edit mode |
|
1049 |
// ---------------------------------------------------------------------------------- |
|
1050 |
// |
|
1051 |
void CLocSUPLServerEditor::SetCursorToEndL() |
|
1052 |
{ |
|
1053 |
if ( IdOfFocusControl() == ELocSuplServerIdServerAddr ) |
|
1054 |
{ |
|
1055 |
CEikEdwin* serverAddress = |
|
1056 |
static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) ); |
|
1057 |
if( serverAddress ) |
|
1058 |
{ |
|
1059 |
HBufC* address = serverAddress->GetTextInHBufL(); |
|
1060 |
if( address ) |
|
1061 |
{ |
|
1062 |
serverAddress->SetCursorPosL( address->Length(), EFalse ); |
|
1063 |
serverAddress->DrawDeferred(); |
|
1064 |
} |
|
1065 |
delete address; |
|
1066 |
} |
|
1067 |
} |
|
1068 |
} |
|
1069 |
// ---------------------------------------------------------------------------------- |
|
1070 |
// CLocSUPLServerEditor::HandleDialogPageEventL |
|
1071 |
// ---------------------------------------------------------------------------------- |
|
1072 |
// |
|
1073 |
void CLocSUPLServerEditor::HandleDialogPageEventL(TInt aEventID) |
|
1074 |
{ |
|
1075 |
DEBUG( +CLocSUPLServerEditor::HandleDialogPageEventL ); |
|
1076 |
||
1077 |
CAknForm::HandleDialogPageEventL(aEventID); |
|
1078 |
CEikEdwin* iapEditor = static_cast<CEikEdwin*> (ControlOrNull( |
|
1079 |
ELocSuplServerIdAccessPoint)); |
|
1080 |
CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
|
1081 |
ELocSuplServerIdUsageInHomeNw); |
|
1082 |
TInt focusControl(IdOfFocusControl()); |
|
1083 |
||
1084 |
if (!IsEditable()) |
|
1085 |
{ |
|
1086 |
if (focusControl == ELocSuplServerIdUsageInHomeNw |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1087 |
|| focusControl == ELocSuplServerIdServerAddr) |
45 | 1088 |
{ |
1089 |
ProcessCommandL(EAknFormCmdEdit); |
|
1090 |
} |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1091 |
else |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1092 |
return; |
45 | 1093 |
} |
1094 |
else if (aEventID == MEikDialogPageObserver::EDialogPageTapped) |
|
1095 |
{ |
|
1096 |
if (focusControl == ELocSuplServerIdUsageInHomeNw) |
|
1097 |
{ |
|
1098 |
if (usageInHomeNWPopupFieldText) |
|
1099 |
{ |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1100 |
HBufC* string; |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1101 |
string = StringLoader::LoadLC( |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1102 |
R_LOC_SERVER_USAGEINHOMENETWORK_NO, iCoeEnv); |
45 | 1103 |
TBuf<KMaxUsageTextSize> des; |
1104 |
usageInHomeNWPopupFieldText->GetText(des); |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1105 |
if (!des.CompareC(string->Des())) |
45 | 1106 |
{ |
1107 |
SetUsageinHomeNetwork(ETrue); |
|
1108 |
} |
|
1109 |
else |
|
1110 |
{ |
|
1111 |
SetUsageinHomeNetwork(EFalse); |
|
1112 |
} |
|
1113 |
if (iIsNewServer) |
|
1114 |
{ |
|
1115 |
iIsModified = ETrue; |
|
1116 |
} |
|
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1117 |
CleanupStack::PopAndDestroy(string); |
45 | 1118 |
} |
1119 |
return; |
|
1120 |
} |
|
1121 |
}DEBUG( -CLocSUPLServerEditor::HandleDialogPageEventL ); |
|
1122 |
} |
|
1123 |
||
1124 |
// ----------------------------------------------------------------------------- |
|
1125 |
// CLocSUPLServerEditor::SetUsageinHomeNetwork |
|
1126 |
// Set usage in network field on or off |
|
1127 |
// ----------------------------------------------------------------------------- |
|
1128 |
// |
|
1129 |
void CLocSUPLServerEditor::SetUsageinHomeNetwork(TBool aOnOff) |
|
1130 |
{ |
|
1131 |
HBufC* string; |
|
1132 |
CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
|
1133 |
ELocSuplServerIdUsageInHomeNw); |
|
1134 |
if (aOnOff) |
|
1135 |
{ |
|
1136 |
// load string 'ON' |
|
1137 |
string = StringLoader::LoadLC(R_LOC_SERVER_USAGEINHOMENETWORK_YES, |
|
1138 |
iCoeEnv); |
|
1139 |
} |
|
1140 |
else |
|
1141 |
{ |
|
1142 |
// load string 'OFF' |
|
1143 |
string = StringLoader::LoadLC(R_LOC_SERVER_USAGEINHOMENETWORK_NO, |
|
1144 |
iCoeEnv); |
|
1145 |
} |
|
1146 |
// set Usage in Network field string as 'ON'/'OFF' |
|
1147 |
usageInHomeNWPopupFieldText->SetTextL(string); |
|
1148 |
CleanupStack::PopAndDestroy(string); |
|
1149 |
} |
|
1150 |
||
49
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1151 |
// ----------------------------------------------------------------------------- |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1152 |
// CLocSUPLServerEditor::SetAccessPointEnabled |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1153 |
// |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1154 |
// ----------------------------------------------------------------------------- |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1155 |
// |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1156 |
void CLocSUPLServerEditor::SetAccessPointEnabled (TBool aEnabled) |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1157 |
{ |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1158 |
iIsAccessPointDefined = aEnabled; |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1159 |
} |
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1160 |
|
10852b179f64
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
1161 |
|
45 | 1162 |
// End of file |