Open
Bug 743913
Opened 13 years ago
Updated 2 years ago
nsIMsgCompose needs saveAsFile() to save composing message
Categories
(MailNews Core :: Composition, defect)
MailNews Core
Composition
Tracking
(Not tracked)
NEW
People
(Reporter: hiro, Assigned: hiro)
References
(Blocks 1 open bug)
Details
(Whiteboard: [patchlove])
Attachments
(5 files, 5 obsolete files)
24.60 KB,
patch
|
Bienvenu
:
review+
|
Details | Diff | Splinter Review |
2.64 KB,
patch
|
Details | Diff | Splinter Review | |
1.97 KB,
patch
|
Details | Diff | Splinter Review | |
12.27 KB,
patch
|
hiro
:
review+
|
Details | Diff | Splinter Review |
29.42 KB,
patch
|
Bienvenu
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•13 years ago
|
||
Before implemting the new method, nsMsgCompose::SendMsg and nsMsgCompose::_SendMsg should be cleaned up, because the new method also needs the codes SendMsg and _SendMsg.
Assignee | ||
Comment 2•13 years ago
|
||
nsMsgCompose::SendMsg is split into ConvertBodyText, AttachVCard, OpenProgressDialog and DisplayErrorMessage.
Attachment #613496 -
Flags: review?(dbienvenu)
Assignee | ||
Comment 3•13 years ago
|
||
GetConvertedBody and SetCompFields are split out.
Attachment #613497 -
Flags: review?(dbienvenu)
Assignee | ||
Comment 4•13 years ago
|
||
Attachment #613498 -
Flags: review?(dbienvenu)
Assignee | ||
Updated•13 years ago
|
OS: Linux → All
Hardware: x86_64 → All
Updated•13 years ago
|
Assignee: nobody → hiikezoe
Status: NEW → ASSIGNED
Comment 5•13 years ago
|
||
With these patches applied, compose xpcshell test test_attachment.js crashes in RememberQueuedDisposition with a null m_identity.
Assignee | ||
Comment 6•13 years ago
|
||
(In reply to David :Bienvenu from comment #5)
> With these patches applied, compose xpcshell test test_attachment.js crashes
> in RememberQueuedDisposition with a null m_identity.
The last patch did accidentally remove "m_identity = aIdentity" just before invoking _SendMsg(). Anyway it my fault. I should have run all compose xpcshell tests.
The last patch causes test_nsMsgCompose2.js failure because the test calls onStopSending with null for returnFile. This patch also fixes this failure.
Attachment #613498 -
Attachment is obsolete: true
Attachment #613498 -
Flags: review?(dbienvenu)
Attachment #615209 -
Flags: review?(dbienvenu)
Assignee | ||
Comment 7•13 years ago
|
||
I confirmed all xpcshell tests passed on Linux.
And pushed to tryserver now.
http://build.mozillamessaging.com/tinderboxpushlog/?tree=ThunderbirdTry&rev=35d329483b4e
Comment 8•13 years ago
|
||
Comment on attachment 613496 [details] [diff] [review]
[PATCH 1/3] Split nsMSgCompose::SendMsg into shorter methods.
thanks for the new patch...
I think rv might be used unitialized in nsMsgCompose::ConvertBodyText() if m_editor is false. Minusing for that issue...
nsMsgCompose::OpenProgressDialog can probably directly return the mProgress->OpenProgressDialog call result.
Attachment #613496 -
Flags: review?(dbienvenu) → review-
Assignee | ||
Comment 9•13 years ago
|
||
Addresses comment #8.
Attachment #613496 -
Attachment is obsolete: true
Attachment #618126 -
Flags: review?(dbienvenu)
Comment 10•13 years ago
|
||
Comment on attachment 618126 [details] [diff] [review]
[PATCH 1/3] Split nsMSgCompose::SendMsg into shorter methods.
thx for the new patch
Attachment #618126 -
Flags: review?(dbienvenu) → review+
Comment 11•13 years ago
|
||
Comment on attachment 613497 [details] [diff] [review]
[PATCH 2/3] Split nsMsgCompose::_SendMsg into shorter methods
Instead of Adopt, we could use getter_Copies in +nsresult nsMsgCompose::GetConvertedBody(nsACString &aBody) in the call to nsMsgI18NSaveAsCharset
you might need to pass in nsCString & instead of nsACString, but since it's not a public method, that's OK.
r=me, with that change.
Attachment #613497 -
Flags: review?(dbienvenu) → review+
Comment 12•13 years ago
|
||
Comment on attachment 615209 [details] [diff] [review]
[PATCH 3/3] Implement nsIMsgCompose.saveAsFile
thx for the patch!
+## @name NS_MSG_UNABLE_TO_SAVE_FILE
+12601=Unable to save your message as file.
either "as a file" or "to a file"
I think you should add the same strings to suite's properties file.
need doxygen-style comments for this method, and wrap this long line:
+ void saveAsFile(in string aFileName, in nsIMsgIdentity aIdentity, in string accountKey, in nsIMsgWindow aMsgWindow, in nsIMsgProgress aProgress);
+
+ nsresult rv = SetCompFields(aIdentity);
+
this error is ignored; Should it have NS_ENSURE_SUCCESS(rv, rv); ?
I think most of these:
+ if (NS_FAILED(rv))
+ return rv;
can be NS_ENSURE_SUCCESS(rv, rv); since these are unexpected errors.
I'd also like a comment above this method, saying that we save to a temp file, and then when it's done, rename the temp file over the desired target file. Also, what happens if the target file already exists? Do we warn the user, overwrite the file, or fail?
+NS_IMETHODIMP nsMsgCompose::SaveAsFile(const char *aPath,
Attachment #615209 -
Flags: review?(dbienvenu) → review-
Comment 13•13 years ago
|
||
hmm, you know, I think when I run with these patches, my compose window closes down after an auto-save of a draft message. Have you tried that? I should probably provisionally revoke my r+'s until that's figured out...
Updated•13 years ago
|
Attachment #613497 -
Flags: review+ → review?
Updated•13 years ago
|
Attachment #618126 -
Flags: review+ → review?(dbienvenu)
Comment 14•13 years ago
|
||
Hiro, are you able to reproduce the issue with auto save of drafts closing the compose window? I have my autosave interval set to 1 minute, so this is easy to reproduce for me.
Comment 15•13 years ago
|
||
Comment on attachment 618126 [details] [diff] [review]
[PATCH 1/3] Split nsMSgCompose::SendMsg into shorter methods.
clearing review request until the auto-save issue is diagnosed.
Attachment #618126 -
Flags: review?(dbienvenu)
Assignee | ||
Comment 16•13 years ago
|
||
Now I can reproduce the closing compose window issue. I will investigate it.
Assignee | ||
Comment 17•13 years ago
|
||
I found the cause of the closing issue.
The cause lies in [PATCH 3/3]. The mDeliverMode in nsMsgComposeSendListener is wrong.
// right now, AutoSaveAsDraft is identical to SaveAsDraft as
// far as the msg send code is concerned. This way, we don't have
// to add an nsMsgDeliverMode for autosaveasdraft, and add cases for
// it in the msg send code.
MSG_DeliverMode deliverMode =
(mDeliverMode == nsIMsgCompDeliverMode::AutoSaveAsDraft) ?
nsIMsgCompDeliverMode::SaveAsDraft : mDeliverMode;
- nsRefPtr<nsIMsgCompose> msgCompose(this);
- composeSendListener->SetMsgCompose(msgCompose);
- composeSendListener->SetDeliverMode(deliverMode);
In the original source code, nsIMsgCompose gets the converted deliver mode value, but
+
+nsresult nsMsgCompose::GetMsgSendListener(nsIMsgSendListener **aListener)
+{
+ nsresult rv;
+ nsCOMPtr<nsIMsgComposeSendListener> composeSendListener =
+ do_CreateInstance(NS_MSGCOMPOSESENDLISTENER_CONTRACTID, &rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsRefPtr<nsIMsgCompose> msgCompose(this);
+ composeSendListener->SetMsgCompose(msgCompose);
+ composeSendListener->SetDeliverMode(mDeliverMode);
This mDeliverMode is not converted here.
I will post two patches to make review easier and a conjunction patch.
Assignee | ||
Comment 18•13 years ago
|
||
In nsMsgComposeSendListener class, mDeliverMode is compared with nsIMsgSend::nsMsgSave or others, but it should be nsIMsgCompDeliverMode there.
Assignee | ||
Comment 19•13 years ago
|
||
This patch solves the closing window issue.
Assignee | ||
Comment 20•13 years ago
|
||
This is the conjunction patch.
Attachment #622266 -
Flags: review?(dbienvenu)
Assignee | ||
Updated•13 years ago
|
Attachment #615209 -
Attachment is obsolete: true
Assignee | ||
Comment 21•13 years ago
|
||
Use getter_Copies.
This change breaks [PATCH 3/3]. I will re-post [PATCH 3/3] again.
Attachment #622266 -
Attachment is obsolete: true
Attachment #622266 -
Flags: review?(dbienvenu)
Attachment #622271 -
Flags: review+
Assignee | ||
Comment 22•13 years ago
|
||
Updated conjunction patch.
(In reply to David :Bienvenu from comment #12)
> Comment on attachment 615209 [details] [diff] [review]
> [PATCH 3/3] Implement nsIMsgCompose.saveAsFile
>
> +## @name NS_MSG_UNABLE_TO_SAVE_FILE
> +12601=Unable to save your message as file.
>
> either "as a file" or "to a file"
Done.
> I think you should add the same strings to suite's properties file.
Done.
> need doxygen-style comments for this method, and wrap this long line:
>
> + void saveAsFile(in string aFileName, in nsIMsgIdentity aIdentity, in
> string accountKey, in nsIMsgWindow aMsgWindow, in nsIMsgProgress aProgress);
> +
Done.
> + nsresult rv = SetCompFields(aIdentity);
> +
> this error is ignored; Should it have NS_ENSURE_SUCCESS(rv, rv); ?
Done.
> I think most of these:
> + if (NS_FAILED(rv))
> + return rv;
>
> can be NS_ENSURE_SUCCESS(rv, rv); since these are unexpected errors.
Done.
> I'd also like a comment above this method, saying that we save to a temp
> file, and then when it's done, rename the temp file over the desired target
> file.
Done. Copied your sentence as it is.
> Also, what happens if the target file already exists? Do we warn the
> user, overwrite the file, or fail?
Current implementation is that "overwrite". While I was implementing this, I thought the file name check should be done in caller of this method. Because file dialog might be opened there, and can be also checked the file name there.
Attachment #622276 -
Flags: review?(dbienvenu)
Assignee | ||
Updated•13 years ago
|
Attachment #613497 -
Attachment is obsolete: true
Attachment #613497 -
Flags: review?
Assignee | ||
Comment 23•13 years ago
|
||
Comment on attachment 618126 [details] [diff] [review]
[PATCH 1/3] Split nsMSgCompose::SendMsg into shorter methods.
This patch is not related to the closing window issue.
Attachment #618126 -
Flags: review?(dbienvenu)
Comment 24•13 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #22)
> > Also, what happens if the target file already exists? Do we warn the
> > user, overwrite the file, or fail?
>
> Current implementation is that "overwrite". While I was implementing this, I
> thought the file name check should be done in caller of this method. Because
> file dialog might be opened there, and can be also checked the file name
> there.
makes sense - a comment to that effect in the idl would be helpful, I think.
Updated•13 years ago
|
Attachment #618126 -
Flags: review?(dbienvenu) → review+
Comment 25•13 years ago
|
||
Comment on attachment 622276 [details] [diff] [review]
[PATCH 3/3] Implement nsIMsgCompose.saveAsFile
r=me, but I'd really like a comment in nsIMsgCompose.idl about what will happen if the file already exists.
Attachment #622276 -
Flags: review?(dbienvenu) → review+
Comment 26•12 years ago
|
||
Hiro, did you forget about these patches?
Comment 27•12 years ago
|
||
(In reply to Mark Banner (:standard8) from comment #26)
> Hiro, did you forget about these patches?
Flags: needinfo?(hiikezoe)
Comment 28•9 years ago
|
||
Removing myslef on all the bugs I'm cced on. Please NI me if you need something on MailNews Core bugs from me.
Updated•9 years ago
|
Status: ASSIGNED → NEW
Flags: needinfo?(hiikezoe)
Whiteboard: [patchlove]
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•