phonebookui/Phonebook2/Commands/src/CPbk2AiwInterestItemFactory.cpp
changeset 0 e686773b3f54
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 AIW interest item factory.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CPbk2AiwInterestItemFactory.h"
       
    20 
       
    21 // Phonebook 2
       
    22 #include "MPbk2AiwInterestItem.h"
       
    23 #include "CPbk2AiwInterestItemCall.h"
       
    24 #include "CPbk2AiwInterestItemPoc.h"
       
    25 #include "CPbk2AiwInterestItemSyncMl.h"
       
    26 #include "CPbk2AiwInterestItemOviSync.h"
       
    27 #include "CPbk2AiwInterestItemSindInfoView.h"
       
    28 #include "Pbk2InternalCommands.hrh"
       
    29 #include <CPbk2UIExtensionManager.h>
       
    30 #include <MPbk2UIExtensionFactory.h>
       
    31 
       
    32 // System includes
       
    33 #include <AiwCommon.hrh>
       
    34 
       
    35 
       
    36 // --------------------------------------------------------------------------
       
    37 // CPbk2AiwInterestItemFactory::CPbk2AiwInterestItemFactory
       
    38 // --------------------------------------------------------------------------
       
    39 //
       
    40 CPbk2AiwInterestItemFactory::CPbk2AiwInterestItemFactory
       
    41         ( CAiwServiceHandler& aServiceHandler ) :
       
    42         iServiceHandler( aServiceHandler )
       
    43     {
       
    44     }
       
    45 
       
    46 // --------------------------------------------------------------------------
       
    47 // CPbk2AiwInterestItemFactory::~CPbk2AiwInterestItemFactory
       
    48 // --------------------------------------------------------------------------
       
    49 //
       
    50 CPbk2AiwInterestItemFactory::~CPbk2AiwInterestItemFactory()
       
    51     {
       
    52     Release( iExtensionManager );
       
    53     }
       
    54 
       
    55 // --------------------------------------------------------------------------
       
    56 // CPbk2AiwInterestItemFactory::ConstructL
       
    57 // --------------------------------------------------------------------------
       
    58 //
       
    59 inline void CPbk2AiwInterestItemFactory::ConstructL()
       
    60     {
       
    61     iExtensionManager = CPbk2UIExtensionManager::InstanceL();
       
    62     }
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // CPbk2AiwInterestItemFactory::NewL
       
    66 // --------------------------------------------------------------------------
       
    67 //
       
    68 CPbk2AiwInterestItemFactory* CPbk2AiwInterestItemFactory::NewL
       
    69         ( CAiwServiceHandler& aServiceHandler )
       
    70     {
       
    71     CPbk2AiwInterestItemFactory* self =
       
    72         new ( ELeave ) CPbk2AiwInterestItemFactory( aServiceHandler );
       
    73     CleanupStack::PushL( self );
       
    74     self->ConstructL();
       
    75     CleanupStack::Pop( self );
       
    76     return self;
       
    77     }
       
    78 
       
    79 // --------------------------------------------------------------------------
       
    80 // CPbk2AiwInterestItemFactory::CreateInterestItemL
       
    81 // --------------------------------------------------------------------------
       
    82 //
       
    83 MPbk2AiwInterestItem* CPbk2AiwInterestItemFactory::CreateInterestItemL
       
    84         ( TInt aInterestId )
       
    85     {
       
    86     MPbk2AiwInterestItem* interest = iExtensionManager->FactoryL()->
       
    87             CreatePbk2AiwInterestForIdL( aInterestId, iServiceHandler );
       
    88 
       
    89     if ( !interest )
       
    90         {
       
    91         switch ( aInterestId )
       
    92             {
       
    93             case KAiwCmdCall:
       
    94                 {
       
    95                 interest = CPbk2AiwInterestItemCall::NewL
       
    96                     ( aInterestId, iServiceHandler );
       
    97                 break;
       
    98                 }
       
    99             case KAiwCmdPoC:
       
   100                 {
       
   101                 interest = CPbk2AiwInterestItemPoc::NewL
       
   102                     ( aInterestId, iServiceHandler );
       
   103                 break;
       
   104                 }
       
   105             case KAiwCmdSynchronize:
       
   106                 {
       
   107                 interest = CPbk2AiwInterestItemSyncMl::NewL
       
   108                     ( aInterestId, iServiceHandler );
       
   109                 break;
       
   110                 }
       
   111     
       
   112             case KAiwCmdInfoView:
       
   113                 {
       
   114                 interest = CPbk2AiwInterestItemSindInfoView::NewL
       
   115                     ( aInterestId, iServiceHandler );
       
   116                 break;
       
   117                 }
       
   118             case KOtasAiwCmdSynchronize:
       
   119                 {
       
   120                 interest = CPbk2AiwInterestItemOviSync::NewL
       
   121                     ( aInterestId, iServiceHandler );
       
   122                 break;
       
   123                 }
       
   124             default:
       
   125                 {
       
   126                 break;
       
   127                 }
       
   128             }
       
   129         }
       
   130 
       
   131     return interest;
       
   132     }
       
   133 
       
   134 // End of File