uiservicetab/vimpstui/src/cvimpstuiviewmanager.cpp
branchRCL_3
changeset 22 3104fc151679
parent 21 2b7283837edb
child 23 9a48e301e94b
equal deleted inserted replaced
21:2b7283837edb 22:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 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:  Class that provides centralized access for UI classes 
       
    15 *                to logic handling
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <eikenv.h>
       
    22 #include <coeaui.h>
       
    23 
       
    24 #include "cvimpstuiviewmanager.h"
       
    25 #include "cvimpstuiextensionservice.h"
       
    26 #include "cvimpstuiextensionviewinfo.h"
       
    27 #include "cvimpstuiextensionfactory.h"
       
    28 #include "cvimpstuimenuextension.h"
       
    29 #include "uiservicetabtracer.h"
       
    30 
       
    31 
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CVIMPSTUIViewManager::CVIMPSTUIViewManager
       
    37 // ---------------------------------------------------------------------------
       
    38 // 
       
    39 CVIMPSTUIViewManager::CVIMPSTUIViewManager(
       
    40     const TDesC& aServiceName,
       
    41     CVIMPSTUiExtensionFactory& aExtensionFactory ):
       
    42     iServiceName( aServiceName ),
       
    43     iExtensionFactory( aExtensionFactory )
       
    44     {
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CVIMPSTUIViewManager::ConstructL
       
    49 // ---------------------------------------------------------------------------
       
    50 // 
       
    51 void CVIMPSTUIViewManager::ConstructL()
       
    52     {
       
    53     
       
    54     iEikEnv = CEikonEnv::Static();        
       
    55         
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CVIMPSTUIViewManager::NewL
       
    60 // ---------------------------------------------------------------------------
       
    61 // 
       
    62 CVIMPSTUIViewManager* CVIMPSTUIViewManager::NewL(
       
    63     const TDesC& aSpsHandler,
       
    64     CVIMPSTUiExtensionFactory& aExtensionFactory )
       
    65     {    
       
    66     CVIMPSTUIViewManager* self = NewLC( aSpsHandler,
       
    67         aExtensionFactory );
       
    68     CleanupStack::Pop(self);
       
    69     return self;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CVIMPSTUIViewManager::NewLC
       
    74 // ---------------------------------------------------------------------------
       
    75 // 
       
    76 CVIMPSTUIViewManager* CVIMPSTUIViewManager::NewLC(
       
    77     const TDesC& aSpsHandler,
       
    78     CVIMPSTUiExtensionFactory& aExtensionFactory )
       
    79     {
       
    80     CVIMPSTUIViewManager* self =
       
    81         new (ELeave) CVIMPSTUIViewManager( aSpsHandler,aExtensionFactory );
       
    82     CleanupStack::PushL( self );
       
    83     self->ConstructL();
       
    84     return self;
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CVIMPSTUIViewManager::~CVIMPSTUIViewManager
       
    89 // ---------------------------------------------------------------------------
       
    90 // 
       
    91 CVIMPSTUIViewManager::~CVIMPSTUIViewManager()
       
    92     {   
       
    93     
       
    94     iViewInfos.Reset();
       
    95     iViewInfos.Close();
       
    96     
       
    97    
       
    98     iServices.ResetAndDestroy();
       
    99     iServices.Close();       
       
   100     
       
   101     }
       
   102     
       
   103     
       
   104 // ---------------------------------------------------------------------------
       
   105 // CVIMPSTUIViewManager::AddNewClientL
       
   106 // ---------------------------------------------------------------------------
       
   107 // 
       
   108 void CVIMPSTUIViewManager::AddNewClientL( TUint aServiceId, MVIMPSTEngine& aEngine,
       
   109     TInt aTabbedViewId,TInt aSearchViewId,TInt aBlockedViewId ,CVIMPSTUIMenuExtension& aMenuExtension )
       
   110     {    
       
   111     
       
   112 	TRACER_AUTO;
       
   113     CVIMPSTUIExtensionService* service =
       
   114         CVIMPSTUIExtensionService::NewL( 
       
   115             aServiceId,
       
   116             aTabbedViewId,
       
   117             aSearchViewId,
       
   118             aBlockedViewId,
       
   119             aEngine.ServiceName(),   
       
   120             aMenuExtension,
       
   121             aEngine
       
   122              );
       
   123     iServices.Append( service );
       
   124 
       
   125     iViewInfos.Append( service->TabbedViewInfoL() );         
       
   126     iViewInfos.Append( service->SearchViewInfo() );   
       
   127     iViewInfos.Append( service->BlockedViewInfo() ); 
       
   128     }    
       
   129     
       
   130     
       
   131   
       
   132 // ---------------------------------------------------------------------------
       
   133 // CVIMPSTUIViewManager::EikEnv()
       
   134 // ---------------------------------------------------------------------------
       
   135 //  
       
   136 CEikonEnv& CVIMPSTUIViewManager::EikEnv()
       
   137     {
       
   138     return *iEikEnv;
       
   139     }    
       
   140 
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CVIMPSTUIViewManager::ViewInfoCount()
       
   144 // ---------------------------------------------------------------------------
       
   145 //  
       
   146 TInt CVIMPSTUIViewManager::ViewInfoCount() const 
       
   147     {
       
   148     return iViewInfos.Count();
       
   149     } 
       
   150     
       
   151 // ---------------------------------------------------------------------------
       
   152 // CVIMPSTUIViewManager::ViewInfo()
       
   153 // ---------------------------------------------------------------------------
       
   154 //  
       
   155 const MxSPViewInfo* CVIMPSTUIViewManager::ViewInfo( 
       
   156     TInt aIndex ) const 
       
   157     {
       
   158     return static_cast<MxSPViewInfo*>( iViewInfos[ aIndex ] );    
       
   159     }    
       
   160     
       
   161 // ---------------------------------------------------------------------------
       
   162 // CVIMPSTUIViewManager::ServiceCount()
       
   163 // ---------------------------------------------------------------------------
       
   164 
       
   165 TInt CVIMPSTUIViewManager::ServiceCount() const 
       
   166     {
       
   167     return iServices.Count();    
       
   168     }    
       
   169 
       
   170 // ---------------------------------------------------------------------------
       
   171 // CVIMPSTUIViewManager::ServiceCount()
       
   172 // ---------------------------------------------------------------------------
       
   173 //  
       
   174 CVIMPSTUIExtensionService& CVIMPSTUIViewManager::Service( 
       
   175     TInt aIndex ) const 
       
   176     {
       
   177     return *iServices[ aIndex ];    
       
   178     }    
       
   179 
       
   180 
       
   181 
       
   182 // End of file