omadm/omadmappui/src/NSmlDMDlgProfileView.cpp
branchRCL_3
changeset 29 ebe540617f90
parent 9 db6d61d7814f
child 55 c4687ff85147
equal deleted inserted replaced
25:7f4d10e92162 29:ebe540617f90
    86                                               iProfileId( aProfileId ),
    86                                               iProfileId( aProfileId ),
    87                                               iResourceOffset(KErrNotFound),
    87                                               iResourceOffset(KErrNotFound),
    88                                               iConnUtilResourceOffset(KErrNotFound)
    88                                               iConnUtilResourceOffset(KErrNotFound)
    89 	{
    89 	{
    90 	FLOG( "[OMADM] CNSmlDMDlgProfileView::CNSmlDMDlgProfileView" );
    90 	FLOG( "[OMADM] CNSmlDMDlgProfileView::CNSmlDMDlgProfileView" );
    91 	
       
    92 	}
    91 	}
    93 
    92 
    94 // -----------------------------------------------------------------------------
    93 // -----------------------------------------------------------------------------
    95 // Destructor
    94 // Destructor
    96 // -----------------------------------------------------------------------------
    95 // -----------------------------------------------------------------------------
   124 // CNSmlDMDlgProfileView::OkToExitL
   123 // CNSmlDMDlgProfileView::OkToExitL
   125 // -----------------------------------------------------------------------------
   124 // -----------------------------------------------------------------------------
   126 //
   125 //
   127 TBool CNSmlDMDlgProfileView::OkToExitL( TInt aButtonId )
   126 TBool CNSmlDMDlgProfileView::OkToExitL( TInt aButtonId )
   128 	{
   127 	{
   129 	FLOG( "[OMADM] CNSmlDMDlgProfileView::OkToExitL:" );
   128 	FLOG( "[OMADM] CNSmlDMDlgProfileView::OkToExitL:" );    
   130     
   129 	
       
   130 	
   131     if ( aButtonId == EAknSoftkeyChange )
   131     if ( aButtonId == EAknSoftkeyChange )
   132         {
   132         {
   133     	HandleOKL();
   133     	HandleOKL();
   134     	return EFalse;
   134     	return EFalse;
   135         }
   135         }
   140 		TBool saveProfile = ETrue;
   140 		TBool saveProfile = ETrue;
   141         //TInt index;
   141         //TInt index;
   142 		TInt retValue = CheckMandatoryFieldsL();
   142 		TInt retValue = CheckMandatoryFieldsL();
   143 		if ( retValue != KErrNotFound ) 
   143 		if ( retValue != KErrNotFound ) 
   144 			{
   144 			{
   145 			if ( ShowConfirmationNoteL( R_NSML_SETTINGS_SAVE_ANYWAY ) )
   145             if(CheckUniqueFieldsL()== ENSmlServerId )
   146 				{
   146                 {
   147 				if ( iEditMode == ESmlCopyProfile  )
   147 			    STATIC_CAST( CNSmlDMSyncAppUi*,
   148 					{
   148 			                     iEikonEnv->EikAppUi())->ShowResourceErrorNoteL(R_QTN_DM_CONF_SET_DUP_SERVER_ID );
   149 					iDoc->MoveIndexToProfile( iProfileId );
   149                 closeDlg = EFalse;
   150 			        // This deletes the source profile
   150                 iProfileListBox->SetCurrentItemIndexAndDraw( retValue );
   151 			        //iDoc->DeleteProfile( index );
   151                 saveProfile = EFalse;
   152 			        iDoc->AppEngine()->DeleteProfileL( iProfileId );
   152 			    }			
   153 			        iDoc->MoveIndexToProfile( iOldProfileId );
   153 		  else if(ShowConfirmationNoteL( R_NSML_SETTINGS_SAVE_ANYWAY ))
   154 					}
   154                 {
   155 				else if ( iEditMode == ESmlNewProfile )
   155 			    
   156 				    {
   156                 if ( iEditMode == ESmlCopyProfile  )
   157 				    iDoc->AppEngine()->DeleteProfileL( iProfileId );
   157                     {
   158 				    }
   158                     iDoc->MoveIndexToProfile( iProfileId );
   159 				//For CP stored umcompleted message
   159                     // This deletes the source profile
   160 				else if ( iEditMode == ESmlEditProfile )
   160                     //iDoc->DeleteProfile( index );
   161 				    {
   161                     iDoc->AppEngine()->DeleteProfileL( iProfileId );
   162 				    iDoc->AppEngine()->DeleteProfileL( iProfileId );
   162                     iDoc->MoveIndexToProfile( iOldProfileId );
   163 				    iDoc->RefreshProfileListL();
   163                     }
   164 				    iDoc->MoveIndexToProfile( iProfileId );
   164                 else if ( iEditMode == ESmlNewProfile )
   165 				    }
   165                     {
   166 				//For CP umcompleted message
   166                     iDoc->AppEngine()->DeleteProfileL( iProfileId );
   167 				saveProfile = EFalse;
   167                     }
   168 				}
   168                 //For CP stored umcompleted message
   169 			else
   169                 else if ( iEditMode == ESmlEditProfile )
   170 				{
   170                     {
   171 				closeDlg = EFalse;
   171                     iDoc->AppEngine()->DeleteProfileL( iProfileId );
   172 				iProfileListBox->SetCurrentItemIndexAndDraw( retValue );
   172                     iDoc->RefreshProfileListL();
   173 				saveProfile = EFalse;
   173                     iDoc->MoveIndexToProfile( iProfileId );
   174 				}
   174                     }
   175 			}
   175                 //For CP umcompleted message
       
   176                 saveProfile = EFalse;
       
   177                 }
       
   178             else
       
   179                 {
       
   180                 closeDlg = EFalse;
       
   181                 iProfileListBox->SetCurrentItemIndexAndDraw( retValue );
       
   182                 saveProfile = EFalse;
       
   183                 }
       
   184               
       
   185 			}
       
   186 			
   176 		if ( saveProfile )
   187 		if ( saveProfile )
   177 			{
   188 			{
   178 			SaveProfileL();	
   189 			SaveProfileL();	
   179 			}
   190 			}
   180 		if ( closeDlg )
   191 		if ( closeDlg )
   242 					}
   253 					}
   243 				else if( iEditMode == ESmlEditProfile )	
   254 				else if( iEditMode == ESmlEditProfile )	
   244 					{
   255 					{
   245 					iDoc->AppEngine()->DeleteProfileL( iProfileId );
   256 					iDoc->AppEngine()->DeleteProfileL( iProfileId );
   246 					}
   257 					}
       
   258 				else if ( iEditMode == ESmlNewProfile )
       
   259                     {
       
   260                     iDoc->AppEngine()->DeleteProfileL( iProfileId );
       
   261                     }
   247 				}
   262 				}
   248 			TApaTaskList taskList(CEikonEnv::Static()->WsSession());
   263 			TApaTaskList taskList(CEikonEnv::Static()->WsSession());
   249 	        TApaTask task1(taskList.FindApp( KFotaServerAppUid));
   264 	        TApaTask task1(taskList.FindApp( KFotaServerAppUid));
   250 	        if(task1.Exists())
   265 	        if(task1.Exists())
   251 	        	{
   266 	        	{
   660 		{
   675 		{
   661 		if ( iEditMode != ESmlEditProfile )
   676 		if ( iEditMode != ESmlEditProfile )
   662 			{
   677 			{
   663 			if ( iSyncAppEngine->ServerIdFoundL( item->Value()->Des(),
   678 			if ( iSyncAppEngine->ServerIdFoundL( item->Value()->Des(),
   664 			                                     iProfileId ) )
   679 			                                     iProfileId ) )
   665 				{		
   680 				{			    
   666 				returnValue = ENSmlServerId;
   681 				returnValue = ENSmlServerId;
   667 				}
   682 				}
   668 			}
   683 			}
   669 		else if ( ( iEditMode == ESmlEditProfile ) &&
   684 		else if ( ( iEditMode == ESmlEditProfile ) &&
   670 		          ( item->Value()->Des() != item->iValue ) )
   685 		          ( item->Value()->Des() != item->iValue ) )