phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp
branchRCL_3
changeset 74 6b5524b4f673
parent 68 9da50d567e3c
child 85 38bb213f60ba
--- a/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp	Tue Sep 14 20:54:53 2010 +0300
+++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp	Wed Sep 15 11:56:55 2010 +0300
@@ -113,6 +113,7 @@
 //
 inline void CPmapContactEditorExtension::ConstructL()
     {
+    iMapCommandFinish = ETrue;
     }
 
 // --------------------------------------------------------------------------
@@ -170,31 +171,53 @@
 TBool CPmapContactEditorExtension::ProcessCommandL
         ( TInt aCommandId )
     {
+    TBool result = EFalse;
+    
     switch( aCommandId )
         {
         case EPbk2ExtensionShowOnMap:
-        	{
-        	if(iCmd)
-        	    {
-                delete iCmd;
-                iCmd = NULL;
-        	    }
-        	iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
-        	// Execute the command 
-        	iCmd->ExecuteLD();
-            return ETrue;
+            {
+            // Ignore new command if the previous command is not finished
+            if ( iMapCommandFinish )
+                {
+                if(iCmd)
+                    {
+                    delete iCmd;
+                    iCmd = NULL;
+                    }
+                iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
+                
+                // Observer if the Map command is finished
+                iCmd->AddObserver( *this );
+                iMapCommandFinish = EFalse;
+                
+                // Execute the command 
+                iCmd->ExecuteLD();
+                }
+            result = ETrue;
+            break;
             }
         case EPbk2ExtensionAssignFromMap:
-        	{
-        	if(iCmd)
+            {
+            // Ignore new command if the previous command is not finished
+            if ( iMapCommandFinish )
                 {
-                delete iCmd;
-                iCmd = NULL;
+                if(iCmd)
+                    {
+                    delete iCmd;
+                    iCmd = NULL;
+                    }
+                iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
+                
+                // Observer if the Map command is finished
+                iCmd->AddObserver( *this );
+                iMapCommandFinish = EFalse;
+                
+                // Execute the command
+                iCmd->ExecuteLD();
                 }
-        	iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
-        	// Execute the command
-        	iCmd->ExecuteLD();
-            return ETrue;
+            result = ETrue;
+            break;
             }
         default:
             {
@@ -202,7 +225,16 @@
             break;
             }
         }
-    return EFalse;
+    return result;
+    }
+
+// --------------------------------------------------------------------------
+// CPmapContactEditorExtension::CommandFinished
+// --------------------------------------------------------------------------
+//
+void CPmapContactEditorExtension::CommandFinished(const MPbk2Command& /*aCommand*/)
+    {
+    iMapCommandFinish = ETrue;
     }
 
 // --------------------------------------------------------------------------