I'm porting a custom MTM project I have from 3rd edition to 2nd edition.
The 3rd edition version uses RAknAppServiceBase/CAknAppServiceBase and CAknAppServer to launch the editor, but this is not available in 2nd edition. So instead I'm loading the editor as an embedded app from my "open editor" CMsvOperation.
Here is the code to launch the editor (which is working properly as far as I can tell):
The editor is opened and my message is loaded, no problems so far.
// Add a new embedded document to the current process with the type of our viewer\editor app
TFileName buffer = KViewEditAppFileName();
// Put this new document on the cleanup stack
TApaDocCleanupItem cleanup(process, document);
CleanupStack::PushL(cleanup); // push cleanup
// Tell the document to initialise
CleanupStack::Pop(); // cleanup
iDocument = document;
// restore document
// Create a stream store, this could be on disk but here we are using an in-memory store
CBufStore* store=CBufStore::NewLC(32); // push store
TStreamId id=outStream.CreateLC(*store); // push outStream
CleanupStack::PopAndDestroy(); // pop outStream
// Create a stream dictionary so we can find our parameters
CStreamDictionary* dic=CStreamDictionary::NewLC(); // push dic
outStream.CreateLC(*store); // push outStream
CleanupStack::PopAndDestroy(); // pop outstream
// Tell the document to restore itself from this store
readStream.OpenLC(*store, id); // push readStream
CleanupStack::PopAndDestroy(3, store); // readStream, dic, store
I call iDoorObserver->NotifyExit() in the editor's AppUi destructor to let the calling app (the messaging app) know that it's finished, and in the CMsvOperation's destructor I have:
But this always causes the messaging app to close too (instead of just my editor).
If I don't call DestroyDocument() (even though the documentation says I <i>have to</i>) then I get back to the messaging app, but if I try to create/edit a message the messaging app closes down.
I'm not getting any panics or other error messages (I have ErrRd).
Any ideas on what I might be doing wrong? Or any examples I can look at other than the DocumentHandler example which wasn't much help?
I just ran a little test on the phone where I added a call to User::Panic and I didn't get any error message (the messaging app just closed). So I am guessing that I'm causing a panic somehow. Is there anyway to get the panic messages to display? I'm using an N90.