phonebookui/cnthistorymodel/cnthistorymodel.h
changeset 81 640d30f4fb64
equal deleted inserted replaced
77:c18f9fa7f42e 81:640d30f4fb64
       
     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:
       
    15 *
       
    16 */
       
    17 #ifndef CNTHISTORYMODEL_H
       
    18 #define CNTHISTORYMODEL_H
       
    19 
       
    20 #include <QAbstractListModel>
       
    21 #include <QSharedData>
       
    22 #include <qmobilityglobal.h>
       
    23 #include <qcontactid.h>
       
    24 
       
    25 #include "cnthistorymodelconsts.h"
       
    26 #include "cnthistorymodelglobal.h"
       
    27 
       
    28 QTM_BEGIN_NAMESPACE
       
    29 class QContactManager;
       
    30 QTM_END_NAMESPACE
       
    31 
       
    32 QTM_USE_NAMESPACE
       
    33 
       
    34 class CntHistoryModelPrivate;
       
    35 
       
    36 /*!
       
    37  * CntHistoryModel is a model used to fetch conversation history
       
    38  * (SMS & call logs) from databases. It will 
       
    39  * cache content from the databases to be displayed on the screen
       
    40  * by the conversation view.
       
    41  * 
       
    42  * Note that that this is a prototype implementation and does
       
    43  * not yet support more advanced features.
       
    44  */
       
    45 class CNTHISTORYMODEL_EXPORT CntHistoryModel : public QAbstractListModel
       
    46 {    
       
    47     Q_OBJECT
       
    48     
       
    49 public:
       
    50     CntHistoryModel(QContactLocalId contactId,
       
    51                     QContactManager* manager,
       
    52                     QObject *parent = 0);
       
    53     ~CntHistoryModel();
       
    54     
       
    55 public: // from QAbstractTableModel/QAbstractItemModel
       
    56     QVariant data(const QModelIndex& index, int role) const;
       
    57     int rowCount(const QModelIndex& parent = QModelIndex()) const;
       
    58 
       
    59 public:
       
    60     void clearHistory();
       
    61     void markAllAsSeen();
       
    62     void sortAndRefresh(Qt::SortOrder order = Qt::AscendingOrder);
       
    63 
       
    64 private:
       
    65     void doBeginInsertRows(const QModelIndex &parent, int first, int last);
       
    66     void doEndInsertRows();
       
    67     void doBeginRemoveRows(const QModelIndex &parent, int first, int last);
       
    68     void doEndRemoveRows();
       
    69     void doBeginResetModel();
       
    70     void doEndResetModel();
       
    71     void doDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
       
    72     
       
    73 private:
       
    74 	CntHistoryModelPrivate* const d_ptr;
       
    75     Q_DECLARE_PRIVATE_D(d_ptr, CntHistoryModel)
       
    76     Q_DISABLE_COPY(CntHistoryModel)
       
    77     
       
    78     // Testing related friend definitions
       
    79     friend class TestCntHistoryModel;
       
    80 };
       
    81 
       
    82 #endif