messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h
changeset 37 518b245aa84c
child 62 fdbe8253b596
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
       
     1 /*
       
     2  * Copyright (c) 2009 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: Widget for displaying attachment media objects.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef UNI_VIEWER_ATTACHMENT_WIDGET_H
       
    19 #define UNI_VIEWER_ATTACHMENT_WIDGET_H
       
    20 
       
    21 // SYSTEM INCLUDES
       
    22 #include <HbWidget>
       
    23 
       
    24 // FORWARD DECLARATIONS
       
    25 class HbTextItem;
       
    26 class HbIconItem;
       
    27 class HbIcon;
       
    28 class HbFrameItem;
       
    29 class UniViewerUtils;
       
    30 class UniMessageInfo;
       
    31 
       
    32 /**
       
    33  * @class UniViewerAttachmentWidget
       
    34  * @brief Widget for displaying attachment media objects.
       
    35  */
       
    36 class UniViewerAttachmentWidget: public HbWidget
       
    37 {
       
    38 Q_OBJECT
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Constructor
       
    44      */
       
    45     explicit UniViewerAttachmentWidget(QGraphicsItem *parent = 0);
       
    46 
       
    47     /**
       
    48      * Destructor
       
    49      */
       
    50     virtual ~UniViewerAttachmentWidget();
       
    51 
       
    52     /**
       
    53      * Populates the widget contents.
       
    54      * @param info Object information.
       
    55      */
       
    56     void populate(UniMessageInfo *info);
       
    57 
       
    58 signals:
       
    59 
       
    60     /**
       
    61      * Signal emitted when widget is clicked.
       
    62      * @param mediaPath File path of the media.
       
    63      */
       
    64     void shortTap(const QString &mediaPath);
       
    65 
       
    66     /**
       
    67      * Signal emitted when widget is long tapped.
       
    68      * @param position Scene coordinates of tap.
       
    69      */
       
    70     void longTap(const QPointF &position);
       
    71 
       
    72 protected:
       
    73 
       
    74     /**
       
    75      * Event handler for gesture events.
       
    76      * Reimplemented from HbWidgetBase.
       
    77      * @see HbWidgetBase
       
    78      */
       
    79     virtual void gestureEvent(QGestureEvent *event);
       
    80 
       
    81 private slots:
       
    82 
       
    83     /**
       
    84      * Handles opening of media.
       
    85      */
       
    86     void handleOpen();
       
    87 
       
    88     /**
       
    89      * Handles saving of media.
       
    90      */
       
    91     void handleSave();
       
    92     
       
    93     /**
       
    94      * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
       
    95      * events back to back.  
       
    96      */
       
    97     void regrabGesture();
       
    98 
       
    99 private:
       
   100 
       
   101     /**
       
   102      * Handles short tap event.
       
   103      */
       
   104     void handleShortTap();
       
   105 
       
   106     /**
       
   107      * Handles long tap event.
       
   108      * @param position Scene coordinates of tap.
       
   109      */
       
   110     void handleLongTap(const QPointF &position);
       
   111 
       
   112     /**
       
   113      * Handles pressed state.
       
   114      */
       
   115     void setPressed(bool pressed);
       
   116 
       
   117 private:
       
   118 
       
   119     /**
       
   120      * Media icon item.
       
   121      * Own
       
   122      */
       
   123     HbIconItem *mMediaIcon;
       
   124 
       
   125     /**
       
   126      * Media name text item.
       
   127      * Own
       
   128      */
       
   129     HbTextItem *mName;
       
   130 
       
   131     /**
       
   132      * Media information text item.
       
   133      * Own
       
   134      */
       
   135     HbTextItem *mInfo;
       
   136 
       
   137     /**
       
   138      * Background item of widget.
       
   139      * Own
       
   140      */
       
   141     HbFrameItem *mFrameItem;
       
   142 
       
   143     /**
       
   144      * UniViewerUtils object.
       
   145      * Own
       
   146      */
       
   147     UniViewerUtils *mViewerUtils;
       
   148 
       
   149     /**
       
   150      * Media file path.
       
   151      */
       
   152     QString mMediaPath;
       
   153 
       
   154     /**
       
   155      * Mime type of media.
       
   156      */
       
   157     QString mMimeType;
       
   158 };
       
   159 
       
   160 #endif // UNI_VIEWER_ATTACHMENT_WIDGET_H
       
   161 // EOF