uiservicetab/vimpstui/src/cvimpstuidoublelistboxarray.cpp
branchRCL_3
changeset 14 9fdee5e1da30
parent 0 5e5d6b214f4f
equal deleted inserted replaced
13:796276a1bdcc 14:9fdee5e1da30
    22 #include    "vimpstutils.h"
    22 #include    "vimpstutils.h"
    23 #include    "mvimpstprocessarray.h"
    23 #include    "mvimpstprocessarray.h"
    24 #include    "cvimpstuidoublelistboxtabviewcontrol.h" // tab control
    24 #include    "cvimpstuidoublelistboxtabviewcontrol.h" // tab control
    25 #include 	<vimpstuires.rsg>
    25 #include 	<vimpstuires.rsg>
    26 #include    "tvimpstenums.h"
    26 #include    "tvimpstenums.h"
    27 #include    "vimpstdebugprint.h" 
    27 #include "uiservicetabtracer.h"
    28 // platform includes
    28 // platform includes
    29 
    29 
    30 #include    <AknUtils.h>
    30 #include    <AknUtils.h>
    31 #include    <StringLoader.h>
    31 #include    <StringLoader.h>
    32 #include    <AknIconUtils.h>
    32 #include    <AknIconUtils.h>
    45 							            CFormattedCellListBoxData* aListboxData,
    45 							            CFormattedCellListBoxData* aListboxData,
    46 							            CVIMPSTUiDoubleStyleListBox& aListBox,
    46 							            CVIMPSTUiDoubleStyleListBox& aListBox,
    47 							            CVIMPSTUiDoubleListBoxTabViewControl& aTabbedviewControl
    47 							            CVIMPSTUiDoubleListBoxTabViewControl& aTabbedviewControl
    48 							            )
    48 							            )
    49     {
    49     {
       
    50 	TRACER_AUTO;
    50     CVIMPSTUiDoubleListboxArray* self = new (ELeave) CVIMPSTUiDoubleListboxArray( aItemModel, 
    51     CVIMPSTUiDoubleListboxArray* self = new (ELeave) CVIMPSTUiDoubleListboxArray( aItemModel, 
    51     								aListboxData, aListBox,aTabbedviewControl);
    52     								aListboxData, aListBox,aTabbedviewControl);
    52     								
    53     								
    53     CleanupStack::PushL( self );
    54     CleanupStack::PushL( self );
    54     self->ConstructL();
    55     self->ConstructL();
    77     }
    78     }
    78 
    79 
    79 // Symbian OS default constructor can leave.
    80 // Symbian OS default constructor can leave.
    80 void CVIMPSTUiDoubleListboxArray::ConstructL()
    81 void CVIMPSTUiDoubleListboxArray::ConstructL()
    81 	{
    82 	{
    82 	
    83 	TRACER_AUTO;
    83 	 // maximum length of icons appended to identification
    84 	 // maximum length of icons appended to identification
    84     // There can be four icons (A+B and two on D-column)
    85     // There can be four icons (A+B and two on D-column)
    85     iMaxLengthOfIcons =
    86     iMaxLengthOfIcons =
    86         KDefaultAvatar().Length()+  // longest A-Column icon
    87         KDefaultAvatar().Length()+  // longest A-Column icon
    87         (KTab().Length() * 2)+ // length of tabs between items 
    88         (KTab().Length() * 2)+ // length of tabs between items 
   114 // (other items were commented in a header).
   115 // (other items were commented in a header).
   115 // ---------------------------------------------------------
   116 // ---------------------------------------------------------
   116 //
   117 //
   117 TPtrC16 CVIMPSTUiDoubleListboxArray::MdcaPoint( TInt aIndex ) const
   118 TPtrC16 CVIMPSTUiDoubleListboxArray::MdcaPoint( TInt aIndex ) const
   118 	{
   119 	{
   119 	CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::MdcaPoint: aIndex: %d"), aIndex );	    
   120 	TRACER_AUTO;
       
   121 	TRACE(" aIndex: %d", aIndex );	    
   120 	// Although this is a const method, we do change the member data.
   122 	// Although this is a const method, we do change the member data.
   121 	// This is done because of performance
   123 	// This is done because of performance
   122 	// -> no need to create new buffer every time.
   124 	// -> no need to create new buffer every time.
   123     TPtr dataPtr( iData->Des() );
   125     TPtr dataPtr( iData->Des() );
   124     dataPtr.Zero();
   126     dataPtr.Zero();
   125 
   127 
   126   
   128   
   127     // fetch the item and process correct type    
   129     // fetch the item and process correct type    
   128     TVIMPSTEnums::TItem type = iItemArray.GetType(aIndex);
   130     TVIMPSTEnums::TItem type = iItemArray.GetType(aIndex);
   129     CHAT_DP( D_CHAT_LIT(" -> item type: %d"), type );	    
   131     TRACE(" item type: %d", type );	    
   130  
   132  
   131     switch( type )
   133     switch( type )
   132         {
   134         {
   133         case TVIMPSTEnums::EOwnStatusItem:
   135         case TVIMPSTEnums::EOwnStatusItem:
   134 	        {
   136 	        {
   135 	        CHAT_DP( D_CHAT_LIT(" -> own data") );	    
   137 	        TRACE("  own data" );	    
   136 	        TRAP_IGNORE( AppendOwnDataL(dataPtr,aIndex ) );
   138 	        TRAP_IGNORE( AppendOwnDataL(dataPtr,aIndex ) );
   137 	        break;	
   139 	        break;	
   138 	        }	
   140 	        }	
   139         case TVIMPSTEnums::EContactItem: 		
   141         case TVIMPSTEnums::EContactItem: 		
   140         case TVIMPSTEnums::EUnknonContactItem:
   142         case TVIMPSTEnums::EUnknonContactItem:
   143             return iItemArray.GetFormattedString(aIndex);
   145             return iItemArray.GetFormattedString(aIndex);
   144             }
   146             }
   145         default:
   147         default:
   146             {
   148             {
   147             // shouldn't be here
   149             // shouldn't be here
   148             CHAT_DP( D_CHAT_LIT(" -> default") );	    
   150             TRACE(" -> default" );	    
   149             break;
   151             break;
   150             }
   152             }
   151         } //end outer switch
   153         } //end outer switch
   152     
   154     
   153     CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::MdcaPoint out") );	    
   155        
   154     return dataPtr;
   156     return dataPtr;
   155 	}
   157 	}
   156 	
   158 	
   157 
   159 
   158 
   160 
   164 //
   166 //
   165 void CVIMPSTUiDoubleListboxArray::AppendOwnDataL( TPtr& aBuffer,
   167 void CVIMPSTUiDoubleListboxArray::AppendOwnDataL( TPtr& aBuffer,
   166                                       TInt aIndex
   168                                       TInt aIndex
   167                                       ) const
   169                                       ) const
   168     {    
   170     {    
   169     CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::AppendOwnDataL" ) );		
   171 	TRACER_AUTO;		
   170     TVIMPSTEnums::TVIMPSTRegistrationState loginstate = iItemArray.GetLoginState();
   172     TVIMPSTEnums::TVIMPSTRegistrationState loginstate = iItemArray.GetLoginState();
   171     CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::AppendOwnDataL, login state: %d" ), loginstate );		
   173     TRACE("login state: %d" , loginstate );		
   172     TInt avtarIndex = iItemArray.OwnAvatarIndexL();
   174     TInt avtarIndex = iItemArray.OwnAvatarIndexL();
   173 
   175 
   174     if( avtarIndex )
   176     if( avtarIndex )
   175         {
   177         {
   176         TBuf<KAvtarLength> buf;
   178         TBuf<KAvtarLength> buf;
   197 
   199 
   198     // append status text for second line and Icon for column D  based on conditions 
   200     // append status text for second line and Icon for column D  based on conditions 
   199     if (  TVIMPSTEnums::ESVCERegistered == loginstate ) 
   201     if (  TVIMPSTEnums::ESVCERegistered == loginstate ) 
   200         {
   202         {
   201         TVIMPSTEnums::TOnlineStatus status = iItemArray.GetOnlineStatusL(aIndex);
   203         TVIMPSTEnums::TOnlineStatus status = iItemArray.GetOnlineStatusL(aIndex);
   202         CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::AppendOwnDataL, status: %d" ), status );		
   204         TRACE(" status: %d" , status );		
   203         TPtrC statusText = iItemArray.StatusTextL( aIndex );
   205         TPtrC statusText = iItemArray.StatusTextL( aIndex );
   204         if( statusText.Length()  > 0) // if status text show it
   206         if( statusText.Length()  > 0) // if status text show it
   205             {
   207             {
   206             // append only KStatusMsgMaxLenght of status masg
   208             // append only KStatusMsgMaxLenght of status masg
   207             aBuffer.Append( statusText.Left( KStatusMsgMaxLength ) );
   209             aBuffer.Append( statusText.Left( KStatusMsgMaxLength ) );
   263                 }// end case for status text
   265                 }// end case for status text
   264             }
   266             }
   265         // append tab before appending icon
   267         // append tab before appending icon
   266         aBuffer.Append( KTab );
   268         aBuffer.Append( KTab );
   267 
   269 
   268         CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::AppendOwnDataL, handle status enum: %d" ), status );		
   270         TRACE(" handle status enum: %d" , status );		
   269         switch(status)
   271         switch(status)
   270             {
   272             {
   271             case TVIMPSTEnums::EOnline:
   273             case TVIMPSTEnums::EOnline:
   272                 {
   274                 {
   273                 aBuffer.Append( KContactOnlineIconA );
   275                 aBuffer.Append( KContactOnlineIconA );
   312     else 
   314     else 
   313         {
   315         {
   314         // except in  disconnecting state show username
   316         // except in  disconnecting state show username
   315         if(TVIMPSTEnums::ESVCENetworkDisConnecting != loginstate )                               
   317         if(TVIMPSTEnums::ESVCENetworkDisConnecting != loginstate )                               
   316             {
   318             {
   317             CHAT_DP( D_CHAT_LIT("CVIMPSTUiArray::AppendOwnDataL, offline state" ) );		
   319 			TRACE(" offline state" );		
   318             TPtrC userId = iItemArray.LoginUserIdFromStoreL(); 
   320             TPtrC userId = iItemArray.LoginUserIdFromStoreL(); 
   319             aBuffer.Append( VIMPSTUtils::DisplayId( userId ));
   321             aBuffer.Append( VIMPSTUtils::DisplayId( userId ));
   320             }
   322             }
   321         aBuffer.Append( KTab ); // append tab 
   323         aBuffer.Append( KTab ); // append tab 
   322         aBuffer.Append( KEmptyIconC );  // no icon
   324         aBuffer.Append( KEmptyIconC );  // no icon