31
|
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 UNIFIED_EDITOR_ATTACHMENT_H
|
|
19 |
#define UNIFIED_EDITOR_ATTACHMENT_H
|
|
20 |
|
|
21 |
#include <HbWidget>
|
|
22 |
#include <QList>
|
|
23 |
|
|
24 |
class HbTextItem;
|
|
25 |
class HbIconItem;
|
|
26 |
class HbGestureSceneFilter;
|
|
27 |
|
|
28 |
class MsgUnifiedEditorAttachment : public HbWidget
|
|
29 |
{
|
|
30 |
Q_OBJECT
|
|
31 |
|
|
32 |
public:
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Constructor
|
|
36 |
*/
|
|
37 |
MsgUnifiedEditorAttachment( const QString& attachmentpath,
|
|
38 |
const int filesize,
|
|
39 |
QGraphicsItem *parent = 0 );
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Destructor
|
|
43 |
*/
|
|
44 |
~MsgUnifiedEditorAttachment();
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Seeker method to get the path of the attachment
|
|
48 |
* @return path of the attachment
|
|
49 |
*/
|
|
50 |
const QString& path();
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Seeker method to get the size of the attachment
|
|
54 |
* @return size in bytes
|
|
55 |
*/
|
|
56 |
qreal size();
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Seeker method to get mimetype of the attachment
|
|
60 |
* @return mimetype
|
|
61 |
*/
|
|
62 |
const QString& mimeType();
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Check if the attachment content is MM content
|
|
66 |
* @return true/false
|
|
67 |
*/
|
|
68 |
bool isMultimediaContent();
|
|
69 |
|
|
70 |
/*
|
|
71 |
* Depricated
|
|
72 |
*/
|
|
73 |
// HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
|
|
74 |
|
|
75 |
protected:
|
|
76 |
/**
|
|
77 |
* reimplemented from base class.
|
|
78 |
*/
|
|
79 |
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
80 |
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
81 |
|
|
82 |
|
|
83 |
private:
|
|
84 |
/**
|
|
85 |
* Helper method to initialize gesture.
|
|
86 |
*/
|
|
87 |
void initGesture();
|
|
88 |
|
|
89 |
|
|
90 |
signals:
|
|
91 |
/**
|
|
92 |
* emit when short-tap happens on the attachment
|
|
93 |
*/
|
|
94 |
void clicked();
|
|
95 |
|
|
96 |
/**
|
|
97 |
* emit when 'remove' option is selected from longpress menu
|
|
98 |
*/
|
|
99 |
void deleteMe(MsgUnifiedEditorAttachment* attachment);
|
|
100 |
|
|
101 |
private slots:
|
|
102 |
/**
|
|
103 |
* show longpress menu for attachment object
|
|
104 |
*/
|
|
105 |
void longPressed(QPointF position);
|
|
106 |
|
|
107 |
/**
|
|
108 |
* slot to remove attachment from msg editor
|
|
109 |
*/
|
|
110 |
void removeAttachment();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* slot to open attachment
|
|
114 |
*/
|
|
115 |
void openAttachment();
|
|
116 |
|
|
117 |
/**
|
|
118 |
* slot to view details of the attachment file
|
|
119 |
*/
|
|
120 |
void viewDetails();
|
|
121 |
|
|
122 |
private:
|
|
123 |
/**
|
|
124 |
* attachment file's path
|
|
125 |
*/
|
|
126 |
QString mPath;
|
|
127 |
|
|
128 |
/**
|
|
129 |
* attachment's size in bytes
|
|
130 |
*/
|
|
131 |
qreal mSize;
|
|
132 |
|
|
133 |
/**
|
|
134 |
* attachment file's mimetype
|
|
135 |
*/
|
|
136 |
QString mMimeType;
|
|
137 |
|
|
138 |
/**
|
|
139 |
* layout icon to indicate attachment
|
|
140 |
*/
|
|
141 |
HbIconItem* mAttachmentIcon;
|
|
142 |
|
|
143 |
/**
|
|
144 |
* layout item to hold attachment's name
|
|
145 |
*/
|
|
146 |
HbTextItem* mAttachmentName;
|
|
147 |
|
|
148 |
/**
|
|
149 |
* layout item to hold attachment's details e.g. size
|
|
150 |
*/
|
|
151 |
HbTextItem* mAttachmentDetails;
|
|
152 |
|
|
153 |
/**
|
|
154 |
* gesture filter for long press.
|
|
155 |
*/
|
|
156 |
HbGestureSceneFilter* mGestureFilter;
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Max limit on sms size. Store at class level for optimization
|
|
160 |
*/
|
|
161 |
int mMaxSmsSize;
|
|
162 |
|
|
163 |
};
|
|
164 |
|
|
165 |
typedef QList<MsgUnifiedEditorAttachment*> MsgUnifiedEditorAttachmentList;
|
|
166 |
|
|
167 |
#endif //UNIFIED_EDITOR_ATTACHMENT_H
|