emailservices/nmutilities/src/nmcontacthistorymodelitem.cpp
changeset 75 47d84de1c893
child 76 38bf5461e270
equal deleted inserted replaced
72:64e38f08e49c 75:47d84de1c893
       
     1 /*
       
     2 * Copyright (c) 2010 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: Implementation of NmContactHistoryModelItem
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QList>
       
    19 
       
    20 #include "nmcontacthistorymodel.h"
       
    21 #include "nmcontacthistorymodel_p.h"
       
    22 
       
    23 // --------------------------------------------------------------------------
       
    24 // Start of implementation (NmContactHistoryModelItem)
       
    25 // --------------------------------------------------------------------------
       
    26 /*!
       
    27      Not meant to be used alone.
       
    28 */
       
    29 NmContactHistoryModelItem::NmContactHistoryModelItem()
       
    30 {
       
    31     d = new NmContactHistoryModelItemData();
       
    32 }
       
    33 
       
    34 /*!
       
    35     Not meant to be used alone.
       
    36 */
       
    37 NmContactHistoryModelItem::NmContactHistoryModelItem(
       
    38     const NmContactHistoryModelItem &other)
       
    39 {
       
    40     d = other.d;
       
    41 }
       
    42 
       
    43 /*!
       
    44     Not meant to be used alone.
       
    45 */
       
    46 NmContactHistoryModelItem::~NmContactHistoryModelItem()
       
    47 {
       
    48 }
       
    49 
       
    50 /*!
       
    51     Not meant to be used alone.
       
    52 */
       
    53 unsigned int NmContactHistoryModelItem::contactId() const
       
    54 {
       
    55     return d->mContactId;
       
    56 }
       
    57 
       
    58 /*!
       
    59     Not meant to be used alone.
       
    60 */
       
    61 void NmContactHistoryModelItem::setContactId(unsigned int contactId)
       
    62 {
       
    63     d->mContactId = contactId;
       
    64 }
       
    65 
       
    66 /*!
       
    67     Not meant to be used alone.
       
    68 */
       
    69 int NmContactHistoryModelItem::subItemCount() const
       
    70 {
       
    71     return d->mItems.count();
       
    72 }
       
    73 
       
    74 /*!
       
    75     Not meant to be used alone.
       
    76 */
       
    77 NmContactHistoryModelSubItem NmContactHistoryModelItem::subItemAt(
       
    78     int index) const
       
    79 {
       
    80     if ( index <= d->mItems.count() )
       
    81     {
       
    82         return d->mItems[index];
       
    83     }
       
    84     else
       
    85     {
       
    86         return NmContactHistoryModelSubItem();
       
    87     }
       
    88 }
       
    89 
       
    90 /*!
       
    91     Returns SubEntries from private list
       
    92     First entry is contact name
       
    93     Second entry is email address / phone number
       
    94 
       
    95     \return List of items.
       
    96 */
       
    97 QList<NmContactHistoryModelSubItem> NmContactHistoryModelItem::subEntries(
       
    98     ) const
       
    99 {
       
   100     QList<NmContactHistoryModelSubItem> subItemList;
       
   101 
       
   102     if (!d->mItems.isEmpty())
       
   103     {
       
   104         for ( int subIndex = 0; subIndex < d->mItems.count(); subIndex++)
       
   105         {
       
   106             subItemList.append(d->mItems[subIndex]);
       
   107         }
       
   108     }
       
   109 
       
   110     return subItemList;
       
   111 }
       
   112 
       
   113 /*!
       
   114     Public - Appends subItem to private list
       
   115 
       
   116     \param entry subItem to be appended
       
   117 */
       
   118 void NmContactHistoryModelItem::appendSubItem(
       
   119     NmContactHistoryModelSubItem entry)
       
   120 {
       
   121     d->mItems.append(entry);
       
   122 }
       
   123 // --------------------------------------------------------------------------
       
   124 // End of implementation (NmContactHistoryModelItem)
       
   125 // --------------------------------------------------------------------------/*!