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