emailuis/nmailuiwidgets/inc/nmattachmentlistwidget.h
branchRCL_3
changeset 63 d189ee25cf9d
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Attachment list widget
       
    15 *
       
    16 */
       
    17 #ifndef NMATTACHMENTLISTWIDGET_H_
       
    18 #define NMATTACHMENTLISTWIDGET_H_
       
    19 
       
    20 #include <QColor>
       
    21 
       
    22 #include <hbwidget.h>
       
    23 #include "nmailuiwidgetsdef.h"
       
    24 
       
    25 class NmAttachmentListItem;
       
    26 class QGraphicsGridLayout;
       
    27 class QStyleOptionGraphicsItem;
       
    28 class QPainter;
       
    29 
       
    30 class NMAILUIWIDGETS_EXPORT NmAttachmentListWidget : public HbWidget
       
    31 {
       
    32     Q_OBJECT
       
    33         
       
    34 public:
       
    35     NmAttachmentListWidget(QGraphicsItem *parent = 0);
       
    36     virtual ~NmAttachmentListWidget();
       
    37     void setTextColor(const QColor color);
       
    38     void insertAttachment(const int index, const QString &fileName, const QString &fileSize);
       
    39     void removeAttachment(const int index);
       
    40     void setAttachmentSize(int index, const QString &fileSize);
       
    41     int count() const;
       
    42     int progressValue(int index) const;
       
    43     void hideProgressBar(int index);
       
    44     void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,QWidget *widget);
       
    45 
       
    46 public slots:
       
    47     void setProgressBarValue(int index, int value); 
       
    48 
       
    49 private slots:
       
    50     void handleLongPressed(QPointF point);
       
    51     void handleItemActivated();
       
    52     void orientationChanged(Qt::Orientation);
       
    53    
       
    54 protected:
       
    55     virtual void changeEvent(QEvent *event);
       
    56 
       
    57 signals:
       
    58     void itemActivated(int index);
       
    59     void longPressed(int index, QPointF point);
       
    60 
       
    61 private: 
       
    62     void init( );
       
    63     void constructUi();
       
    64     int findItem(const QObject *obj);
       
    65     void insertItemToLayout(NmAttachmentListItem* item);
       
    66     void rearrangeLayout();
       
    67     QColor checkColor();
       
    68         
       
    69 private:
       
    70     Q_DISABLE_COPY(NmAttachmentListWidget)
       
    71     QList<NmAttachmentListItem*> mItemList; //owned
       
    72     QGraphicsGridLayout *mLayout;
       
    73     Qt::Orientation mOrientation;
       
    74     QColor mTextColor;
       
    75 };
       
    76 
       
    77 #endif // NMATTACHMENTLISTWIDGET_H_