phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp
branchRCL_3
changeset 85 38bb213f60ba
parent 74 6b5524b4f673
equal deleted inserted replaced
74:6b5524b4f673 85:38bb213f60ba
    17 
    17 
    18 #include "cpmapcontacteditorextension.h"
    18 #include "cpmapcontacteditorextension.h"
    19 
    19 
    20 // Phonebook 2
    20 // Phonebook 2
    21 #include <CPbk2UIExtensionPlugin.h>
    21 #include <CPbk2UIExtensionPlugin.h>
    22 #include <pbk2usimuires.rsg>
    22 #include <Pbk2USimUIRes.rsg>
    23 #include <pbk2uicontrols.rsg>
    23 #include <Pbk2UIControls.rsg>
    24 #include <pbk2commonui.rsg>
    24 #include <Pbk2CommonUi.rsg>
    25 #include <Pbk2UIControls.hrh>
    25 #include <Pbk2UIControls.hrh>
    26 #include <MPbk2ContactEditorControl.h>
    26 #include <MPbk2ContactEditorControl.h>
    27 #include <CPbk2StoreProperty.h>
    27 #include <CPbk2StoreProperty.h>
    28 #include <CPbk2StorePropertyArray.h>
    28 #include <CPbk2StorePropertyArray.h>
    29 #include <MPbk2FieldProperty.h>
    29 #include <MPbk2FieldProperty.h>
    50 #include "pbk2mapcommands.hrh"
    50 #include "pbk2mapcommands.hrh"
    51 #include <CPbk2AppUiBase.h>
    51 #include <CPbk2AppUiBase.h>
    52 #include <Pbk2Commands.hrh>
    52 #include <Pbk2Commands.hrh>
    53 #include <MPbk2CommandHandler.h>
    53 #include <MPbk2CommandHandler.h>
    54 #include <MPbk2ApplicationServices.h>
    54 #include <MPbk2ApplicationServices.h>
    55 #include <pbk2mapuires.rsg>
    55 #include <Pbk2MapUIRes.rsg>
    56 #include <pbk2commands.rsg>
    56 #include <Pbk2Commands.rsg>
    57 #include <Pbk2UIControls.hrh>
    57 #include <Pbk2UIControls.hrh>
       
    58 #include <Pbk2UIControls.rsg>
    58 #include <cpmapcontacteditorextension.h>
    59 #include <cpmapcontacteditorextension.h>
    59 #include <CPbk2ContactEditorDlgImpl.h>
    60 #include <CPbk2ContactEditorDlgImpl.h>
    60 
    61 
    61 // System includes
    62 // System includes
    62 #include <etelmmerr.h>
    63 #include <etelmmerr.h>
   111 // CPmapContactEditorExtension::ConstructL
   112 // CPmapContactEditorExtension::ConstructL
   112 // --------------------------------------------------------------------------
   113 // --------------------------------------------------------------------------
   113 //
   114 //
   114 inline void CPmapContactEditorExtension::ConstructL()
   115 inline void CPmapContactEditorExtension::ConstructL()
   115     {
   116     {
   116     iMapCommandFinish = ETrue;
       
   117     }
   117     }
   118 
   118 
   119 // --------------------------------------------------------------------------
   119 // --------------------------------------------------------------------------
   120 // CPmapContactEditorExtension::NewL
   120 // CPmapContactEditorExtension::NewL
   121 // --------------------------------------------------------------------------
   121 // --------------------------------------------------------------------------
   169 // --------------------------------------------------------------------------
   169 // --------------------------------------------------------------------------
   170 //
   170 //
   171 TBool CPmapContactEditorExtension::ProcessCommandL
   171 TBool CPmapContactEditorExtension::ProcessCommandL
   172         ( TInt aCommandId )
   172         ( TInt aCommandId )
   173     {
   173     {
   174     TBool result = EFalse;
       
   175     
       
   176     switch( aCommandId )
   174     switch( aCommandId )
   177         {
   175         {
   178         case EPbk2ExtensionShowOnMap:
   176         case EPbk2ExtensionShowOnMap:
   179             {
   177         	{
   180             // Ignore new command if the previous command is not finished
   178         	if(iCmd)
   181             if ( iMapCommandFinish )
   179         	    {
   182                 {
   180                 delete iCmd;
   183                 if(iCmd)
   181                 iCmd = NULL;
   184                     {
   182         	    }
   185                     delete iCmd;
   183         	iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
   186                     iCmd = NULL;
   184         	// Execute the command 
   187                     }
   185         	iCmd->ExecuteLD();
   188                 iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
   186             return ETrue;
   189                 
       
   190                 // Observer if the Map command is finished
       
   191                 iCmd->AddObserver( *this );
       
   192                 iMapCommandFinish = EFalse;
       
   193                 
       
   194                 // Execute the command 
       
   195                 iCmd->ExecuteLD();
       
   196                 }
       
   197             result = ETrue;
       
   198             break;
       
   199             }
   187             }
   200         case EPbk2ExtensionAssignFromMap:
   188         case EPbk2ExtensionAssignFromMap:
   201             {
   189         	{
   202             // Ignore new command if the previous command is not finished
   190         	if(iCmd)
   203             if ( iMapCommandFinish )
       
   204                 {
   191                 {
   205                 if(iCmd)
   192                 delete iCmd;
   206                     {
   193                 iCmd = NULL;
   207                     delete iCmd;
       
   208                     iCmd = NULL;
       
   209                     }
       
   210                 iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
       
   211                 
       
   212                 // Observer if the Map command is finished
       
   213                 iCmd->AddObserver( *this );
       
   214                 iMapCommandFinish = EFalse;
       
   215                 
       
   216                 // Execute the command
       
   217                 iCmd->ExecuteLD();
       
   218                 }
   194                 }
   219             result = ETrue;
   195         	iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
   220             break;
   196         	// Execute the command
       
   197         	iCmd->ExecuteLD();
       
   198             return ETrue;
   221             }
   199             }
   222         default:
   200         default:
   223             {
   201             {
   224             // Do nothing
   202             // Do nothing
   225             break;
   203             break;
   226             }
   204             }
   227         }
   205         }
   228     return result;
   206     return EFalse;
   229     }
       
   230 
       
   231 // --------------------------------------------------------------------------
       
   232 // CPmapContactEditorExtension::CommandFinished
       
   233 // --------------------------------------------------------------------------
       
   234 //
       
   235 void CPmapContactEditorExtension::CommandFinished(const MPbk2Command& /*aCommand*/)
       
   236     {
       
   237     iMapCommandFinish = ETrue;
       
   238     }
   207     }
   239 
   208 
   240 // --------------------------------------------------------------------------
   209 // --------------------------------------------------------------------------
   241 // CPmapContactEditorExtension::OkToDeleteContactL
   210 // CPmapContactEditorExtension::OkToDeleteContactL
   242 // --------------------------------------------------------------------------
   211 // --------------------------------------------------------------------------