22#include <osl/file.hxx>
33#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
34#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
45 auto nCount = m_xRadioLB->n_children();
46 bool bIsSelected = m_xRadioLB->get_selected_index() != -1;
48 m_xDelBtn->set_sensitive(bEnable && bIsSelected);
53 auto nCount = m_xPathLB->n_children();
54 bool bIsSelected = m_xPathLB->get_selected_index() != -1;
56 m_xDelBtn->set_sensitive(bEnable && bIsSelected);
77 HandleEntryChecked(m_xRadioLB->get_iter_index_in_parent(rRowCol.first));
91 Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
94 if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
101 osl::FileBase::getSystemPathFromFileURL(
aURL, sInsPath);
103 if (m_xRadioLB->find_text(sInsPath) != -1)
105 OUString sMsg(
CuiResId( RID_MULTIPATH_DBL_ERR ) );
106 sMsg = sMsg.replaceFirst(
"%1", sInsPath );
108 VclMessageType::Info, VclButtonsType::Ok, sMsg));
113 AppendEntry(sInsPath,
aURL);
116 SelectHdl_Impl(*m_xRadioLB);
121 Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
124 if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
131 osl::FileBase::getSystemPathFromFileURL(
aURL, sInsPath);
133 if (m_xPathLB->find_text(sInsPath) != -1)
135 OUString sMsg(
CuiResId( RID_MULTIPATH_DBL_ERR ) );
136 sMsg = sMsg.replaceFirst(
"%1", sInsPath );
138 VclMessageType::Info, VclButtonsType::Ok, sMsg));
143 m_xPathLB->append(
aURL, sInsPath);
146 SelectHdl_Impl(*m_xPathLB);
151 int nPos = m_xRadioLB->get_selected_index();
153 m_xRadioLB->remove(
nPos);
154 int nCnt = m_xRadioLB->n_children();
164 HandleEntryChecked(
nPos);
166 m_xRadioLB->select(
nPos);
169 SelectHdl_Impl(*m_xRadioLB);
174 int nPos = m_xPathLB->get_selected_index();
175 m_xPathLB->remove(
nPos);
176 int nCnt = m_xPathLB->n_children();
184 m_xPathLB->select(
nPos);
187 SelectHdl_Impl(*m_xPathLB);
191 : GenericDialogController(pParent,
"cui/ui/multipathdialog.ui",
"MultiPathDialog")
192 , m_xRadioLB(m_xBuilder->weld_tree_view(
"paths"))
193 , m_xAddBtn(m_xBuilder->weld_button(
"add"))
194 , m_xDelBtn(m_xBuilder->weld_button(
"delete"))
209 : GenericDialogController(pParent,
"cui/ui/selectpathdialog.ui",
"SelectPathDialog")
210 , m_xPathLB(m_xBuilder->weld_tree_view(
"paths"))
211 , m_xAddBtn(m_xBuilder->weld_button(
"add"))
212 , m_xDelBtn(m_xBuilder->weld_button(
"delete"))
230 OUStringBuffer sNewPath;
240 if (!sNewPath.isEmpty())
245 if (!sNewPath.isEmpty())
247 sNewPath.append(sWritable);
249 return sNewPath.makeStringAndClear();
254 OUStringBuffer sNewPath;
258 if ( !sNewPath.isEmpty() )
263 return sNewPath.makeStringAndClear();
268 if ( !rPath.empty() )
276 OUString sSystemPath;
278 osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
280 const OUString sEntry((bIsSystemPath ? sSystemPath : sPath));
298 if ( !rPath.empty() )
304 OUString sSystemPath;
306 osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
308 m_xPathLB->append(sPath, bIsSystemPath ? sSystemPath : sPath);
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
std::unique_ptr< weld::TreeView > m_xRadioLB
std::unique_ptr< weld::Button > m_xDelBtn
void HandleEntryChecked(int nRow)
void SetPath(std::u16string_view rPath)
void AppendEntry(const OUString &rText, const OUString &rId)
SvxMultiPathDialog(weld::Window *pParent)
virtual ~SvxMultiPathDialog() override
std::unique_ptr< weld::Button > m_xAddBtn
std::unique_ptr< weld::Button > m_xAddBtn
std::unique_ptr< weld::TreeView > m_xPathLB
void SetPath(std::u16string_view rPath)
std::unique_ptr< weld::Button > m_xDelBtn
SvxPathSelectDialog(weld::Window *pParent)
std::pair< const TreeIter &, int > iter_col
OUString CuiResId(TranslateId aKey)
#define LINK(Instance, Class, Member)
IMPL_LINK(SvxMultiPathDialog, CheckHdl_Impl, const weld::TreeView::iter_col &, rRowCol, void)
IMPL_LINK_NOARG(SvxMultiPathDialog, SelectHdl_Impl, weld::TreeView &, void)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker(const css::uno::Reference< css::uno::XComponentContext > &rContext, weld::Window *pPreferredParent)
#define SVT_SEARCHPATH_DELIMITER