Bug 324109

Summary: implicit draft names should substitute empty subject lines
Product: [Applications] trojita Reporter: kavol <kavol>
Component: Message ComposerAssignee: Trojita default assignee <trojita-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.3.93   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description kavol 2013-08-27 10:24:56 UTC
I've saved a message as a draft. What was my surprise that on the next run, Trojitá showed no draft available to load. But the file was there and renaming it helped to be able to make it visible for Trojitá.

Reproducible: Always

Steps to Reproduce:
1. create a new message
2. kill Trojitá gently (try to logout)
3. Trojitá will ask for saving as draft, answer to save
4. accept the suggested default filename
5. on next run, choose to load the saved draft
Actual Results:  
Trojitá does not show the file with the draft

Expected Results:  
Trojitá offers to load the saved draft

the actual file name produced in step 4 was ".draft.draft" - after getting rid of the starting dot, the file appeared in the file chooser dialog box
Comment 1 Thomas Lübking 2013-08-27 11:22:55 UTC
FYI:
the leading dot means exactly that - "hidden"; good file dialogs have an opton to show hidden files.

-> There's no issue on opening the draft but on implicit name choosing.

... and don't you ever dare to send mails w/o subject line ;-)
Comment 2 Jan Kundrát 2013-08-27 11:24:18 UTC
Looks like this happens because there's no fallback to use when the subject 
of the draft is empty. Patch under review at 
https://git.reviewboard.kde.org/r/112309/ .

Don't worry, Thomas, Trojita will refuse to send such mail. It should be 
possible to save it as a draft, though.
Comment 3 kavol 2013-08-27 11:52:21 UTC
(In reply to comment #1)
> FYI:
> the leading dot means exactly that - "hidden"; good file dialogs have an
> opton to show hidden files.

ah, true, I forgot about that as my favourite file manager `mc` doesn't do such stupid things like hiding files from me :-)

> -> There's no issue on opening the draft but on implicit name choosing.

agreed; what I've meant in the first place was that suggesting using just the extension while the same string gets appended automatically is not a good idea anyways

> ... and don't you ever dare to send mails w/o subject line ;-)

the subject of this particular e-mail will depend on the date when I'll send it so it is intentional to have it empty, instead having to rewrite it (and it's easier to spot completely empty subject rather than "FIXME" in the middle of pre-filled subject)

(In reply to comment #2)
> Looks like this happens because there's no fallback to use when the subject 
> of the draft is empty. Patch under review at 
> https://git.reviewboard.kde.org/r/112309/ .

cool, using the current date looks like a nice idea to me, thanks
Comment 4 Jan Kundrát 2013-08-27 14:31:08 UTC
Git commit be2982019d996a579b4ad218a8a621a6c5fc123d by Jan Kundrát.
Committed on 27/08/2013 at 11:14.
Pushed by jkt into branch 'master'.

Use current date when saving mail drafts in case subject is empty and sanitize the suggested filename unconditionally

Thanks to Karel Volný for reporting this. Previously, a message with an empty
subject would produced file ".draft" which did not match the GUI's wildcard and
therefore was not visible in the file picker when resuming these drafts.

Thanks to Thomas Lübking for pointing out that some characters are best avoided
here. The code now sanitizes the suggested filename so that it does not contain
"strange" characters, even if they were present in the subject before. Of
course, the subject itself is not modified.
REVIEW: 112309

M  +10   -1    src/Gui/ComposeWidget.cpp

http://commits.kde.org/trojita/be2982019d996a579b4ad218a8a621a6c5fc123d