[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - vcl/unx
David Tardon
dtardon at redhat.com
Thu Jul 11 06:10:54 PDT 2013
vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
New commits:
commit 532025b2b9ef6b30ab7fbf7efc2b922fbc3ab971
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).
(cherry picked from commit 70376f610a7eb876739829e1f362bc94b21cb82f)
Signed-off-by: David Tardon <dtardon at redhat.com>
Conflicts:
vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
Change-Id: Ic6b16d3b4aa17580404d02a9fb7b087b9aa52fc2
Reviewed-on: https://gerrit.libreoffice.org/4824
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index f2e1141..b952f30 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -33,6 +33,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"
@@ -794,6 +795,25 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::R
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<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException )
{
SolarMutexGuard g;
@@ -856,7 +876,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw
++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