[nemo-qml-plugin-email] Simplify body creation. #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding attachment already move the body
to a first part and set a multipart/mixed
content type, in the QMF code.
@pvuorela, still looking on attachment code, I've noticed that some code were duplicated between QMF and the nemo plugin. But, it's a bit tricky in the sense, that
setAttachments()actually changes the multipart to multipart/mixed and clear the existing parts. Which is basically what was done in the plugin. But the clear parts in the plugin was done before setting the body. From my understanding, this should not have any impact. Tests also show no regression (creating a draft with attachment, then reediting the draft to remove the attachment for instance). But I'm not 100% sure because of the slightly different code path and QMF being quite a complex code.Another question also: I needed to add the change of attachment flag because removing the attachments from a draft didn't remove the icon in the email list (already existing bug). I think, this does not belong to here and should be done at QMF level, since setting the flag is done at QMF level by the call to setAttachments(). But I'm not completely sure where to put it. It seems to me that it should be in ::setBody(). Looking at the code there, I've noticed that you can set a body to a partcontainer that already contains parts (_messageParts is non empty), which is basically what we're doing when removing the attachments of draft with attachments. In that case, the _messageParts is not cleared, and you can still have ::hasBody() that is true and ::partCount() that is strictly greater than 0. Which is inconsistent as far as I can say. Do you agree with me ? Should I provide a patch in QMF that empties the parts when setting a non empty body (and as a consequence unset the attachment flag) ?