Kaydet (Commit) fce0f582 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Caolán McNamara

tdf#115407: preselect sound file saved

To display the sound in the dropbox, the complete filename
(eg: file:///home/julien/lo/libreoffice/instdir/share/gallery/sounds/pluck.wav)
was compared with items of the sound list formed like this:
file:///home/julien/lo/libreoffice/instdir/program/../share/gallery/sounds/pluck.wav

See https://bugs.documentfoundation.org/show_bug.cgi?id=115407#c1

Since listbox displays only basename, let's just compare basenames

Change-Id: I5fb49990322423fa7818e5d6e1cafd828e3500ec
Reviewed-on: https://gerrit.libreoffice.org/52476
(cherry picked from commit 23c82e1a)
Reviewed-on: https://gerrit.libreoffice.org/52490Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 92a0181d
...@@ -270,10 +270,11 @@ struct lcl_EqualsSoundFileName : public ::std::unary_function< OUString, bool > ...@@ -270,10 +270,11 @@ struct lcl_EqualsSoundFileName : public ::std::unary_function< OUString, bool >
{ {
// note: formerly this was a case insensitive search for all // note: formerly this was a case insensitive search for all
// platforms. It seems more sensible to do this platform-dependent // platforms. It seems more sensible to do this platform-dependent
INetURLObject aURL(rStr);
#if defined(_WIN32) #if defined(_WIN32)
return maStr.equalsIgnoreAsciiCase( rStr ); return maStr.equalsIgnoreAsciiCase( aURL.GetBase() );
#else #else
return maStr == rStr; return maStr == aURL.GetBase();
#endif #endif
} }
...@@ -286,9 +287,10 @@ bool lcl_findSoundInList( const ::std::vector< OUString > & rSoundList, ...@@ -286,9 +287,10 @@ bool lcl_findSoundInList( const ::std::vector< OUString > & rSoundList,
const OUString & rFileName, const OUString & rFileName,
::std::vector< OUString >::size_type & rOutPosition ) ::std::vector< OUString >::size_type & rOutPosition )
{ {
INetURLObject aURL(rFileName);
::std::vector< OUString >::const_iterator aIt = ::std::vector< OUString >::const_iterator aIt =
::std::find_if( rSoundList.begin(), rSoundList.end(), ::std::find_if( rSoundList.begin(), rSoundList.end(),
lcl_EqualsSoundFileName( rFileName )); lcl_EqualsSoundFileName( aURL.GetBase()));
if( aIt != rSoundList.end()) if( aIt != rSoundList.end())
{ {
rOutPosition = ::std::distance( rSoundList.begin(), aIt ); rOutPosition = ::std::distance( rSoundList.begin(), aIt );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment