uiservicetab/vimpstdetailsviewplugin/src/cvimpstdetailsviewplugin.cpp
branchRCL_3
changeset 14 9fdee5e1da30
parent 0 5e5d6b214f4f
equal deleted inserted replaced
13:796276a1bdcc 14:9fdee5e1da30
    49 #include 	<spentry.h>
    49 #include 	<spentry.h>
    50 #include 	<spproperty.h>
    50 #include 	<spproperty.h>
    51 
    51 
    52 // Virtual Phonebook
    52 // Virtual Phonebook
    53 #include <CVPbkContactLinkArray.h>
    53 #include <CVPbkContactLinkArray.h>
    54 #include "vimpstdebugtrace.h"
    54 
       
    55 #include "uiservicetabtracer.h"
    55 // meco service uid
    56 // meco service uid
    56 #define KMECOIMPLEMENTATIONUID 0x20012423
    57 #define KMECOIMPLEMENTATIONUID 0x20012423
    57 _LIT(KVIMPSTDetailsViewDllResFileName, "\\resource\\vimpstdetailsviewpluginrsc.rsc");
    58 _LIT(KVIMPSTDetailsViewDllResFileName, "\\resource\\vimpstdetailsviewpluginrsc.rsc");
    58 _LIT8( KEMbmConversationsQgnDefaultImage,  "default_brand_image");
    59 _LIT8( KEMbmConversationsQgnDefaultImage,  "default_brand_image");
    59 
    60 
    73 // CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin
    74 // CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin
    74 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    75 //
    76 //
    76 CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin()
    77 CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin()
    77 	{
    78 	{
    78 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin start") );
    79 	TRACER_AUTO;
    79 	delete iMenuHandler;
    80 	delete iMenuHandler;
    80 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin iMenuHandler deleted") );
    81 	TRACE("iMenuHandler deleted");
    81 	delete iBrandHandler;
    82 	delete iBrandHandler;
    82 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin iBrandHandler deleted") );
    83 	TRACE("iBrandHandler deleted");
    83 	delete iPresenceHandler;	
    84 	delete iPresenceHandler;
    84 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin iPresenceHandler deleted") );
    85 	TRACE("iPresenceHandler deleted");
    85 	delete iContactHandler;
    86 	delete iContactHandler;
    86 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin end") );
    87 
    87 	}
    88 	}
    88 
    89 
    89 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
    90 // CVIMPSTDetailsViewPlugin::CVIMPSTDetailsViewPlugin()
    91 // CVIMPSTDetailsViewPlugin::CVIMPSTDetailsViewPlugin()
    91 // ---------------------------------------------------------------------------
    92 // ---------------------------------------------------------------------------
   109 //
   110 //
   110 void CVIMPSTDetailsViewPlugin::PreparePluginViewL(
   111 void CVIMPSTDetailsViewPlugin::PreparePluginViewL(
   111 			MCCAppPluginParameter& aPluginParameter)
   112 			MCCAppPluginParameter& aPluginParameter)
   112 	{
   113 	{
   113 	// check parameter version
   114 	// check parameter version
   114 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::PreparePluginViewL start") );
   115 	TRACER_AUTO;
   115 	if (aPluginParameter.Version() != 1)
   116 	if (aPluginParameter.Version() != 1)
   116 		{
   117 		{
   117 		User::Leave(KErrNotSupported);
   118 		User::Leave(KErrNotSupported);
   118 		}
   119 		}
   119 	
   120 	
   135 	iContactHandler = CVIMPSTDetailsContactHandler::NewL( *iLaunchParameter , 
   136 	iContactHandler = CVIMPSTDetailsContactHandler::NewL( *iLaunchParameter , 
   136 														  *this,
   137 														  *this,
   137 														  iBrandHandler->ServiceStoreUriL(),														  
   138 														  iBrandHandler->ServiceStoreUriL(),														  
   138 														  serviceNamePtr,
   139 														  serviceNamePtr,
   139 														  iServiceId);
   140 														  iServiceId);
   140 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::PreparePluginViewL iContactHandler created") );
   141 
       
   142 	TRACE("iContactHandler created");
   141 	CleanupStack::PopAndDestroy(); // serviceName
   143 	CleanupStack::PopAndDestroy(); // serviceName
   142 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::PreparePluginViewL end") );
   144 
   143 	}
   145 	}
   144 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   145 // CVIMPSTDetailsViewPlugin::ImplementationUid
   147 // CVIMPSTDetailsViewPlugin::ImplementationUid
   146 // ---------------------------------------------------------------------------
   148 // ---------------------------------------------------------------------------
   147 //
   149 //
   180 //
   182 //
   181 void CVIMPSTDetailsViewPlugin::ProvideBitmapL(
   183 void CVIMPSTDetailsViewPlugin::ProvideBitmapL(
   182 		TCCAppIconType aIconType, CAknIcon& aIcon)
   184 		TCCAppIconType aIconType, CAknIcon& aIcon)
   183 
   185 
   184     {
   186     {
       
   187 	TRACER_AUTO;
   185     if (ECCAppTabIcon == aIconType)
   188     if (ECCAppTabIcon == aIconType)
   186         {
   189         {
   187         CFbsBitmap* bmp = NULL;
   190         CFbsBitmap* bmp = NULL;
   188         CFbsBitmap* bmpMask = NULL;
   191         CFbsBitmap* bmpMask = NULL;
   189         CGulIcon* tabIcon = iBrandHandler->LoadBrandBitmapL(KEMbmConversationsQgnDefaultImage);
   192         CGulIcon* tabIcon = iBrandHandler->LoadBrandBitmapL(KEMbmConversationsQgnDefaultImage);
   258 // ---------------------------------------------------------------------------
   261 // ---------------------------------------------------------------------------
   259 //
   262 //
   260 void CVIMPSTDetailsViewPlugin::PrepareViewResourcesL()
   263 void CVIMPSTDetailsViewPlugin::PrepareViewResourcesL()
   261 	{
   264 	{
   262 	// Ignore codescanner warning generated here : " Leaving function called before BaseConstructL "
   265 	// Ignore codescanner warning generated here : " Leaving function called before BaseConstructL "
   263 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::PrepareViewResourcesL start") );
   266     TRACER_AUTO;
   264 	TFileName fileName(KVIMPSTDetailsViewDllResFileName);
   267 	TFileName fileName(KVIMPSTDetailsViewDllResFileName);
   265     BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName);
   268     BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName);
   266    	iResourceLoader.OpenL(fileName);
   269    	iResourceLoader.OpenL(fileName);
   267     BaseConstructL(R_VIMPSTDETAILSVIEW_MAINVIEW);
   270     BaseConstructL(R_VIMPSTDETAILSVIEW_MAINVIEW);
   268     TRACED( T_LIT("CVIMPSTDetailsViewPlugin::PrepareViewResourcesL end") );
   271  
   269     }
   272     }
   270 
   273 
   271 // ---------------------------------------------------------------------------
   274 // ---------------------------------------------------------------------------
   272 // CVIMPSTDetailsViewPlugin::DoActivateL
   275 // CVIMPSTDetailsViewPlugin::DoActivateL
   273 // ---------------------------------------------------------------------------
   276 // ---------------------------------------------------------------------------
   275 void CVIMPSTDetailsViewPlugin::DoActivateL(
   278 void CVIMPSTDetailsViewPlugin::DoActivateL(
   276 	const TVwsViewId& aPrevViewId,
   279 	const TVwsViewId& aPrevViewId,
   277 	TUid aCustomMessageId,
   280 	TUid aCustomMessageId,
   278 	const TDesC8& aCustomMessage)
   281 	const TDesC8& aCustomMessage)
   279 	{
   282 	{
   280 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoActivateL start") );
   283 	TRACER_AUTO;
   281 	CCCAppViewPluginAknView::DoActivateL(aPrevViewId, aCustomMessageId,
   284 	CCCAppViewPluginAknView::DoActivateL(aPrevViewId, aCustomMessageId,
   282 	aCustomMessage);
   285 	aCustomMessage);
   283 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoActivateL calling GetContactData") );
   286 	TRACE("calling GetContactData");
   284 	GetContactDataL();
   287 	GetContactDataL();
   285 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoActivateL end") );
   288 
   286 	}
   289 	}
   287 
   290 
   288 // ---------------------------------------------------------------------------
   291 // ---------------------------------------------------------------------------
   289 // CVIMPSTDetailsViewPlugin::DoDeactivate
   292 // CVIMPSTDetailsViewPlugin::DoDeactivate
   290 // ---------------------------------------------------------------------------
   293 // ---------------------------------------------------------------------------
   291 //
   294 //
   292 void CVIMPSTDetailsViewPlugin::DoDeactivate()
   295 void CVIMPSTDetailsViewPlugin::DoDeactivate()
   293 	{
   296 	{
   294 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoDeactivate satrt") );
   297 	TRACER_AUTO;
   295 	if( iContactHandler )
   298 	if( iContactHandler )
   296 		{
   299 		{
   297 		iContactHandler->CancelOngoingRequest();	
   300 		iContactHandler->CancelOngoingRequest();	
   298 		}
   301 		}
   299 
   302 	TRACE("ongoing request canceled");
   300 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoDeactivate ongoing request canceled") );
       
   301 	if (iContainer)
   303 	if (iContainer)
   302 		{
   304 		{
   303 		iFocusedListIndex = static_cast<CVIMPSTDetailsViewContainer*>
   305 		iFocusedListIndex = static_cast<CVIMPSTDetailsViewContainer*>
   304 							(iContainer)->ListBoxModel().FocusedFieldIndex();
   306 							(iContainer)->ListBoxModel().FocusedFieldIndex();
   305 		}
   307 		}
   306 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoDeactivate calling base class Deactivate") );
   308 	TRACE("calling base class Deactivate");
   307 	CCCAppViewPluginAknView::DoDeactivate();
   309 	CCCAppViewPluginAknView::DoDeactivate();
   308 	// not woned by this class
   310 	// not woned by this class
   309 	iContainer = NULL;
   311 	iContainer = NULL;
   310     TRACED( T_LIT("CVIMPSTDetailsViewPlugin::DoDeactivate end") );
   312 
   311 	}
   313 	}
   312 
   314 
   313 // --------------------------------------------------------------------------
   315 // --------------------------------------------------------------------------
   314 // CVIMPSTDetailsViewPlugin::GetContactDataL
   316 // CVIMPSTDetailsViewPlugin::GetContactDataL
   315 // --------------------------------------------------------------------------
   317 // --------------------------------------------------------------------------
   316 //
   318 //
   317 void CVIMPSTDetailsViewPlugin::GetContactDataL()
   319 void CVIMPSTDetailsViewPlugin::GetContactDataL()
   318 	{
   320 	{
   319 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::GetContactDataL start") );
   321 
       
   322 	TRACER_AUTO;
   320 	if (iLaunchParameter && iContactHandler )
   323 	if (iLaunchParameter && iContactHandler )
   321 		{
   324 		{
   322 		// todo: pass launchparameter to listbox model?
   325 		// todo: pass launchparameter to listbox model?
   323 		HBufC& contactData = iLaunchParameter->ContactDataL();
   326 		HBufC& contactData = iLaunchParameter->ContactDataL();
   324 
   327 
   326 		buf->Des().Copy(contactData);
   329 		buf->Des().Copy(contactData);
   327 		TPtrC8 bufDes(buf->Des());
   330 		TPtrC8 bufDes(buf->Des());
   328 	
   331 	
   329 		CVPbkContactLinkArray* links = CVPbkContactLinkArray::NewLC( bufDes, iContactHandler->ContactStoresL() );
   332 		CVPbkContactLinkArray* links = CVPbkContactLinkArray::NewLC( bufDes, iContactHandler->ContactStoresL() );
   330 		CleanupStack::Pop(links);
   333 		CleanupStack::Pop(links);
   331 		TRACED( T_LIT("CVIMPSTDetailsViewPlugin::GetContactDataL links created") );
   334 		TRACE("links created");
   332 		CleanupStack::PopAndDestroy(buf);
   335 		CleanupStack::PopAndDestroy(buf);
   333 		TRACED( T_LIT("CVIMPSTDetailsViewPlugin::GetContactDataL buffer destroyed") );    
   336 		TRACE("buffer destroyed");
   334 		TUid launchUid = iLaunchParameter->LaunchedViewUid();
   337 		TUid launchUid = iLaunchParameter->LaunchedViewUid();
   335 		if(  launchUid.iUid != (KVIMPSTDetailsViewPluginImplmentationUid+iServiceId) && iContactHandler->StoreType() == EStoreServer )
   338 		if(  launchUid.iUid != (KVIMPSTDetailsViewPluginImplmentationUid+iServiceId) && iContactHandler->StoreType() == EStoreServer )
   336 			{
   339 			{
   337 			TRACED( T_LIT("CVIMPSTDetailsViewPlugin::GetContactDataL service store set link called from pbk") );
   340 				TRACE("service store set link called from pbk");
   338 			// launch from other than service tab
   341 			// launch from other than service tab
   339 			// ETrue, read xsp id from pbk store and search in service store and show 
   342 			// ETrue, read xsp id from pbk store and search in service store and show 
   340 			// incase of xsp store , need to find the details from xsp store
   343 			// incase of xsp store , need to find the details from xsp store
   341 			iContactHandler->SetLinks( links , ETrue );
   344 			iContactHandler->SetLinks( links , ETrue );
   342 			}
   345 			}
   343 		else
   346 		else
   344 			{
   347 			{
   345 			TRACED( T_LIT("CVIMPSTDetailsViewPlugin::GetContactDataL set linkcalled from service tab/CV") );
   348 			TRACE("set linkcalled from service tab/CV");
   346 			iContactHandler->SetLinks( links , EFalse );
   349 			iContactHandler->SetLinks( links , EFalse );
   347 			 //make sure this is set to null after view is changed
   350 			 //make sure this is set to null after view is changed
   348 			// cannot be set it to null in dodeactivate call. as ilaunchparameter is not
   351 			// cannot be set it to null in dodeactivate call. as ilaunchparameter is not
   349 			//owned by us. might get destryoed by cca
   352 			//owned by us. might get destryoed by cca
   350 			iLaunchParameter->SetLaunchedViewUid(TUid::Null()); 
   353 			iLaunchParameter->SetLaunchedViewUid(TUid::Null()); 
   351 			}
   354 			}
   352 		}
   355 		}
   353 	TRACED( T_LIT("CVIMPSTDetailsViewPlugin::GetContactDataL end") );
   356 
   354 	}
   357 	}
   355 // ---------------------------------------------------------------------------
   358 // ---------------------------------------------------------------------------
   356 // CVIMPSTDetailsViewPlugin::SetTitleL
   359 // CVIMPSTDetailsViewPlugin::SetTitleL
   357 // ---------------------------------------------------------------------------
   360 // ---------------------------------------------------------------------------
   358 //
   361 //
   359 void CVIMPSTDetailsViewPlugin::SetTitleL()
   362 void CVIMPSTDetailsViewPlugin::SetTitleL()
   360 	{
   363 	{
       
   364 	TRACER_AUTO;
   361 	HBufC* title = NULL;
   365 	HBufC* title = NULL;
   362 	
   366 	
   363 	if( iContainer && iContactHandler )
   367 	if( iContainer && iContactHandler )
   364 		{
   368 		{
   365 		title = static_cast<CVIMPSTDetailsViewContainer*>
   369 		title = static_cast<CVIMPSTDetailsViewContainer*>
   397 // CVIMPSTDetailsViewPlugin::HandleContactReadyL
   401 // CVIMPSTDetailsViewPlugin::HandleContactReadyL
   398 // --------------------------------------------------------------------------
   402 // --------------------------------------------------------------------------
   399 //
   403 //
   400 void CVIMPSTDetailsViewPlugin::HandleContactReadyL( MVPbkStoreContact& aContact )
   404 void CVIMPSTDetailsViewPlugin::HandleContactReadyL( MVPbkStoreContact& aContact )
   401 	{
   405 	{
       
   406 	TRACER_AUTO;
   402 	if( iContainer )
   407 	if( iContainer )
   403 		{
   408 		{
   404 		// read the service name for servic eid - iServiceId
   409 		// read the service name for servic eid - iServiceId
   405 		// pass to CreatePresentation
   410 		// pass to CreatePresentation
   406 		HBufC* serviceName = HBufC::NewLC( KVIMPST_MAX_LENGTH );
   411 		HBufC* serviceName = HBufC::NewLC( KVIMPST_MAX_LENGTH );