phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp
branchRCL_3
changeset 23 5586b4d2ec3e
parent 21 b3431bff8c19
child 32 2828b4d142c0
equal deleted inserted replaced
21:b3431bff8c19 23:5586b4d2ec3e
    39 #include <MVPbkContactViewBase.h>
    39 #include <MVPbkContactViewBase.h>
    40 #include <MVPbkViewContact.h>
    40 #include <MVPbkViewContact.h>
    41 #include <MVPbkContactLink.h>
    41 #include <MVPbkContactLink.h>
    42 
    42 
    43 // CONSTANTS
    43 // CONSTANTS
    44 
    44 namespace {
    45 // Character used to replace invalid characters for UI
    45 // Character used to replace invalid characters for UI
    46 const TText KGraphicReplaceCharacter    = ' ';
    46 const TText KGraphicReplaceCharacter    = ' ';
    47 
    47 
    48 // Character used to separate listbox columns
    48 // Character used to separate listbox columns
    49 const TText KListColumnSeparator        = '\t';
    49 const TText KListColumnSeparator        = '\t';
    56 
    56 
    57 // Default formating used for contacts
    57 // Default formating used for contacts
    58 const TInt KDefaultListFormatting =
    58 const TInt KDefaultListFormatting =
    59         MPbk2ContactNameFormatter::EUseSeparator |
    59         MPbk2ContactNameFormatter::EUseSeparator |
    60         MPbk2ContactNameFormatter::EPreserveLeadingSpaces;
    60         MPbk2ContactNameFormatter::EPreserveLeadingSpaces;
       
    61 
       
    62 // iBuffer max size is EMaxListBoxText = 256
       
    63 // -> max length for name data is 100 and max lenght for status data is 100
       
    64 // rest 56 are reserved for icon data
       
    65 const TInt KMaxTxtLength = 100;
       
    66 
       
    67 }
    61 
    68 
    62 // --------------------------------------------------------------------------
    69 // --------------------------------------------------------------------------
    63 // CPbk2ContactViewDoubleListBoxModel::CPbk2ContactViewDoubleListBoxModel
    70 // CPbk2ContactViewDoubleListBoxModel::CPbk2ContactViewDoubleListBoxModel
    64 // --------------------------------------------------------------------------
    71 // --------------------------------------------------------------------------
    65 //
    72 //
   220 
   227 
   221     // (1) Thumbnail icon
   228     // (1) Thumbnail icon
   222     // No element support needed for thumbnail at the moment 
   229     // No element support needed for thumbnail at the moment 
   223 
   230 
   224     // (2) Contact name
   231     // (2) Contact name
   225     AppendName( aElement.TextPtr( MPbk2DoubleListboxDataElement::EName ) );
   232     AppendName( aElement.TextPtr( 
       
   233             MPbk2DoubleListboxDataElement::EName ).Left( KMaxTxtLength ) );
   226     iBuffer.Append( KListColumnSeparator );
   234     iBuffer.Append( KListColumnSeparator );
   227     
   235     
   228     // (3) Secondary text
   236     // (3) Secondary text
   229     TPtr status( aElement.TextPtr( MPbk2DoubleListboxDataElement::EStatusText ) );
   237     TPtr status( aElement.TextPtr( MPbk2DoubleListboxDataElement::EStatusText ) );
   230     AppendText( status );
   238     AppendText( status );
   247     Pbk2PresentationUtils::ReplaceNonGraphicCharacters(
   255     Pbk2PresentationUtils::ReplaceNonGraphicCharacters(
   248         aText, KGraphicReplaceCharacter );
   256         aText, KGraphicReplaceCharacter );
   249     AknTextUtils::ReplaceCharacters(
   257     AknTextUtils::ReplaceCharacters(
   250         aText, KAknReplaceListControlChars, KGraphicReplaceCharacter );
   258         aText, KAknReplaceListControlChars, KGraphicReplaceCharacter );
   251     
   259     
   252     iBuffer.Append( aText );
   260     iBuffer.Append( aText.Left( KMaxTxtLength ) );
   253     iBuffer.Append( KListColumnSeparator );
   261     iBuffer.Append( KListColumnSeparator );
   254     }
   262     }
   255 
   263 
   256 // --------------------------------------------------------------------------
   264 // --------------------------------------------------------------------------
   257 // CPbk2ContactViewDoubleListBoxModel::AppendIconIndexIfFound
   265 // CPbk2ContactViewDoubleListBoxModel::AppendIconIndexIfFound