phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxrow.cpp
branchRCL_3
changeset 21 b3431bff8c19
parent 15 e8e3147d53eb
child 23 5586b4d2ec3e
equal deleted inserted replaced
15:e8e3147d53eb 21:b3431bff8c19
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  Listbox model row for MyCard details list
       
    15  *
       
    16  */
       
    17 
       
    18 #include "ccappmycardlistboxrow.h"
       
    19 
       
    20 // ======== MEMBER FUNCTIONS ========
       
    21 
       
    22 // --------------------------------------------------------------------------
       
    23 // CCCAppMyCardListBoxRow::CCCAppMyCardListBoxRow
       
    24 // --------------------------------------------------------------------------
       
    25 //
       
    26 inline CCCAppMyCardListBoxRow::CCCAppMyCardListBoxRow()
       
    27     {
       
    28     }
       
    29 
       
    30 // --------------------------------------------------------------------------
       
    31 // CCCAppMyCardListBoxRow::~CCCAppMyCardListBoxRow
       
    32 // --------------------------------------------------------------------------
       
    33 //
       
    34 CCCAppMyCardListBoxRow::~CCCAppMyCardListBoxRow()
       
    35     {
       
    36     iColumns.ResetAndDestroy();
       
    37     }
       
    38 
       
    39 // --------------------------------------------------------------------------
       
    40 // CCCAppMyCardListBoxRow::NewL
       
    41 // --------------------------------------------------------------------------
       
    42 //
       
    43 CCCAppMyCardListBoxRow* CCCAppMyCardListBoxRow::NewL()
       
    44     {
       
    45     return new (ELeave) CCCAppMyCardListBoxRow;
       
    46     }
       
    47 
       
    48 // --------------------------------------------------------------------------
       
    49 // CCCAppMyCardListBoxRow::ColumnCount
       
    50 // --------------------------------------------------------------------------
       
    51 //
       
    52 TInt CCCAppMyCardListBoxRow::ColumnCount() const
       
    53     {
       
    54     return iColumns.Count();
       
    55     }
       
    56 
       
    57 // --------------------------------------------------------------------------
       
    58 // CCCAppMyCardListBoxRow::At
       
    59 // --------------------------------------------------------------------------
       
    60 //
       
    61 TPtrC CCCAppMyCardListBoxRow::At(TInt aColumnIndex) const
       
    62     {
       
    63     return *iColumns[aColumnIndex];
       
    64     }
       
    65 
       
    66 // --------------------------------------------------------------------------
       
    67 // CCCAppMyCardListBoxRow::AppendColumnL
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 void CCCAppMyCardListBoxRow::AppendColumnL(const TDesC& aColumnText)
       
    71     {
       
    72     HBufC* buf = aColumnText.AllocLC();
       
    73     iColumns.AppendL( buf );
       
    74     CleanupStack::Pop( buf );
       
    75     }
       
    76 
       
    77 // --------------------------------------------------------------------------
       
    78 // CCCAppMyCardListBoxRow::IsClipRequired
       
    79 // --------------------------------------------------------------------------
       
    80 //
       
    81 TBool CCCAppMyCardListBoxRow::IsClipRequired() const
       
    82     {
       
    83     return iClipBeginning;
       
    84     }
       
    85 
       
    86 // --------------------------------------------------------------------------
       
    87 // CCCAppMyCardListBoxRow::SetClipRequired
       
    88 // --------------------------------------------------------------------------
       
    89 //
       
    90 void CCCAppMyCardListBoxRow::SetClipRequired(TBool aFlag)
       
    91     {
       
    92     iClipBeginning = aFlag;
       
    93     }
       
    94 
       
    95 // --------------------------------------------------------------------------
       
    96 // CCCAppMyCardListBoxRow::TotalLength
       
    97 // --------------------------------------------------------------------------
       
    98 //
       
    99 TInt CCCAppMyCardListBoxRow::TotalLength() const
       
   100     {
       
   101     TInt result = 0;
       
   102     const TInt count = iColumns.Count();
       
   103     for (TInt i = 0; i < count; ++i)
       
   104         {
       
   105         result += At(i).Length();
       
   106         }
       
   107     return result;
       
   108     }
       
   109 
       
   110 // --------------------------------------------------------------------------
       
   111 // CCCAppMyCardListBoxRow::MaxColumnLength
       
   112 // --------------------------------------------------------------------------
       
   113 //
       
   114 TInt CCCAppMyCardListBoxRow::MaxColumnLength() const
       
   115     {
       
   116     TInt result = 0;
       
   117     const TInt count = iColumns.Count();
       
   118     for (TInt i = 0; i < count; ++i)
       
   119         {
       
   120         result = Max(result, At(i).Length());
       
   121         }
       
   122     return result;
       
   123     }
       
   124 
       
   125 // End of File