uiservicetab/vimpstui/src/cvimpstuisearchviewcontrol.cpp
branchRCL_3
changeset 14 9fdee5e1da30
parent 0 5e5d6b214f4f
equal deleted inserted replaced
13:796276a1bdcc 14:9fdee5e1da30
    25 #include "tvimpstconsts.h"
    25 #include "tvimpstconsts.h"
    26 #include "mvimpstengine.h"
    26 #include "mvimpstengine.h"
    27 #include "cvimpstuisearchview.h"
    27 #include "cvimpstuisearchview.h"
    28 #include "vimpstui.hrh"
    28 #include "vimpstui.hrh"
    29 #include "vimpstutilsdialog.h"
    29 #include "vimpstutilsdialog.h"
    30 #include    "vimpstdebugprint.h" 
    30 #include "uiservicetabtracer.h"
    31 // imlauncher
    31 // imlauncher
    32 #include <imcvlauncher.h>
    32 #include <imcvlauncher.h>
    33 
    33 
    34 
    34 
    35 // system include
    35 // system include
   223 // ---------------------------------------------------------
   223 // ---------------------------------------------------------
   224 //
   224 //
   225 void CVIMPSTUiSearchViewControl::HandleListBoxEventL( CEikListBox* /*aListBox*/,
   225 void CVIMPSTUiSearchViewControl::HandleListBoxEventL( CEikListBox* /*aListBox*/,
   226 												 TListBoxEvent aEventType )
   226 												 TListBoxEvent aEventType )
   227     {
   227     {
       
   228 	TRACER_AUTO;
   228     switch(aEventType)
   229     switch(aEventType)
   229         {
   230         {
   230 
   231 
   231         case EEventItemSingleClicked:
   232         case EEventItemSingleClicked:
   232 
   233 
   286 // CVIMPSTUiSearchViewControl::OpenConversationL(
   287 // CVIMPSTUiSearchViewControl::OpenConversationL(
   287 // (other items were commented in a header).
   288 // (other items were commented in a header).
   288 // ---------------------------------------------------------
   289 // ---------------------------------------------------------
   289 void CVIMPSTUiSearchViewControl::OpenConversationL(const TDesC& aContactId )
   290 void CVIMPSTUiSearchViewControl::OpenConversationL(const TDesC& aContactId )
   290 	{
   291 	{
       
   292 	TRACER_AUTO;
   291 	MVIMPSTProcessArray& arrayProcess = iCommandHandler.GetProcessInterface();
   293 	MVIMPSTProcessArray& arrayProcess = iCommandHandler.GetProcessInterface();
   292 	TInt indexInTabbedView = arrayProcess.FindContactIndexL( aContactId );
   294 	TInt indexInTabbedView = arrayProcess.FindContactIndexL( aContactId );
   293 	TInt result = EAknSoftkeyOk;
   295 	TInt result = EAknSoftkeyOk;
   294 
   296 
   295 	//get the status from engine.
   297 	//get the status from engine.
   334 // (other items were commented in a header).
   336 // (other items were commented in a header).
   335 // ---------------------------------------------------------
   337 // ---------------------------------------------------------
   336 //
   338 //
   337 void CVIMPSTUiSearchViewControl::SizeChanged()
   339 void CVIMPSTUiSearchViewControl::SizeChanged()
   338 	{
   340 	{
       
   341 	TRACER_AUTO;
   339 	if ( iListBox )
   342 	if ( iListBox )
   340         {
   343         {
   341         iListBox->SetRect(Rect());
   344         iListBox->SetRect(Rect());
   342         }  
   345         }  
   343     }
   346     }
   379 // ---------------------------------------------------------
   382 // ---------------------------------------------------------
   380 //
   383 //
   381 TKeyResponse CVIMPSTUiSearchViewControl::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   384 TKeyResponse CVIMPSTUiSearchViewControl::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   382 													TEventCode aType )
   385 													TEventCode aType )
   383 	{
   386 	{
       
   387 	TRACER_AUTO;
   384 	TKeyResponse result = EKeyWasNotConsumed;
   388 	TKeyResponse result = EKeyWasNotConsumed;
   385 
   389 
   386     // Offer key event first to the key event handler
   390     // Offer key event first to the key event handler
   387     if ( iKeyEventHandler && iKeyEventHandler->Pbk2ProcessKeyEventL
   391     if ( iKeyEventHandler && iKeyEventHandler->Pbk2ProcessKeyEventL
   388             ( aKeyEvent, aType ) )
   392             ( aKeyEvent, aType ) )
   420 // CVIMPSTUiSearchViewControl::UpdateListBoxL()
   424 // CVIMPSTUiSearchViewControl::UpdateListBoxL()
   421 // ---------------------------------------------------------
   425 // ---------------------------------------------------------
   422 //
   426 //
   423 void CVIMPSTUiSearchViewControl::UpdateListBoxL(RArray<TVIMPSTSearchData> aSerachData)
   427 void CVIMPSTUiSearchViewControl::UpdateListBoxL(RArray<TVIMPSTSearchData> aSerachData)
   424     {
   428     {
   425 	
   429 	TRACER_AUTO;
   426 	TInt granularity( iItemArray->Count() );
   430 	TInt granularity( iItemArray->Count() );
   427 	++granularity;
   431 	++granularity;
   428 	
   432 	
   429    	CDesCArray* tempArray = new ( ELeave ) CDesCArrayFlat( granularity );
   433    	CDesCArray* tempArray = new ( ELeave ) CDesCArrayFlat( granularity );
   430 	CleanupStack::PushL( tempArray );
   434 	CleanupStack::PushL( tempArray );
   485 // (other items were commented in a header).
   489 // (other items were commented in a header).
   486 // ---------------------------------------------------------
   490 // ---------------------------------------------------------
   487 //
   491 //
   488 HBufC* CVIMPSTUiSearchViewControl::GetFocusedContactLC() const
   492 HBufC* CVIMPSTUiSearchViewControl::GetFocusedContactLC() const
   489 	{
   493 	{
       
   494 	TRACER_AUTO;
   490 	HBufC* retText=NULL;
   495 	HBufC* retText=NULL;
   491 	TInt curIndex = iListBox->CurrentItemIndex();
   496 	TInt curIndex = iListBox->CurrentItemIndex();
   492     TPtrC ptr= iItemArray->MdcaPoint(curIndex);
   497     TPtrC ptr= iItemArray->MdcaPoint(curIndex);
   493     ptr.Set(ptr.Mid(1));  // set pointer from next char :since first char is KTab
   498     ptr.Set(ptr.Mid(1));  // set pointer from next char :since first char is KTab
   494     
   499     
   506 // CVIMPSTUiSearchViewControl::ClearListBoxContents()
   511 // CVIMPSTUiSearchViewControl::ClearListBoxContents()
   507 // ---------------------------------------------------------
   512 // ---------------------------------------------------------
   508 //
   513 //
   509 void CVIMPSTUiSearchViewControl::ClearListBoxContents()
   514 void CVIMPSTUiSearchViewControl::ClearListBoxContents()
   510     {
   515     {
       
   516 	TRACER_AUTO;
   511 	iItemArray->Reset();
   517 	iItemArray->Reset();
   512     TRAPD( err, iListBox->HandleItemRemovalL() );
   518     TRAPD( err, iListBox->HandleItemRemovalL() );
   513     if( err != KErrNone )
   519     if( err != KErrNone )
   514         {
   520         {
   515         CActiveScheduler::Current()->Error( err );
   521         CActiveScheduler::Current()->Error( err );
   521 // Updates Softkeys according to current focus.
   527 // Updates Softkeys according to current focus.
   522 // ---------------------------------------------------------
   528 // ---------------------------------------------------------
   523 //
   529 //
   524 void CVIMPSTUiSearchViewControl::UpdateCbaL( TBool  aUseDefaultCba /*= EFalse*/ )
   530 void CVIMPSTUiSearchViewControl::UpdateCbaL( TBool  aUseDefaultCba /*= EFalse*/ )
   525     {
   531     {
       
   532 	TRACER_AUTO;
   526     TInt cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_BACK__EMPTY;
   533     TInt cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_BACK__EMPTY;
   527     iCurrentCmdToExe = -1;
   534     iCurrentCmdToExe = -1;
   528     TInt index = KErrNotFound;
   535     TInt index = KErrNotFound;
   529     if ( !iCba ) 
   536     if ( !iCba ) 
   530         {
   537         {
   545 		}
   552 		}
   546 	else //some results are there, hence update it to add to contacts.
   553 	else //some results are there, hence update it to add to contacts.
   547 		{
   554 		{
   548 		if(iSearchView.HideAddToContactsL())
   555 		if(iSearchView.HideAddToContactsL())
   549 		    {			
   556 		    {			
   550 		    CHAT_DP( D_CHAT_LIT("CVIMPSTUiDoubleListboxArray::HideAddToContactsL after" ) );		
   557 		   TRACE(" after"  );		
   551 		    HBufC* contactId = GetFocusedContactLC();
   558 		    HBufC* contactId = GetFocusedContactLC();
   552 		    TInt curIndex = iCommandHandler.GetProcessInterface().FindContactIndexL(*contactId); 
   559 		    TInt curIndex = iCommandHandler.GetProcessInterface().FindContactIndexL(*contactId); 
   553 		    TVIMPSTEnums::TOnlineStatus onlinestatus = iCommandHandler.GetProcessInterface().GetOnlineStatusL(curIndex);   
   560 		    TVIMPSTEnums::TOnlineStatus onlinestatus = iCommandHandler.GetProcessInterface().GetOnlineStatusL(curIndex);   
   554 		    CleanupStack::PopAndDestroy(contactId);
   561 		    CleanupStack::PopAndDestroy(contactId);
   555 		    if( TVIMPSTEnums::EPending == onlinestatus )
   562 		    if( TVIMPSTEnums::EPending == onlinestatus )
   556 		        {
   563 		        {
   557 		        CHAT_DP( D_CHAT_LIT("CVIMPSTUiDoubleListboxArray::EPending in" ) );		
   564 		        TRACE(" EPending in"  );		
   558 		        cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_BACK__EMPTY;
   565 		        cbaRes = R_SERVTAB_SOFTKEYS_OPTIONS_BACK__EMPTY;
   559 		        iCurrentCmdToExe = -1;    
   566 		        iCurrentCmdToExe = -1;    
   560 		        }
   567 		        }
   561 		    else
   568 		    else
   562 		        {
   569 		        {
   563 		        CHAT_DP( D_CHAT_LIT("CVIMPSTUiDoubleListboxArray::ESearchOpenConversation" ) );		
   570 		        TRACE("ESearchOpenConversation"  );		
   564 		        cbaRes = R_SERVTAB_SOFTKEYS_OPTION_SEARCH_OPENCONV__BACK;
   571 		        cbaRes = R_SERVTAB_SOFTKEYS_OPTION_SEARCH_OPENCONV__BACK;
   565 		        iCurrentCmdToExe = ESearchOpenConversation;    
   572 		        iCurrentCmdToExe = ESearchOpenConversation;    
   566 		        }
   573 		        }
   567 
   574 
   568 		    }
   575 		    }