messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h
branchRCL_3
changeset 26 ebe688cedc25
equal deleted inserted replaced
25:fa1df4b99609 26:ebe688cedc25
       
     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:attachment field to show attachment details.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSG_UNIFIED_EDITOR_ATTACHMENT_H
       
    19 #define MSG_UNIFIED_EDITOR_ATTACHMENT_H
       
    20 
       
    21 #include <HbWidget>
       
    22 #include <QList>
       
    23 
       
    24 class HbTextItem;
       
    25 class HbIconItem;
       
    26 class HbGestureSceneFilter;
       
    27 class HbFrameItem;
       
    28 class MsgUnifiedEditorUtils;
       
    29 
       
    30 class MsgUnifiedEditorAttachment : public HbWidget
       
    31     {
       
    32     Q_OBJECT
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Constructor
       
    38      */
       
    39     MsgUnifiedEditorAttachment( const QString& attachmentpath,
       
    40                                 const int filesize,
       
    41                                 QGraphicsItem *parent = 0 );
       
    42 
       
    43     /**
       
    44      * Destructor
       
    45      */
       
    46     ~MsgUnifiedEditorAttachment();
       
    47 
       
    48     /**
       
    49      * Seeker method to get the path of the attachment
       
    50      * @return path of the attachment
       
    51      */
       
    52     const QString& path();
       
    53 
       
    54     /**
       
    55      * Seeker method to get the size of the attachment
       
    56      * @return size in bytes
       
    57      */
       
    58     qreal size();
       
    59 
       
    60     /**
       
    61      * Seeker method to get mimetype of the attachment
       
    62      * @return mimetype
       
    63      */
       
    64     const QString& mimeType();
       
    65 
       
    66     /**
       
    67      * Check if the attachment content is MM content
       
    68      * @return true/false
       
    69      */
       
    70     bool isMultimediaContent();
       
    71     
       
    72 protected:
       
    73     /**
       
    74      * reimplemented from base class.
       
    75      */
       
    76     virtual void gestureEvent(QGestureEvent *event);
       
    77     
       
    78     
       
    79 private:
       
    80    
       
    81     void setPressed(bool pressed);
       
    82 
       
    83 
       
    84 signals:
       
    85     /**
       
    86 	 * emit when short-tap happens on the attachment
       
    87 	 */
       
    88     void clicked();
       
    89 
       
    90 	/**
       
    91 	 * emit when 'remove' option is selected from longpress menu
       
    92 	 */
       
    93     void deleteMe(MsgUnifiedEditorAttachment* attachment);
       
    94 
       
    95 private slots:
       
    96     /**
       
    97 	 * show longpress menu for attachment object
       
    98 	 */
       
    99     void handleLongTap(QPointF position);
       
   100     
       
   101     /**
       
   102      * Handles short tap event.
       
   103      */
       
   104     void handleShortTap();
       
   105 
       
   106 	/**
       
   107 	 * slot to remove attachment from msg editor
       
   108 	 */
       
   109     void handleRemove();
       
   110 
       
   111 	/**
       
   112 	 * slot to open attachment
       
   113 	 */
       
   114     void handleOpen();
       
   115 
       
   116 	/**
       
   117 	 * slot to view details of the attachment file
       
   118 	 */
       
   119     void viewDetails();
       
   120     
       
   121     /**
       
   122      * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
       
   123      * events back to back.  
       
   124      */
       
   125     void regrabGesture();
       
   126 
       
   127 private:
       
   128     /**
       
   129 	 * attachment file's path
       
   130 	 */
       
   131     QString mPath;
       
   132 
       
   133     /**
       
   134 	 * attachment's size in bytes
       
   135 	 */
       
   136     qreal mSize;
       
   137 
       
   138     /**
       
   139 	 * attachment file's mimetype
       
   140 	 */
       
   141     QString mMimeType;
       
   142 
       
   143     /**
       
   144 	 * layout icon to indicate attachment
       
   145 	 */
       
   146     HbIconItem* mAttachmentIcon;
       
   147 
       
   148     /**
       
   149 	 * layout item to hold attachment's name
       
   150 	 */
       
   151     HbTextItem* mAttachmentName;
       
   152 
       
   153     /**
       
   154 	 * layout item to hold attachment's details e.g. size
       
   155 	 */
       
   156     HbTextItem* mAttachmentDetails;
       
   157 
       
   158     /**
       
   159 	 * gesture filter for long press.
       
   160 	 */    
       
   161     HbGestureSceneFilter* mGestureFilter;
       
   162 	
       
   163 	/**
       
   164      * Max limit on sms size. Store at class level for optimization
       
   165      */
       
   166     int mMaxSmsSize;
       
   167     
       
   168 	/**
       
   169      * Background item
       
   170      * Own
       
   171      */
       
   172     HbFrameItem* mBackGround;
       
   173     
       
   174     /**
       
   175      * MsgUnifiedEditorUtils object.
       
   176      * Own
       
   177      */
       
   178     MsgUnifiedEditorUtils *mEditorUtils;
       
   179 
       
   180     };
       
   181 
       
   182 typedef QList<MsgUnifiedEditorAttachment*> MsgUnifiedEditorAttachmentList;
       
   183 
       
   184 #endif //MSG_UNIFIED_EDITOR_ATTACHMENT_H