Bug 435431

Summary: Edit menu (Variables submenu) doesn't work as advertised
Product: [Applications] kmail2 Reporter: David C. Bryant <davidbryant>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: davidbryant
Priority: NOR    
Version: 5.16.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.17.0
Attachments: Screenshot from Composer window, illustrating the bug.

Description David C. Bryant 2021-04-06 17:42:16 UTC
SUMMARY
There are a few glitches in the Edit --> Variables > menu items. In particular, the "First Name" option extracts Last Name, not First Name.


STEPS TO REPRODUCE
1. Open the Composer, fill in "To:" and "CC:" fields ("From:" is pre-filled).
2. Position the cursor somewhere in the main Composer window.
3. Select menu item Edit --> Variable > To > To Field First Name (or ... CC > CC 
Field First Name, or ... From > From Field First Name).


OBSERVED RESULT
The selected menu item inserts the person's last name.


EXPECTED RESULT
I expected this function to insert the person's first name, as advertised.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Yes!
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I ran across this bug while working on the documentation update project. There are a couple of other problems with "Variables >" ... check out "Edit --> Variables > Attachments > Names and Sizes" (appends the literal value "AND SIZES" to the list of attachments' names ... I expected to see the size of each attachment, sort of the way sizes are displayed in the list of attachments underneath the main Composer window) and also try "Edit --> Variables > Date/Time > Time" (appends the literal value "LONG" to hh:mm:ss AM/PM, where I expected to see, e.g., "GMT" or "UTC" or "CDT").

See the attached screenshot, where I tried each of the four options (Address, Last Name, First Name, Name) for "To >", "From  >", and "CC >", respectively. First Name and Last Name are stored as separate fields in KAddressBook, and "Name" includes both a person's first and last names, so these functions work almost right ... only the "First Name" option is misbehaving.
Comment 1 David C. Bryant 2021-04-06 17:45:30 UTC
Created attachment 137388 [details]
Screenshot from Composer window, illustrating the bug.
Comment 2 Laurent Montel 2021-04-07 05:47:26 UTC
Git commit 1d14ddb598cda4a9afaddd8be257b1e91c1d8d23 by Laurent Montel.
Committed on 07/04/2021 at 05:46.
Pushed by mlaurent into branch 'release/21.04'.

Fix BUG 435431 Edit menu (Variables submenu) doesn't work as advertised

FIXED-IN: 5.17.0

M  +1    -1    messagecomposer/src/snippet/convertsnippetvariablesjob.cpp

https://invent.kde.org/pim/messagelib/commit/1d14ddb598cda4a9afaddd8be257b1e91c1d8d23