omadm/omadmappui/src/NSmlDMDlgProfileView.cpp
branchRCL_3
changeset 18 ebe540617f90
parent 9 db6d61d7814f
child 23 c4687ff85147
--- a/omadm/omadmappui/src/NSmlDMDlgProfileView.cpp	Tue May 11 16:01:36 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMDlgProfileView.cpp	Wed Jun 09 09:27:55 2010 +0300
@@ -88,7 +88,6 @@
                                               iConnUtilResourceOffset(KErrNotFound)
 	{
 	FLOG( "[OMADM] CNSmlDMDlgProfileView::CNSmlDMDlgProfileView" );
-	
 	}
 
 // -----------------------------------------------------------------------------
@@ -126,8 +125,9 @@
 //
 TBool CNSmlDMDlgProfileView::OkToExitL( TInt aButtonId )
 	{
-	FLOG( "[OMADM] CNSmlDMDlgProfileView::OkToExitL:" );
-    
+	FLOG( "[OMADM] CNSmlDMDlgProfileView::OkToExitL:" );    
+	
+	
     if ( aButtonId == EAknSoftkeyChange )
         {
     	HandleOKL();
@@ -142,37 +142,48 @@
 		TInt retValue = CheckMandatoryFieldsL();
 		if ( retValue != KErrNotFound ) 
 			{
-			if ( ShowConfirmationNoteL( R_NSML_SETTINGS_SAVE_ANYWAY ) )
-				{
-				if ( iEditMode == ESmlCopyProfile  )
-					{
-					iDoc->MoveIndexToProfile( iProfileId );
-			        // This deletes the source profile
-			        //iDoc->DeleteProfile( index );
-			        iDoc->AppEngine()->DeleteProfileL( iProfileId );
-			        iDoc->MoveIndexToProfile( iOldProfileId );
-					}
-				else if ( iEditMode == ESmlNewProfile )
-				    {
-				    iDoc->AppEngine()->DeleteProfileL( iProfileId );
-				    }
-				//For CP stored umcompleted message
-				else if ( iEditMode == ESmlEditProfile )
-				    {
-				    iDoc->AppEngine()->DeleteProfileL( iProfileId );
-				    iDoc->RefreshProfileListL();
-				    iDoc->MoveIndexToProfile( iProfileId );
-				    }
-				//For CP umcompleted message
-				saveProfile = EFalse;
-				}
-			else
-				{
-				closeDlg = EFalse;
-				iProfileListBox->SetCurrentItemIndexAndDraw( retValue );
-				saveProfile = EFalse;
-				}
+            if(CheckUniqueFieldsL()== ENSmlServerId )
+                {
+			    STATIC_CAST( CNSmlDMSyncAppUi*,
+			                     iEikonEnv->EikAppUi())->ShowResourceErrorNoteL(R_QTN_DM_CONF_SET_DUP_SERVER_ID );
+                closeDlg = EFalse;
+                iProfileListBox->SetCurrentItemIndexAndDraw( retValue );
+                saveProfile = EFalse;
+			    }			
+		  else if(ShowConfirmationNoteL( R_NSML_SETTINGS_SAVE_ANYWAY ))
+                {
+			    
+                if ( iEditMode == ESmlCopyProfile  )
+                    {
+                    iDoc->MoveIndexToProfile( iProfileId );
+                    // This deletes the source profile
+                    //iDoc->DeleteProfile( index );
+                    iDoc->AppEngine()->DeleteProfileL( iProfileId );
+                    iDoc->MoveIndexToProfile( iOldProfileId );
+                    }
+                else if ( iEditMode == ESmlNewProfile )
+                    {
+                    iDoc->AppEngine()->DeleteProfileL( iProfileId );
+                    }
+                //For CP stored umcompleted message
+                else if ( iEditMode == ESmlEditProfile )
+                    {
+                    iDoc->AppEngine()->DeleteProfileL( iProfileId );
+                    iDoc->RefreshProfileListL();
+                    iDoc->MoveIndexToProfile( iProfileId );
+                    }
+                //For CP umcompleted message
+                saveProfile = EFalse;
+                }
+            else
+                {
+                closeDlg = EFalse;
+                iProfileListBox->SetCurrentItemIndexAndDraw( retValue );
+                saveProfile = EFalse;
+                }
+              
 			}
+			
 		if ( saveProfile )
 			{
 			SaveProfileL();	
@@ -244,6 +255,10 @@
 					{
 					iDoc->AppEngine()->DeleteProfileL( iProfileId );
 					}
+				else if ( iEditMode == ESmlNewProfile )
+                    {
+                    iDoc->AppEngine()->DeleteProfileL( iProfileId );
+                    }
 				}
 			TApaTaskList taskList(CEikonEnv::Static()->WsSession());
 	        TApaTask task1(taskList.FindApp( KFotaServerAppUid));
@@ -662,7 +677,7 @@
 			{
 			if ( iSyncAppEngine->ServerIdFoundL( item->Value()->Des(),
 			                                     iProfileId ) )
-				{		
+				{			    
 				returnValue = ENSmlServerId;
 				}
 			}