locationsystemui/locationsysui/locsuplsettingsui/src/locsuplservereditor.cpp
branchRCL_3
changeset 6 f3bd2a0973b9
parent 4 42de37ce7ce4
child 7 19bff11d6c18
equal deleted inserted replaced
4:42de37ce7ce4 6:f3bd2a0973b9
   268 void CLocSUPLServerEditor::ProcessCommandL( TInt aCommandId )
   268 void CLocSUPLServerEditor::ProcessCommandL( TInt aCommandId )
   269 	{
   269 	{
   270 	DEBUG1( + CLocSUPLServerEditor::ProcessCommandL aCommandId=%d, aCommandId );
   270 	DEBUG1( + CLocSUPLServerEditor::ProcessCommandL aCommandId=%d, aCommandId );
   271 	CAknForm::ProcessCommandL( aCommandId );
   271 	CAknForm::ProcessCommandL( aCommandId );
   272 
   272 
   273 	switch ( aCommandId )
   273     switch (aCommandId)
   274        	{
   274         {
   275        	case EAknFormCmdEdit:
   275         case EAknFormCmdEdit:
   276        		{
   276             {
   277 			iIsEditMode = ETrue;
   277             iIsEditMode = ETrue;
   278 			SetCursorToEndL();
   278             SetCursorToEndL();
   279    			HandleMSKCaptionL();						
   279             HandleMSKCaptionL();
   280        		break;
   280             break;
   281        		}
   281             }
   282        	case ELocServerEditorDelete:
   282         case ELocServerEditorDelete:
   283        	case ELocServerEditorRemove:
   283         case ELocServerEditorRemove:
   284        		{
   284             {
   285        		if( DeleteConfirmationQueryL() )
   285             if (DeleteConfirmationQueryL())
   286        			{
   286                 {
   287        			TRAP_IGNORE( iEngine.RemoveServerL( iSlpId ) );
   287                 TRAP_IGNORE( iEngine.RemoveServerL( iSlpId ) );
   288         		// Return back to server view
   288                 // Return back to server view
   289 	       		TryExitL( EAknSoftkeyBack );
   289                 TryExitL(EAknSoftkeyBack);
   290       			}       			
   290                 }
   291        		break;
   291             break;
   292        		}
   292             }
   293        	case ELocServerEditorDisable:
   293         case ELocServerEditorDisable:
   294        		{
   294             {
   295        		TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, EFalse ) );
   295             TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, EFalse ) );
   296        		break;
   296             break;
   297        		}
   297             }
   298        	case ELocServerEditorEnable:
   298         case ELocServerEditorEnable:
   299        		{
   299             {
   300        		TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, ETrue ) );
   300             TRAP_IGNORE( iEngine.SetServerEnabledFlagL( iSlpId, ETrue ) );
   301       		break;
   301             break;
   302        		}
   302             }
   303        	case ELocServerEditorDefine:
   303         case ELocServerEditorDefine:
   304        		{
   304             {
   305         	TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
   305             TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
   306        		break;
   306             break;
   307        		}
   307             }
   308        	case ELocServerEditorChange:
   308         case ELocServerEditorChange:
   309        	case ELocServerEditorMSKChange:       	
   309         case ELocServerEditorMSKChange:
   310        		{
   310             {
   311 		    if ( IdOfFocusControl() == ELocSuplServerIdAccessPoint )
   311             CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control(
   312 		    	{
   312                     ELocSuplServerIdUsageInHomeNw);
   313         		TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
   313             if (IdOfFocusControl() == ELocSuplServerIdAccessPoint)
   314 		    	}
   314                 {
   315 		    else
   315                 TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
   316 		    	{
   316                 }
   317 		    	if( iIsNewServer )
   317             else
   318 		    		{
   318                 {
   319 		    		TogglePopupFieldControlL( IdOfFocusControl() );
   319                 if (iIsNewServer)
   320 		    		}
   320                     {
   321 		    	else
   321                     TBuf<KMaxUsageTextSize> des;
   322 		    		{
   322                     usageInHomeNWPopupFieldText->GetText(des);
   323 			    	TBool editableFlag;
   323                     if (!des.Compare(KNoUsageInHomeNetork))
   324 			    	TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );
   324                         {
   325 			    	if ( editableFlag )
   325                         SetUsageinHomeNetwork(ETrue);
   326 			    		TogglePopupFieldControlL( IdOfFocusControl() );		    		
   326                         }
   327 		    		}
   327                     else
   328 		    	}			    	
   328                         {
   329        		break;
   329                         SetUsageinHomeNetwork(EFalse);
   330        		}
   330                         }
   331        	case EAknCmdHelp:
   331                     }
   332        		{
   332                 else
   333             HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(),
   333                     {
   334                                               iAvkonAppUi->AppHelpContextL() );
   334                     TBool editableFlag;
   335        		break;
   335                     TRAP_IGNORE( iEngine.GetEditableFlagL( iSlpId, editableFlag ) );
   336        		}
   336                     if (editableFlag)
   337        	case EEikCmdExit:
   337                         {
   338        		{
   338                         TBuf<KMaxUsageTextSize> des;
   339        		// The Exit is handled by the Application UI
   339                         usageInHomeNWPopupFieldText->GetText(des);
   340        		TryExitL( EEikCmdExit );
   340                         if (!des.Compare(KNoUsageInHomeNetork))
   341        		break;
   341                             {
   342        		}
   342                             SetUsageinHomeNetwork(ETrue);
   343 		default:
   343                             }
   344 			break;
   344                         else
   345        	}
   345                             {
   346 	DEBUG( - CLocSUPLServerEditor::ProcessCommandL );
   346                             SetUsageinHomeNetwork(EFalse);
   347 	}
   347                             }
   348 	
   348                         }
       
   349                     }
       
   350                 }
       
   351             break;
       
   352             }
       
   353         case EAknCmdHelp:
       
   354             {
       
   355             HlpLauncher::LaunchHelpApplicationL(iCoeEnv->WsSession(),
       
   356                     iAvkonAppUi->AppHelpContextL());
       
   357             break;
       
   358             }
       
   359         case EEikCmdExit:
       
   360             {
       
   361             // The Exit is handled by the Application UI
       
   362             TryExitL(EEikCmdExit);
       
   363             break;
       
   364             }
       
   365         default:
       
   366             break;
       
   367         }DEBUG( - CLocSUPLServerEditor::ProcessCommandL );
       
   368     }
       
   369 
   349 // ---------------------------------------------------------------------------
   370 // ---------------------------------------------------------------------------
   350 // Derived from CEikDialog
   371 // Derived from CEikDialog
   351 // ---------------------------------------------------------------------------
   372 // ---------------------------------------------------------------------------
   352 
   373 
   353 // -----------------------------------------------------------------------------
       
   354 // CLocSUPLServerEditor::HandlePointerEventL
       
   355 // -----------------------------------------------------------------------------
       
   356 //  
       
   357 void CLocSUPLServerEditor::HandlePointerEventL(const TPointerEvent &aPointerEvent)
       
   358 	{	
       
   359     DEBUG( +CLocSUPLServerEditor::HandlePointerEventL );
       
   360     CEikEdwin* serverAddress = static_cast<CEikEdwin*> (ControlOrNull(
       
   361             ELocSuplServerIdServerAddr));
       
   362     CEikEdwin* iapEditor = static_cast<CEikEdwin*> (ControlOrNull(
       
   363             ELocSuplServerIdAccessPoint));
       
   364     CAknPopupFieldText* usageInHomeNWPopupFieldText =
       
   365             (CAknPopupFieldText*) Control(ELocSuplServerIdUsageInHomeNw);
       
   366 
       
   367     if (!IsEditable())
       
   368         {
       
   369         CAknForm::HandlePointerEventL(aPointerEvent);
       
   370     
       
   371         if(aPointerEvent.iType == TPointerEvent::EButton1Up)
       
   372             {
       
   373             // Opens the editor on Single Click on any of the controls. Click on rest of the click does not repond
       
   374             if (iapEditor->Rect().Contains(aPointerEvent.iPosition)
       
   375                     || usageInHomeNWPopupFieldText->Rect().Contains(
       
   376                             aPointerEvent.iPosition)
       
   377                     || serverAddress->Rect().Contains(aPointerEvent.iPosition))
       
   378                 {
       
   379                 ProcessCommandL(EAknFormCmdEdit);
       
   380                 }
       
   381             }
       
   382         }
       
   383     else if (IsEditable())
       
   384         {
       
   385         if (usageInHomeNWPopupFieldText )
       
   386             {
       
   387             if (usageInHomeNWPopupFieldText->Rect().Contains(
       
   388                     aPointerEvent.iPosition) )
       
   389                 {
       
   390                 if( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   391                     {
       
   392                       TogglePopupFieldControlL(IdOfFocusControl());
       
   393                       if (iIsNewServer)
       
   394                         {
       
   395                         iIsModified = ETrue;
       
   396                         }
       
   397                     } 
       
   398                 return;
       
   399                 }
       
   400             }
       
   401 
       
   402         CAknForm::HandlePointerEventL(aPointerEvent);
       
   403 
       
   404         //check if click is on IAP Editor control
       
   405         if (iapEditor)
       
   406             {
       
   407             if (iapEditor->Rect().Contains(aPointerEvent.iPosition) &&
       
   408                     aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   409                 {
       
   410                 //Launch IAP Dialog
       
   411                 TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
       
   412                 return;
       
   413                 }
       
   414             }
       
   415         }
       
   416     DEBUG( - CLocSUPLServerEditor::HandlePointerEventL );
       
   417     }
       
   418 
       
   419         
       
   420 // -----------------------------------------------------------------------------
   374 // -----------------------------------------------------------------------------
   421 // CLocSUPLServerEditor::OfferKeyEventL
   375 // CLocSUPLServerEditor::OfferKeyEventL
   422 // Receives and handles key events
   376 // Receives and handles key events
   423 // -----------------------------------------------------------------------------
   377 // -----------------------------------------------------------------------------
   424 //
   378 //
   676         if( apString->Compare( iIap->Des() ) == 0 ) 
   630         if( apString->Compare( iIap->Des() ) == 0 ) 
   677         	{
   631         	{
   678         	iIap->Des().Copy( KNullDesC );
   632         	iIap->Des().Copy( KNullDesC );
   679         	}
   633         	}
   680         delete apString;
   634         delete apString;
   681        	}
   635         }
   682 	
   636 
   683 	//Retrieve Usage In Home Nw Field value
   637     //Retrieve Usage In Home Nw Field value
   684    	CAknPopupFieldText* usageInHomeNWPopupFieldText =
   638     CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control(
   685          	( CAknPopupFieldText* ) Control( ELocSuplServerIdUsageInHomeNw );
   639             ELocSuplServerIdUsageInHomeNw);
   686    	if( usageInHomeNWPopupFieldText )
   640     if (usageInHomeNWPopupFieldText)
   687        	{
   641         {
   688        	if( usageInHomeNWPopupFieldText->CurrentValueIndex() == 0 )
   642         TBuf<KMaxUsageTextSize> des;
   689        		{
   643         usageInHomeNWPopupFieldText->GetText(des);
   690        		iUsageInHomeNw = ETrue;
   644         if (!des.Compare(KNoUsageInHomeNetork))
   691        		}
   645             {
   692        	else
   646             iUsageInHomeNw = ETrue;
   693        		{
   647             }
   694         	iUsageInHomeNw = EFalse;      		
   648         else
   695        		}
   649             {
   696        	}
   650             iUsageInHomeNw = EFalse;
       
   651             }
       
   652         }
   697 
   653 
   698     if( iServerAddress->Length() > 0 )
   654     if( iServerAddress->Length() > 0 )
   699     	{
   655     	{
   700     	retVal = ETrue;
   656     	retVal = ETrue;
   701     	}       	       	    
   657     	}       	       	    
   857        	if( apSelector )
   813        	if( apSelector )
   858             {   
   814             {   
   859             HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE );   
   815             HBufC* apString = StringLoader::LoadL( R_LOC_SERVER_NONE );   
   860             apSelector->SetTextL( apString );
   816             apSelector->SetTextL( apString );
   861             delete apString;
   817             delete apString;
   862             } 
   818             }
   863        	apSelector->DrawNow();
   819         apSelector->DrawNow();
   864         
   820 
       
   821         CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control(
       
   822                 ELocSuplServerIdUsageInHomeNw);
       
   823         if (usageInHNWPopupFieldText)
       
   824             {
       
   825             HBufC* usageString = StringLoader::LoadL(
       
   826                     R_LOC_SERVER_USAGEINHOMENETWORK_YES);
       
   827             usageInHNWPopupFieldText->SetTextL(usageString);
       
   828             delete usageString;
       
   829             }
       
   830         usageInHNWPopupFieldText->DrawNow();
       
   831 
   865         // update the title pane caption
   832         // update the title pane caption
   866        	HBufC* serverTitle = StringLoader::LoadL( R_LOC_SERVER_EDITOR_TITLE ); 
   833        	HBufC* serverTitle = StringLoader::LoadL( R_LOC_SERVER_EDITOR_TITLE ); 
   867        	if( serverTitle )
   834        	if( serverTitle )
   868             {
   835             {
   869         	ChangeTitlePaneTextL( *serverTitle ); 
   836         	ChangeTitlePaneTextL( *serverTitle ); 
   923             	            
   890             	            
   924         	apSelector->DrawNow();
   891         	apSelector->DrawNow();
   925         	iIap->Des().Copy( iapName->Des() );
   892         	iIap->Des().Copy( iapName->Des() );
   926             } 
   893             } 
   927 
   894 
   928         CAknPopupFieldText* usageInHNWPopupFieldText = 
   895         CEikEdwin* usageInHNWPopupFieldText = (CEikEdwin*) Control(
   929         			( CAknPopupFieldText* ) Control( ELocSuplServerIdUsageInHomeNw );
   896                 ELocSuplServerIdUsageInHomeNw);
   930         if( usageInHNWPopupFieldText )
   897         if (usageInHNWPopupFieldText)
   931             {  
   898             {
   932             if( usageInHomeNwFlag  )
   899             if (usageInHomeNwFlag)
   933             	usageInHNWPopupFieldText->SetCurrentValueIndex( 0 );                  	
   900                 SetUsageinHomeNetwork(EFalse);
   934             else
   901             else
   935             	usageInHNWPopupFieldText->SetCurrentValueIndex( 1 );                  	
   902                 SetUsageinHomeNetwork(ETrue);
   936             
   903 
   937             UpdatePageL( ETrue );
   904             UpdatePageL(ETrue);
   938             iUsageInHomeNw = usageInHomeNwFlag;
   905             iUsageInHomeNw = usageInHomeNwFlag;
   939             }            
   906             }            
   940             
   907             
   941 	    delete iapName;
   908 	    delete iapName;
   942 	    delete hslpAddr;	    
   909 	    delete hslpAddr;	    
   969     }     
   936     }     
   970 
   937 
   971 // ---------------------------------------------------------------------------
   938 // ---------------------------------------------------------------------------
   972 // CLocSUPLServerEditor::TogglePopupFieldControlL()
   939 // CLocSUPLServerEditor::TogglePopupFieldControlL()
   973 // it toggles  value of popupfield control
   940 // it toggles  value of popupfield control
       
   941 // This method is no longer in use since TB 9.2
   974 // ---------------------------------------------------------------------------
   942 // ---------------------------------------------------------------------------
   975 //
   943 //
   976 void CLocSUPLServerEditor::TogglePopupFieldControlL( TInt aControlId )
   944 void CLocSUPLServerEditor::TogglePopupFieldControlL( TInt aControlId )
   977     {
   945     {
   978 	DEBUG( + CLocSUPLServerEditor::TogglePopupFieldControlL );
   946 	DEBUG( + CLocSUPLServerEditor::TogglePopupFieldControlL );
  1150             	}
  1118             	}
  1151         	delete address;     			
  1119         	delete address;     			
  1152    			}
  1120    			}
  1153 		}
  1121 		}
  1154 	}
  1122 	}
       
  1123 // ----------------------------------------------------------------------------------
       
  1124 // CLocSUPLServerEditor::HandleDialogPageEventL
       
  1125 // ----------------------------------------------------------------------------------
       
  1126 //
       
  1127 void CLocSUPLServerEditor::HandleDialogPageEventL(TInt aEventID)
       
  1128     {
       
  1129     DEBUG( +CLocSUPLServerEditor::HandleDialogPageEventL );
       
  1130 
       
  1131     CAknForm::HandleDialogPageEventL(aEventID);
       
  1132     CEikEdwin* iapEditor = static_cast<CEikEdwin*> (ControlOrNull(
       
  1133             ELocSuplServerIdAccessPoint));
       
  1134     CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control(
       
  1135             ELocSuplServerIdUsageInHomeNw);
       
  1136     TInt focusControl(IdOfFocusControl());
       
  1137 
       
  1138     if (!IsEditable())
       
  1139         {
       
  1140         if (focusControl == ELocSuplServerIdUsageInHomeNw
       
  1141                 || ELocSuplServerIdServerAddr || ELocSuplServerIdAccessPoint)
       
  1142             {
       
  1143             ProcessCommandL(EAknFormCmdEdit);
       
  1144             }
       
  1145         }
       
  1146     else if (aEventID == MEikDialogPageObserver::EDialogPageTapped)
       
  1147         {
       
  1148         if (focusControl == ELocSuplServerIdUsageInHomeNw)
       
  1149             {
       
  1150             if (usageInHomeNWPopupFieldText)
       
  1151                 {
       
  1152                 TBuf<KMaxUsageTextSize> des;
       
  1153                 usageInHomeNWPopupFieldText->GetText(des);
       
  1154                 if (!des.Compare(KNoUsageInHomeNetork))
       
  1155                     {
       
  1156                     SetUsageinHomeNetwork(ETrue);
       
  1157                     }
       
  1158                 else
       
  1159                     {
       
  1160                     SetUsageinHomeNetwork(EFalse);
       
  1161                     }
       
  1162                 if (iIsNewServer)
       
  1163                     {
       
  1164                     iIsModified = ETrue;
       
  1165                     }
       
  1166                 }
       
  1167             return;
       
  1168             }
       
  1169         if (focusControl == ELocSuplServerIdAccessPoint)
       
  1170             {
       
  1171             if (iapEditor)
       
  1172                 {
       
  1173                 //Launch IAP Dialog
       
  1174                 TRAP_IGNORE( iEngine.LaunchApConfiguratorL( iSlpId, this ) );
       
  1175                 }
       
  1176             }
       
  1177         }DEBUG( -CLocSUPLServerEditor::HandleDialogPageEventL );
       
  1178     }
       
  1179 
       
  1180 // -----------------------------------------------------------------------------
       
  1181 // CLocSUPLServerEditor::SetUsageinHomeNetwork
       
  1182 // Set usage in network field on or off
       
  1183 // -----------------------------------------------------------------------------
       
  1184 //
       
  1185 void CLocSUPLServerEditor::SetUsageinHomeNetwork(TBool aOnOff)
       
  1186     {
       
  1187     HBufC* string;
       
  1188     CEikEdwin* usageInHomeNWPopupFieldText = (CEikEdwin*) Control(
       
  1189             ELocSuplServerIdUsageInHomeNw);
       
  1190     if (aOnOff)
       
  1191         {
       
  1192         // load string 'ON'
       
  1193         string = StringLoader::LoadLC(R_LOC_SERVER_USAGEINHOMENETWORK_YES,
       
  1194                 iCoeEnv);
       
  1195         }
       
  1196     else
       
  1197         {
       
  1198         // load string 'OFF'
       
  1199         string = StringLoader::LoadLC(R_LOC_SERVER_USAGEINHOMENETWORK_NO,
       
  1200                 iCoeEnv);
       
  1201         }
       
  1202     // set Usage in Network field string as 'ON'/'OFF'
       
  1203     usageInHomeNWPopupFieldText->SetTextL(string);
       
  1204     CleanupStack::PopAndDestroy(string);
       
  1205     }
  1155 
  1206 
  1156 // End of file
  1207 // End of file