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>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user