From db3078bd8c8e3ce3a99fc3987bb6e93b609990c1 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Thu, 21 Sep 2023 16:00:40 +0200 Subject: tdf#157431 Show description for expert config items Change-Id: I7d0257c2e06ed384f90ca3b51a6d2549044f2cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157148 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- cui/source/options/optaboutconfig.cxx | 33 +++++++++++++++++++++++++++------ cui/source/options/optaboutconfig.hxx | 3 ++- 2 files changed, 29 insertions(+), 7 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 4578bc027581..74bf672a3cf1 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -70,13 +71,15 @@ struct UserData bool bIsPropertyPath; bool bIsReadOnly; OUString sPropertyPath; + OUString sTooltip; int aLineage; Reference aXNameAccess; - explicit UserData( OUString aPropertyPath, bool isReadOnly ) + explicit UserData( OUString aPropertyPath, OUString aTooltip, bool isReadOnly ) : bIsPropertyPath( true ) , bIsReadOnly( isReadOnly ) , sPropertyPath(std::move(aPropertyPath)) + , sTooltip(std::move(aTooltip)) , aLineage(0) {} @@ -186,12 +189,19 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage(weld::Window* pParent) IMPL_LINK(CuiAboutConfigTabPage, QueryTooltip, const weld::TreeIter&, rIter, OUString) { UserData *pUserData = weld::fromId(m_xPrefBox->get_id(rIter)); + OUStringBuffer ret; if (pUserData && pUserData->bIsReadOnly) { - return CuiResId(RID_CUISTR_OPT_READONLY); + ret.append(CuiResId(RID_CUISTR_OPT_READONLY)); + } + if (pUserData && !pUserData->sTooltip.isEmpty()) + { + if (pUserData->bIsReadOnly) + ret.append("\n\n"); + ret.append(pUserData->sTooltip); } - return OUString(); + return ret.makeStringAndClear(); } IMPL_LINK(CuiAboutConfigTabPage, HeaderBarClick, int, nColumn, void) @@ -230,10 +240,11 @@ CuiAboutConfigTabPage::~CuiAboutConfigTabPage() } void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUString& rProp, const OUString& rStatus, - const OUString& rType, const OUString& rValue, const weld::TreeIter* pParentEntry, + const OUString& rType, const OUString& rValue, const OUString& rTooltip, + const weld::TreeIter* pParentEntry, bool bInsertToPrefBox, bool bIsReadOnly) { - m_vectorUserData.push_back(std::make_unique(rPropertyPath, bIsReadOnly)); + m_vectorUserData.push_back(std::make_unique(rPropertyPath, rTooltip, bIsReadOnly)); if (bInsertToPrefBox) { OUString sId(weld::toId(m_vectorUserData.back().get())); @@ -357,6 +368,16 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces SAL_WARN("cui.options", "unknown property: " << sPath + "/" + sPropertyName); } + OUString sTooltip; + try + { + Reference xObjProp(xNameAccess, UNO_QUERY_THROW); + sTooltip = xObjProp->getDescriptionByHierarchicalName(sPath + "/" + sPropertyName); + } + catch (css::container::NoSuchElementException) + { + } + OUString sType = aNode.getValueTypeName(); OUStringBuffer sValue; @@ -518,7 +539,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces for(int j = 1; j < lineage; ++j) index = sPath.indexOf("/", index + 1); - InsertEntry(sPath, sPath.copy(index + 1), item, sType, sValue.makeStringAndClear(), + InsertEntry(sPath, sPath.copy(index + 1), item, sType, sValue.makeStringAndClear(), sTooltip, pParentEntry, !bLoadAll, bReadOnly); } } diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index 6cbb76e4cbde..c7278be7b19b 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -66,7 +66,8 @@ 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, + void InsertEntry(const OUString &rPropertyPath, const OUString& rProp, const OUString& rStatus, + const OUString& rType, const OUString& rValue, const OUString& rTooltip, const weld::TreeIter* pParentEntry, bool bInsertToPrefBox, bool bIsReadOnly); void Reset(); void FillItems(const css::uno::Reference& xNameAccess, -- cgit