254 { |
255 { |
255 NM_FUNCTION; |
256 NM_FUNCTION; |
256 |
257 |
257 if (mHeaderBox) { // Initialize recipient box |
258 if (mHeaderBox) { // Initialize recipient box |
258 if (!mRecipientsBox){ |
259 if (!mRecipientsBox){ |
259 mRecipientsBox = new HbTextEdit(); |
260 mRecipientsBox = new HbLabel(); |
260 HbStyle::setItemName(mRecipientsBox, "recipients"); |
261 HbStyle::setItemName(mRecipientsBox, "recipients"); |
261 mRecipientsBox->setContextMenuFlags(0); |
|
262 mRecipientsBox->setReadOnly(true); |
|
263 mRecipientsBox->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); |
262 mRecipientsBox->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); |
264 // Set text wrapping for from/to/cc address fields using text document |
263 mRecipientsBox->setTextWrapping((Hb::TextWrapping)NmTextWrapWordOrAnywhere); |
265 QTextOption textOption = mRecipientsBox->document()->defaultTextOption(); |
264 } |
266 textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); |
265 |
267 mRecipientsBox->document()->setDefaultTextOption(textOption); |
|
268 } |
|
269 connect(mRecipientsBox, SIGNAL(cursorPositionChanged(int, int)), |
|
270 this, SLOT(cursorPositionChanged(int, int))); |
|
271 |
|
272 // Set recipients to text edit field as html |
266 // Set recipients to text edit field as html |
273 NmAddress sender = mMessage->envelope().sender(); |
267 NmAddress sender = mMessage->envelope().sender(); |
274 if (mMessage) { |
268 if (mMessage) { |
275 mRecipientsBox->setHtml(formatRecipientList(addressToDisplay(sender), |
269 mRecipientsBox->setHtml(formatRecipientList(addressToDisplay(sender), |
276 mMessage->envelope().toRecipients(), |
270 mMessage->envelope().toRecipients(), |
277 mMessage->envelope().ccRecipients())); |
271 mMessage->envelope().ccRecipients())); |
278 } |
272 } |
279 mRecipientsBox->setCursorVisibility(Hb::TextCursorHidden); |
|
280 mHeaderBox->setContentWidget(mRecipientsBox); |
273 mHeaderBox->setContentWidget(mRecipientsBox); |
281 // Set box collapsed as default |
274 // Set box collapsed as default |
282 mHeaderBox->setCollapsed(true); |
275 mHeaderBox->setCollapsed(true); |
283 } |
276 } |
284 } |
277 } |
293 NM_FUNCTION; |
286 NM_FUNCTION; |
294 |
287 |
295 QString result; |
288 QString result; |
296 result.append("<html><body link=\"blue\" topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\""); |
289 result.append("<html><body link=\"blue\" topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\""); |
297 result.append("marginwidth=\"0\">"); |
290 result.append("marginwidth=\"0\">"); |
298 result.append("<font face=\""); |
291 result.append("<font color=\"black\" face=\""); |
299 result.append("Nokia Sans"); |
292 result.append("Nokia Sans"); |
300 result.append("\"size=\"3\">"); |
293 result.append("\"size=\"3\">"); |
301 // Set text in HTML format based on layout direction |
294 // Set text in HTML format based on layout direction |
302 if (qApp->layoutDirection()==Qt::RightToLeft){ |
295 if (qApp->layoutDirection()==Qt::RightToLeft){ |
303 result.append("<p style=\"margin-right: '0'; margin-left: '0'\" dir=\"rtl\"><b>"); |
296 result.append("<p style=\"margin-right: '0'; margin-left: '0'\" dir=\"rtl\"><b>"); |
308 result.append(hbTrId("txt_mail_list_to")); |
301 result.append(hbTrId("txt_mail_list_to")); |
309 result.append(" </b>"); |
302 result.append(" </b>"); |
310 int reciCount = to.count(); |
303 int reciCount = to.count(); |
311 for (int i=0; i < reciCount; i++) { |
304 for (int i=0; i < reciCount; i++) { |
312 result.append(addressToDisplay(to[i])); |
305 result.append(addressToDisplay(to[i])); |
313 result.append(" "); |
306 if (i!=reciCount-1) { |
|
307 result.append(" "); |
|
308 } |
314 } |
309 } |
315 reciCount = cc.count(); |
310 reciCount = cc.count(); |
316 if (reciCount) { |
311 if (reciCount) { |
317 result.append("<br><b>"); |
312 result.append("<br><b>"); |
318 result.append(hbTrId("txt_mail_list_cc")); |
313 result.append(hbTrId("txt_mail_list_cc")); |
319 result.append(" </b>"); |
314 result.append(" </b>"); |
320 for (int i=0; i < reciCount; i++) { |
315 for (int i=0; i < reciCount; i++) { |
321 result.append(addressToDisplay(cc[i])); |
316 result.append(addressToDisplay(cc[i])); |
322 result.append(" "); |
317 if (i!=reciCount-1) { |
|
318 result.append(" "); |
|
319 } |
323 } |
320 } |
324 } |
321 } |
325 } |
322 } |
326 else{ |
323 else{ |
327 result.append("<p style=\"margin-right: '0'; margin-left: '0'\" dir=\"ltr\"><b>"); |
324 result.append("<p style=\"margin-right: '0'; margin-left: '0'\" dir=\"ltr\"><b>"); |
332 result.append(hbTrId("txt_mail_list_to")); |
329 result.append(hbTrId("txt_mail_list_to")); |
333 result.append(" </b>"); |
330 result.append(" </b>"); |
334 int reciCount = to.count(); |
331 int reciCount = to.count(); |
335 for (int i=0; i < reciCount; i++) { |
332 for (int i=0; i < reciCount; i++) { |
336 result.append(addressToDisplay(to[i])); |
333 result.append(addressToDisplay(to[i])); |
337 result.append("; "); |
334 if (i!=reciCount-1) { |
|
335 result.append("; "); |
|
336 } |
338 } |
337 } |
339 reciCount = cc.count(); |
338 reciCount = cc.count(); |
340 if (reciCount) { |
339 if (reciCount) { |
341 result.append("<br><b>"); |
340 result.append("<br><b>"); |
342 result.append(hbTrId("txt_mail_list_cc")); |
341 result.append(hbTrId("txt_mail_list_cc")); |
343 result.append(" </b>"); |
342 result.append(" </b>"); |
344 for (int i=0; i < reciCount; i++) { |
343 for (int i=0; i < reciCount; i++) { |
345 result.append(addressToDisplay(cc[i])); |
344 result.append(addressToDisplay(cc[i])); |
346 result.append("; "); |
345 if (i!=reciCount-1) { |
|
346 result.append("; "); |
|
347 } |
347 } |
348 } |
348 } |
349 } |
349 } |
350 } |
350 result.append("</p></font></body></html>"); |
351 result.append("</p></font></body></html>"); |
351 return result; |
352 return result; |