Hi to all,
Hope you all will be fine. I am sending sms on command. The view has option and back button. If you do not send sms, then back button works fine. But if you send sms then after sending sms when you click on back button , then following error occurs
Here is my code. Please tell me what i am doing wrong
Code:
HBufC* CL4_Mazazeek_AssignToneToCaller_EnterToneNumberScreen_ViewContainer::getEditorText() {
itext = iEdit1->GetTextInHBufL();
return itext;
}
Code:
TBool CL4_Mazazeek_AssignToneToCaller_EnterToneNumberScreen_View::HandleSend_SMSL(TInt aCommand) {
hbuf = iMazazeek_AssignToneToCaller_EnterToneNumberScreen_ViewContainer->getEditorText();
if (hbuf ) {
// Creating TBuf from HBuf
TBuf<15> buffer(hbuf->Des());
// Print a HBufC
//RDebug::Print( _L("Test string: %S"), hbuf );
_LIT(KPrivate, "Private*");
_LIT(KAsterisk, "*");
TBuf<30> totalMessage(KPrivate);
TBuf<50> msg(iModel.getMessageText());
totalMessage.Append(msg);
totalMessage.Append(KAsterisk);
totalMessage.Append(buffer);
// Print a TBuf
//RDebug::Print( _L("Test string: %S"), &totalMessage );
_LIT(Sc,"777");
TBuf<10> Shortcode(Sc);
iModel.SendSMSL(totalMessage, Shortcode);
} //end of if
return ETrue;
} //end of HandleEdit_SMSL
send sms
Code:
void CCallControllingModel::SendSMSL(TDesC& aMsgText, TDesC& aMsgNum)
{
RSendAs sendAs;
TInt err = sendAs.Connect();
if (err)
{
// TODO: Error handling
return;
}
CleanupClosePushL(sendAs);
RSendAsMessage sendAsMessage;
sendAsMessage.CreateL(sendAs, KUidMsgTypeSMS);
CleanupClosePushL(sendAsMessage);
// Add the receiver
//_LIT(KReceiver, aMsgNum);
sendAsMessage.AddRecipientL(aMsgNum, RSendAsMessage::ESendAsRecipientTo);
// Set the body text
//_LIT(KBodyText, "Hi, I am Busy. I call you after sometime. Thanks");
//sendAsMessage.SetBodyTextL(KBodyText);
sendAsMessage.SetBodyTextL(aMsgText);
// Send the message
///sendAsMessage.SendMessageAndCloseL();
sendAsMessage.LaunchEditorAndCloseL();
CleanupStack::Pop(); // sendAsMessage (already closed)
CleanupStack::PopAndDestroy(); // sendAs
}
Why i am getting these errors?
Thank you