diff -r 64e38f08e49c -r 47d84de1c893 emailservices/nmutilities/inc/nmcontacthistorymodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailservices/nmutilities/inc/nmcontacthistorymodel_p.h Mon Oct 04 00:05:37 2010 +0300 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Private declaration of Contact History Model API +* +*/ + +#ifndef NMCONTACTHISTORYMODELPRIVATE_H +#define NMCONTACTHISTORYMODELPRIVATE_H + +#include +#include +#include + +#include "nmcontacthistorymodel.h" + +QTM_USE_NAMESPACE + +class NmContactHistoryModelItemData : public QSharedData +{ +public: + +NmContactHistoryModelItemData() : + mContactId(0xDEAD) +{ + +} + +~NmContactHistoryModelItemData() +{ + mItems.clear(); +} + + unsigned int mContactId; + QList mItems; +}; + +class NmContactHistoryModelPrivate : public QObject +{ + + enum nameOrder + { + LastNameFirstName = 0x0, + LastNameCommaFirstName = 0x1, + FirstNameLastName = 0x2 + }; + +Q_OBJECT + +public: + + NmContactHistoryModelPrivate(const NmContactHistoryModelType modelType); + ~NmContactHistoryModelPrivate(); + +signals: + + void queryCompleted(int err); + +private: + + void queryDatabases(const QString &query); + + // Helper functions that are used by queryDatabases(); + bool queryMruDatabase(const QString &query); + QList queryContactDatabase(const QString &query); + + void populateListWithMruItems(const QString &query); + + void populateListWithContactItems(const QList cnt_ids, + const QString &query); + + + int rowCount(const QModelIndex &parent) const; + QVariant data(const QModelIndex &index, int role) const; + void refreshDataModel(); + + bool fillMruMatchList(); + QString obeyContactOrder(const QString &firstName, const QString &lastName); + +private: + + // Member variables + NmContactHistoryModelType mType; + QList mModelItemList; + QList< QSharedPointer > mPrivateItemList; + QContactManager *mContactManager; + QHash mMruList; + QMap mMruMatches; + bool mModelReady; + TUint32 mNameOrder; + +private: // Friend definitions + + friend class NmContactHistoryModel; + friend class TestNmContactHistoryModelPrivate; +}; + +#endif //NMCONTACTHISTORYMODELPRIVATE_H