Bug 43497 - User Data: Initials incorrectly assumes 2 letter initials string on update
Summary: User Data: Initials incorrectly assumes 2 letter initials string on update
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
3.4.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-03 15:56 UTC by Adric Net
Modified: 2012-12-29 05:32 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
initials field incorrectly displays ANN, Mac , libo 3.4.4 (77.53 KB, image/jpeg)
2011-12-03 15:56 UTC, Adric Net
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adric Net 2011-12-03 15:56:58 UTC
Created attachment 54093 [details]
initials field incorrectly displays ANN, Mac , libo 3.4.4

In Options (Preferences on Mac) user may input or update first name and last name fields and on field change (eg with Tab key) the Initials field is calculated and updated. When initials are not a 2 letter string incorrect initials are populated.
As noted in #30862 the field is too narrow to see this until it's scrolled (screenshot attached).

Reproduction:
In User Data fields of Options/Preferences input initials directly (eg 'ADN') and update First Name (gn) or Last Name (sn) fields directly (eg 'Adric', 'Net'). Initials field is updated to incorrect value 'ANN" rather than 'AN' or 'ADN'.

I've seen this in these builds:
LibreOffice 3.4.4 OOO340m1 (Build:402) Mac OS X Lion 10.7.2 (Intel 64bit)
LibreOffice 3.4.4 OOO340m1 (Build:402) Ubuntu 11.10 (Intel 32bit)

Although this is a trivial display concern easily worked-around it demonstrates that a assumption made by the software is incorrect. The behaviour I see suggests that the second character of the string in the Initials field is updated when a new Last name (sn) is input rather than clearing the field and drawing a new correct value.
Comment 1 Christopher Copits 2012-09-02 19:18:46 UTC
I would like to take a shot at fixing this bug. It would be my first bugfix for LO, and after poking around in the code, I think I have an idea.

In file cui/source/options/optgenrl.cxx, method ModifyHdl_Impl(), I will check to see if the initials field is three characters. If it is, I will clear the field before it is updated.
Comment 2 Christopher Copits 2012-09-22 16:49:32 UTC
Took a bit of time to get set up to push patches directly, but I submitted the fix today.
Comment 3 Christopher Copits 2012-09-24 23:55:52 UTC
To reproduce the bug in existing code:

1. Click Tools > Options;
2. Navigate to LibreOffice > User Data;
3. Enter "ALB" (without quotes) in the initials field;
4. In the first name field, enter "Adam" (without quotes);
5. In the last name field, enter "Bucky" (without quotes);
6. Observe that the initials now contains "ABB"; the middle initial of "L" has been overwritten.

After my change:

1. Click Tools > Options;
2. Navigate to LibreOffice > User Data;
3. Enter "ALB" (without quotes) in the initials field;
4. In the first name field, enter "Adam" (without quotes);
5. Observe that the initials field now contains an "A";
6. In the last name field, enter "Bucky" (without quotes);
7. Observe that the initials field now contains an "AB".

What I am changing:

Instead of letting the initials field contain the invalid "ABB" (which ignores the middle initial), I cleared out the initials field completely.
Comment 4 Not Assigned 2012-09-25 10:00:26 UTC
Chris Copits committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3610d36782ca30aa6478921bcf331dcd7a554efb

fdo#43497 Editing the first or last name clears initials.



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.