equal
deleted
inserted
replaced
36 mPrioIcon(NULL), |
36 mPrioIcon(NULL), |
37 mHeaderBox(NULL), |
37 mHeaderBox(NULL), |
38 mRecipientsBox(NULL), |
38 mRecipientsBox(NULL), |
39 mViewerView(NULL) |
39 mViewerView(NULL) |
40 { |
40 { |
|
41 NM_FUNCTION; |
|
42 |
41 loadWidgets(); |
43 loadWidgets(); |
42 } |
44 } |
43 |
45 |
44 /*! |
46 /*! |
45 Destructor |
47 Destructor |
46 */ |
48 */ |
47 NmViewerHeader::~NmViewerHeader() |
49 NmViewerHeader::~NmViewerHeader() |
48 { |
50 { |
|
51 NM_FUNCTION; |
49 } |
52 } |
50 |
53 |
51 /*! |
54 /*! |
52 setter for nmviewer view |
55 setter for nmviewer view |
53 */ |
56 */ |
54 void NmViewerHeader::setView(NmViewerView* view) |
57 void NmViewerHeader::setView(NmViewerView* view) |
55 { |
58 { |
|
59 NM_FUNCTION; |
|
60 |
56 mViewerView = view; |
61 mViewerView = view; |
57 } |
62 } |
58 |
63 |
59 /*! |
64 /*! |
60 Load widgets from XML for the header |
65 Load widgets from XML for the header |
61 */ |
66 */ |
62 void NmViewerHeader::loadWidgets() |
67 void NmViewerHeader::loadWidgets() |
63 { |
68 { |
|
69 NM_FUNCTION; |
|
70 |
64 // Scale header widget to screen width |
71 // Scale header widget to screen width |
65 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); |
72 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); |
66 |
73 |
67 // Add header box |
74 // Add header box |
68 if (!mHeaderBox) { |
75 if (!mHeaderBox) { |
103 void NmViewerHeader::paint( |
110 void NmViewerHeader::paint( |
104 QPainter *painter, |
111 QPainter *painter, |
105 const QStyleOptionGraphicsItem *option, |
112 const QStyleOptionGraphicsItem *option, |
106 QWidget *widget) |
113 QWidget *widget) |
107 { |
114 { |
|
115 NM_FUNCTION; |
|
116 |
108 Q_UNUSED(option); |
117 Q_UNUSED(option); |
109 Q_UNUSED(widget); |
118 Q_UNUSED(widget); |
110 if (painter) { |
119 if (painter) { |
111 painter->setOpacity(nmHeaderLineOpacity); |
120 painter->setOpacity(nmHeaderLineOpacity); |
112 QLineF line1( rect().topLeft().x(), rect().bottomRight().y(), |
121 QLineF line1( rect().topLeft().x(), rect().bottomRight().y(), |
124 /*! |
133 /*! |
125 Setter for message object |
134 Setter for message object |
126 */ |
135 */ |
127 void NmViewerHeader::setMessage(NmMessage* message) |
136 void NmViewerHeader::setMessage(NmMessage* message) |
128 { |
137 { |
|
138 NM_FUNCTION; |
|
139 |
129 mMessage=message; |
140 mMessage=message; |
130 setHeaderData(); |
141 setHeaderData(); |
131 } |
142 } |
132 |
143 |
133 |
144 |
137 This function gets called when message body is fetched and |
148 This function gets called when message body is fetched and |
138 to/cc/bcc data needs to be updated |
149 to/cc/bcc data needs to be updated |
139 */ |
150 */ |
140 void NmViewerHeader::updateMessageData(NmMessage* message) |
151 void NmViewerHeader::updateMessageData(NmMessage* message) |
141 { |
152 { |
|
153 NM_FUNCTION; |
|
154 |
142 if (message){ |
155 if (message){ |
143 mMessage=message; |
156 mMessage=message; |
144 // Set recipients to text edit field as html |
157 // Set recipients to text edit field as html |
145 NmAddress sender = mMessage->envelope().sender(); |
158 NmAddress sender = mMessage->envelope().sender(); |
146 if (mRecipientsBox){ |
159 if (mRecipientsBox){ |
154 /*! |
167 /*! |
155 Function sets data to header area based on message data |
168 Function sets data to header area based on message data |
156 */ |
169 */ |
157 void NmViewerHeader::setHeaderData() |
170 void NmViewerHeader::setHeaderData() |
158 { |
171 { |
|
172 NM_FUNCTION; |
|
173 |
159 if (mMessage) { |
174 if (mMessage) { |
160 // Background is all white always, so force text color to black |
175 // Background is all white always, so force text color to black |
161 QColor textColor(Qt::black); |
176 QColor textColor(Qt::black); |
162 const NmMessageEnvelope &envelope = mMessage->envelope(); |
177 const NmMessageEnvelope &envelope = mMessage->envelope(); |
163 const QString dispName = envelope.sender().displayName(); |
178 const QString dispName = envelope.sender().displayName(); |
220 /*! |
235 /*! |
221 Function can be used to rescale the header area. |
236 Function can be used to rescale the header area. |
222 */ |
237 */ |
223 void NmViewerHeader::rescaleHeader(const QSizeF layoutReso) |
238 void NmViewerHeader::rescaleHeader(const QSizeF layoutReso) |
224 { |
239 { |
|
240 NM_FUNCTION; |
|
241 |
225 setMinimumWidth(layoutReso.width()); |
242 setMinimumWidth(layoutReso.width()); |
226 setMaximumWidth(layoutReso.width()); |
243 setMaximumWidth(layoutReso.width()); |
227 } |
244 } |
228 |
245 |
229 /*! |
246 /*! |
230 Function creates expandable header area with group box |
247 Function creates expandable header area with group box |
231 */ |
248 */ |
232 void NmViewerHeader::createExpandableHeader() |
249 void NmViewerHeader::createExpandableHeader() |
233 { |
250 { |
|
251 NM_FUNCTION; |
|
252 |
234 if (mHeaderBox) { // Initialize recipient box |
253 if (mHeaderBox) { // Initialize recipient box |
235 if (!mRecipientsBox){ |
254 if (!mRecipientsBox){ |
236 mRecipientsBox = new HbTextEdit(); |
255 mRecipientsBox = new HbTextEdit(); |
237 HbStyle::setItemName(mRecipientsBox, "recipients"); |
256 HbStyle::setItemName(mRecipientsBox, "recipients"); |
238 mRecipientsBox->setContextMenuFlags(0); |
257 mRecipientsBox->setContextMenuFlags(0); |
265 */ |
284 */ |
266 QString NmViewerHeader::formatRecipientList(const QString &sender, |
285 QString NmViewerHeader::formatRecipientList(const QString &sender, |
267 const QList<NmAddress> &to, |
286 const QList<NmAddress> &to, |
268 const QList<NmAddress> &cc) |
287 const QList<NmAddress> &cc) |
269 { |
288 { |
|
289 NM_FUNCTION; |
|
290 |
270 QString result; |
291 QString result; |
271 result.append("<html><body link=\"blue\" topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\""); |
292 result.append("<html><body link=\"blue\" topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\""); |
272 result.append("marginwidth=\"0\" bgcolor=\"white\" text=\"black\">"); |
293 result.append("marginwidth=\"0\" bgcolor=\"white\" text=\"black\">"); |
273 result.append("<font color=\"black\" face=\""); |
294 result.append("<font color=\"black\" face=\""); |
274 result.append("Nokia Sans"); |
295 result.append("Nokia Sans"); |
330 Function retursn address string from NmAddress to |
351 Function retursn address string from NmAddress to |
331 be displayed in HTML format |
352 be displayed in HTML format |
332 */ |
353 */ |
333 QString NmViewerHeader::addressToDisplayInHtml(const NmAddress &addr) |
354 QString NmViewerHeader::addressToDisplayInHtml(const NmAddress &addr) |
334 { |
355 { |
|
356 NM_FUNCTION; |
|
357 |
335 QString dispName; |
358 QString dispName; |
336 if (addr.displayName().length()!=0){ |
359 if (addr.displayName().length()!=0){ |
337 dispName.append(NmUtilities::cleanupDisplayName(addr.displayName())); |
360 dispName.append(NmUtilities::cleanupDisplayName(addr.displayName())); |
338 } |
361 } |
339 else{ |
362 else{ |
351 Function handles cursor position changes in header group box. |
374 Function handles cursor position changes in header group box. |
352 E.g link handler. |
375 E.g link handler. |
353 */ |
376 */ |
354 void NmViewerHeader::cursorPositionChanged(int oldPos, int newPos) |
377 void NmViewerHeader::cursorPositionChanged(int oldPos, int newPos) |
355 { |
378 { |
|
379 NM_FUNCTION; |
|
380 |
356 Q_UNUSED(oldPos); |
381 Q_UNUSED(oldPos); |
357 QString string = mRecipientsBox->anchorAt(newPos); |
382 QString string = mRecipientsBox->anchorAt(newPos); |
358 if (mViewerView&&string.contains("mailto:",Qt::CaseSensitive)){ |
383 if (mViewerView&&string.contains("mailto:",Qt::CaseSensitive)){ |
359 QUrl url(string); |
384 QUrl url(string); |
360 mViewerView->linkClicked(url); |
385 mViewerView->linkClicked(url); |