diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-06-05 10:57:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-06-05 20:33:28 +0200 |
commit | 68db2d42c1518fdb777faeff891155f350da538c (patch) | |
tree | 5a07696b7e09451541ae1215a96863ac14aadfc9 /fpicker | |
parent | 638f2642769cc73ad6dfa75d33145f03fa408d7f (diff) |
have just one way to set expander image
Change-Id: Ic07709a864620c6146616c8e0a1417343c0937de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95590
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/source/office/fileview.cxx | 6 | ||||
-rw-r--r-- | fpicker/source/office/foldertree.cxx | 13 | ||||
-rw-r--r-- | fpicker/source/office/foldertree.hxx | 1 |
3 files changed, 13 insertions, 7 deletions
diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index d10c67dffaef..57269cc72011 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -143,11 +143,13 @@ public: std::unique_ptr<weld::TreeIter> make_iterator() const { return mxTreeView->make_iterator(); } void insert(const OUString &rEntry, const OUString& rId, const OUString& rImage, weld::TreeIter& rIter) { - mxTreeView->insert(nullptr, -1, &rEntry, &rId, nullptr, nullptr, &rImage, false, &rIter); + mxTreeView->insert(nullptr, -1, &rEntry, &rId, nullptr, nullptr, false, &rIter); + mxTreeView->set_image(rIter, rImage); } void append(const OUString& rId, const OUString& rStr, const OUString& rType, const OUString& rSize, const OUString& rDate, const OUString& rImage) { - mxTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, mxScratchIter.get()); + mxTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, mxScratchIter.get()); + mxTreeView->set_image(*mxScratchIter, rImage); int nCol = 1; if (mbShowType) mxTreeView->set_text(*mxScratchIter, rType, nCol++); diff --git a/fpicker/source/office/foldertree.cxx b/fpicker/source/office/foldertree.cxx index 256335c3702a..c2c9c764a742 100644 --- a/fpicker/source/office/foldertree.cxx +++ b/fpicker/source/office/foldertree.cxx @@ -20,6 +20,7 @@ using namespace ::com::sun::star::task; FolderTree::FolderTree(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel) : m_xTreeView(std::move(xTreeView)) + , m_xScratchIter(m_xTreeView->make_iterator()) , m_pTopLevel(pTopLevel) { m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 24, @@ -44,11 +45,11 @@ IMPL_LINK(FolderTree, RequestingChildrenHdl, const weld::TreeIter&, rEntry, bool void FolderTree::InsertRootEntry(const OUString& rId, const OUString& rRootLabel) { - std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator()); OUString sFolderImage(RID_BMP_FOLDER); m_xTreeView->insert(nullptr, -1, &rRootLabel, &rId, nullptr, nullptr, - &sFolderImage, true, xEntry.get()); - m_xTreeView->set_cursor(*xEntry); + true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sFolderImage); + m_xTreeView->set_cursor(*m_xScratchIter); } void FolderTree::FillTreeEntry(const weld::TreeIter& rEntry) @@ -83,7 +84,8 @@ void FolderTree::FillTreeEntry(const weld::TreeIter& rEntry) if (!i->mbIsFolder) continue; m_xTreeView->insert(&rEntry, -1, &i->GetTitle(), &i->maTargetURL, - nullptr, nullptr, &sFolderImage, true, nullptr); + nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sFolderImage); } } } @@ -116,7 +118,8 @@ void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std: for (auto const& folder : rFolders) { m_xTreeView->insert(xParent.get(), -1, &folder.first, &folder.second, - nullptr, nullptr, &sFolderImage, true, nullptr); + nullptr, nullptr, true, m_xScratchIter.get()); + m_xTreeView->set_image(*m_xScratchIter, sFolderImage); } m_sLastUpdatedDir = rUrl; diff --git a/fpicker/source/office/foldertree.hxx b/fpicker/source/office/foldertree.hxx index 7e5e85816c48..aaa79bbf2635 100644 --- a/fpicker/source/office/foldertree.hxx +++ b/fpicker/source/office/foldertree.hxx @@ -23,6 +23,7 @@ class FolderTree { private: std::unique_ptr<weld::TreeView> m_xTreeView; + std::unique_ptr<weld::TreeIter> m_xScratchIter; weld::Window* m_pTopLevel; Reference< XCommandEnvironment > m_xEnv; ::osl::Mutex m_aMutex; |