qcontactlistmodel_p.h Example File
incomingcalls/qcontactlistmodel_p.h
#ifndef QCONTACTLISTMODEL_P_H
#define QCONTACTLISTMODEL_P_H
#include "qtcontactsglobal.h"
#include "qcontactphonenumber.h"
#include "qcontactrequests.h"
#include "qcontactlistmodel.h"
#include <QSharedData>
#include <QMap>
QTM_USE_NAMESPACE
class QContactListModelPrivate : public QSharedData
{
public:
QContactListModelPrivate()
: QSharedData(),
m_manager(0),
m_requestPolicy(QContactListModel::CancelOnCacheMissPolicy),
m_halfCacheSize(10),
m_quarterCacheSize(5),
m_lastCacheCentreRow(-1),
m_currentRow(-1),
m_relevantDefinitionName(QString(QLatin1String(QContactPhoneNumber::DefinitionName))),
m_relevantFieldName(QString(QLatin1String(QContactPhoneNumber::FieldNumber))),
m_idRequest(0)
{
}
QContactListModelPrivate(const QContactListModelPrivate& other)
: QSharedData(other),
m_idsToRows(other.m_idsToRows),
m_rowsToIds(other.m_rowsToIds),
m_manager(other.m_manager),
m_requestPolicy(other.m_requestPolicy),
m_halfCacheSize(other.m_halfCacheSize),
m_quarterCacheSize(other.m_quarterCacheSize),
m_cache(other.m_cache),
m_lastCacheCentreRow(other.m_lastCacheCentreRow),
m_currentRow(other.m_currentRow),
m_requestCentreRows(other.m_requestCentreRows),
m_relevantDefinitionName(other.m_relevantDefinitionName),
m_relevantFieldName(other.m_relevantFieldName),
m_idRequest(other.m_idRequest)
{
}
~QContactListModelPrivate()
{
if (m_idRequest) {
m_idRequest->cancel();
delete m_idRequest;
}
QList<QContactAbstractRequest*> requests = m_requestCentreRows.keys();
for (int i = 0; i < requests.size(); i++) {
QContactAbstractRequest* current = requests.at(i);
current->cancel();
m_requestCentreRows.remove(current);
delete current;
}
}
QMap<QContactLocalId, int> m_idsToRows;
QMap<int, QContactLocalId> m_rowsToIds;
QContactManager* m_manager;
QContactListModel::AsynchronousRequestPolicy m_requestPolicy;
int m_halfCacheSize;
int m_quarterCacheSize;
mutable QMap<int, QContact> m_cache;
mutable int m_lastCacheCentreRow;
mutable int m_currentRow;
mutable QMap<QContactAbstractRequest*, int> m_requestCentreRows;
QString m_relevantDefinitionName;
QString m_relevantFieldName;
QContactLocalIdFetchRequest* m_idRequest;
};
#endif
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) |
Trademarks |
Qt Mobility Project 1.0.0 (Technology Preview) |