|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MSGEDITORWIDGET_H |
|
19 #define MSGEDITORWIDGET_H |
|
20 |
|
21 // SYSTEM INCLUDES |
|
22 #include <HbWidget> |
|
23 #include <HbLineEdit> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class HbPushButton; |
|
27 class HbFrameItem; |
|
28 class HbTextItem; |
|
29 class HbAction; |
|
30 class UniEditorPluginLoader; |
|
31 class UniEditorPluginInterface; |
|
32 class UniEditorGenUtils; |
|
33 |
|
34 /** |
|
35 * Custom editor class |
|
36 */ |
|
37 class MsgEditor : public HbLineEdit |
|
38 { |
|
39 Q_OBJECT |
|
40 |
|
41 public: |
|
42 /** |
|
43 * Constructor |
|
44 */ |
|
45 MsgEditor(QGraphicsItem *parent = 0); |
|
46 |
|
47 /** |
|
48 * Foucus in Event method from HbAbstractEdit |
|
49 */ |
|
50 |
|
51 protected: |
|
52 /** |
|
53 * reimplemented from base class. |
|
54 */ |
|
55 void focusInEvent(QFocusEvent *event); |
|
56 void focusOutEvent(QFocusEvent * event); |
|
57 |
|
58 signals: |
|
59 /** |
|
60 * Signal emitted when the focus in event comes |
|
61 * i.e. when editor is tapped for reply |
|
62 */ |
|
63 void replyStarted(); |
|
64 }; |
|
65 |
|
66 /** |
|
67 * This class is a custom layout widget for Msg Editor. |
|
68 */ |
|
69 |
|
70 class MsgEditorWidget : public HbWidget |
|
71 { |
|
72 Q_OBJECT |
|
73 |
|
74 public: |
|
75 |
|
76 /** |
|
77 * Constructor |
|
78 */ |
|
79 MsgEditorWidget(QGraphicsItem *parent = 0); |
|
80 |
|
81 /** |
|
82 * Destructor |
|
83 */ |
|
84 virtual ~MsgEditorWidget(); |
|
85 |
|
86 public: |
|
87 /* Setter/Getter methods */ |
|
88 |
|
89 /** |
|
90 * Returns the editor's contents. |
|
91 * @return Editor contents |
|
92 */ |
|
93 QString content() const; |
|
94 |
|
95 /** |
|
96 * Set the editor's content. |
|
97 * @param contentText content text to set. |
|
98 */ |
|
99 void setContent(const QString &contentText); |
|
100 |
|
101 /** |
|
102 * This function does initialisations needed for character counter |
|
103 */ |
|
104 void setEncodingSettingsL(); |
|
105 |
|
106 signals: |
|
107 |
|
108 /** |
|
109 * Emitted when send button from virtual ITUT is pressed. |
|
110 */ |
|
111 void sendMessage(); |
|
112 |
|
113 /** |
|
114 * Signal emitted when the focus in event comes |
|
115 * i.e. when editor is tapped for reply |
|
116 */ |
|
117 void replyStarted(); |
|
118 |
|
119 /** |
|
120 * Signal emitted when the sms char limit is reached |
|
121 */ |
|
122 void smsCharLimitReached(); |
|
123 |
|
124 public slots: |
|
125 |
|
126 /** |
|
127 * Clears the content. |
|
128 */ |
|
129 void clear(); |
|
130 |
|
131 private slots: |
|
132 |
|
133 /** |
|
134 * Called when editor content is chaged. to enable/disable send button. |
|
135 */ |
|
136 void onTextChanged(const QString& str); |
|
137 |
|
138 /** |
|
139 * called when send button is clicked. |
|
140 */ |
|
141 void onClicked(); |
|
142 |
|
143 /** |
|
144 * called the timer expires and handles the case when sms char limit is |
|
145 * reached |
|
146 */ |
|
147 void handleSmsCharLimitReached(); |
|
148 |
|
149 /** |
|
150 * called when send button is pressed/released. |
|
151 */ |
|
152 void onPressed(); |
|
153 void onReleased(); |
|
154 |
|
155 /** |
|
156 * This slot is called when sms char limit reached dialog is launched. |
|
157 * @param action selected action (yes or no). |
|
158 */ |
|
159 void onSmsCharLimitReached(HbAction* action); |
|
160 |
|
161 private: |
|
162 |
|
163 /** |
|
164 * Initialization function. |
|
165 */ |
|
166 void init(); |
|
167 |
|
168 /** |
|
169 * To update back ground. |
|
170 */ |
|
171 void updateButtonBackground(const QString& bg); |
|
172 |
|
173 private: |
|
174 |
|
175 /** |
|
176 * Instance of message edit. |
|
177 * Will be deleted automatically by parent. |
|
178 * Own. |
|
179 */ |
|
180 MsgEditor *mMsgEditor; |
|
181 |
|
182 /** |
|
183 * Instance of push button. |
|
184 * Will be deleted automatically by parent. |
|
185 * Own. |
|
186 */ |
|
187 HbPushButton *mSendButton; |
|
188 |
|
189 /** |
|
190 * Instance of HbTextItem |
|
191 * Will be deleted automatically by parent. |
|
192 * Own. |
|
193 */ |
|
194 HbTextItem *mCharCounter; |
|
195 |
|
196 /** |
|
197 * Instance of HbFrameItem |
|
198 * Will be deleted automatically by parent. |
|
199 * Own. |
|
200 */ |
|
201 HbFrameItem* mBackgroundItem; |
|
202 |
|
203 /** |
|
204 * Holds the previous buffer inside msgeditor |
|
205 */ |
|
206 QString mPrevBuffer; |
|
207 |
|
208 /** |
|
209 * Holds char type supported |
|
210 */ |
|
211 int mCharSupportType; |
|
212 |
|
213 /** |
|
214 * Instance of UniEditorPluginInterface |
|
215 * Will be deleted automatically by parent. |
|
216 * Own. |
|
217 */ |
|
218 UniEditorPluginInterface* mPluginInterface; |
|
219 |
|
220 /** |
|
221 * Instance of UniEditorPluginLoader |
|
222 * Will be deleted when UniEditorPluginInterface object is deleted |
|
223 * Not Own. |
|
224 */ |
|
225 UniEditorPluginLoader* mPluginLoader; |
|
226 |
|
227 /** |
|
228 * Instance of UniEditorGenUtils |
|
229 * Own. |
|
230 */ |
|
231 UniEditorGenUtils* mEditorUtils; |
|
232 |
|
233 /** |
|
234 * Indication for sms char limt reached |
|
235 */ |
|
236 bool mSmsCharLimitReached; |
|
237 }; |
|
238 |
|
239 #endif // MSGEDITORWIDGET_H |
|
240 // EOF |