diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-02 14:21:37 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-07-07 17:42:14 +0200 |
commit | 81d18240efc733ba0595a23b29237fed933e8dfd (patch) | |
tree | 126787e7bae2e6b2ff1675e8080c677ad0a2615a /cui | |
parent | 39a4675d584ddbd2ac544e63bfa838da34a03a02 (diff) |
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
(cherry picked from commit b4d43cc2152e5cdd274ad76c90532694cc1fb6e2)
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optpath.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 677e90b90c25..e88a44ae17b8 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -46,11 +46,14 @@ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FilePicker.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/util/thePathSettings.hpp> #include <officecfg/Office/Common.hxx> #include "optHeaderTabListbox.hxx" #include <vcl/help.hxx> +using namespace css; using namespace css::beans; using namespace css::lang; using namespace css::ui::dialogs; @@ -553,6 +556,7 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) SvTreeListEntry* pEntry = pPathBox->GetCurEntry(); sal_uInt16 nPos = ( pEntry != nullptr ) ? static_cast<PathUserData_Impl*>(pEntry->GetUserData())->nRealId : 0; OUString sInternal, sUser, sWritable; + bool bPickFile = false; if ( pEntry ) { PathUserData_Impl* pPathImpl = static_cast<PathUserData_Impl*>(pEntry->GetUserData()); @@ -560,6 +564,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))) @@ -621,7 +626,7 @@ IMPL_LINK_NOARG_TYPED(SvxPathTabPage, PathHdl_Impl, Button*, void) } } } - else if ( pEntry ) + else if (pEntry && !bPickFile) { try { @@ -649,6 +654,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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext()); + uno::Reference<ui::dialogs::XFilePicker3> xFilePicker = ui::dialogs::FilePicker::createWithMode(xComponentContext, ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE); + xFilePicker->appendFilter(OUString(), "*.xml"); + if (xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK) + { + uno::Sequence<OUString> aPathSeq(xFilePicker->getSelectedFiles()); + ChangeCurrentEntry(aPathSeq[0]); + } + } + catch (const uno::Exception& rException) + { + SAL_WARN("cui.options", "SvxPathTabPage::PathHdl_Impl: exception from file picker: " << rException.Message); + } + } } |