sdext/Library_PresentationMinimizer.mk | 1 + sdext/source/minimizer/optimizerdialog.cxx | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 18 deletions(-)
New commits: commit dcd89d24f0837f85a359f2630981d985a9811d86 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Tue Jan 24 18:55:20 2017 +0900 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. Reviewed-on: https://gerrit.libreoffice.org/33261 Reviewed-by: Stephan Bergmann <sberg...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit d8aa4503966e2c8882c238a1a30c05b72bdf6f68) Change-Id: I51ccd7672513118f39518c4ed21902de16b2298f Reviewed-on: https://gerrit.libreoffice.org/33507 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk index 2ae650a..eb8995f 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 78c044a..40d8132 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::DECODE_WITH_CHARSET ) ); + aFileOpenDialog.setDefaultName( aName ); } } bool bDialogExecuted = aFileOpenDialog.execute() == dialogs::ExecutableDialogResults::OK;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits