diff options
author | Tor Lillqvist <tml@collabora.com> | 2017-04-28 12:16:13 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2017-04-28 12:54:52 +0300 |
commit | 9416611763a6c6e5bc04a938e909727579716db0 (patch) | |
tree | c41995224af251a02392ebbb02bcfa9b6f27d6b6 /cui | |
parent | 72947e82fef1800d50e6d317fbfd7be05aaebf6b (diff) |
tdf#105841: Avoid REGRESSION!!!
Let's reinstate the name charade instead. Pitäkää tunkkinne.
This reverts commit 5941496601600269296dde3e4ff8b615a8bb45ca.
This reverts commit db231633af4667e24281e0be69ab63ad3081fdc3.
Change-Id: I7d9890f3bd478bac195c1a7a59ff9822c2c83653
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/cuioptgenrl.hxx | 1 | ||||
-rw-r--r-- | cui/source/options/optgenrl.cxx | 102 | ||||
-rw-r--r-- | cui/uiconfig/ui/optuserpage.ui | 204 |
3 files changed, 247 insertions, 60 deletions
diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx index 5f1065ada287..0c56b6cdcde6 100644 --- a/cui/source/inc/cuioptgenrl.hxx +++ b/cui/source/inc/cuioptgenrl.hxx @@ -47,6 +47,7 @@ private: struct Field; std::vector<std::shared_ptr<Field> > vFields; // "name" fields + unsigned nNameRow; unsigned nShortNameField; DECL_LINK( ModifyHdl_Impl, Edit&, void ); diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx index 0dd5e7f0e05a..fc220de51598 100644 --- a/cui/source/options/optgenrl.cxx +++ b/cui/source/options/optgenrl.cxx @@ -41,6 +41,8 @@ enum RowType { Row_Company, Row_Name, + Row_Name_Russian, + Row_Name_Eastern, Row_Street, Row_Street_Russian, Row_City, @@ -58,6 +60,7 @@ namespace Lang { unsigned const Others = 1; unsigned const Russian = 2; + unsigned const Eastern = 4; unsigned const US = 8; unsigned const All = static_cast<unsigned>(-1); } @@ -77,7 +80,9 @@ struct const vRowInfo[] = { { "companyft", Lang::All }, - { "nameft", Lang::All }, + { "nameft", Lang::All & ~Lang::Russian & ~Lang::Eastern }, + { "rusnameft", Lang::Russian }, + { "eastnameft", Lang::Eastern }, { "streetft", Lang::All & ~Lang::Russian }, { "russtreetft", Lang::Russian }, { "icityft", Lang::All & ~Lang::US }, @@ -108,8 +113,18 @@ const vFieldInfo[] = // Company { Row_Company, "company", UserOptToken::Company, EditPosition::COMPANY }, // Name + { Row_Name, "firstname", UserOptToken::FirstName, EditPosition::FIRSTNAME }, { Row_Name, "lastname", UserOptToken::LastName, EditPosition::LASTNAME }, { Row_Name, "shortname", UserOptToken::ID, EditPosition::SHORTNAME }, + // Name (russian) + { Row_Name_Russian, "ruslastname", UserOptToken::LastName, EditPosition::LASTNAME }, + { Row_Name_Russian, "rusfirstname", UserOptToken::FirstName, EditPosition::FIRSTNAME }, + { Row_Name_Russian, "rusfathersname", UserOptToken::FathersName, EditPosition::UNKNOWN }, + { Row_Name_Russian, "russhortname", UserOptToken::ID, EditPosition::SHORTNAME }, + // Name (eastern: reversed name ord + { Row_Name_Eastern, "eastlastname", UserOptToken::LastName, EditPosition::LASTNAME }, + { Row_Name_Eastern, "eastfirstname", UserOptToken::FirstName, EditPosition::FIRSTNAME }, + { Row_Name_Eastern, "eastshortname", UserOptToken::ID, EditPosition::SHORTNAME }, // Street { Row_Street, "street", UserOptToken::Street, EditPosition::STREET }, // Street (russian) @@ -218,7 +233,10 @@ void SvxGeneralTabPage::InitControls () LangBit = Lang::Russian; else { - LangBit = Lang::Others; + if (MsLangId::isFamilyNameFirst(l)) + LangBit = Lang::Eastern; + else + LangBit = Lang::Others; } // creating rows @@ -248,6 +266,7 @@ void SvxGeneralTabPage::InitControls () // "short name" field? if (vFieldInfo[iField].nUserOptionsId == UserOptToken::ID) { + nNameRow = vRows.size() - 1; nShortNameField = vFields.size() - 1; } } @@ -260,7 +279,7 @@ void SvxGeneralTabPage::SetLinks () { // link for updating the initials Link<Edit&,void> aLink = LINK( this, SvxGeneralTabPage, ModifyHdl_Impl ); - Row& rNameRow = *vRows[Row_Name]; + Row& rNameRow = *vRows[nNameRow]; for (unsigned i = rNameRow.nFirstField; i != rNameRow.nLastField - 1; ++i) vFields[i]->pEdit->SetModifyHdl(aLink); } @@ -313,22 +332,36 @@ void SvxGeneralTabPage::Reset( const SfxItemSet* rSet ) // ModifyHdl_Impl() // This handler updates the initials (short name) -// when the name field was updated. +// when one of the name fields was updated. IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit&, rEdit, void ) { // short name field and row Field& rShortName = *vFields[nShortNameField]; - if (rShortName.pEdit->IsEnabled()) + Row& rNameRow = *vRows[nNameRow]; + // number of initials + unsigned const nInits = rNameRow.nLastField - rNameRow.nFirstField - 1; + // which field was updated? (in rNameRow) + unsigned nField = nInits; + for (unsigned i = 0; i != nInits; ++i) + { + if (vFields[rNameRow.nFirstField + i]->pEdit == &rEdit) + nField = i; + } + // updating the initial + if (nField < nInits && rShortName.pEdit->IsEnabled()) { - sal_Int32 nIndex = 0; + OUString sShortName = rShortName.pEdit->GetText(); + // clear short name if it contains more characters than the number of initials + if ((unsigned)sShortName.getLength() > nInits) + { + rShortName.pEdit->SetText(OUString()); + } + while ((unsigned)sShortName.getLength() < nInits) + sShortName += " "; OUString sName = rEdit.GetText(); - OUString sShortName; - do { - OUString sToken = sName.getToken(0, ' ', nIndex); - if (!sToken.isEmpty()) - sShortName += sToken.copy(0, 1); - } while (nIndex != -1); - rShortName.pEdit->SetText(sShortName); + OUString sLetter = sName.isEmpty() + ? OUString(sal_Unicode(' ')) : sName.copy(0, 1); + rShortName.pEdit->SetText(sShortName.replaceAt(nField, 1, sLetter).trim()); } } @@ -338,18 +371,10 @@ bool SvxGeneralTabPage::GetData_Impl() // updating SvtUserOptions aUserOpt; for (auto const & i: vFields) - { aUserOpt.SetToken( vFieldInfo[i->iField].nUserOptionsId, i->pEdit->GetText() ); - // Blank out first name and father's name which aren't kept separately any longer - if (vFieldInfo[i->iField].nUserOptionsId == UserOptToken::LastName) - { - aUserOpt.SetToken(UserOptToken::FirstName, ""); - aUserOpt.SetToken(UserOptToken::FathersName, ""); - } - } // modified? for (auto const & i: vFields) @@ -373,40 +398,7 @@ void SvxGeneralTabPage::SetData_Impl() Field& rField = *vFields[iField]; // updating content UserOptToken const nToken = vFieldInfo[rField.iField].nUserOptionsId; - if (nToken == UserOptToken::LastName) - { - // When using old-style data (with separated name), if - // "family name" comes first in the locale, use that - // order. If Russian, use also father's name if - // present. - OUString sName; - - if (MsLangId::isFamilyNameFirst(Application::GetSettings().GetUILanguageTag().getLanguageType())) - { - sName += aUserOpt.GetToken(UserOptToken::LastName); - OUString sFirstName = aUserOpt.GetToken(UserOptToken::FirstName); - if (!sName.isEmpty() && !sFirstName.isEmpty()) - sName += " "; - sName += sFirstName; - } - else - { - sName += aUserOpt.GetToken(UserOptToken::FirstName); - OUString sFathersName; - if (Application::GetSettings().GetUILanguageTag().getLanguageType() == LANGUAGE_RUSSIAN) - sFathersName = aUserOpt.GetToken(UserOptToken::FathersName); - if (!sName.isEmpty() && !sFathersName.isEmpty()) - sName += " "; - sName += sFathersName; - OUString sLastName = aUserOpt.GetToken(UserOptToken::LastName); - if (!sName.isEmpty() && !sLastName.isEmpty()) - sName += " "; - sName += sLastName; - } - rField.pEdit->SetText(sName); - } - else - rField.pEdit->SetText(aUserOpt.GetToken(nToken)); + rField.pEdit->SetText(aUserOpt.GetToken(nToken)); // is enabled? bool const bEnableEdit = !aUserOpt.IsTokenReadonly(nToken); rField.pEdit->Enable(bEnableEdit); diff --git a/cui/uiconfig/ui/optuserpage.ui b/cui/uiconfig/ui/optuserpage.ui index 009ec6ec73be..93a7db478f96 100644 --- a/cui/uiconfig/ui/optuserpage.ui +++ b/cui/uiconfig/ui/optuserpage.ui @@ -39,9 +39,9 @@ <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="halign">end</property> - <property name="label" translatable="yes">Name/initials:</property> + <property name="label" translatable="yes">First/last _name/initials:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">lastname</property> + <property name="mnemonic_widget">firstname</property> </object> <packing> <property name="left_attach">0</property> @@ -143,6 +143,24 @@ <property name="no_show_all">True</property> <property name="column_spacing">6</property> <child> + <object class="GtkEntry" id="firstname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <child internal-child="accessible"> + <object class="AtkObject" id="firstname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">First name</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> <object class="GtkEntry" id="lastname"> <property name="can_focus">True</property> <property name="no_show_all">True</property> @@ -151,12 +169,12 @@ <property name="invisible_char">•</property> <child internal-child="accessible"> <object class="AtkObject" id="lastname-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Name</property> + <property name="AtkObject::accessible-name" translatable="yes">Last name</property> </object> </child> </object> <packing> - <property name="left_attach">0</property> + <property name="left_attach">1</property> <property name="top_attach">0</property> </packing> </child> @@ -174,7 +192,7 @@ </child> </object> <packing> - <property name="left_attach">1</property> + <property name="left_attach">2</property> <property name="top_attach">0</property> </packing> </child> @@ -407,6 +425,182 @@ </packing> </child> <child> + <object class="GtkLabel" id="rusnameft"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="halign">end</property> + <property name="label" translatable="yes">Last name/first _name/father’s name/initials:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">ruslastname</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid8"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkEntry" id="ruslastname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <child internal-child="accessible"> + <object class="AtkObject" id="ruslastname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Last name</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="rusfathersname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <child internal-child="accessible"> + <object class="AtkObject" id="rusfathersname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Father's name</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="russhortname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="invisible_char">•</property> + <property name="width_chars">7</property> + <child internal-child="accessible"> + <object class="AtkObject" id="russhortname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Initials</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="rusfirstname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <child internal-child="accessible"> + <object class="AtkObject" id="rusfirstname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">First name</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="eastnameft"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="halign">end</property> + <property name="label" translatable="yes">Last/first _name/initials:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">eastlastname</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid9"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkEntry" id="eastlastname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <child internal-child="accessible"> + <object class="AtkObject" id="eastlastname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Last name</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="eastfirstname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + <child internal-child="accessible"> + <object class="AtkObject" id="eastfirstname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">First name</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="eastshortname"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="valign">center</property> + <property name="invisible_char">•</property> + <property name="width_chars">7</property> + <child internal-child="accessible"> + <object class="AtkObject" id="eastshortname-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Initials</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> <object class="GtkLabel" id="russtreetft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> |