I have a problem: after I pressed "BACK", the dialog exits, runs until "break;" in CMyAppUi::HandleCommandL(), and then
HandleCommandL() is called again with EEikCmdExit argument, and exits the program. Why is it called twice?
I don't want to exit the program, i just want "BACK" to activate the previous view after the dialog exits. How can I do that?
;======================================= from AppUi
void CMyAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case ESortMessagesOptions:
{
CSortMessagesDialog *dialog=CSortMessagesDialog::NewL(&options);
if(dialog->RunDlgLD())
{
iUiOptions=options;
...
}
break;
}
case EEikCmdExit:
{
Exit();
break;
}
}
}
;============================================== from Dialog
TBool CSortMessagesDialog::RunDlgLD()
{
CAknForm::ConstructL();
return ExecuteLD(R_SORT_MESSAGES_DLG);
};


TBool CSortMessagesDialog::OkToExitL(TInt aButtonId)
{
if (aButtonId == EAknSoftkeyBack) {
return ETrue;
}
else
return CAknForm::OkToExitL(aButtonId);
}
}
;============================================= from RSS
RESOURCE DIALOG r_sort_messages_dlg
{
title=STRING_dlg_title_sorting;
flags = EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect |
EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder |
EEikDialogFlagCbaButtons|EEikDialogFlagWait;

buttons=R_AVKON_SOFTKEYS_OPTIONS_BACK;
pages=r_sort_messages_dlg_pages;
}