37
|
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: Helper class to monitor msg construction in unified editor
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef MSG_UNIFIED_EDITOR_MONITOR_H
|
|
19 |
#define MSG_UNIFIED_EDITOR_MONITOR_H
|
|
20 |
|
|
21 |
#include <QObject>
|
|
22 |
#include "convergedmessage.h"
|
76
|
23 |
|
37
|
24 |
class MsgUnifiedEditorView;
|
|
25 |
class HbWidget;
|
|
26 |
class UniEditorGenUtils;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Helper class to monitor message's contruction in unified editor.
|
|
30 |
* This class is for only reading editor's content to run its logic.
|
|
31 |
* This class is NOT a place for content editing inside editor.
|
|
32 |
*/
|
|
33 |
class MsgUnifiedEditorMonitor : public QObject
|
|
34 |
{
|
|
35 |
Q_OBJECT
|
|
36 |
|
|
37 |
public:
|
|
38 |
/**
|
|
39 |
* Constructor
|
|
40 |
*/
|
|
41 |
MsgUnifiedEditorMonitor(QObject* parent=0);
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Destructor
|
|
45 |
*/
|
|
46 |
~MsgUnifiedEditorMonitor();
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Set to skip showing note for first time
|
|
50 |
* @param skip true/false
|
|
51 |
*/
|
76
|
52 |
inline void setSkipNote(bool skip = true)
|
|
53 |
{
|
|
54 |
mSkipNote = skip;
|
|
55 |
}
|
37
|
56 |
|
|
57 |
/**
|
|
58 |
* Seeker method to access current message type
|
|
59 |
*/
|
76
|
60 |
static inline ConvergedMessage::MessageType messageType()
|
|
61 |
{
|
|
62 |
return mMessageType;
|
|
63 |
}
|
37
|
64 |
|
|
65 |
/**
|
|
66 |
* seeker function to get current msg size in bytes
|
|
67 |
*/
|
76
|
68 |
static inline int messageSize()
|
|
69 |
{
|
|
70 |
return mBodyContentSize + mContainerSize + mSubjectSize;
|
|
71 |
}
|
37
|
72 |
|
|
73 |
/**
|
|
74 |
* seeker function to get current msg's body size
|
|
75 |
* in bytes
|
|
76 |
*/
|
76
|
77 |
static inline int bodySize()
|
|
78 |
{
|
|
79 |
return mBodyContentSize;
|
|
80 |
}
|
37
|
81 |
|
|
82 |
/**
|
|
83 |
* seeker function to get current msg's attachment
|
|
84 |
* container size in bytes
|
|
85 |
*/
|
76
|
86 |
static inline int containerSize()
|
|
87 |
{
|
|
88 |
return mContainerSize;
|
|
89 |
}
|
37
|
90 |
|
|
91 |
/**
|
|
92 |
* seeker function to get current msg's subject
|
|
93 |
* size in bytes
|
|
94 |
*/
|
76
|
95 |
static inline int subjectSize()
|
|
96 |
{
|
|
97 |
return mSubjectSize;
|
|
98 |
}
|
37
|
99 |
|
|
100 |
/**
|
|
101 |
* seeker function to get max possible mms size
|
|
102 |
* in bytes
|
|
103 |
*/
|
76
|
104 |
static inline int maxMmsSize()
|
|
105 |
{
|
|
106 |
return mMaxMmsSize;
|
|
107 |
}
|
37
|
108 |
|
|
109 |
/**
|
|
110 |
* seeker funtion to get max recipient count for sms
|
|
111 |
*/
|
76
|
112 |
static inline int maxSmsRecipients()
|
|
113 |
{
|
|
114 |
return mMaxSmsRecipients;
|
|
115 |
}
|
37
|
116 |
|
|
117 |
/**
|
|
118 |
* seeker funtion to get max recipient count for mms
|
|
119 |
*/
|
76
|
120 |
static inline int maxMmsRecipients()
|
|
121 |
{
|
|
122 |
return mMaxMmsRecipients;
|
|
123 |
}
|
37
|
124 |
|
|
125 |
/**
|
|
126 |
* get total address count in To, Cc & Bcc fields
|
|
127 |
*/
|
76
|
128 |
static inline int msgAddressCount()
|
|
129 |
{
|
|
130 |
return mToAddressCount + mCcAddressCount + mBccAddressCount;
|
|
131 |
}
|
|
132 |
|
|
133 |
/**
|
|
134 |
* tells if message is ready for send.
|
|
135 |
*/
|
|
136 |
static inline bool readyForSend()
|
|
137 |
{
|
|
138 |
return mReadyForSend;
|
|
139 |
}
|
37
|
140 |
|
|
141 |
public slots:
|
|
142 |
/**
|
|
143 |
* slot to handle content change in any editor component
|
|
144 |
*/
|
76
|
145 |
void handleContentsChanged(const QVariant& data);
|
37
|
146 |
|
|
147 |
signals:
|
|
148 |
/**
|
|
149 |
* Emitted when composed message can be sent.
|
|
150 |
* @param enable true if send is possible else false.
|
|
151 |
*/
|
|
152 |
void enableSend(bool enable);
|
76
|
153 |
|
|
154 |
/**
|
|
155 |
* Emitte when contents are changed, to set drafts flag.
|
|
156 |
*/
|
|
157 |
void contentsChanged();
|
37
|
158 |
|
|
159 |
private:
|
|
160 |
/**
|
|
161 |
* setter method to initialize content
|
|
162 |
*/
|
|
163 |
void init();
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Determine the projected msg type due to change in editor content
|
|
167 |
*/
|
|
168 |
ConvergedMessage::MessageType projectedMsgType();
|
|
169 |
|
|
170 |
/**
|
|
171 |
* show type change discreet note
|
|
172 |
*/
|
|
173 |
void showPopup(const QString& text);
|
|
174 |
|
76
|
175 |
|
37
|
176 |
/**
|
|
177 |
* check editor body for MMS content
|
|
178 |
* @return true if MMS content is present
|
|
179 |
*/
|
|
180 |
bool bodyHasMMSContent();
|
|
181 |
|
|
182 |
/**
|
|
183 |
* check editor subject for MMS content
|
|
184 |
* @return true if MMS content is present
|
|
185 |
*/
|
|
186 |
bool subjectHasMMSContent();
|
|
187 |
|
|
188 |
/**
|
|
189 |
* check editor attachment container for MMS content
|
|
190 |
* @return true if MMS content is present
|
|
191 |
*/
|
|
192 |
bool containerHasMMSContent();
|
|
193 |
|
|
194 |
/**
|
|
195 |
* check for other MMS content criteria
|
|
196 |
* @return true if MMS criteria is met
|
|
197 |
*/
|
|
198 |
bool otherMMSCriteriaMet();
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Checks if composed message can be sent and emits a signal.
|
|
202 |
*/
|
|
203 |
void updateSend();
|
76
|
204 |
|
|
205 |
/**
|
|
206 |
* Updates body content size.
|
|
207 |
*/
|
|
208 |
void updateBodyContentSize();
|
|
209 |
|
|
210 |
/**
|
|
211 |
* resets value of static member variables.
|
|
212 |
*/
|
|
213 |
void reset();
|
37
|
214 |
|
|
215 |
private:
|
|
216 |
|
|
217 |
/**
|
|
218 |
* Flag to skip showing the type change popup.
|
|
219 |
* Note need to be skipped when an mms is opened from draft.
|
|
220 |
*/
|
|
221 |
bool mSkipNote;
|
76
|
222 |
|
|
223 |
/**
|
|
224 |
* Flag to keep information, if attachment container has mms content.
|
|
225 |
*/
|
|
226 |
bool mContainerHasMmsContent;
|
|
227 |
|
|
228 |
/**
|
|
229 |
* Priority.
|
|
230 |
*/
|
|
231 |
ConvergedMessage::Priority mPriority;
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Email id is present in to field or not.
|
|
235 |
*/
|
|
236 |
bool mEmailPresent;
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Body text has uni code char(s).
|
|
240 |
*/
|
|
241 |
bool mUniCode;
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Flag to hold state of image resizing
|
|
245 |
*/
|
|
246 |
bool mImageResizing;
|
37
|
247 |
|
|
248 |
/**
|
|
249 |
* Type of msg under composition in the editor
|
|
250 |
*/
|
|
251 |
static ConvergedMessage::MessageType mMessageType;
|
|
252 |
|
|
253 |
/**
|
|
254 |
* msg body size in bytes
|
|
255 |
*/
|
|
256 |
static int mBodySize;
|
|
257 |
|
|
258 |
/**
|
76
|
259 |
* msg body text size in bytes
|
|
260 |
*/
|
|
261 |
static int mBodyTextSize;
|
|
262 |
|
|
263 |
/**
|
|
264 |
* msg body content (mBodySize + mBodyTextSize + mime headers) size in bytes.
|
|
265 |
*/
|
|
266 |
static int mBodyContentSize;
|
|
267 |
|
|
268 |
/**
|
37
|
269 |
* msg container size in bytes
|
|
270 |
*/
|
|
271 |
static int mContainerSize;
|
|
272 |
|
|
273 |
/**
|
|
274 |
* msg subject size in bytes
|
|
275 |
*/
|
|
276 |
static int mSubjectSize;
|
|
277 |
|
|
278 |
/**
|
|
279 |
* max mms size in bytes
|
|
280 |
*/
|
|
281 |
static int mMaxMmsSize;
|
|
282 |
|
|
283 |
/**
|
|
284 |
* max recipient count in an sms
|
|
285 |
*/
|
|
286 |
static int mMaxSmsRecipients;
|
|
287 |
|
|
288 |
/**
|
|
289 |
* max recipient count in an sms
|
|
290 |
*/
|
|
291 |
static int mMaxMmsRecipients;
|
|
292 |
|
|
293 |
/**
|
76
|
294 |
* Address count in various fields.
|
37
|
295 |
*/
|
76
|
296 |
static int mToAddressCount;
|
|
297 |
static int mCcAddressCount;
|
|
298 |
static int mBccAddressCount;
|
|
299 |
|
|
300 |
/**
|
|
301 |
* flag to check if message is ready for send.
|
|
302 |
*/
|
|
303 |
static bool mReadyForSend;
|
37
|
304 |
|
|
305 |
/**
|
|
306 |
* UniEditorGenUtils object
|
|
307 |
* Owned
|
|
308 |
*/
|
|
309 |
UniEditorGenUtils* mUniEditorGenUtils;
|
76
|
310 |
#ifdef UNIEDITOR_UNIT_TEST
|
|
311 |
/**
|
|
312 |
* Unit Testing
|
|
313 |
*/
|
|
314 |
friend class TestMsgUnifiedEditorView;
|
|
315 |
friend class TestMsgUnifiedEditorMonitor;
|
|
316 |
#endif
|
37
|
317 |
};
|
|
318 |
|
|
319 |
#endif //MSG_UNIFIED_EDITOR_MONITOR_H
|