[vlc-commits] gui/qt: fix usage of rootIndex() in PLModel::isSupportedAction
Filip Roséen
git at videolan.org
Sun Jul 24 20:39:15 CEST 2016
vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Jul 24 15:30:37 2016 +0200| [39b5660b95040c79d9ef6f3f1c0894a1d4941ced] | committer: Francois 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: Francois Cartegnie <fcvlcdev at free.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39b5660b95040c79d9ef6f3f1c0894a1d4941ced
---
modules/gui/qt/components/playlist/playlist_model.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index a478754..a1dc43d 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -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:
More information about the vlc-commits
mailing list