author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 14:12:40 +0300 | |
changeset 44 | 36f374c67aa8 |
parent 34 | 84197e66a4bd |
child 47 | 5b14749788d7 |
child 70 | a15d9966050f |
permissions | -rw-r--r-- |
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 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
18 |
#ifndef MSG_UNIFIED_EDITOR_ATTACHMENT_H |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
19 |
#define MSG_UNIFIED_EDITOR_ATTACHMENT_H |
31 | 20 |
|
21 |
#include <HbWidget> |
|
22 |
#include <QList> |
|
23 |
||
24 |
class HbTextItem; |
|
25 |
class HbIconItem; |
|
26 |
class HbGestureSceneFilter; |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
27 |
class HbFrameItem; |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
28 |
class MsgUnifiedEditorUtils; |
31 | 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 |
*/ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
76 |
virtual void gestureEvent(QGestureEvent *event); |
31 | 77 |
|
78 |
||
79 |
private: |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
80 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
81 |
void setPressed(bool pressed); |
31 | 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 |
*/ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
99 |
void handleLongTap(QPointF position); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
100 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
101 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
102 |
* Handles short tap event. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
103 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
104 |
void handleShortTap(); |
31 | 105 |
|
106 |
/** |
|
107 |
* slot to remove attachment from msg editor |
|
108 |
*/ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
109 |
void handleRemove(); |
31 | 110 |
|
111 |
/** |
|
112 |
* slot to open attachment |
|
113 |
*/ |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
114 |
void handleOpen(); |
31 | 115 |
|
116 |
/** |
|
117 |
* slot to view details of the attachment file |
|
118 |
*/ |
|
119 |
void viewDetails(); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
120 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
121 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
122 |
* Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
123 |
* events back to back. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
124 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
125 |
void regrabGesture(); |
31 | 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; |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
167 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
168 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
169 |
* Background item |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
170 |
* Own |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
171 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
172 |
HbFrameItem* mBackGround; |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
173 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
174 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
175 |
* MsgUnifiedEditorUtils object. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
176 |
* Own |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
177 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
178 |
MsgUnifiedEditorUtils *mEditorUtils; |
31 | 179 |
|
180 |
}; |
|
181 |
||
182 |
typedef QList<MsgUnifiedEditorAttachment*> MsgUnifiedEditorAttachmentList; |
|
183 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
184 |
#endif //MSG_UNIFIED_EDITOR_ATTACHMENT_H |