deviceencryption/DevEncUi/src/DevEncUiEncrView.cpp
branchRCL_3
changeset 39 65326cf895ed
equal deleted inserted replaced
38:491b3ed49290 39:65326cf895ed
       
     1 /*
       
     2 * Copyright (c) 2005 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 CDevEncUiEncrView.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 // Class includes
       
    20 #include "DevEncUiEncrView.h"
       
    21 
       
    22 // System includes
       
    23 #include <aknViewAppUi.h>	// CAknViewAppUi
       
    24 #include <devencui.rsg>
       
    25 
       
    26 // User includes
       
    27 #include "DevEncLog.h"
       
    28 #include "DevEnc.hrh"
       
    29 #include "DevEncUiEncrViewContainer.h"
       
    30 #include "DevEncUiMemoryEntity.h"
       
    31 
       
    32 // ================= MEMBER FUNCTIONS =======================
       
    33 
       
    34 /**
       
    35 * Destructor.  Frees up memory for the iLabel.
       
    36 */
       
    37 CDevEncUiEncrView::~CDevEncUiEncrView()
       
    38 	{
       
    39 	delete iContainer;
       
    40 	}
       
    41 
       
    42 /**
       
    43 * Symbian OS 2 phase constructor.
       
    44 * Constructs the CDevEncUiEncrView using the NewLC method, popping
       
    45 * the constructed object from the CleanupStack before returning it.
       
    46 *
       
    47 * @param aRect The rectangle for this window
       
    48 * @return The newly constructed CDevEncUiEncrView
       
    49 */
       
    50 CDevEncUiEncrView* CDevEncUiEncrView::NewL( RArray<CDevEncUiMemoryEntity*>& aMemEntities )
       
    51 	{
       
    52 	CDevEncUiEncrView* self = CDevEncUiEncrView::NewLC( aMemEntities );
       
    53 	CleanupStack::Pop( self );
       
    54 	return self;
       
    55 	}
       
    56 
       
    57 /**
       
    58 * Symbian OS 2 phase constructor.
       
    59 * Constructs the CDevEncUiEncrView using the constructor and ConstructL
       
    60 * method, leaving the constructed object on the CleanupStack before returning it.
       
    61 *
       
    62 * @param aRect The rectangle for this window
       
    63 * @return The newly constructed CDevEncUiEncrView
       
    64 */
       
    65 CDevEncUiEncrView* CDevEncUiEncrView::NewLC( RArray<CDevEncUiMemoryEntity*>& aMemEntities )
       
    66 	{
       
    67 	CDevEncUiEncrView* self = new ( ELeave ) CDevEncUiEncrView( aMemEntities );
       
    68 	CleanupStack::PushL( self );
       
    69 	self->ConstructL();
       
    70 	return self;
       
    71 	}
       
    72 
       
    73 CDevEncUiEncrView::CDevEncUiEncrView( RArray<CDevEncUiMemoryEntity*>& aMemEntities )
       
    74     : iMemEntities( aMemEntities )
       
    75 	{
       
    76 	}
       
    77 
       
    78 CDevEncUiEncrViewContainer* CDevEncUiEncrView::Container()
       
    79 	{
       
    80 	return iContainer;
       
    81 	}
       
    82 
       
    83 CDevEncUiAppUi& CDevEncUiEncrView::GetAppUi()
       
    84     {
       
    85     CAknViewAppUi* aknViewAppUi = AppUi();
       
    86     CDevEncUiAppUi* appUi = reinterpret_cast<CDevEncUiAppUi*>( aknViewAppUi );
       
    87     return ( *appUi );
       
    88     }
       
    89 
       
    90 /**
       
    91 * Symbian OS 2nd phase constructor.
       
    92 * Uses the superclass constructor to construct the view using the
       
    93 * R_EMCCVIEWSWITCHED_VIEW1 resource.
       
    94 */
       
    95 void CDevEncUiEncrView::ConstructL()
       
    96 	{
       
    97 	BaseConstructL( R_DEVENCUI_ENCRVIEW );
       
    98 	}
       
    99 
       
   100 /**
       
   101 * Called by the framework
       
   102 * @return The Uid for this view
       
   103 */
       
   104 TUid CDevEncUiEncrView::Id() const
       
   105 	{
       
   106 	return TUid::Uid( EDevEncUiEncrViewId );
       
   107 	}
       
   108 
       
   109 /**
       
   110 * Called by the framework when the view is activated.  Constructs the
       
   111 * container if necessary, setting this view as its MOP parent, and
       
   112 * adding it to the control stack.
       
   113 */
       
   114 void CDevEncUiEncrView::DoActivateL( const TVwsViewId& /*aPrevViewId*/ ,
       
   115 									 TUid /*aCustomMessageId*/,
       
   116 									 const TDesC8& /*aCustomMessage*/ )
       
   117 	{
       
   118 	if ( ! iContainer )
       
   119 		{
       
   120 		iContainer = CDevEncUiEncrViewContainer::NewL( AppUi()->ClientRect(),
       
   121                                                        *this );
       
   122 		iContainer->SetMopParent( this );
       
   123 		AppUi()->AddToStackL( *this, iContainer );
       
   124 		}
       
   125 	}
       
   126 
       
   127 /**
       
   128 * Called by the framework when the view is deactivated.
       
   129 * Removes the container from the control stack and deletes it.
       
   130 */
       
   131 void CDevEncUiEncrView::DoDeactivate()
       
   132 	{
       
   133 	if ( iContainer )
       
   134 		{
       
   135 		AppUi()->RemoveFromStack( iContainer );
       
   136 		delete iContainer;
       
   137 		iContainer = NULL;
       
   138 		}
       
   139 	}
       
   140 
       
   141 /**
       
   142 * From CEikAppUi, takes care of command handling for this view.
       
   143 *
       
   144 * @param aCommand command to be handled
       
   145 */
       
   146 void CDevEncUiEncrView::HandleCommandL( TInt aCommand )
       
   147 	{
       
   148     DFLOG2( "CDevEncUiEncrView::HandleCommandL %d", aCommand );
       
   149 
       
   150     switch ( aCommand )
       
   151 		{
       
   152 		case EAknSoftkeyBack:
       
   153 			{
       
   154 			AppUi()->HandleCommandL( EAknSoftkeyBack );
       
   155 			break;
       
   156 			}
       
   157 		default:
       
   158 			{
       
   159 			AppUi()->HandleCommandL( aCommand );
       
   160 			}
       
   161 		}
       
   162 	}
       
   163 
       
   164 // --------------------------------------------------------------------------
       
   165 //  Called by the framework when the application status pane
       
   166 //  size is changed.  Passes the new client rectangle to the container.
       
   167 // --------------------------------------------------------------------------
       
   168 void CDevEncUiEncrView::HandleStatusPaneSizeChange()
       
   169     {
       
   170     if ( iContainer )
       
   171         {
       
   172         iContainer->SetRect( ClientRect() );
       
   173         }
       
   174     }
       
   175 
       
   176 // End of File