diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-01-24 18:55:20 +0900 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-01-24 13:22:37 +0000 |
commit | d8aa4503966e2c8882c238a1a30c05b72bdf6f68 (patch) | |
tree | f810a50165bc65cdd55516778a37e79a72eda349 /sdext | |
parent | 80cec5faa5c69d4cf01dd7fc8a7e0dc1ed6f73ae (diff) |
tdf#105382 Set URL-decoded default filename for minimized presentation
See mailing-list thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076702.html>
for a discussion on the original presentation file's URL.
Change-Id: I51ccd7672513118f39518c4ed21902de16b2298f
Reviewed-on: https://gerrit.libreoffice.org/33261
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/Library_PresentationMinimizer.mk | 1 | ||||
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 27 |
2 files changed, 10 insertions, 18 deletions
diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk index 2ae650a5f855..eb8995f00be0 100644 --- a/sdext/Library_PresentationMinimizer.mk +++ b/sdext/Library_PresentationMinimizer.mk @@ -28,6 +28,7 @@ $(eval $(call gb_Library_use_libraries,PresentationMinimizer,\ cppu \ cppuhelper \ sal \ + tl \ )) $(eval $(call gb_Library_add_exception_objects,PresentationMinimizer,\ diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index 78c044a752c5..014228540a40 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <sal/macros.h> #include <osl/time.h> +#include <tools/urlobj.hxx> using namespace ::com::sun::star::io; @@ -511,24 +512,14 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) Reference< XStorable > xStorable( mrOptimizerDialog.mxController->getModel(), UNO_QUERY ); if ( xStorable.is() && xStorable->hasLocation() ) { - OUString aLocation( xStorable->getLocation() ); - if ( !aLocation.isEmpty() ) - { - sal_Int32 nIndex = aLocation.lastIndexOf( '/', aLocation.getLength() - 1 ); - if ( nIndex >= 0 ) - { - if ( nIndex < aLocation.getLength() - 1 ) - aLocation = aLocation.copy( nIndex + 1 ); - - // remove extension - nIndex = aLocation.lastIndexOf( '.', aLocation.getLength() - 1 ); - if ( nIndex >= 0 ) - aLocation = aLocation.copy( 0, nIndex ); - - // adding .mini - aLocation = aLocation.concat( ".mini" ); - aFileOpenDialog.setDefaultName( aLocation ); - } + INetURLObject aURLObj( xStorable->getLocation() ); + if ( !aURLObj.hasFinalSlash() && + aURLObj.setExtension( "mini", INetURLObject::LAST_SEGMENT, false ) ) { + // tdf#105382 uri-decode file name + auto aName( aURLObj.getName( INetURLObject::LAST_SEGMENT, + false, + INetURLObject::DecodeMechanism::WithCharset ) ); + aFileOpenDialog.setDefaultName( aName ); } } bool bDialogExecuted = aFileOpenDialog.execute() == dialogs::ExecutableDialogResults::OK; |