310 return d_ptr->_size; |
310 return d_ptr->_size; |
311 } |
311 } |
312 |
312 |
313 QString QMessageContentContainer::textContent() const |
313 QString QMessageContentContainer::textContent() const |
314 { |
314 { |
315 if (d_ptr->_textContent.isEmpty() && d_ptr->_attachmentId != 0) { |
315 QString retString; |
316 ModestEngine *engine = ModestEngine::instance(); |
316 |
317 d_ptr->_textContent = engine->getMimePart(QMessageId(d_ptr->_containingMessageId), |
317 if (!d_ptr->_textContent.isEmpty()) { |
|
318 retString = d_ptr->_textContent; |
|
319 } else { |
|
320 if (d_ptr->_content.isEmpty() && d_ptr->_attachmentId != 0) { |
|
321 ModestEngine *engine = ModestEngine::instance(); |
|
322 d_ptr->_content = engine->getMimePart(QMessageId(d_ptr->_containingMessageId), |
318 d_ptr->_attachmentId); |
323 d_ptr->_attachmentId); |
319 d_ptr->_size = d_ptr->_textContent.size(); |
324 d_ptr->_size = d_ptr->_content.size(); |
320 } |
325 } |
321 if (!d_ptr->_textContent.isEmpty()) { |
326 |
322 return d_ptr->_textContent; |
327 if (!d_ptr->_content.isEmpty()) { |
323 } |
328 if (d_ptr->_subType.toLower() == "html") { |
324 |
329 QTextCodec *codec = QTextCodec::codecForName(d_ptr->_charset.data()); |
325 QTextCodec *codec = QTextCodec::codecForName(d_ptr->_charset.data()); |
330 if (codec) { |
326 if (codec) { |
331 retString = codec->toUnicode(d_ptr->_content); |
327 return codec->toUnicode(d_ptr->_content); |
332 } |
328 } else { |
333 } else { |
329 return QString::fromLatin1(d_ptr->_content); |
334 // Modest plugin automatically decodes plain text content to UTF-8 format |
330 } |
335 retString = QString::fromUtf8(d_ptr->_content); |
|
336 } |
|
337 } |
|
338 } |
|
339 |
|
340 return retString; |
331 } |
341 } |
332 |
342 |
333 QByteArray QMessageContentContainer::content() const |
343 QByteArray QMessageContentContainer::content() const |
334 { |
344 { |
335 if (d_ptr->_content.isEmpty() && d_ptr->_attachmentId != 0) { |
345 if (d_ptr->_content.isEmpty() && d_ptr->_attachmentId != 0) { |