phonebookui/pbkcommonui/inc/cntcontactcarddetailitem.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 17 Sep 2010 08:27:32 +0300
changeset 71 7cc7d74059f9
parent 46 efe85016a067
permissions -rw-r--r--
Revision: 201035 Kit: 201037

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

#include <QObject>
#include <hbwidget.h>

class HbIconItem;
class HbTextItem;
class QGraphicsGridLayout;
class HbFrameItem;
class CntContactCardDataItem;

class CntContactCardDetailItem : public HbWidget
{
    Q_OBJECT
    Q_PROPERTY( QString text READ getText )
    Q_PROPERTY( QString valueText READ getValueText )
    Q_PROPERTY( HbIcon icon READ getIcon )
    Q_PROPERTY( HbIcon secondaryIcon READ getSecondaryIcon )

public:
    CntContactCardDetailItem(int index, QGraphicsItem *parent = 0, bool isFocusable = true);
    ~CntContactCardDetailItem();

protected:
    void gestureEvent(QGestureEvent* event);
    
public:
    void initGesture();
    void createPrimitives();
    void recreatePrimitives();
    void updatePrimitives();
    void setDetails(CntContactCardDataItem* aDataItem);
    //To update the secondary icon item. Used for
    //maptile progress icon updation.
    void setSecondaryIconItem( HbIcon aIcon );
    int index();

public slots:
    void onLongPress(const QPointF &point);

signals:
    void clicked();
    void longPressed(const QPointF &point);
    
private:
    QString getText() const { return text; }
    QString getValueText() const { return valueText; }
    HbIcon getIcon() const { return icon; }
    HbIcon getSecondaryIcon() const { return secondaryIcon; }

private:
    HbIconItem              *mIcon;
    HbIconItem              *mSecondaryIcon;
    HbTextItem              *mFirstLineText;
    HbTextItem              *mSecondLineText;
    HbFrameItem             *mFrameItem;
    HbFrameItem             *mFocusItem;
    bool                    mHasFocus;
    int                     mIndex;
    bool                    mIsFocusable;
    Qt::TextElideMode       mValueTextElideMode;
    bool                    mIsUnderline;

    QString                 text;
    QString                 valueText;
    HbIcon                  icon;
    HbIcon                  secondaryIcon;
    
friend class TestCntContactCardDetailItem;
};

#endif // CNTCOMMLAUNCHERDETAILITEM_H