diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-09-21 16:00:40 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-11-09 08:14:38 +0100 |
commit | db3078bd8c8e3ce3a99fc3987bb6e93b609990c1 (patch) | |
tree | ade902e5f81d719894b5072f6db6ac241b60fc50 /cui | |
parent | 560cb9c53e7c6d6b8164cdd92e897d3c99b850d2 (diff) |
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 <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 33 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.hxx | 3 |
2 files changed, 29 insertions, 7 deletions
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 <com/sun/star/beans/UnknownPropertyException.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/configuration/ReadWriteAccess.hpp> +#include <com/sun/star/configuration/XDocumentation.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XHierarchicalName.hpp> @@ -70,13 +71,15 @@ struct UserData bool bIsPropertyPath; bool bIsReadOnly; OUString sPropertyPath; + OUString sTooltip; int aLineage; Reference<XNameAccess> 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<UserData*>(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<UserData>(rPropertyPath, bIsReadOnly)); + m_vectorUserData.push_back(std::make_unique<UserData>(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<configuration::XDocumentation> 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<css::container::XNameAccess>& xNameAccess, |