phonebookui/Phonebook2/UIControls/src/Pbk2ContactEditorStrategyFactory.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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:  A factory for creating contact editor strategy
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "Pbk2ContactEditorStrategyFactory.h"
       
    22 
       
    23 #include <TPbk2ContactEditorParams.h>
       
    24 #include "CPbk2ContactEditorNewContact.h"
       
    25 #include "CPbk2ContactEditorEditContact.h"
       
    26 #include "cpbk2contacteditornewowncontact.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ============================
       
    29 
       
    30 // --------------------------------------------------------------------------
       
    31 // Pbk2ContactEditorStrategyFactory::CreateL
       
    32 // Creates a strategy according the editor flags. Creating new contact has
       
    33 // a different startegy than editing contact
       
    34 // --------------------------------------------------------------------------
       
    35 //
       
    36 MPbk2ContactEditorStrategy* Pbk2ContactEditorStrategyFactory::CreateL(
       
    37     TPbk2ContactEditorParams& aParams, CPbk2PresentationContact* aContact)
       
    38     {
       
    39     if (aParams.iFlags & TPbk2ContactEditorParams::ENewContact)
       
    40         {
       
    41         if( aParams.iFlags & TPbk2ContactEditorParams::EOwnContact )
       
    42             {
       
    43             return CPbk2ContactEditorNewOwnContact::NewL( aParams, aContact );
       
    44             }
       
    45         return CPbk2ContactEditorNewContact::NewL(aParams, aContact);
       
    46         }
       
    47     return CPbk2ContactEditorEditContact::NewL(aParams, aContact);
       
    48     }
       
    49 
       
    50 //  End of File