Categories: Symbian C++ | How To | Code Examples | Messaging | E-Mail
This page was last modified 10:42, 13 June 2008.
Create your own email editor or viewer
From Forum Nokia Wiki
Contents |
Overview
When we need to have our own email editor or viewer then this example can be used for that purposes. In this example we have provided two main features of the email editor. Inserting email address from phone book, resizing the editor control and making line to the editor. Though S60 email editor shows name only and those email address are embedded under the name. In this example we show the email address directly.
How to insert Email address
CDesCArrayFlat* CEmailEditorView::GetEMailFromPhoneBookL( TBool& aSuccess ) { aSuccess = EFalse; RPbkViewResourceFile PbkResourceFile(*iCoeEnv); if (!iPbkEngine) { iPbkEngine = CPbkContactEngine::NewL(&iEikonEnv->FsSession()); } if (!PbkResourceFile.IsOpen()) { PbkResourceFile.OpenL(); } CDesCArrayFlat* addresses = new (ELeave) CDesCArrayFlat( 8 ); // granularity = 8 CleanupStack::PushL(addresses); CPbkMultipleEntryFetchDlg::TParams params; params.iContactView = &iPbkEngine->FilteredContactsViewL(CContactDatabase::EMailable); CPbkMultipleEntryFetchDlg* fetchDlg = CPbkMultipleEntryFetchDlg::NewL( params, *iPbkEngine); fetchDlg->SetMopParent(this); const TInt res(fetchDlg->ExecuteLD()); fetchDlg = NULL; if (res) { CleanupStack::PushL(params.iMarkedEntries); const TInt count(params.iMarkedEntries->Count()); for (TInt i = 0; i < count; ++i) { const TContactItemId cid = (*params.iMarkedEntries)[i]; CPbkContactItem* pbkItem = iPbkEngine->ReadContactLC(cid); CPbkEmailAddressSelect::TParams pbkParams = CPbkEmailAddressSelect::TParams(*pbkItem); pbkParams.SetUseDefaultDirectly(ETrue); CPbkEmailAddressSelect* dlg = new(ELeave) CPbkEmailAddressSelect(); // Shows "select email address popup" if necessary if (dlg->ExecuteLD( pbkParams )) { const TPbkContactItemField* selectedField = pbkParams.SelectedField(); if (selectedField) { TPtrC address = selectedField->Text(); aSuccess = ETrue; addresses->AppendL(address); } } CleanupStack::PopAndDestroy( pbkItem ); // pbkItem } CleanupStack::PopAndDestroy( params.iMarkedEntries ); } CleanupStack::Pop( addresses ); delete iPbkEngine; iPbkEngine = NULL; PbkResourceFile.Close(); return addresses; }
How to draw underline in editor
The underline are icons created by AknsUtils::CreateGulIconL() and the background is saved by calling SetSuppressBackgroundDrawing() method. The line can be adjusted as calculating the text height and resizing it.
Capability Used
To access address we need following capability. So self signed would not work in this case. CAPABILITY ReadUserData WriteUserData WriteDeviceData ReadDeviceData
Example Applications
The application is tested with E70, can be found here: Image:EmailEditor.zip
If you want to make your own proprietary email protocol then integrated this example with the following example. http://www.forum.nokia.com/info/sw.nokia.com/id/ec735e80-0bbb-491c-b5c2-3fa8df09dfb2/S60_3rd_Edition_Creating_Custom_Message_Type_Modules.html
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Theme Editor and Icons | Bello e Monello | Symbian Media (Graphics & Sounds) | 0 | 2005-08-25 20:47 |
| Problem with CAknNavigationControlContainer and editor indicator object | madsum | Symbian User Interface | 4 | 2006-05-19 12:27 |
| get window text of another application | thehung111 | General Symbian C++ | 2 | 2008-05-27 09:29 |
| problems in secret editor in symbian. | platinnum | General Symbian C++ | 3 | 2005-04-25 08:02 |
| CShelp works on emulator, not on 9500 | p1rpp | General Symbian C++ | 3 | 2006-12-18 18:21 |
