Bug 2569 - select html part on folder spesific properties
Summary: select html part on folder spesific properties
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: Folders (show other bugs)
Version: 3.7.10
Hardware: PC Linux
: P3 enhancement
Assignee: users
Depends on:
Reported: 2011-12-27 11:08 CET by MSulchan Darmawan
Modified: 2012-11-28 13:41 CET (History)
2 users (show)

See Also:

A per-folder option to "select HTML part" on message open (5.91 KB, patch)
2012-05-30 15:59 CEST, Andrej Kacian
no flags Details | Diff
A per-folder option to "select HTML part" on message open (7.75 KB, patch)
2012-05-30 20:16 CEST, Andrej Kacian
no flags Details | Diff
A per-folder option to "select HTML part" on message open (1.47 KB, patch)
2012-09-13 22:52 CEST, Andrej Kacian
no flags Details | Diff
A per-folder option to "select HTML part" on message open (8.13 KB, patch)
2012-09-13 23:06 CEST, Andrej Kacian
no flags Details | Diff
A per-folder option to "select HTML part" on message open (8.44 KB, patch)
2012-10-31 11:09 CET, Colin Leroy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description MSulchan Darmawan 2011-12-27 11:08:33 CET
The option to set "Select html part of multipart/alternative message" is already in global preferences (Configuration>Preferences>TextOptions>HTMLMessages).

It would be nice if we can set only on spesific folder properties (right click on folder>properties).

Thank you.
Comment 1 Kevin Fenzi 2012-05-21 22:05:58 CEST
This would be an excellent feature. I would sure appreciate it here too.
Comment 2 Andrej Kacian 2012-05-22 14:05:27 CEST
I was considering enabling this on a per-folderclass basis, so that clawsmail would select HTML part for e.g my RSS feeds, but not for e-mails. But per-folder sounds good as well, with possibility to apply this also to subfolders.
Comment 3 Marcel van der Boom 2012-05-22 14:10:19 CEST
Adding my vote to this as well, This would be excellent.
Comment 4 Andrej Kacian 2012-05-27 14:47:05 CEST
I was thinking of implementing this, but am still not sure how to handle the user preferences. Right now, there's a simple global on/off switch for selecting HTML part automatically. What happens when we add such option per-folder? Remove the global switch? What would be the default ? (NOT selecting HTML part, I guess) How to handle the migration from previous CM version?
Comment 5 Salvatore De Paolis 2012-05-27 14:59:37 CEST
Yes, that's an interesting feature.
It would allow to select HTML only for folders like RSS feeds or similar.
General preference can be overridden by the local folder one i think.
I haven't gone thought the code but it's something interesting to be done.
Comment 6 Kevin Fenzi 2012-05-27 18:19:49 CEST
I don't know the code/internals here, but I think changing the existing pref into the 'global' one (and noting it could be changed on a per folder basis) would be the best way. Then you honor that setting as global unless it's changed in the per folder pref.
Comment 7 Andrej Kacian 2012-05-27 23:32:02 CEST
Kevin, right now, it *is* a global preference. :) The thing is, if we add it also as a per-folder preference, the global preference loses its meaning, because in effect, whether or not to select HTML part would be controlled by that folder's switch. A checkbox can only have two values, there is no space for "yes"/"no"/"obey global preference".
I guess best way would be to remove the global preference option, and write a small routine which will run only if the global option is found in config, and would:
- remove the option from config
- apply its last value to all existing folders

Any comments?
Comment 8 Salvatore De Paolis 2012-05-28 01:29:40 CEST
I think it's just easier and logical to let the local preference overrides the global one.
Much the same as it works with global and local variables.
Comment 9 Kevin Fenzi 2012-05-29 22:38:16 CEST
Perhaps it's better to not try and get really specific, but instead think about use cases?

I would prefer everything prefer text by default, except for specific folders, and thinking about it, perhaps it's not even per folder, perhaps it could be a per contact preference? 

I might like to prefer the html for bugzilla bugs, and I might like to prefer the plain text for some friend that sends crazy htmls that are hard to read. 

Would it make more sense to have this as a per contact pref?
Comment 10 Andrej Kacian 2012-05-30 01:08:12 CEST
There was an interesting idea by Woody on IRC today - instead of a checkbox, make the preference a combobox with three options:
- select HTML part
- do not select HTML part
- obey global preference

In this form, this could be added to folder preferences, as well as to contact preferences (if the addressbook allows it, I'm not really sure now), and figure out which one gets priority. Possibly contact > folder > global.

By the way, I don't think such per-contact option is that useful, but if more people want it, and if the addressbook allows it, I have no objections.
Comment 11 MSulchan Darmawan 2012-05-30 04:31:50 CEST
isn't it better to use checkbox like any other properties ? Just like Salvatore comment #8. Example :

                                                        Apply to subfolder
[ ] Select html part of multipart/alternative message          [ ]

if not checked, use global preference.
Comment 12 Abhay S. Kushwaha 2012-05-30 05:13:10 CEST
That doesn't take care of the scenario where the user wants to see HTML version by default (set in app preferences) except a few folders where they want to see mails only in text.
Comment 13 MSulchan Darmawan 2012-05-30 05:35:13 CEST
Ah sorry, it's because I use text by default :P
Then I guess combobox is the best choice.
Comment 14 Andrej Kacian 2012-05-30 15:59:11 CEST
Created attachment 1114 [details]
A per-folder option to "select HTML part" on message open

Attached patch adds a "Yes"/"No"/"Obey global preference" combobox to folder prefs, and selects HTML part accordingly. Comments are welcome.

Please note that this won't have any effect on RSSyl folders, because RSSyl doesn't create multipart/alternative messages, just text/html messages. Therefore you need to have the global "Render HTML-only messages with plugin if possible" option enabled to view HTML-rendered output by default.
Comment 15 Andrej Kacian 2012-05-30 20:16:28 CEST
Created attachment 1115 [details]
A per-folder option to "select HTML part" on message open

Updated patch adds "apply to subfolders checkbox", changes the long "Obey ..." option wording to simple "Default", and adds a tooltip explaining what exactly "Default" does.
Comment 16 Holger Berndt 2012-05-30 20:38:35 CEST
I image from a users perspective, it seems weird to treat html only mails differently from multipart/alternative with a html part. Either I want to see html, or I don't. Whether that's multipart or html only doesn't really matter.
Comment 17 Andrej Kacian 2012-05-30 21:01:28 CEST
I agree with you, but that is somewhat outside of scope for this particular bug. Right now, there are two separate toggles for:
- selecting HTML part automatically for multipart messages
- rendering HTML with a plugin, regardless of how it happened to be selected

I agree that it is a good idea to have this unified somehow.
Comment 18 Andrej Kacian 2012-09-13 22:52:23 CEST
Created attachment 1158 [details]
A per-folder option to "select HTML part" on message open

Updated the patch to work with current cvs (3.8.1cvs57).

I have noticed that our multipart parsing logic is a bit limited. The html part of following message will not be selected automatically, because the parser is not looking for multipart/related inside a multipart/alternative (messageview.c, around line 1500).


It could use a rewrite, a truly recursive parser could probably be better. Of course, this is also outside of scope of this bug. :)
Comment 19 Andrej Kacian 2012-09-13 23:06:27 CEST
Created attachment 1159 [details]
A per-folder option to "select HTML part" on message open

Once again, this time a complete patch, not just for one file. Sorry about that.
Comment 20 Colin Leroy 2012-09-14 09:35:14 CEST
Hi Andrej, Thanks!

Just one nitpick: I'd love to have promote_html_part as an enum so that it's more clear which value does what. :)
Comment 21 Colin Leroy 2012-10-31 11:09:15 CET
Created attachment 1178 [details]
 A per-folder option to "select HTML part" on message open

Fourth version with an enum. I'll commit it if Andrej's happy with it...
Comment 22 users 2012-10-31 11:26:34 CET
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:

2012-10-31 [colin]	3.8.1cvs109

	* src/folder_item_prefs.c
	* src/folder_item_prefs.h
	* src/messageview.c
	* src/prefs_folder_item.c
		Implement feature from bug #2569, 
		"select html part on folder specific properties"
		Patch based on Andrej's patch.