[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/unx

David Tardon dtardon at redhat.com
Thu Jul 11 02:59:37 PDT 2013


 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 262caa3bdefc8add38a0fa221099fb59b64b5b3d
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Jul 11 09:25:16 2013 +0200

    rhbz#980387 fix filter selection from file ext.
    
    ... for filters that have more than one extension associated with them
    (e.g., JPEG).
    
    Change-Id: Ic6b16d3b4aa17580404d02a9fb7b087b9aa52fc2
    (cherry picked from commit 70376f610a7eb876739829e1f362bc94b21cb82f)
    Signed-off-by: David Tardon <dtardon at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/4823
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 50ec20c..d854d46 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <com/sun/star/ui/dialogs/ControlActions.hpp>
 #include <com/sun/star/uno/Any.hxx>
+#include <comphelper/string.hxx>
 #include <osl/mutex.hxx>
 #include "unx/gtk/gtkinst.hxx"
 
@@ -790,6 +791,25 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::Runtim
     return aFiles;
 }
 
+namespace
+{
+
+bool lcl_matchFilter( const rtl::OUString& rFilter, const rtl::OUString& rExt )
+{
+    const int nCount = comphelper::string::getTokenCount( rFilter, ';' );
+
+    for ( int n = 0; n != nCount; ++n )
+    {
+        const rtl::OUString aToken = comphelper::string::getToken( rFilter, n, ';' );
+        if ( aToken == rExt )
+            return true;
+    }
+
+    return false;
+}
+
+}
+
 uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException )
 {
     SolarMutexGuard g;
@@ -852,7 +872,7 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno
                               ++aListIter
                         )
                         {
-                            if( aListIter->getFilter().equalsIgnoreAsciiCase( aStarDot+sExtension ) )
+                            if( lcl_matchFilter( aListIter->getFilter(), aStarDot+sExtension ) )
                             {
                                 if( aNewFilter.isEmpty() )
                                     aNewFilter = aListIter->getTitle();


More information about the Libreoffice-commits mailing list