Revision: 201033 RCL_3 PDK_3.0.3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 22:16:31 +0300
branchRCL_3
changeset 24 002ade1da91c
parent 23 d51193d814ea
Revision: 201033 Kit: 201035
messagingfw/alwaysonline/AlwaysOnlineManager/inc/AlwaysOnlineManager.h
messagingfw/alwaysonline/AlwaysOnlineManager/src/AlwaysOnlineManager.cpp
--- a/messagingfw/alwaysonline/AlwaysOnlineManager/inc/AlwaysOnlineManager.h	Wed Sep 01 12:27:27 2010 +0100
+++ b/messagingfw/alwaysonline/AlwaysOnlineManager/inc/AlwaysOnlineManager.h	Tue Sep 14 22:16:31 2010 +0300
@@ -248,18 +248,21 @@
         void HandleStopPluginL( const TDes8& aParameter );
 
         /**
-        * Handles stopping of plugin with given UID.
+        * Handles stopping of plugin with given implementation UID.
         * @since Series60 3.1
-        * @param aPlugin, UID of plugin
+        * @param aPluginImplementationUid, implementation UID of plugin 
+        *        (implementation_uid in .rss). 
+        *        NOTE: There can be multiple instances of same plugin 
+        *        implementation.
         */
-        void StopPluginL( const TUid& aPlugin );
+        void StopPluginL( const TUid& aPluginImplementationUid );
 
         /**
-        * Unloads the plugin with given UID and sets it as disabled.
+        * Unloads the plugin with given instance UID and sets it as disabled.
         * @since Series60 3.1
-        * @param aPlugin, UID of plugin
+        * @param aPluginInstanceUid, UID of plugin instance
         */
-        void DisablePlugin( const TUid& aPlugin );
+        void DisablePlugin( const TUid& aPluginInstanceUid );
 
         /**
         * Handles the final progress of an operation.
--- a/messagingfw/alwaysonline/AlwaysOnlineManager/src/AlwaysOnlineManager.cpp	Wed Sep 01 12:27:27 2010 +0100
+++ b/messagingfw/alwaysonline/AlwaysOnlineManager/src/AlwaysOnlineManager.cpp	Tue Sep 14 22:16:31 2010 +0300
@@ -789,7 +789,7 @@
         {
         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : plugin: 0x%x", id);
         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : command: %d", command);
-        KAOMANAGER_LOGGER_WRITE_FORMAT8("CAlwaysOnlineManager::HandleOpCompletionL() : result: %S", &result);
+        KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : result: %S", &result);
         
         switch ( static_cast<TManagerServerCommands>( command ) )
             {
@@ -954,32 +954,29 @@
 // CAlwaysOnlineManager::StopPluginL
 // ----------------------------------------------------------------------------
 //
-void CAlwaysOnlineManager::StopPluginL(
-    const TUid& aPlugin )
+void CAlwaysOnlineManager::StopPluginL( const TUid& aPluginImplementationUid )
     {
     KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::StopPluginL");
     
     // Find the plugin and send stop command.
-    if ( iPluginArray->Count() )
+    for ( TInt i = 0; i < iPluginArray->Count(); i++ )
         {
-        // Get correct plugin from 
-        for ( TInt i = 0; i < iPluginArray->Count(); i++ )
-            {
-            TUid id = ( iPluginArray->At( i ) )->InstanceUid();
+        TUid id = ( iPluginArray->At( i ) )->InstanceUid();
 
-            // Is it this plugin?                
-            if ( id == aPlugin )
-                {
-                KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::StopPluginL() Calling stop to plugin: 0x%x", aPlugin);
-                TBuf8<1> dummyParam;
-                InvokeCommandHandlerL( 
-                    static_cast<TManagerServerCommands>( EAOManagerPluginStop ), 
-                    dummyParam, 
-                    i );    
-                }
+        // Stop plugin if it has matching implemention UID.
+        // Will stop all plugin instances with matching implementation.
+        if ( REComSession::GetImplementationUidL(id) == aPluginImplementationUid )
+            {
+            KAOMANAGER_LOGGER_WRITE_FORMAT(
+                "CAlwaysOnlineManager::StopPluginL() Calling stop to plugin: 0x%x", 
+                id );
+            TBuf8<1> dummyParam;
+            InvokeCommandHandlerL( 
+                static_cast<TManagerServerCommands>( EAOManagerPluginStop ), 
+                dummyParam, 
+                i );    
             }
         }
-        
     KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::StopPluginL");
     }
 
@@ -987,35 +984,33 @@
 // CAlwaysOnlineManager::DisablePlugin
 // ----------------------------------------------------------------------------
 //
-void CAlwaysOnlineManager::DisablePlugin( const TUid& aPlugin )
+void CAlwaysOnlineManager::DisablePlugin( const TUid& aPluginInstanceUid )
     {
     KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::DisablePlugin");
     
     // Delete the plugin and mark it disabled.
-    if ( iPluginArray->Count() )
+    for ( TInt i = 0; i < iPluginArray->Count(); i++ )
         {
-        // Get correct plugin from 
-        for ( TInt i = 0; i < iPluginArray->Count(); i++ )
+        TUid id = ( iPluginArray->At( i ) )->InstanceUid();
+        
+        // Delete plugin if it has matching instance UID.
+        if ( id == aPluginInstanceUid )
             {
-            TUid id = ( iPluginArray->At( i ) )->InstanceUid();
-            
-            // Is it this plugin?
-            if ( id == aPlugin )
-                {
-                KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::DisablePlugin() Deleting plugin from array: 0x%x", aPlugin);
-                // Delete object
-                delete iPluginArray->At( i );
-                // Delete element
-                iPluginArray->Delete( i );
-                }
+            KAOMANAGER_LOGGER_WRITE_FORMAT(
+                "CAlwaysOnlineManager::DisablePlugin() Deleting plugin from array: 0x%x", 
+                aPluginInstanceUid);
+            // Delete object
+            delete iPluginArray->At( i );
+            // Delete element
+            iPluginArray->Delete( i );
             }
-            // Set this plugin as disabled.
-            iCenRepControl->SetPluginStatus( aPlugin, ETrue );
-            
-            // Refresh the list of disabled plugins UIDs.
-            iCenRepControl->UpdateDisabledPluginsUids( 
-                *iDisabledPluginUidsArray );
         }
+    // Set this plugin as disabled.
+    iCenRepControl->SetPluginStatus( aPluginInstanceUid, ETrue );
+    
+    // Refresh the list of disabled plugins UIDs.
+    iCenRepControl->UpdateDisabledPluginsUids( *iDisabledPluginUidsArray );
+    
     
     KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::DisablePlugin");
     }