22 #include <osl/file.hxx>
28 #include <dialmgr.hxx>
30 #include <strings.hrc>
32 #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
33 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
43 auto nCount = m_xRadioLB->n_children();
44 bool bIsSelected = m_xRadioLB->get_selected_index() != -1;
46 m_xDelBtn->set_sensitive(bEnable && bIsSelected);
51 auto nCount = m_xPathLB->n_children();
52 bool bIsSelected = m_xPathLB->get_selected_index() != -1;
54 m_xDelBtn->set_sensitive(bEnable && bIsSelected);
65 for (
int i = 0;
i < nCount; ++
i)
75 HandleEntryChecked(m_xRadioLB->get_iter_index_in_parent(rRowCol.first));
90 Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
92 if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
99 osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
101 if (m_xRadioLB->find_text(sInsPath) != -1)
103 OUString sMsg(
CuiResId( RID_MULTIPATH_DBL_ERR ) );
104 sMsg = sMsg.replaceFirst(
"%1", sInsPath );
106 VclMessageType::Info, VclButtonsType::Ok, sMsg));
111 AppendEntry(sInsPath, aURL);
114 SelectHdl_Impl(*m_xRadioLB);
120 Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
122 if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
129 osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
131 if (m_xPathLB->find_text(sInsPath) != -1)
133 OUString sMsg(
CuiResId( RID_MULTIPATH_DBL_ERR ) );
134 sMsg = sMsg.replaceFirst(
"%1", sInsPath );
136 VclMessageType::Info, VclButtonsType::Ok, sMsg));
141 m_xPathLB->append(aURL, sInsPath);
144 SelectHdl_Impl(*m_xPathLB);
149 int nPos = m_xRadioLB->get_selected_index();
150 bool bChecked = m_xRadioLB->get_toggle(nPos) ==
TRISTATE_TRUE;
151 m_xRadioLB->remove(nPos);
152 int nCnt = m_xRadioLB->n_children();
162 HandleEntryChecked(nPos);
164 m_xRadioLB->select(nPos);
167 SelectHdl_Impl(*m_xRadioLB);
172 int nPos = m_xPathLB->get_selected_index();
173 m_xPathLB->remove(nPos);
174 int nCnt = m_xPathLB->n_children();
182 m_xPathLB->select(nPos);
185 SelectHdl_Impl(*m_xPathLB);
189 : GenericDialogController(pParent,
"cui/ui/multipathdialog.ui",
"MultiPathDialog")
190 , m_xRadioLB(m_xBuilder->weld_tree_view(
"paths"))
191 , m_xAddBtn(m_xBuilder->weld_button(
"add"))
192 , m_xDelBtn(m_xBuilder->weld_button(
"delete"))
207 : GenericDialogController(pParent,
"cui/ui/selectpathdialog.ui",
"SelectPathDialog")
208 , m_xPathLB(m_xBuilder->weld_tree_view(
"paths"))
209 , m_xAddBtn(m_xBuilder->weld_button(
"add"))
210 , m_xDelBtn(m_xBuilder->weld_button(
"delete"))
228 OUStringBuffer sNewPath;
238 if (!sNewPath.isEmpty())
239 sNewPath.append(cDelim);
243 if (!sNewPath.isEmpty())
244 sNewPath.append(cDelim);
245 sNewPath.append(sWritable);
247 return sNewPath.makeStringAndClear();
252 OUStringBuffer sNewPath;
256 if ( !sNewPath.isEmpty() )
261 return sNewPath.makeStringAndClear();
266 if ( !rPath.isEmpty() )
273 const OUString sPath = rPath.getToken( 0, cDelim, nIndex );
274 OUString sSystemPath;
276 osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
278 const OUString sEntry((bIsSystemPath ? sSystemPath : sPath));
296 if ( !rPath.isEmpty() )
302 OUString sSystemPath;
304 osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None;
306 m_xPathLB->append(sPath, bIsSystemPath ? sSystemPath : sPath);
#define LINK(Instance, Class, Member)
std::unique_ptr< weld::Button > m_xDelBtn
std::pair< const TreeIter &, int > iter_col
std::unique_ptr< weld::Button > m_xAddBtn
void HandleEntryChecked(int nRow)
SvxPathSelectDialog(weld::Window *pParent)
IMPL_LINK(SvxMultiPathDialog, CheckHdl_Impl, const weld::TreeView::iter_col &, rRowCol, void)
void SetPath(const OUString &rPath)
void AppendEntry(const OUString &rText, const OUString &rId)
std::unique_ptr< weld::Button > m_xAddBtn
virtual ~SvxMultiPathDialog() override
std::unique_ptr< weld::TreeView > m_xRadioLB
SvxMultiPathDialog(weld::Window *pParent)
OUString CuiResId(const char *pKey)
#define SVT_SEARCHPATH_DELIMITER
std::unique_ptr< weld::Button > m_xDelBtn
void SetPath(const OUString &rPath)
IMPL_LINK_NOARG(SvxMultiPathDialog, SelectHdl_Impl, weld::TreeView &, void)
Reference< XExecutableDialog > m_xDialog
Reference< XComponentContext > getProcessComponentContext()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
std::unique_ptr< weld::TreeView > m_xPathLB