PLItem *item = index.isValid() ? getItem( index ) : rootItem;
- input_item_t *pl_input =
- p_playlist->p_local_category ?
- p_playlist->p_local_category->p_input : NULL;
- input_item_t *ml_input =
- p_playlist->p_ml_category ?
- p_playlist->p_ml_category->p_input : NULL;
-
- if( ( pl_input && rootItem->p_input == pl_input ) ||
- ( ml_input && rootItem->p_input == ml_input ) )
+ if( canEdit() )
{
PL_LOCK;
playlist_item_t *plItem =
return column;
}
+bool PLModel::canEdit() const
+{
+ return (
+ rootItem != NULL &&
+ (
+ rootItem->p_input == p_playlist->p_local_category->p_input ||
+ (
+ p_playlist->p_ml_category &&
+ rootItem->p_input == p_playlist->p_ml_category->p_input
+ )
+ )
+ );
+}
/************************* Updates handling *****************************/
void PLModel::customEvent( QEvent *event )
{
*/
void PLModel::doDelete( QModelIndexList selected )
{
+ if( !canEdit() ) return;
+
for( int i = selected.size() -1 ; i >= 0; i-- )
{
QModelIndex index = selected[i];
static inline PLItem *getItem( QModelIndex index );
int columnFromMeta( int meta_column ) const;
int columnToMeta( int column ) const;
+ bool canEdit() const;
PLItem *p_cached_item;
PLItem *p_cached_item_bi;
int i_cached_id;