cryptoservices/filebasedcertificateandkeystores/test/keytool/controller.cpp
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2004-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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "controller.h"
       
    20 
       
    21 CController::CController(MKeyToolView& aView) : iView(aView)
       
    22 	{
       
    23 	
       
    24 	}
       
    25 
       
    26 MKeyToolView& CController::GetView()
       
    27 	{
       
    28 	return iView;
       
    29 	}
       
    30 	
       
    31 void CController::DisplayErrorL(const TDesC& aError, TInt aErrorCode, TBool aPageWise)
       
    32 	{
       
    33 	iView.DisplayErrorL(aError, aErrorCode, aPageWise);	
       
    34 	}
       
    35 	
       
    36 	
       
    37 void CController::DisplayErrorL(const TDesC& aError, TBool aPageWise)
       
    38 	{
       
    39 	iView.DisplayErrorL(aError, aPageWise);
       
    40 	}
       
    41 	
       
    42 	
       
    43 void CController::DisplayLocalisedMsgL(TInt aResourceId, TInt aErrorCode)
       
    44 	{
       
    45 	HBufC8* buf = NULL;
       
    46     buf = iResourceFile.AllocReadL(aResourceId); 
       
    47 	TBuf<512> bPtr;
       
    48 
       
    49 	bPtr.Copy(reinterpret_cast<const TUint16*>(buf->Ptr()), buf->Size()/2);
       
    50 	iView.DisplayErrorL(bPtr, aErrorCode, 0);
       
    51 	delete buf;	
       
    52 	}
       
    53 	
       
    54 	
       
    55 void CController::DisplayLocalisedMsgL(TInt aResourceId)
       
    56 	{
       
    57 	HBufC8* buf = NULL;
       
    58 	buf = iResourceFile.AllocReadL(aResourceId); 
       
    59 	TBuf<512> bPtr;
       
    60 
       
    61 	// resource file having rls_string which is 16-bit Unicode string 
       
    62 	// So we can cast it to get a 8 bit without changing the data.
       
    63 	bPtr.Copy(reinterpret_cast<const TUint16*>(buf->Ptr()), buf->Size()/2);
       
    64 	iView.DisplayErrorL(bPtr, 0);
       
    65 	delete buf;
       
    66 	}
       
    67 
       
    68 void CController::DisplayKeyL(CCTKeyInfo& aKey, TBool aIsDetailed, TBool aPageWise)
       
    69 	{
       
    70 	iView.DisplayKeyInfoL(aKey, aIsDetailed, aPageWise);
       
    71 	}
       
    72 	
       
    73 
       
    74 void CController::DisplayCertL(CCTCertInfo& aCert, CCertificate& aCertificate, RUidArray aApps, TBool aIsDetailed, TBool aPageWise)
       
    75 	{
       
    76 	iView.DisplayCertL(aCert, aCertificate, aApps, aIsDetailed, aPageWise);
       
    77 	}
       
    78 	
       
    79 CController::~CController()
       
    80 	{
       
    81 	iResourceFile.Close();
       
    82 	iFsSession.Close();
       
    83 	}