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_MONITOR_H |
|
19 #define MSG_MONITOR_H |
|
20 |
|
21 #include <QObject> |
|
22 #include "convergedmessage.h" |
|
23 class MsgUnifiedEditorView; |
|
24 class HbWidget; |
|
25 class UniEditorGenUtils; |
|
26 |
|
27 /** |
|
28 * Helper class to monitor message's contruction in unified editor. |
|
29 * This class is for only reading editor's content to run its logic. |
|
30 * This class is NOT a place for content editing inside editor. |
|
31 */ |
|
32 class MsgMonitor : public QObject |
|
33 { |
|
34 Q_OBJECT |
|
35 |
|
36 public: |
|
37 /** |
|
38 * Constructor |
|
39 */ |
|
40 MsgMonitor(QObject* parent=0); |
|
41 |
|
42 /** |
|
43 * Destructor |
|
44 */ |
|
45 ~MsgMonitor(); |
|
46 |
|
47 /** |
|
48 * Set to skip showing note for first time |
|
49 * @param skip true/false |
|
50 */ |
|
51 inline void setSkipNote(bool skip = true); |
|
52 |
|
53 /** |
|
54 * Seeker method to access current message type |
|
55 */ |
|
56 static inline ConvergedMessage::MessageType messageType(); |
|
57 |
|
58 /** |
|
59 * seeker function to get current msg size in bytes |
|
60 */ |
|
61 static inline int messageSize(); |
|
62 |
|
63 /** |
|
64 * seeker function to get current msg's body size |
|
65 * in bytes |
|
66 */ |
|
67 static inline int bodySize(); |
|
68 |
|
69 /** |
|
70 * seeker function to get current msg's attachment |
|
71 * container size in bytes |
|
72 */ |
|
73 static inline int containerSize(); |
|
74 |
|
75 /** |
|
76 * seeker function to get current msg's subject |
|
77 * size in bytes |
|
78 */ |
|
79 static inline int subjectSize(); |
|
80 |
|
81 /** |
|
82 * seeker function to get max possible mms size |
|
83 * in bytes |
|
84 */ |
|
85 static inline int maxMmsSize(); |
|
86 |
|
87 /** |
|
88 * seeker funtion to get max recipient count for sms |
|
89 */ |
|
90 static inline int maxSmsRecipients(); |
|
91 |
|
92 /** |
|
93 * seeker funtion to get max recipient count for mms |
|
94 */ |
|
95 static inline int maxMmsRecipients(); |
|
96 |
|
97 public slots: |
|
98 /** |
|
99 * slot to find any msg type change during editor operations |
|
100 */ |
|
101 void checkMsgTypeChange(); |
|
102 |
|
103 private: |
|
104 /** |
|
105 * setter method to initialize content |
|
106 */ |
|
107 void init(); |
|
108 |
|
109 /** |
|
110 * handle size change of editor components |
|
111 */ |
|
112 void updateSizeInfo(HbWidget* aWidget); |
|
113 |
|
114 /** |
|
115 * show type change discreet note |
|
116 */ |
|
117 void showPopup(const QString& text); |
|
118 |
|
119 /** |
|
120 * accessor for view |
|
121 */ |
|
122 MsgUnifiedEditorView* view(); |
|
123 |
|
124 private: |
|
125 /** |
|
126 * Flag to skip showing the type change popup. |
|
127 * Note need to be skipped when an mms is opened from draft. |
|
128 */ |
|
129 bool mSkipNote; |
|
130 |
|
131 /** |
|
132 * Type of msg under composition in the editor |
|
133 */ |
|
134 static ConvergedMessage::MessageType mMessageType; |
|
135 |
|
136 /** |
|
137 * msg body size in bytes |
|
138 */ |
|
139 static int mBodySize; |
|
140 |
|
141 /** |
|
142 * msg container size in bytes |
|
143 */ |
|
144 static int mContainerSize; |
|
145 |
|
146 /** |
|
147 * msg subject size in bytes |
|
148 */ |
|
149 static int mSubjectSize; |
|
150 |
|
151 /** |
|
152 * max mms size in bytes |
|
153 */ |
|
154 static int mMaxMmsSize; |
|
155 |
|
156 /** |
|
157 * max recipient count in an sms |
|
158 */ |
|
159 static int mMaxSmsRecipients; |
|
160 |
|
161 /** |
|
162 * max recipient count in an sms |
|
163 */ |
|
164 static int mMaxMmsRecipients; |
|
165 |
|
166 /** |
|
167 * UniEditorGenUtils object |
|
168 * Owned |
|
169 */ |
|
170 UniEditorGenUtils* mUniEditorGenUtils; |
|
171 }; |
|
172 |
|
173 #include "msgmonitor.inl" |
|
174 |
|
175 #endif //MSG_MONITOR_H |
|