Commit 39b5660b authored by Filip Roséen's avatar Filip Roséen Committed by François Cartegnie

gui/qt: fix usage of rootIndex() in PLModel::isSupportedAction

There is no need to compare the index associated with the right-click,
and the return-value of "rootIndex()" now that VLCModel::getItem is used
instead of PLModel::getItem.

If "item" is NULL, we know that it is not an item within the playlist
(excluding the root).

This commit is also more than justifiable if one looks at the
implementation of PLModel::rootIndex; we should not go through all that
work when a simple NULL-check is sufficient.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <fcvlcdev@free.fr>
parent 641a1520
......@@ -1037,9 +1037,9 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
case ACTION_STREAM:
case ACTION_SAVE:
case ACTION_INFO:
return index != rootIndex();
return item;
case ACTION_REMOVE:
return index != rootIndex() && !item->readOnly();
return item && !item->readOnly();
case ACTION_EXPLORE:
{
if( !item )
......@@ -1052,7 +1052,7 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
case ACTION_CREATENODE:
return canEdit() && isTree() && ( !item || !item->readOnly() );
case ACTION_RENAMENODE:
return ( index != rootIndex() ) && !isLeaf( index ) && !item->readOnly();
return item && !isLeaf( index ) && !item->readOnly();
case ACTION_CLEAR:
return canEdit() && rowCount();
case ACTION_ENQUEUEFILE:
......
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