Bug 1986 - New feature: warn user when inserting a large file in the message body
: New feature: warn user when inserting a large file in the message body
Status: CLOSED FIXED
: Claws Mail
User Interface/Compose Window
: 3.7.3
: PC Linux
: P3 normal
Assigned To:
:
:
:
  Show dependency treegraph
 
Reported: 2009-08-16 16:15 by
Modified: 2009-08-24 20:47 (History)


Attachments
Warn when inserting a large file in the message body (9.72 KB, patch)
2009-08-16 16:15, Didier Barvaux
no flags Details | Diff
Warn when inserting a large file in the message body (updated) (10.66 KB, patch)
2009-08-21 15:47, Didier Barvaux
no flags Details | Diff
Allow larger sizes for insert limit (926 bytes, patch)
2009-08-21 21:46, Didier Barvaux
no flags Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-08-16 16:15:05
Created an attachment (id=716) [details]
Warn when inserting a large file in the message body

Problem:
Sometime, when composing an email, I use by mistake the 'Insert' button instead
of the 'Attach' button to attach a file to the email. Both actions open a
window to select a file so I see no difference. I select a file on the disk and
click on the 'open' button. Claws Mail then inserts the content of the file in
the body of the email. If the file contains binary data, I now have a message
full of useless garbage. Removing it by hand or undoing changes is not an
acceptable solution if the file is quite large.

Proposed solution:
Claws Mail should issue a warning when someone inserts a large file into the
body of a message. As some users may not like such a warning, the feature
should be configurable. As the notion of 'large file' depends on the user, the
size limit above which a warning is issued should also be configurable.

Implementation:
The attached pacth contains an implementation of the solution described above.
The patch is against CVS. The feature is enabled by default. The size limit is
set to 500KB by default. It was tested with small and large files. Disabling
the feature was tested. Changing the size limit was also tested.
------- Comment #1 From 2009-08-17 08:53:37 -------
Interesting idea ! Two things: it would be better if the size was displayed
using to_human_readable(); also, it would be nice to have a "Show this message
next time", as is done for the "Insert or attach?" dialog - see compose.c:10318
for an example; if the user unchecks the box, the returned value will have the
G_ALERTDISABLE flag.
------- Comment #2 From 2009-08-17 10:39:06 -------
I will look at it and update the patch.
------- Comment #3 From 2009-08-21 15:47:31 -------
Created an attachment (id=720) [details]
Warn when inserting a large file in the message body (updated)

Updated version of the previous patch:
 - use to_human_readable() in the confirmation popup,
 - the confirmation popup is now of type ALERT_QUESTION instead of ALERT_ERROR,
 - the title of the confirmation popup is now "Are you sure?" instead of
"Warning",
 - the confirmation popup now got a "show this message next time" checkbox that
allows disabling the feature,
 - replace "KBytes" by "KB" in the preferences window because it is already
translated (in French at least).

The patch is against Claws Mail 3.7.2cvs20. All the different use cases where
successfully tested on my Linux box. More tests are welcome.
------- Comment #4 From 2009-08-21 18:00:38 -------
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:
http://www.colino.net/claws-mail/

2009-08-21 [colin]    3.7.2cvs22

    * src/compose.c
    * src/prefs_common.c
    * src/prefs_common.h
    * src/prefs_compose_writing.c
    * src/common/utils.c
        Fix bug 1986, "New feature: warn user when inserting 
        a large file in the message body". Patch by Didier
        Barvaux

        Fix bug 1984: Add Réf. : reply prefix (french 
        Lotus Notes); patch by Didier Barvaux
------- Comment #5 From 2009-08-21 21:46:22 -------
Created an attachment (id=721) [details]
Allow larger sizes for insert limit

I checked with version 3.7.2cvs24 and it worked fine. However I found a problem
in my patch: it is not possible to put a size limit above 1000KB for insertion.
It is too low, some people might want a higher limit. The spin button is
configured for value <= 1000. The attached patch increases the limit to
10000KB.
------- Comment #6 From 2009-08-23 13:04:38 -------
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:
http://www.colino.net/claws-mail/

2009-08-23 [colin]    3.7.2cvs25

    * src/prefs_compose_writing.c
        Make the maximum size warning bigger. Patch
        by Didier Barvaux on bug 1986.
------- Comment #7 From 2009-08-24 20:47:42 -------
I checked with version 3.7.2cvs26 and it worked fine. Thank you. I close the
bug.