equal
deleted
inserted
replaced
38 ** $QT_END_LICENSE$ |
38 ** $QT_END_LICENSE$ |
39 ** |
39 ** |
40 ****************************************************************************/ |
40 ****************************************************************************/ |
41 #include "qmessagecontentcontainer.h" |
41 #include "qmessagecontentcontainer.h" |
42 #include "qmessagecontentcontainer_maemo_p.h" |
42 #include "qmessagecontentcontainer_maemo_p.h" |
|
43 #include "modestengine_maemo_p.h" |
|
44 |
43 #include <QFile> |
45 #include <QFile> |
44 #include <QFileInfo> |
46 #include <QFileInfo> |
45 #include <QTextCodec> |
47 #include <QTextCodec> |
46 |
48 |
47 QTM_BEGIN_NAMESPACE |
49 QTM_BEGIN_NAMESPACE |
48 |
50 |
49 QMessageContentContainer QMessageContentContainerPrivate::from(long int messageId, |
51 QMessageContentContainer QMessageContentContainerPrivate::from(QString &messageId, |
50 unsigned int attachmentId, |
52 QString &attachmentId, |
51 QByteArray &name, |
53 QByteArray &name, |
52 QByteArray &mimeType, |
54 QByteArray &mimeType, |
53 QByteArray &mimeSubType, |
55 QByteArray &mimeSubType, |
54 int size) |
56 int size) |
55 { |
57 { |
108 _filename = QByteArray(); |
110 _filename = QByteArray(); |
109 _available = false; |
111 _available = false; |
110 _size = 0; |
112 _size = 0; |
111 _header.clear(); |
113 _header.clear(); |
112 _attachments.clear(); |
114 _attachments.clear(); |
113 _containingMessageId = 0; |
115 _containingMessageId = QString(); |
114 _attachmentId = 0; |
116 _attachmentId.clear(); |
115 } |
117 } |
116 |
118 |
117 void QMessageContentContainerPrivate::setContentType(const QByteArray &type, const QByteArray &subType, const QByteArray &charset) |
119 void QMessageContentContainerPrivate::setContentType(const QByteArray &type, const QByteArray &subType, const QByteArray &charset) |
118 { |
120 { |
119 clearContents(); |
121 clearContents(); |
308 return d_ptr->_size; |
310 return d_ptr->_size; |
309 } |
311 } |
310 |
312 |
311 QString QMessageContentContainer::textContent() const |
313 QString QMessageContentContainer::textContent() const |
312 { |
314 { |
313 //TODO: if (d_ptr->_textContent.isEmpty() && d_ptr->_attachmentId != 0) { |
315 if (d_ptr->_textContent.isEmpty() && d_ptr->_attachmentId != 0) { |
314 //TODO: CMTMEngine* mtmEngine = CMTMEngine::instance(); |
316 ModestEngine *engine = ModestEngine::instance(); |
315 //TODO: const_cast<QString&>(d_ptr->_textContent) = mtmEngine->attachmentTextContent(d_ptr->_containingMessageId, d_ptr->_attachmentId, d_ptr->_charset); |
317 d_ptr->_textContent = engine->getMimePart(QMessageId(d_ptr->_containingMessageId), |
316 //TODO: } |
318 d_ptr->_attachmentId); |
|
319 d_ptr->_size = d_ptr->_textContent.size(); |
|
320 } |
317 if (!d_ptr->_textContent.isEmpty()) { |
321 if (!d_ptr->_textContent.isEmpty()) { |
318 return d_ptr->_textContent; |
322 return d_ptr->_textContent; |
319 } |
323 } |
320 |
324 |
321 QTextCodec *codec = QTextCodec::codecForName(d_ptr->_charset.data()); |
325 QTextCodec *codec = QTextCodec::codecForName(d_ptr->_charset.data()); |
326 } |
330 } |
327 } |
331 } |
328 |
332 |
329 QByteArray QMessageContentContainer::content() const |
333 QByteArray QMessageContentContainer::content() const |
330 { |
334 { |
331 //TODO: if (d_ptr->_content.isEmpty() && d_ptr->_attachmentId != 0) { |
335 if (d_ptr->_content.isEmpty() && d_ptr->_attachmentId != 0) { |
332 //TODO: CMTMEngine* mtmEngine = CMTMEngine::instance(); |
336 ModestEngine *engine = ModestEngine::instance(); |
333 //TODO: const_cast<QByteArray&>(d_ptr->_content) = mtmEngine->attachmentContent(d_ptr->_containingMessageId, d_ptr->_attachmentId); |
337 d_ptr->_content = engine->getMimePart( |
334 //TODO: } |
338 QMessageId (d_ptr->_containingMessageId), |
|
339 d_ptr->_attachmentId); |
|
340 d_ptr->_size = d_ptr->_content.size(); |
|
341 } |
335 |
342 |
336 return d_ptr->_content; |
343 return d_ptr->_content; |
337 } |
344 } |
338 |
345 |
339 void QMessageContentContainer::writeTextContent(QTextStream& out) const |
346 void QMessageContentContainer::writeTextContent(QTextStream& out) const |