Hi,
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.Code:_LIT(KViewEditAppFileName,"MyMessageEditor.APP"); CApaProcess* process=CEikonEnv::Static()->Process(); // Add a new embedded document to the current process with the type of our viewer\editor app TFileName buffer = KViewEditAppFileName(); CEikDocument* document=static_cast<CEikDocument*>(process->AddNewDocumentL(buffer)); // Put this new document on the cleanup stack TApaDocCleanupItem cleanup(process, document); CleanupStack::PushL(cleanup); // push cleanup // Tell the document to initialise document->NewDocumentL(); CleanupStack::Pop(); // cleanup iDocument = document; // restore document TPckgBuf<TEditorParameters> package(aParams); // 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 RStoreWriteStream outStream; TStreamId id=outStream.CreateLC(*store); // push outStream outStream.WriteL(package); store->CommitL(); CleanupStack::PopAndDestroy(); // pop outStream // Create a stream dictionary so we can find our parameters CStreamDictionary* dic=CStreamDictionary::NewLC(); // push dic dic->AssignL(TUid::Uid(0), id); outStream.CreateLC(*store); // push outStream dic->ExternalizeL(outStream); store->CommitL(); CleanupStack::PopAndDestroy(); // pop outstream // Tell the document to restore itself from this store RStoreReadStream readStream; readStream.OpenLC(*store, id); // push readStream iDocument->RestoreL(*store, *dic); CleanupStack::PopAndDestroy(3, store); // readStream, dic, store iDocument->EditL(this)
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).Code:CApaProcess* process=CEikonEnv::Static()->Process(); process->DestroyDocument(iDocument);
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?
shmoove
EDIT:
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.

Reply With Quote

