phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp
changeset 0 e686773b3f54
child 9 0d28c1c5b6dd
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Phonebook 2 contact editor dialog extension.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cpmapcontacteditorextension.h"
       
    19 
       
    20 // Phonebook 2
       
    21 #include <CPbk2UIExtensionPlugin.h>
       
    22 #include <Pbk2USimUIRes.rsg>
       
    23 #include <Pbk2UIControls.rsg>
       
    24 #include <Pbk2CommonUi.rsg>
       
    25 #include <Pbk2UIControls.hrh>
       
    26 #include <MPbk2ContactEditorControl.h>
       
    27 #include <CPbk2StoreProperty.h>
       
    28 #include <CPbk2StorePropertyArray.h>
       
    29 #include <MPbk2FieldProperty.h>
       
    30 #include <CPbk2FieldPropertyArray.h>
       
    31 #include <MPbk2ApplicationServices.h>
       
    32 #include <MPbk2AppUi.h>
       
    33 #include "CPbk2ContactEditorUIAFMField.h"
       
    34 #include <MPbk2UIField.h>
       
    35 #include <CPbk2IconInfoContainer.h>
       
    36 
       
    37 // Virtual Phonebook
       
    38 #include <MVPbkStoreContact.h>
       
    39 #include <MVPbkContactStore.h>
       
    40 #include <MVPbkContactStoreProperties.h>
       
    41 #include <TVPbkContactStoreUriPtr.h>
       
    42 #include <VPbkContactStoreUris.h>
       
    43 #include <MVPbkFieldType.h>
       
    44 #include <CVPbkFieldTypeSelector.h>
       
    45 #include <CVPbkContactManager.h>
       
    46 #include <MVPbkStoreContactField.h>
       
    47 #include <MVPbkStoreContactFieldCollection.h>
       
    48 #include <MVPbkContactFieldTextData.h>
       
    49 #include "cpmapcmd.h"
       
    50 #include "pbk2mapcommands.hrh"
       
    51 #include <CPbk2AppUiBase.h>
       
    52 #include <Pbk2Commands.hrh>
       
    53 #include <MPbk2CommandHandler.h>
       
    54 #include <MPbk2ApplicationServices.h>
       
    55 #include <Pbk2MapUIRes.rsg>
       
    56 #include <Pbk2Commands.rsg>
       
    57 #include <Pbk2UIControls.hrh>
       
    58 #include <Pbk2UIControls.rsg>
       
    59 #include <cpmapcontacteditorextension.h>
       
    60 #include <CPbk2ContactEditorDlgImpl.h>
       
    61 
       
    62 // System includes
       
    63 #include <etelmmerr.h>
       
    64 #include <gsmerror.h>
       
    65 #include <exterror.h>
       
    66 #include <eikmenub.h>
       
    67 #include <StringLoader.h>
       
    68 #include <aknnotewrappers.h>
       
    69 #include <barsread.h>
       
    70 #include <eikbtgpc.h>
       
    71 #include <charconv.h>
       
    72 #include <AiwCommon.hrh>
       
    73 #include <AiwServiceHandler.h>
       
    74 #include <mnproviderfinder.h>
       
    75 
       
    76 // Debugging headers
       
    77 #include <Pbk2Debug.h>
       
    78 
       
    79 /// Unnamed namespace for local definitions
       
    80 namespace {
       
    81 
       
    82 } /// namespace
       
    83 
       
    84 // --------------------------------------------------------------------------
       
    85 // CPmapContactEditorExtension::CPmapContactEditorExtension
       
    86 // --------------------------------------------------------------------------
       
    87 //
       
    88 CPmapContactEditorExtension::CPmapContactEditorExtension
       
    89         ( CVPbkContactManager& aContactManager,
       
    90           MVPbkStoreContact& aContact,
       
    91           MPbk2ContactEditorControl& aEditorControl ) :
       
    92             iContactManager( aContactManager ),
       
    93             iContact( aContact ),
       
    94             iEditorControl( aEditorControl )
       
    95     {
       
    96     }
       
    97 
       
    98 // --------------------------------------------------------------------------
       
    99 // CPmapContactEditorExtension::~CPmapContactEditorExtension
       
   100 // --------------------------------------------------------------------------
       
   101 //
       
   102 CPmapContactEditorExtension::~CPmapContactEditorExtension()
       
   103     {
       
   104     }
       
   105 
       
   106 // --------------------------------------------------------------------------
       
   107 // CPmapContactEditorExtension::ConstructL
       
   108 // --------------------------------------------------------------------------
       
   109 //
       
   110 inline void CPmapContactEditorExtension::ConstructL()
       
   111     {
       
   112     }
       
   113 
       
   114 // --------------------------------------------------------------------------
       
   115 // CPmapContactEditorExtension::NewL
       
   116 // --------------------------------------------------------------------------
       
   117 //
       
   118 CPmapContactEditorExtension* CPmapContactEditorExtension::NewL
       
   119         ( CVPbkContactManager& aContactManager,
       
   120           MVPbkStoreContact& aContact,
       
   121           MPbk2ContactEditorControl& aEditorControl )
       
   122     {
       
   123     CPmapContactEditorExtension* self =
       
   124         new (ELeave) CPmapContactEditorExtension
       
   125             (aContactManager, aContact, aEditorControl);
       
   126     CleanupStack::PushL(self);
       
   127     self->ConstructL();
       
   128     CleanupStack::Pop(self);
       
   129     return self;
       
   130     }
       
   131 
       
   132 // --------------------------------------------------------------------------
       
   133 // CPmapContactEditorExtension::CreateEditorFieldL
       
   134 // --------------------------------------------------------------------------
       
   135 //
       
   136 MPbk2ContactEditorField* CPmapContactEditorExtension::CreateEditorFieldL
       
   137     ( MVPbkStoreContactField& /*aField*/,
       
   138       const MPbk2FieldProperty& /*aFieldProperty*/,
       
   139       MPbk2ContactEditorUiBuilder& /*aUiBuilder*/,
       
   140       CPbk2IconInfoContainer& /*aIconInfoContainer*/ )
       
   141     {
       
   142     MPbk2ContactEditorField* field = NULL;
       
   143     return field;
       
   144     }
       
   145 
       
   146 // --------------------------------------------------------------------------
       
   147 // CPmapContactEditorExtension::DynInitMenuPaneL
       
   148 // --------------------------------------------------------------------------
       
   149 //
       
   150 void CPmapContactEditorExtension::DynInitMenuPaneL
       
   151         ( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   152     {
       
   153     if ( aResourceId == R_PBK2_CONTACTEDITOR_MENUPANE )
       
   154     	{
       
   155     	if ( CPmapCmd::CheckViewProviderL() )
       
   156     		{
       
   157     		aMenuPane->SetItemDimmed( EPbk2ExtensionAssignFromMap, EFalse );
       
   158     		aMenuPane->SetItemDimmed( EPbk2ExtensionAssignFromMapSelect, EFalse );
       
   159     		}
       
   160     	}
       
   161     }
       
   162 
       
   163 // --------------------------------------------------------------------------
       
   164 // CPmapContactEditorExtension::ProcessCommandL
       
   165 // --------------------------------------------------------------------------
       
   166 //
       
   167 TBool CPmapContactEditorExtension::ProcessCommandL
       
   168         ( TInt aCommandId )
       
   169     {
       
   170     switch( aCommandId )
       
   171         {
       
   172         case EPbk2ExtensionShowOnMap:
       
   173         	{
       
   174         	MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
       
   175         	// Execute the command
       
   176         	cmd->ExecuteLD();
       
   177             return ETrue;
       
   178             }
       
   179         case EPbk2ExtensionAssignFromMap:
       
   180         case EPbk2ExtensionAssignFromMapSelect:
       
   181         	{
       
   182         	MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
       
   183         	// Execute the command
       
   184         	cmd->ExecuteLD();
       
   185             return ETrue;
       
   186             }
       
   187         default:
       
   188             {
       
   189             // Do nothing
       
   190             break;
       
   191             }
       
   192         }
       
   193     return EFalse;
       
   194     }
       
   195 
       
   196 // --------------------------------------------------------------------------
       
   197 // CPmapContactEditorExtension::OkToDeleteContactL
       
   198 // --------------------------------------------------------------------------
       
   199 //
       
   200 TBool CPmapContactEditorExtension::OkToDeleteContactL
       
   201         ( MPbk2ContactEditorEventObserver::TParams& /*aParams*/ )
       
   202     {
       
   203     return ETrue;
       
   204     }
       
   205 
       
   206 // --------------------------------------------------------------------------
       
   207 // CPmapContactEditorExtension::OkToSaveContactL
       
   208 // --------------------------------------------------------------------------
       
   209 //
       
   210 TBool CPmapContactEditorExtension::OkToSaveContactL
       
   211         ( MPbk2ContactEditorEventObserver::TParams& /*aParams*/ )
       
   212     {
       
   213     return ETrue;
       
   214     }
       
   215 
       
   216 // --------------------------------------------------------------------------
       
   217 // CPmapContactEditorExtension::ModifyButtonGroupContainerL
       
   218 // --------------------------------------------------------------------------
       
   219 //
       
   220 void CPmapContactEditorExtension::ModifyButtonGroupContainerL
       
   221         ( CEikButtonGroupContainer& /*aButtonGroupContainer*/ )
       
   222 	{
       
   223 	}
       
   224 
       
   225 // --------------------------------------------------------------------------
       
   226 // CPmapContactEditorExtension::DoRelease
       
   227 // --------------------------------------------------------------------------
       
   228 //
       
   229 void CPmapContactEditorExtension::DoRelease()
       
   230     {
       
   231     delete this;
       
   232     }
       
   233 
       
   234 // --------------------------------------------------------------------------
       
   235 // CPmapContactEditorExtension::ContactEditorOperationCompleted
       
   236 // --------------------------------------------------------------------------
       
   237 //
       
   238 void CPmapContactEditorExtension::ContactEditorOperationCompleted
       
   239         ( MVPbkContactObserver::TContactOpResult /*aResult*/,
       
   240           TParams /*aParams*/ )
       
   241     {
       
   242     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   243         ("CPmapContactEditorExtension::ContactEditorOperationCompleted"));
       
   244 
       
   245     // Do nothing
       
   246     }
       
   247 
       
   248 // --------------------------------------------------------------------------
       
   249 // CPmapContactEditorExtension::ContactEditorOperationFailed
       
   250 // --------------------------------------------------------------------------
       
   251 //
       
   252 void CPmapContactEditorExtension::ContactEditorOperationFailed
       
   253         ( MVPbkContactObserver::TContactOp /*aOpCode*/,
       
   254           TInt aErrorCode, TParams /*aParams*/, TFailParams& /*aFailParams*/ )
       
   255     {
       
   256     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   257         ("CPmapContactEditorExtension::ContactEditorOperationFailed code: %d"),
       
   258         aErrorCode);
       
   259     }
       
   260 
       
   261 // --------------------------------------------------------------------------
       
   262 // CPmapContactEditorExtension::ContactEditorExtensionExtension
       
   263 // --------------------------------------------------------------------------
       
   264 //
       
   265 TAny* CPmapContactEditorExtension::ContactEditorExtensionExtension(
       
   266         TUid /*aExtensionUid*/ )
       
   267     {
       
   268     return static_cast<MPbk2ContactEditorExtensionExtension*>(this);
       
   269     }
       
   270 
       
   271 // --------------------------------------------------------------------------
       
   272 // CPmapContactEditorExtension::CreateFieldL
       
   273 // --------------------------------------------------------------------------
       
   274 //
       
   275 MPbk2ContactEditorUIField* CPmapContactEditorExtension::CreateFieldLC
       
   276         ( MPbk2UIField& aField,
       
   277           TInt aCustomPosition, 
       
   278           MPbk2ContactEditorUiBuilder& aUiBuilder,
       
   279           const TDesC& /*aCustomText*/, CPbk2IconInfoContainer& aIconInfoContainer )
       
   280     {
       
   281     MPbk2ContactEditorUIField* field = NULL;
       
   282 
       
   283 	 switch(aField.CtrlType())
       
   284 		{
       
   285 		case EPbk2FieldCtrlTypeExtAssignFromMapsEditor:
       
   286 			if( CPmapCmd::CheckViewProviderL() )
       
   287 				{
       
   288 				field = CPbk2ContactEditorUIAFMField::NewL(
       
   289 					&aField, aUiBuilder, aIconInfoContainer, aCustomPosition);
       
   290 				CleanupStack::PushL(field);
       
   291 				}
       
   292 			break;
       
   293 		}
       
   294 
       
   295     return field;
       
   296     }
       
   297 // End of File