diff options
author | David Tardon <dtardon@redhat.com> | 2013-07-11 09:25:16 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-07-11 13:10:28 +0000 |
commit | 532025b2b9ef6b30ab7fbf7efc2b922fbc3ab971 (patch) | |
tree | f4da96ff78aeecb9253b5900c337e571a8947680 /vcl | |
parent | 044e55fd7367c09cfff64765fd5d32047d4e5365 (diff) |
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@redhat.com>
Conflicts:
vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
Change-Id: Ic6b16d3b4aa17580404d02a9fb7b087b9aa52fc2
Reviewed-on: https://gerrit.libreoffice.org/4824
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index f2e114184a89..b952f3025a54 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(); |