emailservices/nmutilities/tsrc/unittests/unittest_nmcontacthistorymodel/nmcnthistorystub.cpp
changeset 74 6c59112cfd31
equal deleted inserted replaced
69:4e54af54a4a1 74:6c59112cfd31
       
     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: Private implementation of Contact History Model API
       
    15 *
       
    16 */
       
    17 
       
    18 extern bool constructorCalled;
       
    19 extern bool destructorCalled;
       
    20 extern bool rowcountCalled;
       
    21 extern bool dataCalled;
       
    22 extern bool modelcompletedCalled;
       
    23 extern bool queryCalled;
       
    24 extern bool refreshdatamodelCalled;
       
    25 extern bool handlequerycompletedCalled;
       
    26 
       
    27 #include "nmcontacthistorymodel_p.h"
       
    28 
       
    29 // --------------------------------------------------------------------------
       
    30 // Start of implementation (NmContactHistoryModelPrivate)
       
    31 // --------------------------------------------------------------------------
       
    32 /*!
       
    33     Constructor of NmContactHistoryModelPrivate
       
    34 
       
    35     \param type The valid values are described by
       
    36     NmContactHistoryModelPrivate::HistoryModelType enum.
       
    37 */
       
    38 NmContactHistoryModelPrivate::NmContactHistoryModelPrivate(
       
    39     const NmContactHistoryModelType modelType) :
       
    40     mType(modelType),
       
    41     mSignalConnected(false)
       
    42 {
       
    43     constructorCalled = true;
       
    44     mPrivateItemList.append("DUMMYDATA");
       
    45 }
       
    46 
       
    47 /*!
       
    48     Destructor of ContactHistoryModel
       
    49 */
       
    50 NmContactHistoryModelPrivate::~NmContactHistoryModelPrivate()
       
    51 {
       
    52     destructorCalled = true;
       
    53 }
       
    54 
       
    55 /*!
       
    56     Searches contact & MRU  databases according to query parameters.
       
    57     Emits QueryCompleted() when ready.
       
    58 
       
    59     \param query Text to be searched
       
    60     \return none
       
    61 
       
    62     Note:: QContactManager supports max. ten characters long queries.
       
    63 */
       
    64 void NmContactHistoryModelPrivate::queryDatabases(const QString& query)
       
    65 {
       
    66     Q_UNUSED(query);
       
    67     queryCalled = true;
       
    68 }
       
    69 
       
    70 void NmContactHistoryModelPrivate::refreshDataModel()
       
    71 {
       
    72     refreshdatamodelCalled = true;
       
    73 }
       
    74 
       
    75 /*!
       
    76     This is called by public class NmContactHistoryModel when rowcount() is requested
       
    77     Not meant to be used alone.
       
    78 
       
    79 */
       
    80 int NmContactHistoryModelPrivate::modelRowCount(const QModelIndex &parent) const
       
    81 {
       
    82     Q_UNUSED(parent);
       
    83     rowcountCalled = true;
       
    84     return 0;
       
    85 }
       
    86 
       
    87 int NmContactHistoryModelPrivate::privateDataCount() const
       
    88 {
       
    89     rowcountCalled = true;
       
    90     return mPrivateItemList.count();
       
    91 }
       
    92 
       
    93 /*!
       
    94     This is called by public class NmContactHistoryModel when data() is requested
       
    95     Not meant to be used alone.
       
    96 
       
    97 */
       
    98 QVariant NmContactHistoryModelPrivate::data(const QModelIndex &index, int role) const
       
    99 {
       
   100     Q_UNUSED(index);
       
   101     Q_UNUSED(role);
       
   102 
       
   103     dataCalled = true;
       
   104     return QVariant();
       
   105 }
       
   106 
       
   107 void NmContactHistoryModelPrivate::connectNotify ( const char * signal )
       
   108     {
       
   109     QString testSignal = signal;
       
   110     mSignalConnected = true;
       
   111     }
       
   112 
       
   113 // --------------------------------------------------------------------------
       
   114 // End of implementation (NmContactHistoryModelPrivate)
       
   115 // --------------------------------------------------------------------------
       
   116 
       
   117 NmContactHistoryModelItem::NmContactHistoryModelItem()
       
   118 {
       
   119 }
       
   120 
       
   121 /*!
       
   122     Not meant to be used alone.
       
   123 */
       
   124 NmContactHistoryModelItem::NmContactHistoryModelItem(
       
   125     const NmContactHistoryModelItem &other)
       
   126 {
       
   127     Q_UNUSED(other);
       
   128 }
       
   129 
       
   130 /*!
       
   131     Not meant to be used alone.
       
   132 */
       
   133 NmContactHistoryModelItem::~NmContactHistoryModelItem()
       
   134 {
       
   135 }
       
   136 
       
   137 /*!
       
   138     Not meant to be used alone.
       
   139 */
       
   140 unsigned int NmContactHistoryModelItem::contactId() const
       
   141 {
       
   142     return 0;
       
   143 }
       
   144 
       
   145 /*!
       
   146     Not meant to be used alone.
       
   147 */
       
   148 void NmContactHistoryModelItem::setContactId(unsigned int contactId)
       
   149 {
       
   150     Q_UNUSED(contactId);
       
   151 }
       
   152 
       
   153 /*!
       
   154     Not meant to be used alone.
       
   155 */
       
   156 int NmContactHistoryModelItem::subItemCount() const
       
   157 {
       
   158     return 0;
       
   159 }
       
   160 
       
   161 /*!
       
   162     Not meant to be used alone.
       
   163 */
       
   164 NmContactHistoryModelSubItem NmContactHistoryModelItem::subItemAt(
       
   165     int index) const
       
   166 {
       
   167     Q_UNUSED(index);
       
   168     return NmContactHistoryModelSubItem();
       
   169 
       
   170 }
       
   171 
       
   172 /*!
       
   173     Returns SubEntries from private list
       
   174     First entry is contact name
       
   175     Second entry is email address / phone number
       
   176 
       
   177     \return List of items.
       
   178 */
       
   179 QList<NmContactHistoryModelSubItem> NmContactHistoryModelItem::subEntries(
       
   180     ) const
       
   181 {
       
   182     QList<NmContactHistoryModelSubItem> subItemList;
       
   183     return subItemList;
       
   184 }
       
   185 
       
   186 /*!
       
   187     Public - Appends subItem to private list
       
   188 
       
   189     \param entry subItem to be appended
       
   190 */
       
   191 void NmContactHistoryModelItem::appendSubItem(
       
   192     NmContactHistoryModelSubItem entry)
       
   193 {
       
   194     Q_UNUSED(entry);
       
   195 }
       
   196