commsconfig/cscsettingsui/src/cscsettingsuimaincontainer.cpp
branchRCL_3
changeset 31 5886d40bb3de
parent 28 d38647835c2e
child 33 2989b291cac7
--- a/commsconfig/cscsettingsui/src/cscsettingsuimaincontainer.cpp	Tue Sep 14 21:02:05 2010 +0300
+++ b/commsconfig/cscsettingsui/src/cscsettingsuimaincontainer.cpp	Wed Sep 15 12:01:56 2010 +0300
@@ -28,6 +28,7 @@
 #include <csxhelp/voip.hlp.hrh>
 #include <csc.rsg>
 #include <aknnotedialog.h>
+#include <aknnotewrappers.h>
 
 #include "cscconstants.h"
 #include "cscsettingsui.hrh"
@@ -892,18 +893,39 @@
     CleanupStack::PopAndDestroy( string );
     CleanupStack::Pop( query );
     if ( query->RunLD() )
-        {
-        // First check if there is a service plugin UID.
-        TInt count = iModel.ServicePluginHandler().PluginCount( 
-            CCSCEngServicePluginHandler::EInitialized );
+        {  
+        // Checke whether current service is disabled.
+        TBool  disabled = iModel.CCHHandler().IsServiceDisabled( iModel.CurrentSPEntryId() );
+        // The current service is deleted directly if the service is disabled.
+        if ( disabled )
+            {            
+            // First check if there is a service plugin UID.
+            TInt count = iModel.ServicePluginHandler().PluginCount( 
+                    CCSCEngServicePluginHandler::EInitialized );
 
-        TRAPD( err, LaunchCleanupPluginL( iModel.CurrentSPEntryId() ) );
-        if ( KErrNone != err )
+            TRAPD( err, LaunchCleanupPluginL( iModel.CurrentSPEntryId() ) );
+            if ( KErrNone != err )
+                {
+                iModel.SettingsHandler().DeleteServiceL( 
+                        iModel.CurrentSPEntryId() );
+                }
+            isDelete = ETrue;                  
+            }
+        else
             {
-            iModel.SettingsHandler().DeleteServiceL( 
-                iModel.CurrentSPEntryId() );
+            // A note that indicates unable to delete service is shown if the service is enabled.
+            HBufC* string = NULL;
+            string = StringLoader::LoadL( 
+                            R_QTN_CSC_UNABLE_TO_DELETE_NOTE,
+                            iModel.SettingsHandler().ServiceNameL( iModel.CurrentSPEntryId() ) );
+            if ( string )
+                {
+                CleanupStack::PushL( string );   
+                CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
+                note->ExecuteLD( *string );
+                CleanupStack::PopAndDestroy( string );
+                }         
             }
-        isDelete = ETrue;
         }
 
     CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::DeleteServiceL - end" );