phonebookui/pbkcommonui/inc/cntfetchcontactsview.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:42:23 +0300
changeset 31 2a11b5b00470
child 37 fd64c38c277d
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* 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 CntFetchContacts_H_
#define CntFetchContacts_H_

#include <hbabstractitemview.h>
#include <hbwidget.h>
#include <hbtextitem.h>
#include <cntviewparams.h>
#include <QSet>

class HbDialog;
class HbSearchPanel;
class HbAction;
class HbListView;
class HbLabel;
class HbStaticVkbHost;
class HbIndexFeedback;

class MobCntModel;
class QGraphicsLinearLayout;

QTM_BEGIN_NAMESPACE
class QContact;
QTM_END_NAMESPACE

QTM_USE_NAMESPACE

class CntFetchContacts : public QObject
    {
    Q_OBJECT

public:
    CntFetchContacts(QContactManager *aManager);
    ~CntFetchContacts();
    
    enum DisplayType {
        view,
        popup
    };
    
private slots:
    void memberSelectionChanged(const QModelIndex &index);
    
    void closeFind();
    void setFilter(const QString &filterString);
    
    void handleKeypadOpen();
    void handleKeypadClose();
    
    void handleUserResponse(HbAction* action);
    
public:
    void displayContacts(DisplayType aType, HbAbstractItemView::SelectionMode aMode, QSet<QContactLocalId> aContacts);
    
    QSet<QContactLocalId> getSelectedContacts() const;
    bool wasCanceled() const;
    void setDetails(QString aTitle, QString aButtonText);

private:
    void doInitialize(HbAbstractItemView::SelectionMode aMode,
                                  QSet<QContactLocalId> aContacts);
    void connectSignal();
    void showPopup();
    void markMembersInView();
    
signals:
    void clicked();

private:
    HbDialog*                          mPopup;
    HbSearchPanel*                     mSearchPanel;
    MobCntModel*                       mCntModel;
    HbListView*                        mListView;
    QGraphicsLinearLayout*             mLayout;
    HbTextItem*                        mEmptyListLabel;
    HbWidget*                          mContainerWidget;
    HbAbstractItemView::SelectionMode  mSelectionMode;
    QSet<QContactLocalId>              mCurrentlySelected;
    QContactManager*                   mManager;
    bool                               mWasCanceled;
    HbLabel*                           mLabel;
    HbStaticVkbHost*                   mVirtualKeyboard;
    QString                            mButtonText;
    HbAction*                          mPrimaryAction;
    HbAction*                          mSecondaryAction;
    HbIndexFeedback*                   mIndexFeedback;
    };

#endif /* CntFetchContacts_H_ */