--- a/phonebookui/cnthistorymodel/inc/cnthistorymodel.h Wed Jun 23 18:02:44 2010 +0300
+++ b/phonebookui/cnthistorymodel/inc/cnthistorymodel.h Tue Jul 06 14:05:47 2010 +0300
@@ -21,7 +21,9 @@
#include <QSharedData>
#include <qmobilityglobal.h>
#include <qcontactid.h>
+#include "cntglobal.h"
+#include "cnthistorymodelconsts.h"
#include "cnthistorymodelglobal.h"
QTM_BEGIN_NAMESPACE
@@ -30,10 +32,7 @@
QTM_USE_NAMESPACE
-class CntHistoryModelData;
-class LogsEvent;
-class HistoryItem;
-class MsgItem;
+class CntHistoryModelPrivate;
/*!
* CntHistoryModel is a model used to fetch conversation history
@@ -49,34 +48,6 @@
Q_OBJECT
public:
- enum Attributes
- {
- Incoming = 1,
- Outgoing = 2,
- Unseen = 4,
- Seen = 8,
- Attachment = 16
- };
-
- enum ItemType
- {
- CallLog = 32,
- Message = 64
- };
- enum Icon
- {
- MissedCall = 128,
- ReceivedCall = 256,
- DialledCall = 512
- };
-
- enum CustomRoles
- {
- FlagsRole = Qt::UserRole + 1,
- PhoneNumberRole
- };
-
-public:
CntHistoryModel(QContactLocalId contactId,
QContactManager* manager,
QObject *parent = 0);
@@ -86,41 +57,26 @@
QVariant data(const QModelIndex& index, int role) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const;
void sort(int column = 0, Qt::SortOrder order = Qt::AscendingOrder);
+
+public:
void clearHistory();
void markAllAsSeen();
void sortAndRefresh(Qt::SortOrder order = Qt::AscendingOrder);
+
+private:
+ void doBeginInsertRows(const QModelIndex &parent, int first, int last);
+ void doEndInsertRows();
+ void doBeginRemoveRows(const QModelIndex &parent, int first, int last);
+ void doEndRemoveRows();
+ void doDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
private:
- void initializeModel();
- QVariant displayRoleData(const HistoryItem& item) const;
- QVariant decorationRoleData(const HistoryItem& item) const;
- QVariant backgroundRoleData(const HistoryItem& item) const;
+ CntHistoryModelPrivate* const d_ptr;
+ Q_DECLARE_PRIVATE_D(d_ptr, CntHistoryModel)
+ Q_DISABLE_COPY(CntHistoryModel)
- // Utility finctions
- void readLogEvent(LogsEvent* event, HistoryItem& item);
- void readMsgEvent(MsgItem& event, HistoryItem& item);
- void initializeLogsModel();
- void initializeMsgModel();
- bool validateRowIndex(const int index) const;
- QList< QList<int> > findIndices( const QList< int >& indices );
-
-private slots:
- // Logs model slots
- void logsRowsInserted(const QModelIndex& parent, int first, int last);
- void logsRowsRemoved(const QModelIndex& parent, int first, int last);
- void logsDataChanged(const QModelIndex& first, const QModelIndex& last);
- void handleLogsReset();
-
- // Messaging model slots
- void messagesReady(QList<MsgItem>& msgs);
- void messageAdded(MsgItem& msg);
- void messageChanged(MsgItem& msg);
- void messageDeleted(MsgItem& msg);
-
-private:
- QSharedDataPointer<CntHistoryModelData> d;
-
- // Testing related friend definitions
+ // Testing related friend definitions
friend class TestCntHistoryModel;
};
+
#endif