pkiutilities/SecModUI/src/SecModUIContainerBase.cpp
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:   Implementation of the CSecModUIContainerBase class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "SecModUIContainerBase.h"
       
    21 #include "SecModUIModel.h"
       
    22 #include "SecModUILogger.h"
       
    23 #include <SecModUI.rsg>
       
    24 #include <aknlists.h>
       
    25 #include <barsread.h>
       
    26 #include <StringLoader.h>
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 CSecModUIContainerBase::CSecModUIContainerBase(
       
    30     CSecModUIModel& aModel,
       
    31     const TDesC& aContextName)
       
    32     :iModel(aModel), iContextName(aContextName)
       
    33     {
       
    34     LOG_WRITE( "CSecModUIContainerBase::CSecModUIContainerBase" );
       
    35 	}
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CSecModUIContainerBase::ConstructL(const TRect& aRect)
       
    39 // EPOC two phased constructor
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 void CSecModUIContainerBase::ConstructL(const TRect& aRect)
       
    43     {
       
    44     CreateWindowL();
       
    45     CreateListL();
       
    46     SetupListItemsL();
       
    47     SetRect(aRect);
       
    48     }
       
    49 
       
    50 // Destructor
       
    51 CSecModUIContainerBase::~CSecModUIContainerBase()
       
    52     {
       
    53     LOG_ENTERFN("CSecModUIContainerBase::~CSecModUIContainerBase()");              
       
    54     delete iListBox;
       
    55     LOG_LEAVEFN("CSecModUIContainerBase::~CSecModUIContainerBase()");
       
    56 	}
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CSecModUIContainerBase::ConstructListL()
       
    60 // Constructs listbox
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 void CSecModUIContainerBase::ConstructListL()	
       
    64     {
       
    65     LOG_ENTERFN("CSecModUIContainerBase::ConstructListL()");   
       
    66     iListBox = new (ELeave) CAknSingleStyleListBox();
       
    67     LOG_LEAVEFN("CSecModUIContainerBase::ConstructListL()");    
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------
       
    71 // CSecModUIContainerBase::ListBox()
       
    72 // 
       
    73 // ---------------------------------------------------------
       
    74 //
       
    75 CEikTextListBox& CSecModUIContainerBase::ListBox()
       
    76     {
       
    77     return *iListBox;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------
       
    81 // CSecModUIContainerBase::CreateResourceReaderLC(
       
    82 //  TResourceReader& aReader)
       
    83 // 
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 void CSecModUIContainerBase::CreateResourceReaderLC(TResourceReader& aReader)	
       
    87     {
       
    88     LOG_ENTERFN("CSecModUIContainerBase::CreateResourceReaderLC()");   
       
    89     iEikonEnv->CreateResourceReaderLC(aReader, R_SECMODUI_DYNAMIC_LISTBOX);
       
    90     LOG_LEAVEFN("CSecModUIContainerBase::CreateResourceReaderLC()");    
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------
       
    94 // CSecModUIContainerBase::CreateListL()
       
    95 // Constructs listbox from resource
       
    96 // ---------------------------------------------------------
       
    97 //	
       
    98 void CSecModUIContainerBase::CreateListL()
       
    99     {
       
   100     LOG_ENTERFN("CSecModUIContainerBase::CreateListL()");   
       
   101     ConstructListL();
       
   102     __ASSERT_ALWAYS(iListBox, Panic(EPanicNullPointer));
       
   103     iListBox->SetContainerWindowL(*this);
       
   104     
       
   105     iListBox->CreateScrollBarFrameL(ETrue);
       
   106 	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   107 	    CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
       
   108     
       
   109     TResourceReader reader;
       
   110     
       
   111     CreateResourceReaderLC(reader);
       
   112     iListBox->ConstructFromResourceL(reader);
       
   113     CleanupStack::PopAndDestroy(); // reader
       
   114     
       
   115     HBufC* stringHolder = StringLoader::LoadLC(R_TEXT_RESOURCE_VIEW_EMPTY_WIM_LIST);
       
   116 	iListBox->View()->SetListEmptyTextL(*stringHolder);
       
   117 	CleanupStack::PopAndDestroy(stringHolder);
       
   118 	LOG_LEAVEFN("CSecModUIContainerBase::CreateListL()");    
       
   119     }
       
   120     
       
   121 // ---------------------------------------------------------
       
   122 // CSecModUIContainerBase::SetupListItemsL()
       
   123 // Setups list items to listbox.
       
   124 // ---------------------------------------------------------
       
   125 //	
       
   126 void CSecModUIContainerBase::SetupListItemsL()
       
   127     {
       
   128     LOG_ENTERFN("CSecModUIContainerBase::SetupListItemsL()");   
       
   129     LOG_LEAVEFN("CSecModUIContainerBase::SetupListItemsL()");    
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CSecModUIContainerBase::SizeChanged()
       
   134 // Called by framework when the view size is changed
       
   135 // ---------------------------------------------------------
       
   136 //
       
   137 void CSecModUIContainerBase::SizeChanged()
       
   138     {
       
   139     LOG_ENTERFN("CSecModUIContainerBase::SizeChanged()");   
       
   140     __ASSERT_ALWAYS(iListBox, Panic(EPanicNullPointer));
       
   141     iListBox->SetRect(Rect());
       
   142     LOG_LEAVEFN("CSecModUIContainerBase::SizeChanged()");    
       
   143     }
       
   144 
       
   145 // ---------------------------------------------------------
       
   146 // CSecModUIContainerBase::CountComponentControls() const
       
   147 // ---------------------------------------------------------
       
   148 //
       
   149 TInt CSecModUIContainerBase::CountComponentControls() const
       
   150     {
       
   151     LOG_ENTERFN("CSecModUIContainerBase::CountComponentControls()");   
       
   152     LOG_LEAVEFN("CSecModUIContainerBase::CountComponentControls()");    
       
   153     return 1;
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------
       
   157 // CSecModUIContainerBase::ComponentControl(TInt aIndex) const
       
   158 // ---------------------------------------------------------
       
   159 //
       
   160 CCoeControl* CSecModUIContainerBase::ComponentControl(TInt aIndex) const
       
   161     {
       
   162     LOG_ENTERFN("CSecModUIContainerBase::ComponentControl()");   
       
   163     LOG_LEAVEFN("CSecModUIContainerBase::ComponentControl()");    
       
   164     switch ( aIndex )
       
   165         {
       
   166         case 0:
       
   167             return iListBox;           
       
   168         default:
       
   169             return NULL;
       
   170         }
       
   171     }
       
   172     
       
   173 // ---------------------------------------------------------
       
   174 // CSecModUIContainerBase::OfferKeyEventL(
       
   175 //     const TKeyEvent& aKeyEvent,TEventCode aType)
       
   176 // ---------------------------------------------------------
       
   177 //
       
   178 TKeyResponse CSecModUIContainerBase::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   179     {
       
   180     if (iModel.Wrapper().IsActive())
       
   181         {
       
   182         // Do not start new operation, if previous is still ongoing.
       
   183         return EKeyWasConsumed;
       
   184         }
       
   185     LOG_ENTERFN("CSecModUIContainerBase::OfferKeyEventL()");   
       
   186     LOG_LEAVEFN("CSecModUIContainerBase::OfferKeyEventL()");    
       
   187     return iListBox->OfferKeyEventL(aKeyEvent, aType);
       
   188     }
       
   189     
       
   190 // ---------------------------------------------------------
       
   191 // CCertManUIContainerAuthority::HandleResourceChange
       
   192 // 
       
   193 // ---------------------------------------------------------
       
   194 //
       
   195 void CSecModUIContainerBase::HandleResourceChange(TInt aType)
       
   196     {        
       
   197     CCoeControl::HandleResourceChange(aType);        
       
   198     if (aType == KEikDynamicLayoutVariantSwitch)
       
   199         {		
       
   200         TRect mainPaneRect;
       
   201         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
       
   202         SetRect(mainPaneRect);
       
   203 		DrawDeferred();
       
   204         }  
       
   205     }
       
   206 
       
   207 
       
   208 // ---------------------------------------------------------
       
   209 // CSecModUIContainerBase::GetHelpContext
       
   210 // This function is called when Help application is launched.  
       
   211 // (other items were commented in a header).
       
   212 // ---------------------------------------------------------
       
   213 //
       
   214 void CSecModUIContainerBase::GetHelpContext( 
       
   215     TCoeHelpContext& aContext ) const
       
   216     {
       
   217 	aContext.iMajor = KUidSecMod;
       
   218     aContext.iContext = iContextName;
       
   219     }
       
   220 
       
   221 
       
   222 // ---------------------------------------------------------
       
   223 // CSecModUIContainerBase::FocusChanged(TDrawNow aDrawNow)
       
   224 // ---------------------------------------------------------
       
   225 //
       
   226 void CSecModUIContainerBase::FocusChanged( TDrawNow aDrawNow )
       
   227     {
       
   228     if ( iListBox )
       
   229         {
       
   230         iListBox->SetFocus( IsFocused(), aDrawNow );
       
   231         }
       
   232     }
       
   233 // End of File