Bug 1986 - New feature: warn user when inserting a large file in the message body
Summary: New feature: warn user when inserting a large file in the message body
Status: CLOSED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: UI/Compose Window (show other bugs)
Version: 3.7.3
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2009-08-16 16:15 UTC by Didier Barvaux
Modified: 2009-08-24 20:47 UTC (History)
1 user (show)

See Also:


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

Description Didier Barvaux 2009-08-16 16:15:05 UTC
Created attachment 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 Colin Leroy 2009-08-17 08:53:37 UTC
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 Didier Barvaux 2009-08-17 10:39:06 UTC
I will look at it and update the patch.
Comment 3 Didier Barvaux 2009-08-21 15:47:31 UTC
Created attachment 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 users 2009-08-21 18:00:38 UTC
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
Comment 5 Didier Barvaux 2009-08-21 21:46:22 UTC
Created attachment 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 users 2009-08-23 13:04:38 UTC
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 Didier Barvaux 2009-08-24 20:47:42 UTC
I checked with version 3.7.2cvs26 and it worked fine. Thank you. I close the bug.

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