Commit 8fb83a5f authored by Filip Roséen's avatar Filip Roséen Committed by François Cartegnie

gui/qt: fix PLModel::isSupportedaction( ACTION_EXPLORE, ... )

It is not enough to simply check if an item's URI starts with "file://"
as it will lead to false-negatives. As an example, if the associated
item has a MRL starting with "file/es://...", we would consider it not
to be part of the local file-system (and as such, we do not provide the
option to explore the associated directory).

This commit fixes the issue by invoking vlc_uri2path, if we get a a
non-NULL pointer as the returned value, the item in question resides in
under a path that is suitable for exploration.

As a note; using vlc_uri2path is what is being done when ACTION_EXPLORE
is actually initiated - this commit can as such be viewed as creating
symmetry between checking if it is a supported action, and invoking it.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <fcvlcdev@free.fr>
parent 1c97d0ba
......@@ -34,6 +34,7 @@
#include "recents.hpp" /* Open:: */
#include <vlc_intf_strings.h> /* I_DIR */
#include <vlc_url.h>
#include "sorting.h"
......@@ -1040,7 +1041,14 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
case ACTION_REMOVE:
return index != rootIndex() && !item->readOnly();
case ACTION_EXPLORE:
return getURI( index ).startsWith( "file://" );
{
if( !item )
return false;
char* psz_path = vlc_uri2path( qtu( item->getURI().toString() ) );
free( psz_path );
return psz_path != NULL;
}
case ACTION_CREATENODE:
return canEdit() && isTree() && ( !item || !item->readOnly() );
case ACTION_RENAMENODE:
......
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