cui/source/options/optaboutconfig.cxx | 28 ++++++++++++++++------------ cui/source/options/optaboutconfig.hxx | 5 +++-- 2 files changed, 19 insertions(+), 14 deletions(-)
New commits: commit 395c8cfb770e7424fd99b884f568a32fcc7a728f Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Mon Jan 15 08:15:46 2024 +0100 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Tue Jan 16 15:42:11 2024 +0100 tdf#159186 Use changed value when editing string-list a second time Change-Id: I0e26a053b3b5fb04abf87894bcfebccea8bdd26f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162074 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit 76ce6466b814bb9ff119f4f83795a2aeefc28793) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162097 Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 1b02642e6d00..f927363f8650 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -70,15 +70,18 @@ struct UserData bool bIsReadOnly; bool bWasModified; OUString sPropertyPath; + Any aPropertyValue; OUString sTooltip; int aLineage; Reference<XNameAccess> aXNameAccess; - explicit UserData(OUString aPropertyPath, OUString aTooltip, bool isReadOnly, bool wasModified) + explicit UserData(OUString aPropertyPath, Any aPropValue, OUString aTooltip, bool isReadOnly, + bool wasModified) : bIsPropertyPath(true) , bIsReadOnly(isReadOnly) , bWasModified(wasModified) , sPropertyPath(std::move(aPropertyPath)) + , aPropertyValue(aPropValue) , sTooltip(std::move(aTooltip)) , aLineage(0) { @@ -187,9 +190,10 @@ IMPL_STATIC_LINK_NOARG(CuiAboutConfigTabPage, ValidNameHdl, SvxNameDialog&, bool CuiAboutConfigTabPage::~CuiAboutConfigTabPage() {} -void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUString& rProp, - const OUString& rStatus, const OUString& rType, - const OUString& rValue, const OUString& rTooltip, +void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, Any aPropertyValue, + const OUString& rProp, const OUString& rStatus, + const OUString& rType, const OUString& rValue, + const OUString& rTooltip, const weld::TreeIter* pParentEntry, bool bInsertToPrefBox, bool bIsReadOnly, bool bWasModified) { @@ -197,8 +201,8 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS if (bOnlyModified && !bWasModified) return; - m_vectorUserData.push_back( - std::make_unique<UserData>(rPropertyPath, rTooltip, bIsReadOnly, bWasModified)); + m_vectorUserData.push_back(std::make_unique<UserData>(rPropertyPath, aPropertyValue, rTooltip, + bIsReadOnly, bWasModified)); if (bInsertToPrefBox) { OUString sId(weld::toId(m_vectorUserData.back().get())); @@ -689,8 +693,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference<XNameAccess>& xNameAccess, for (int j = 1; j < lineage; ++j) index = sPath.indexOf("/", index + 1); - InsertEntry(sPath, sPath.copy(index + 1), item, sType, sValue.makeStringAndClear(), - sTooltip, pParentEntry, !bLoadAll, bReadOnly, bWasModified); + InsertEntry(sPath, aNode, sPath.copy(index + 1), item, sType, + sValue.makeStringAndClear(), sTooltip, pParentEntry, !bLoadAll, bReadOnly, + bWasModified); } } } @@ -940,10 +945,8 @@ IMPL_LINK_NOARG(CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void) else if (sPropertyType == "string-list") { SvxListDialog aListDialog(m_xDialog.get()); - Reference<XNameAccess> xConfigAccess - = getConfigAccess(pUserData->sPropertyPath, false); - Any aNode = xConfigAccess->getByName(sPropertyName); - uno::Sequence<OUString> aList = aNode.get<uno::Sequence<OUString>>(); + uno::Sequence<OUString> aList + = pUserData->aPropertyValue.get<uno::Sequence<OUString>>(); aListDialog.SetEntries( comphelper::sequenceToContainer<std::vector<OUString>>(aList)); aListDialog.SetMode(ListMode::String); @@ -962,6 +965,7 @@ IMPL_LINK_NOARG(CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void) if (bSaveChanges) { AddToModifiedVector(pProperty); + pUserData->aPropertyValue = pProperty->Value; //update listbox value. m_xPrefBox->set_text(*m_xScratchIter, sPropertyType, 2); diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index 28406a8fd776..bc4f7a32f39d 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -72,8 +72,9 @@ private: public: explicit CuiAboutConfigTabPage(weld::Window* pParent); virtual ~CuiAboutConfigTabPage() override; - void InsertEntry(const OUString& rPropertyPath, const OUString& rProp, const OUString& rStatus, - const OUString& rType, const OUString& rValue, const OUString& rTooltip, + void InsertEntry(const OUString& rPropertyPath, css::uno::Any aPropertyValue, + const OUString& rProp, const OUString& rStatus, const OUString& rType, + const OUString& rValue, const OUString& rTooltip, const weld::TreeIter* pParentEntry, bool bInsertToPrefBox, bool bIsReadOnly, bool bWasMOdified); void Reset();