summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-07-11 09:25:16 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-07-11 09:59:15 +0000
commit262caa3bdefc8add38a0fa221099fb59b64b5b3d (patch)
tree5238dd69bed02d61b88fa5d029e35b400299e549 /vcl
parentbd115a62bb3d1b741a035ace9d9c2608acd95c47 (diff)
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@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/4823 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 50ec20c9dca7..d854d46aee10 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();