Bug 280243

Summary: Support changing templates from within the composer
Product: [Applications] kmail2 Reporter: Pavel Baranchikov <maednoldor>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: wishlist CC: adam.jodock, montel, mschiff, paul, thaegele
Priority: NOR    
Version: 4.7   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: kmail2rc snippet template

Description Pavel Baranchikov 2011-08-17 06:19:47 UTC
Version:           4.7 pre (using KDE 4.7.0) 
OS:                Linux

Mail message templates are ignored in KMail after upgrade to KDE 4.7 with KDEPIM 4.7

Reproducible: Didn't try

Steps to Reproduce:
1. Create mail message templates for new message in general KMail configuration or in account-specific configuration.
2. Press "New message" button.

Actual Results:  
The new message is created empty, without some text.

Expected Results:  
The new message should be created from template. As a result, it should be filled with some text.
Comment 1 Christophe Marin 2011-08-29 15:22:07 UTC
Works perfectly here. Which template did you modify ? the one in kmail settings / composer / standard templates / 'New message' ?
Comment 2 Pavel Baranchikov 2011-08-31 07:36:27 UTC
I have modified both "settings/composer/standard templates/New message" and "profiles/change/templates/New message".

I do not think, it affect the bug, but I mention, that I use non-english localization of KDE and PIM.

Tepmlates, used in "reply-to" action work perfectly. Only "New message" button is not affected by the templates.
Comment 3 Tim Haegele 2011-10-18 14:08:02 UTC
I can confirm this Bug.
Comment 4 Laurent Montel 2011-10-26 14:07:31 UTC
could you paste you template here ?
I can't reproduce bug
Comment 5 Tim Haegele 2011-10-26 15:38:41 UTC
Created attachment 64893 [details]
kmail2rc snippet template
Comment 6 Laurent Montel 2011-10-26 15:47:52 UTC
Work fine here.
Are you sure that you don't have specific template on your folder ? (we can define template for specific folder).
Comment 7 Pavel Baranchikov 2011-10-27 05:17:06 UTC
I have templates specific to my main profile (including new message template) and a default new message template.
default one:
-----8<----------------------------------
[TemplateParser]                                                                                                                            
TemplateNewMessage=%REM="New message template"%-\n%BLANK\nasdfasdf    
-----8<----------------------------------

I could not find the profile's templates in files, so there is a template from the UI:
-----8<----------------------------------
Hello.

  %CURSOR

Best regards,
Pavel Baranchikov
%ODATEEN
-----8<----------------------------------
None of the templates work. Other templates (reply-to template, for example) work from my default profile's settings.
Comment 8 Pavel Baranchikov 2011-10-27 05:17:37 UTC
I have templates specific to my main profile (including new message template) and a default new message template.
default one:
-----8<----------------------------------
[TemplateParser]                                                                                                                            
TemplateNewMessage=%REM="New message template"%-\n%BLANK\nasdfasdf    
-----8<----------------------------------

I could not find the profile's templates in files, so there is a template from the UI:
-----8<----------------------------------
Hello.

  %CURSOR

Best regards,
Pavel Baranchikov
%ODATEEN
-----8<----------------------------------
None of the templates work. Other templates (reply-to template, for example) work from my default profile's settings.
Comment 9 Tim Haegele 2011-11-10 15:27:11 UTC
I testet with a new profile on KDE 4.7.4:

I cleared out /etc/skel and logged in as a newly created user. The first thing I did was configuring kmail and created templates just with "test" in it. 
Same thing it does not work with new message.
Comment 10 Tim Haegele 2011-11-10 15:41:40 UTC
I  meant KDE 4.7.3 ;-)
Comment 11 Marc Schiffbauer 2011-12-09 13:56:15 UTC
Additional note from my side (using kmail from KDEPIM 4.8.90):

For me at least identity-based templates do not work.

I just added another identity to kmail and changed some templates within the identity-config dialog.

Then I started a new mail, and switched the identity: The signature is changed correctly on identity change, but the templates to definitly not work.

(In the new identity I just added a default greeting for new messages)

-Marc
Comment 12 Torgny Nyblom 2011-12-09 14:21:26 UTC
Now the smoke clears :)

The procedure defined in comment #11 is not supported.
Templates are used prior to handing the message over to the composer, as a result of this changing identity inside the composer will not change the message as the original message is no longer available for reparsing.
Comment 13 Marc Schiffbauer 2011-12-09 14:53:52 UTC
OK, thanks for the explanation. So this has potential to cause a lot of confusion.

I think we can confirm that this IS an issue, right?

Users can change templates in identities for nothing, because you can have templates for identities that are NOT the default identity for ANY account.

Suggestions to solve the issue (I do not know the code, so please be gentle ;)):

* Change the code so that it will be possible to switch the template while the editor is already opened, say if the previous/new message body has not been altered by the user yet.

AND/OR

* Find a way to make it possible to select identity just before creating a new message or before replying so that processing the template can be done using the identity the user wants.

OR

* The templates should better be anchored to accounts then, and not to  identities at all.

OR

* The tabs for setting templates should only appear / be enabled if the identity being edited is a default identity for an account. But that might also cause some confusion to the user, so I'd prefer the above suggestions to solve this issue.
Comment 14 Torgny Nyblom 2011-12-09 15:09:28 UTC
I agree that this might be an issue :)

Just wanted to point out that you can specify that a identity be used as default on a per folder basis also.
And specify a template when replying/forwarding (press and hold the buttons...).
Comment 15 Adam Jodock 2011-12-14 18:55:08 UTC
I can confirm this as well. Running 4.7.2 (On Kubuntu)

The reply/reply-all/forward templates work fine however the new message template seems to be ignored from both the composer templates and the identity templates.
Comment 16 Tim Haegele 2012-01-11 14:33:33 UTC
still present in Kmail 4.8 RC2
Comment 17 Paul Prince 2012-01-15 23:50:22 UTC
I am seeing this bug on 4.7.4. What is interesting to me is this:

  * If I select 'New Message' from Kontact, my template is ignored.
  * If I select 'New Message' from Kmail, my template is used!


All other templates (reply, forward, etc.) work normally in both programs. I have confirmed that none of my folders have custom templates defined, nor do any of my identities. This is what my new message template looks like:

----SNIP----
%REM="Default new message template"%-
%CURSOR

Thanks,
-Paul P.
----SNIP----
Comment 18 Laurent Montel 2012-03-27 11:16:40 UTC
(In reply to comment #17)
> I am seeing this bug on 4.7.4. What is interesting to me is this:
> 
>   * If I select 'New Message' from Kontact, my template is ignored.
>   * If I select 'New Message' from Kmail, my template is used!
> 
> 
> All other templates (reply, forward, etc.) work normally in both programs. I
> have confirmed that none of my folders have custom templates defined, nor do
> any of my identities. This is what my new message template looks like:
> 
> ----SNIP----
> %REM="Default new message template"%-
> %CURSOR
> 
> Thanks,
> -Paul P.
> ----SNIP----

It's fixed in 4.8.2