67 // |
67 // |
68 CLocSUPLServerEditor::CLocSUPLServerEditor( |
68 CLocSUPLServerEditor::CLocSUPLServerEditor( |
69 TBool aIsEditable, |
69 TBool aIsEditable, |
70 CLocSUPLSettingsUiEngine& aEngine, |
70 CLocSUPLSettingsUiEngine& aEngine, |
71 TInt64 aSlpId |
71 TInt64 aSlpId |
72 ):iIsEditMode( aIsEditable ), iEngine( aEngine ), iSlpId( aSlpId ) |
72 ):iIsEditMode( aIsEditable ), iEngine( aEngine ), iSlpId( aSlpId ), iIsAccessPointDefined(EFalse) |
73 { |
73 { |
74 if( aIsEditable ) |
74 if( aIsEditable ) |
75 { |
75 { |
76 iIsNewServer = ETrue; |
76 iIsNewServer = ETrue; |
77 iSlpId = NULL; |
77 iSlpId = NULL; |
182 switch( IdOfFocusControl() ) |
182 switch( IdOfFocusControl() ) |
183 { |
183 { |
184 case ELocSuplServerIdServerAddr: |
184 case ELocSuplServerIdServerAddr: |
185 { |
185 { |
186 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
186 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
187 aMenuPane->SetItemDimmed( ELocServerEditorChange, ETrue ); |
|
188 break; |
187 break; |
189 } |
188 } |
190 case ELocSuplServerIdAccessPoint: |
189 case ELocSuplServerIdAccessPoint: |
191 { |
190 { |
192 TInt isIapChanged = EFalse; |
|
193 CEikEdwin* apSelector = |
|
194 static_cast < CEikEdwin* > ( ControlOrNull( IdOfFocusControl() ) ); |
|
195 if( apSelector ) |
|
196 { |
|
197 if( iIap->Length() > 0 ) |
|
198 isIapChanged = ETrue; |
|
199 } |
|
200 |
|
201 if( isIapChanged ) |
|
202 { |
|
203 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
|
204 } |
|
205 else |
|
206 { |
|
207 aMenuPane->SetItemDimmed( ELocServerEditorChange, ETrue ); |
|
208 } |
|
209 break; |
191 break; |
210 } |
192 } |
211 case ELocSuplServerIdUsageInHomeNw: |
193 case ELocSuplServerIdUsageInHomeNw: |
212 { |
194 { |
213 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
195 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
214 |
196 |
215 TBool editableFlag = ETrue; |
197 TBool editableFlag = ETrue; |
216 if( iSlpId ) |
198 if( iSlpId ) |
217 TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
199 TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
218 if( editableFlag == EFalse ) |
|
219 aMenuPane->SetItemDimmed( ELocServerEditorChange, ETrue ); |
|
220 |
200 |
221 break; |
201 break; |
222 } |
202 } |
223 default: |
203 default: |
224 break; |
204 break; |
252 break; |
232 break; |
253 } |
233 } |
254 } |
234 } |
255 |
235 |
256 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
236 aMenuPane->SetItemDimmed( ELocServerEditorDefine, ETrue ); |
257 aMenuPane->SetItemDimmed( ELocServerEditorChange, ETrue ); |
|
258 aMenuPane->SetItemDimmed( ELocServerEditorRemove, ETrue ); |
237 aMenuPane->SetItemDimmed( ELocServerEditorRemove, ETrue ); |
259 } |
238 } |
260 } |
239 } |
261 DEBUG( - CLocSUPLServerEditor::DynInitMenuPaneL ); |
240 DEBUG( - CLocSUPLServerEditor::DynInitMenuPaneL ); |
262 } |
241 } |
298 case ELocServerEditorEnable: |
277 case ELocServerEditorEnable: |
299 { |
278 { |
300 TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, ETrue ) ); |
279 TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, ETrue ) ); |
301 break; |
280 break; |
302 } |
281 } |
303 case ELocServerEditorDefine: |
|
304 { |
|
305 TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) ); |
|
306 break; |
|
307 } |
|
308 case ELocServerEditorChange: |
|
309 case ELocServerEditorMSKChange: |
282 case ELocServerEditorMSKChange: |
310 { |
283 { |
311 CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
284 CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
312 ELocSuplServerIdUsageInHomeNw); |
285 ELocSuplServerIdUsageInHomeNw); |
313 if (IdOfFocusControl() == ELocSuplServerIdAccessPoint) |
286 HBufC* string; |
314 { |
287 string = StringLoader::LoadLC( |
315 TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) ); |
288 R_LOC_SERVER_USAGEINHOMENETWORK_NO, iCoeEnv); |
316 } |
|
317 else |
|
318 { |
|
319 if (iIsNewServer) |
289 if (iIsNewServer) |
320 { |
290 { |
321 TBuf<KMaxUsageTextSize> des; |
291 TBuf<KMaxUsageTextSize> des; |
322 usageInHomeNWPopupFieldText->GetText(des); |
292 usageInHomeNWPopupFieldText->GetText(des); |
323 if (!des.Compare(KNoUsageInHomeNetork)) |
293 if (!des.CompareC(string->Des())) |
324 { |
294 { |
325 SetUsageinHomeNetwork(ETrue); |
295 SetUsageinHomeNetwork(ETrue); |
326 } |
296 } |
327 else |
297 else |
328 { |
298 { |
335 TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
305 TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) ); |
336 if (editableFlag) |
306 if (editableFlag) |
337 { |
307 { |
338 TBuf<KMaxUsageTextSize> des; |
308 TBuf<KMaxUsageTextSize> des; |
339 usageInHomeNWPopupFieldText->GetText(des); |
309 usageInHomeNWPopupFieldText->GetText(des); |
340 if (!des.Compare(KNoUsageInHomeNetork)) |
310 if (!des.CompareC(string->Des())) |
341 { |
311 { |
342 SetUsageinHomeNetwork(ETrue); |
312 SetUsageinHomeNetwork(ETrue); |
343 } |
313 } |
344 else |
314 else |
345 { |
315 { |
346 SetUsageinHomeNetwork(EFalse); |
316 SetUsageinHomeNetwork(EFalse); |
347 } |
317 } |
348 } |
318 } |
|
319 CleanupStack::PopAndDestroy(string); |
349 } |
320 } |
350 } |
|
351 break; |
321 break; |
352 } |
322 } |
353 case EAknCmdHelp: |
323 case EAknCmdHelp: |
354 { |
324 { |
355 HlpLauncher::LaunchHelpApplicationL(iCoeEnv->WsSession(), |
325 HlpLauncher::LaunchHelpApplicationL(iCoeEnv->WsSession(), |
489 { |
452 { |
490 if( SaveFormDataL() ) |
453 if( SaveFormDataL() ) |
491 { |
454 { |
492 if( iIsNewServer ) |
455 if( iIsNewServer ) |
493 { |
456 { |
|
457 // iap name is always set as KNullDesC since defining the access point is |
|
458 // not allowed while creating a new server manually |
494 TRAPD( err, iEngine.AddNewServerL( |
459 TRAPD( err, iEngine.AddNewServerL( |
495 iServerAddress->Des(), |
460 iServerAddress->Des(), |
496 iIap->Des(), |
461 KNullDesC, |
497 iUsageInHomeNw ) ); |
462 iUsageInHomeNw ) ); |
498 if( err == KErrNone ) |
463 if( err == KErrNone ) |
499 { |
464 { |
500 iIsNewServer = EFalse; |
465 iIsNewServer = EFalse; |
501 } |
466 } |
638 CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
603 CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control( |
639 ELocSuplServerIdUsageInHomeNw); |
604 ELocSuplServerIdUsageInHomeNw); |
640 if (usageInHomeNWPopupFieldText) |
605 if (usageInHomeNWPopupFieldText) |
641 { |
606 { |
642 TBuf<KMaxUsageTextSize> des; |
607 TBuf<KMaxUsageTextSize> des; |
|
608 HBufC* string; |
|
609 string = StringLoader::LoadLC( |
|
610 R_LOC_SERVER_USAGEINHOMENETWORK_NO, iCoeEnv); |
643 usageInHomeNWPopupFieldText->GetText(des); |
611 usageInHomeNWPopupFieldText->GetText(des); |
644 if (!des.Compare(KNoUsageInHomeNetork)) |
612 if (!des.CompareC(string->Des())) |
|
613 { |
|
614 iUsageInHomeNw = EFalse; |
|
615 } |
|
616 else |
645 { |
617 { |
646 iUsageInHomeNw = ETrue; |
618 iUsageInHomeNw = ETrue; |
647 } |
619 } |
648 else |
620 CleanupStack::PopAndDestroy(string); |
649 { |
|
650 iUsageInHomeNw = EFalse; |
|
651 } |
|
652 } |
621 } |
653 |
622 |
654 if( iServerAddress->Length() > 0 ) |
623 if( iServerAddress->Length() > 0 ) |
655 { |
624 { |
656 retVal = ETrue; |
625 retVal = ETrue; |
750 // CLocSUPLServerEditor::ExecuteLD |
719 // CLocSUPLServerEditor::ExecuteLD |
751 // Executes the Dialog |
720 // Executes the Dialog |
752 // ----------------------------------------------------------------------------- |
721 // ----------------------------------------------------------------------------- |
753 // |
722 // |
754 TInt CLocSUPLServerEditor::ExecuteLD() |
723 TInt CLocSUPLServerEditor::ExecuteLD() |
755 { |
724 { |
756 return CAknForm::ExecuteLD( R_SUPLSERVER_EDITOR_FORM_DIALOG ); |
725 if (!iIsAccessPointDefined) |
757 } |
726 { |
|
727 return CAknForm::ExecuteLD(R_SUPLSERVER_EDITOR_FORM_DIALOG_NOAP); |
|
728 } |
|
729 else |
|
730 { |
|
731 return CAknForm::ExecuteLD(R_SUPLSERVER_EDITOR_FORM_DIALOG); |
|
732 } |
|
733 } |
|
734 |
758 |
735 |
759 // ----------------------------------------------------------------------------- |
736 // ----------------------------------------------------------------------------- |
760 // CLocSUPLServerEditor::HandleControlStateChangeL |
737 // CLocSUPLServerEditor::HandleControlStateChangeL |
761 // ----------------------------------------------------------------------------- |
738 // ----------------------------------------------------------------------------- |
762 // |
739 // |
806 void CLocSUPLServerEditor::LoadFormValuesFromDataL() |
783 void CLocSUPLServerEditor::LoadFormValuesFromDataL() |
807 { |
784 { |
808 DEBUG( + CLocSUPLServerEditor::LoadFormValuesFromDataL ); |
785 DEBUG( + CLocSUPLServerEditor::LoadFormValuesFromDataL ); |
809 if( IsEditable() && iIsNewServer ) //if create new server |
786 if( IsEditable() && iIsNewServer ) //if create new server |
810 { |
787 { |
811 CEikEdwin* apSelector = |
|
812 static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) ); |
|
813 if( apSelector ) |
|
814 { |
|
815 HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE ); |
|
816 apSelector->SetTextL( apString ); |
|
817 delete apString; |
|
818 } |
|
819 apSelector->DrawNow(); |
|
820 |
788 |
821 CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control( |
789 CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control( |
822 ELocSuplServerIdUsageInHomeNw); |
790 ELocSuplServerIdUsageInHomeNw); |
823 if (usageInHNWPopupFieldText) |
791 if (usageInHNWPopupFieldText) |
824 { |
792 { |
860 ); |
828 ); |
861 if ( errParams != KErrNone ) |
829 if ( errParams != KErrNone ) |
862 { |
830 { |
863 // Error has occured |
831 // Error has occured |
864 } |
832 } |
865 |
833 |
866 CEikEdwin* serverAddress = |
834 CEikEdwin* serverAddress = |
867 static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) ); |
835 static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdServerAddr ) ); |
868 if( serverAddress ) |
836 if( serverAddress ) |
869 { |
837 { |
870 serverAddress->SetTextL( hslpAddr ); |
838 serverAddress->SetTextL( hslpAddr ); |
871 if( editFlag == EFalse ) |
839 if( editFlag == EFalse ) |
872 serverAddress->SetReadOnly( ETrue ); |
840 serverAddress->SetReadOnly( ETrue ); |
873 serverAddress->DrawDeferred(); |
841 serverAddress->DrawDeferred(); |
874 iServerAddress->Des().Copy( hslpAddr->Des() ); |
842 iServerAddress->Des().Copy( hslpAddr->Des() ); |
875 } |
843 } |
876 |
844 |
877 CEikEdwin* apSelector = |
845 if (iIsAccessPointDefined) |
878 static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplServerIdAccessPoint ) ); |
846 { |
879 if( apSelector ) |
847 CEikEdwin* apSelector = static_cast<CEikEdwin*> (ControlOrNull( |
880 { |
848 ELocSuplServerIdAccessPoint)); |
881 if( iapName->Length() > 0 ) |
849 if (apSelector) |
882 { |
850 { |
883 apSelector->SetTextL( iapName ); |
851 apSelector->SetTextL(iapName); |
884 } |
852 apSelector->DrawNow(); |
885 else |
853 iIap->Des().Copy(iapName->Des()); |
886 { |
854 } |
887 HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE ); |
855 } |
888 apSelector->SetTextL( apString ); |
856 |
889 delete apString; |
|
890 } |
|
891 |
|
892 apSelector->DrawNow(); |
|
893 iIap->Des().Copy( iapName->Des() ); |
|
894 } |
|
895 |
|
896 CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control( |
857 CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control( |
897 ELocSuplServerIdUsageInHomeNw); |
858 ELocSuplServerIdUsageInHomeNw); |
898 if (usageInHNWPopupFieldText) |
859 if (usageInHNWPopupFieldText) |
899 { |
860 { |
900 if (usageInHomeNwFlag) |
861 if (!usageInHomeNwFlag) |
901 SetUsageinHomeNetwork(EFalse); |
862 SetUsageinHomeNetwork(EFalse); |
902 else |
863 else |
903 SetUsageinHomeNetwork(ETrue); |
864 SetUsageinHomeNetwork(ETrue); |
904 |
865 |
905 UpdatePageL(ETrue); |
866 UpdatePageL(ETrue); |
980 cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE ); |
941 cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_NOMSK_DONE ); |
981 break; |
942 break; |
982 } |
943 } |
983 case ELocSuplServerIdAccessPoint: |
944 case ELocSuplServerIdAccessPoint: |
984 { |
945 { |
985 TInt isIapChanged = EFalse; |
|
986 CEikEdwin* apSelector = |
|
987 static_cast < CEikEdwin* > ( ControlOrNull( IdOfFocusControl() ) ); |
|
988 if( apSelector && iIap ) |
|
989 { |
|
990 if( iIap->Length() > 0 ) |
|
991 isIapChanged = ETrue; |
|
992 } |
|
993 if( isIapChanged ) |
|
994 { |
|
995 cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_CHANGE_DONE ); |
|
996 } |
|
997 else |
|
998 { |
|
999 cba->SetCommandSetL( R_SUPLSERVER_EDITOR_OPTIONS_DEFINE_DONE ); |
|
1000 } |
|
1001 break; |
946 break; |
1002 } |
947 } |
1003 case ELocSuplServerIdUsageInHomeNw: |
948 case ELocSuplServerIdUsageInHomeNw: |
1004 { |
949 { |
1005 TBool editableFlag = ETrue; |
950 TBool editableFlag = ETrue; |
1137 TInt focusControl(IdOfFocusControl()); |
1082 TInt focusControl(IdOfFocusControl()); |
1138 |
1083 |
1139 if (!IsEditable()) |
1084 if (!IsEditable()) |
1140 { |
1085 { |
1141 if (focusControl == ELocSuplServerIdUsageInHomeNw |
1086 if (focusControl == ELocSuplServerIdUsageInHomeNw |
1142 || ELocSuplServerIdServerAddr || ELocSuplServerIdAccessPoint) |
1087 || focusControl == ELocSuplServerIdServerAddr) |
1143 { |
1088 { |
1144 ProcessCommandL(EAknFormCmdEdit); |
1089 ProcessCommandL(EAknFormCmdEdit); |
1145 } |
1090 } |
|
1091 else |
|
1092 return; |
1146 } |
1093 } |
1147 else if (aEventID == MEikDialogPageObserver::EDialogPageTapped) |
1094 else if (aEventID == MEikDialogPageObserver::EDialogPageTapped) |
1148 { |
1095 { |
1149 if (focusControl == ELocSuplServerIdUsageInHomeNw) |
1096 if (focusControl == ELocSuplServerIdUsageInHomeNw) |
1150 { |
1097 { |
1151 if (usageInHomeNWPopupFieldText) |
1098 if (usageInHomeNWPopupFieldText) |
1152 { |
1099 { |
|
1100 HBufC* string; |
|
1101 string = StringLoader::LoadLC( |
|
1102 R_LOC_SERVER_USAGEINHOMENETWORK_NO, iCoeEnv); |
1153 TBuf<KMaxUsageTextSize> des; |
1103 TBuf<KMaxUsageTextSize> des; |
1154 usageInHomeNWPopupFieldText->GetText(des); |
1104 usageInHomeNWPopupFieldText->GetText(des); |
1155 if (!des.Compare(KNoUsageInHomeNetork)) |
1105 if (!des.CompareC(string->Des())) |
1156 { |
1106 { |
1157 SetUsageinHomeNetwork(ETrue); |
1107 SetUsageinHomeNetwork(ETrue); |
1158 } |
1108 } |
1159 else |
1109 else |
1160 { |
1110 { |
1203 // set Usage in Network field string as 'ON'/'OFF' |
1146 // set Usage in Network field string as 'ON'/'OFF' |
1204 usageInHomeNWPopupFieldText->SetTextL(string); |
1147 usageInHomeNWPopupFieldText->SetTextL(string); |
1205 CleanupStack::PopAndDestroy(string); |
1148 CleanupStack::PopAndDestroy(string); |
1206 } |
1149 } |
1207 |
1150 |
|
1151 // ----------------------------------------------------------------------------- |
|
1152 // CLocSUPLServerEditor::SetAccessPointEnabled |
|
1153 // |
|
1154 // ----------------------------------------------------------------------------- |
|
1155 // |
|
1156 void CLocSUPLServerEditor::SetAccessPointEnabled (TBool aEnabled) |
|
1157 { |
|
1158 iIsAccessPointDefined = aEnabled; |
|
1159 } |
|
1160 |
|
1161 |
1208 // End of file |
1162 // End of file |