// EIKALERT.CPP
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#include <eikalert.h>
#include <eikpriv.hrh>
#include <eikon.rsg>
#include <eiktxtut.h>

const TInt KEikAlertMaxMsgLength=80;

void CEikAlert::ConstructL()
	{
	ConstructSleepingDialogL(R_EIK_DIALOG_ALERT);
	SetLabelReserveLengthL(EEikCidAlertText1,KEikAlertMaxMsgLength);
	SetLabelReserveLengthL(EEikCidAlertText2,KEikAlertMaxMsgLength);
	}

void CEikAlert::RunAlert(const TDesC& aMsg1,const TDesC& aMsg2)
	{
	iMsg1=(&aMsg1);
	iMsg2=(&aMsg2);
	RouseSleepingDialog();
	}

void CEikAlert::PreLayoutDynInitL()
	{
	if (iMsg1->Length() > KEikAlertMaxMsgLength)
		{
		TBuf<KEikAlertMaxMsgLength> temp=iMsg1->Left(KEikAlertMaxMsgLength);
		TextUtils::TruncateToNumChars(temp, KEikAlertMaxMsgLength);
		SetLabelL(EEikCidAlertText1,temp);
		}
	else
 		SetLabelL(EEikCidAlertText1,*iMsg1);

	if (iMsg2->Length() > KEikAlertMaxMsgLength)
		{
		TBuf<KEikAlertMaxMsgLength> temp=iMsg2->Left(KEikAlertMaxMsgLength);
		TextUtils::TruncateToNumChars(temp, KEikAlertMaxMsgLength);
		SetLabelL(EEikCidAlertText2,temp);
		}
	else
 		SetLabelL(EEikCidAlertText2,*iMsg2);
	}
