diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2024-01-15 08:15:46 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2024-01-15 12:46:18 +0100 |
commit | 71296fd27dd9e3e5609b4fd41f3842673231a3ad (patch) | |
tree | 990c39260fd4f24ba5ecaf7481ee6537c9e416e3 | |
parent | ca931f4762eb7a47802270689b665b472908740d (diff) |
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.mehrbrodt@allotropia.de>
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 28 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.hxx | 5 |
2 files changed, 19 insertions, 14 deletions
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 78dc234ffbe6..de64f45b4260 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) { @@ -186,9 +189,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) { @@ -196,8 +200,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())); @@ -688,8 +692,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); } } } @@ -939,10 +944,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); @@ -961,6 +964,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 d808e3ed04d5..2b9402369a26 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -70,8 +70,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(); |