os/security/cryptoservices/filebasedcertificateandkeystores/test/keytool/controller.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#include "controller.h"
sl@0
    20
sl@0
    21
CController::CController(MKeyToolView& aView) : iView(aView)
sl@0
    22
	{
sl@0
    23
	
sl@0
    24
	}
sl@0
    25
sl@0
    26
MKeyToolView& CController::GetView()
sl@0
    27
	{
sl@0
    28
	return iView;
sl@0
    29
	}
sl@0
    30
	
sl@0
    31
void CController::DisplayErrorL(const TDesC& aError, TInt aErrorCode, TBool aPageWise)
sl@0
    32
	{
sl@0
    33
	iView.DisplayErrorL(aError, aErrorCode, aPageWise);	
sl@0
    34
	}
sl@0
    35
	
sl@0
    36
	
sl@0
    37
void CController::DisplayErrorL(const TDesC& aError, TBool aPageWise)
sl@0
    38
	{
sl@0
    39
	iView.DisplayErrorL(aError, aPageWise);
sl@0
    40
	}
sl@0
    41
	
sl@0
    42
	
sl@0
    43
void CController::DisplayLocalisedMsgL(TInt aResourceId, TInt aErrorCode)
sl@0
    44
	{
sl@0
    45
	HBufC8* buf = NULL;
sl@0
    46
    buf = iResourceFile.AllocReadL(aResourceId); 
sl@0
    47
	TBuf<512> bPtr;
sl@0
    48
sl@0
    49
	bPtr.Copy(reinterpret_cast<const TUint16*>(buf->Ptr()), buf->Size()/2);
sl@0
    50
	iView.DisplayErrorL(bPtr, aErrorCode, 0);
sl@0
    51
	delete buf;	
sl@0
    52
	}
sl@0
    53
	
sl@0
    54
	
sl@0
    55
void CController::DisplayLocalisedMsgL(TInt aResourceId)
sl@0
    56
	{
sl@0
    57
	HBufC8* buf = NULL;
sl@0
    58
	buf = iResourceFile.AllocReadL(aResourceId); 
sl@0
    59
	TBuf<512> bPtr;
sl@0
    60
sl@0
    61
	// resource file having rls_string which is 16-bit Unicode string 
sl@0
    62
	// So we can cast it to get a 8 bit without changing the data.
sl@0
    63
	bPtr.Copy(reinterpret_cast<const TUint16*>(buf->Ptr()), buf->Size()/2);
sl@0
    64
	iView.DisplayErrorL(bPtr, 0);
sl@0
    65
	delete buf;
sl@0
    66
	}
sl@0
    67
sl@0
    68
void CController::DisplayKeyL(CCTKeyInfo& aKey, TBool aIsDetailed, TBool aPageWise)
sl@0
    69
	{
sl@0
    70
	iView.DisplayKeyInfoL(aKey, aIsDetailed, aPageWise);
sl@0
    71
	}
sl@0
    72
	
sl@0
    73
sl@0
    74
void CController::DisplayCertL(CCTCertInfo& aCert, CCertificate& aCertificate, RUidArray aApps, TBool aTrusted, TBool aIsDetailed, TBool aPageWise)
sl@0
    75
	{
sl@0
    76
	iView.DisplayCertL(aCert, aCertificate, aApps, aTrusted, aIsDetailed, aPageWise);
sl@0
    77
	}
sl@0
    78
	
sl@0
    79
CController::~CController()
sl@0
    80
	{
sl@0
    81
	iResourceFile.Close();
sl@0
    82
	iFsSession.Close();
sl@0
    83
	}
sl@0
    84
sl@0
    85