add option to take a TBuf16

This commit is contained in:
ehouse 2005-01-08 18:21:35 +00:00
parent d36351feb0
commit 72f9ece55b

View file

@ -1,6 +1,6 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
/*
* Copyright 2004 by Eric House (fixin@peak.org). All rights reserved.
* Copyright 2005 by Eric House (fixin@peak.org). All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,7 +24,13 @@
#include "xwords.hrh"
CXWAskDlg::CXWAskDlg( MPFORMAL XWStreamCtxt* aStream, TBool aKillStream ) :
iStream(aStream), iKillStream(aKillStream)
iStream(aStream), iKillStream(aKillStream), iMessage(NULL)
{
MPASSIGN( this->mpool, mpool );
}
CXWAskDlg::CXWAskDlg( MPFORMAL TBuf16<128>* aMessage)
: iMessage(aMessage), iStream(NULL)
{
MPASSIGN( this->mpool, mpool );
}
@ -39,7 +45,10 @@ CXWAskDlg::~CXWAskDlg()
void
CXWAskDlg::PreLayoutDynInitL()
{
CEikEdwin* contents = (CEikEdwin*)Control( EAskContents );
// Load the stream's contents into a read-only edit control.
if ( iStream ) {
TInt size = stream_getSize( iStream );
XP_U16* buf16 = new(ELeave) XP_U16[size];
CleanupStack::PushL( buf16 );
@ -54,14 +63,15 @@ CXWAskDlg::PreLayoutDynInitL()
TPtr16 desc16( buf16, size );
desc16.Copy( desc8 );
CEikEdwin* contents = (CEikEdwin*)Control( EAskContents );
contents->SetTextL( &desc16 );
CleanupStack::PopAndDestroy( buf16 );
XP_FREE( mpool, buf8 );
} else {
contents->SetTextL( iMessage );
}
} /* PreLayoutDynInitL */
TBool CXWAskDlg::OkToExitL( TInt aButtonID /* pressed button */ )
{