phonebookui/pbkcommonui/inc/cntcollectionlistmodelworker.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:39:00 +0300
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
child 66 554fe4dbbb59
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2009 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:
*
*/

#ifndef CNTCOLLECTIONLISTMODELWORKER_H
#define CNTCOLLECTIONLISTMODELWORKER_H

#include <QThread>
#include <QMutex>
#include <QPair>

#include <qmobilityglobal.h>

QTM_BEGIN_NAMESPACE
class QContactManager;
QTM_END_NAMESPACE

QTM_USE_NAMESPACE

class CntCollectionListModelWorker : public QThread
{
    Q_OBJECT
    friend class TestCntCollectionListModelWorker;
    
public:
    CntCollectionListModelWorker(QString unnamed, QString noFavs, QString noMembers, int sortOrder);
    ~CntCollectionListModelWorker();
    
    void run();
    bool event(QEvent *event);
    
    void scheduleJob(int id);

private:
    void processJobs();
    void fetchInformation(int id);
    
signals:
    void fetchDone(int id, const QString& secondRowText, int memberCount);
    
private:
    bool                        mStarted;
    bool                        mProcessingJobs;
    bool                        mStopped;
    QMutex                      mMutex;
    
    QList<int>                  mJobs;

    QContactManager            *mManager;
    
    QString                     mUnnamed;
    QString                     mNoFavorites;
    QString                     mNoMembers;
    int                         mSortOrder;
};

#endif // CNTCOLLECTIONLISTMODELWORKER_H