From b4d43cc2152e5cdd274ad76c90532694cc1fb6e2 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 2 Mar 2016 14:21:37 +0100 Subject: cui: classification path is a file, not a directory in SvxPathTabPage So when editing the classification path, open a file picker, not a directory one. Change-Id: I8f7e18f90dc2b5f180e7ddda7157c1e374ed6e4e --- cui/source/options/optpath.cxx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'cui') diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index d1951f74dc72..03155e4dfc7f 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -46,11 +46,14 @@ #include #include #include +#include +#include #include #include #include "optHeaderTabListbox.hxx" #include +using namespace css; using namespace css::beans; using namespace css::lang; using namespace css::ui::dialogs; @@ -546,6 +549,7 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) SvTreeListEntry* pEntry = pPathBox->GetCurEntry(); sal_uInt16 nPos = ( pEntry != nullptr ) ? static_cast(pEntry->GetUserData())->nRealId : 0; OUString sInternal, sUser, sWritable; + bool bPickFile = false; if ( pEntry ) { PathUserData_Impl* pPathImpl = static_cast(pEntry->GetUserData()); @@ -553,6 +557,7 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly ); sUser = pPathImpl->sUserPath; sWritable = pPathImpl->sWritablePath; + bPickFile = pPathImpl->nRealId == SvtPathOptions::PATH_CLASSIFICATION; } if(pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry))) @@ -614,7 +619,7 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) } } } - else if ( pEntry ) + else if (pEntry && !bPickFile) { try { @@ -642,6 +647,24 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) SAL_WARN( "cui.options", "SvxPathTabPage::PathHdl_Impl: exception from folder picker" ); } } + else if (pEntry) + { + try + { + uno::Reference xComponentContext(comphelper::getProcessComponentContext()); + uno::Reference xFilePicker = ui::dialogs::FilePicker::createWithMode(xComponentContext, ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE); + xFilePicker->appendFilter(OUString(), "*.xml"); + if (xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK) + { + uno::Sequence aPathSeq(xFilePicker->getSelectedFiles()); + ChangeCurrentEntry(aPathSeq[0]); + } + } + catch (const uno::Exception& rException) + { + SAL_WARN("cui.options", "SvxPathTabPage::PathHdl_Impl: exception from file picker: " << rException.Message); + } + } } -- cgit