officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu   |    
3 +
 officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs |    
4 +
 sdext/source/minimizer/optimizerdialog.cxx                                |   
29 +++-------
 sdext/source/minimizer/pppoptimizertoken.cxx                              |    
2 
 sdext/source/minimizer/pppoptimizertoken.hxx                              |    
1 
 5 files changed, 21 insertions(+), 18 deletions(-)

New commits:
commit 25403bf60e9b3554f2cae118fe77c7075fb5bbaa
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Fri Nov 2 13:53:16 2018 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Nov 6 15:48:12 2018 +0100

    presentation minimizer: fixed problem with default filename
    
    According to code, it is expected that minimized copy of
    presentation is proposed with ".mini" suffix as default,
    but this does not works right now. As a solution a new
    localized prefix "(minimized)" is added to filename.
    
    Change-Id: If869c70a5885a9c917fc7254aa8b0d164a6f5a50
    Reviewed-on: https://gerrit.libreoffice.org/62781
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/62964
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git 
a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu 
b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
index fab5d1945cc7..c13aeac41955 100644
--- a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
@@ -196,6 +196,9 @@ The current presentation contains no OLE objects.</value>
         <prop oor:name="STR_FILESIZESEPARATOR">
             <value xml:lang="en-US">.</value>
         </prop>
+        <prop oor:name="STR_FILENAME_SUFFIX">
+            <value xml:lang="en-US">(minimized)</value>
+        </prop>
     </node>
     <node oor:name="LastUsedSettings">
         <prop oor:name="Name">
diff --git 
a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
index 179637d7d677..446b0159a4b1 100644
--- a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
@@ -361,6 +361,10 @@ The current presentation contains no OLE objects.</value>
                <info><desc>String STR_FILESIZESEPARATOR.</desc></info>
                                <value>.</value>
                        </prop>
+                       <prop oor:name="STR_FILENAME_SUFFIX" 
oor:type="xs:string" oor:localized="true">
+               <info><desc>String STR_FILENAME_SUFFIX.</desc></info>
+                               <value>(minimized)</value>
+                       </prop>
                </group>
                <node-ref oor:name="LastUsedSettings" 
oor:node-type="OptimizerSettings">
                        <info>
diff --git a/sdext/source/minimizer/optimizerdialog.cxx 
b/sdext/source/minimizer/optimizerdialog.cxx
index ff8c6cb10b49..4b789ca7e408 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -513,24 +513,17 @@ 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() ) {
+                        // tdf#105382 uri-decode file name
+                        aURLObj.removeExtension(INetURLObject::LAST_SEGMENT, 
false);
+                        auto aName( aURLObj.getName( 
INetURLObject::LAST_SEGMENT,
+                                                     false,
+                                                     
INetURLObject::DECODE_WITH_CHARSET ) );
+                        // Add "(minimized)"
+                        aName += " ";
+                        aName += 
mrOptimizerDialog.getString(STR_FILENAME_SUFFIX);
+                        aFileOpenDialog.setDefaultName( aName );
                     }
                 }
                  bool bDialogExecuted = aFileOpenDialog.execute() == 
dialogs::ExecutableDialogResults::OK;
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx 
b/sdext/source/minimizer/pppoptimizertoken.cxx
index d99c49bfb15b..e48bb05dfdba 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -152,6 +152,8 @@ static const TokenTable pTokenTableArray[] =
     { "STR_OPTIMIZING_GRAPHICS",    STR_OPTIMIZING_GRAPHICS },
     { "STR_CREATING_OLE_REPLACEMENTS",STR_CREATING_OLE_REPLACEMENTS },
     { "STR_FileSizeSeparator",      STR_FILESIZESEPARATOR },
+    { "STR_FILENAME_SUFFIX",        STR_FILENAME_SUFFIX },
+
 
     { "NotFound",           TK_NotFound }
 };
diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx 
b/sdext/source/minimizer/pppoptimizertoken.hxx
index e458da0d3181..a72afd3ef83d 100644
--- a/sdext/source/minimizer/pppoptimizertoken.hxx
+++ b/sdext/source/minimizer/pppoptimizertoken.hxx
@@ -135,6 +135,7 @@ enum PPPOptimizerTokenEnum
     STR_OPTIMIZING_GRAPHICS,
     STR_CREATING_OLE_REPLACEMENTS,
     STR_FILESIZESEPARATOR,
+    STR_FILENAME_SUFFIX,
 
     TK_NotFound
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to