You Are Here:

Community: Wiki

This page was last modified 16:51, 27 March 2009.

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

Hearders Required:

#include <badesca.h> //CDesCArrayFlat
#include <rpbkviewresourcefile.h> //RPbkViewResourceFile 
#include <cpbkcontactengine.h> //CPbkContactEngine 
#include <cpbkmultipleentryfetchdlg.h> //CPbkMultipleEntryFetchDlg 
#include <cntdef.h> //TContactItemId
#include <cpbkcontactitem.h> // CPbkContactItem 
#include <cpbkemailaddressselect.h> //CPbkEmailAddressSelect
#include <tpbkcontactitemfield.h> //TPbkContactItemField

Library required:

LIBRARY  pbkview.lib //RPbkViewResourceFile ,CPbkMultipleEntryFetchDlg ,CPbkEmailAddressSelect
LIBRARY  pbkeng.lib ////CPbkContactEngine , CPbkContactItem ,TPbkContactItemField


Capabilities needed:

Capability  ReadDeviceData ReadUserData WriteDeviceData WriteUserData

Source:

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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fCreateE5fyourE5fownE5femailE5feditorE5forE5fviewerX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxCreateE20yourE20ownE20emailE20editorE20orE20viewerE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfnTypeZCommunityContentQ qdcZtypeQUqfnTypeZE52esourceQ qdcZtypeQUqfnTypeZWebpageQ qdcZtypeQUqfnTypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtopicQUqfnTopicZemailQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZmessagingQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZE52esourceQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxeE2dmailX qfnZuserE5ftagQSxmessagingX qfnZuserE5ftagQSxphonebookX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfnTypeZCommunityContentQ qrdfZtypeQUqfnTypeZE52esourceQ qrdfZtypeQUqfnTypeZWebpageQ qrdfZtypeQUqfnTypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ