Commit 3c2f14dd authored by Matěj Laitl's avatar Matěj Laitl
Browse files

Separate delete and trash collection tree actions

The "delete" action was previously only accessible through holding
Shift when clicking Delete, which was secret, inconsistent and
inconvenient. The old shift + click behaviour is not preserved.

BUG: 286356
FIXED-IN: 2.5
GUI: Move to Trash action added to collection browser context menu
     Handbook needs updating.
parent 3fc94cf0
......@@ -26,6 +26,8 @@ Version 2.5.0-Beta 1
* Auto-save the playlist so that it is not lost if Amarok crashes.
CHANGES:
* Both Delete and Move to Trash actions are now offered in the collection
browser context menu. (BR 286356)
* Amarok now depends on libmygpo-qt > 1.0.5.
* New USB Mass Storage media-device plugin using the Amarok Collection Scanner.
* Browser widget backgrounds can now be enabled/disabled.
......
......@@ -1063,23 +1063,24 @@ QHash<QAction*, Collections::Collection*> CollectionTreeView::getRemoveActions(
{
QHash<QAction*, Collections::Collection*> currentRemoveDestination;
if( onlyOneCollection( indices) )
{
Collections::Collection *collection = getCollection( indices.first() );
if( collection && collection->isWritable() )
{
//writableCollections.append( collection );
KAction *action = new KAction( KIcon( "remove-amarok" ), i18n( "Delete Tracks" ), 0 );
action->setProperty( "popupdropper_svg_id", "delete" );
connect( action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)),
this, SLOT(slotRemoveTracks(Qt::MouseButtons,Qt::KeyboardModifiers)) );
if( !onlyOneCollection( indices ) )
return currentRemoveDestination;
Collections::Collection *collection = getCollection( indices.first() );
if( !collection || !collection->isWritable() )
return currentRemoveDestination;
KAction *trashAction = new KAction( KIcon( "user-trash" ), i18n( "Move Tracks to Trash" ), 0 );
trashAction->setProperty( "popupdropper_svg_id", "delete" );
connect( trashAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)),
this, SLOT(slotTrashTracks()) );
currentRemoveDestination.insert( trashAction, collection );
KAction *deleteAction = new KAction( KIcon( "remove-amarok" ), i18n( "Delete Tracks" ), 0 );
deleteAction->setProperty( "popupdropper_svg_id", "delete" );
connect( deleteAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)),
this, SLOT(slotRemoveTracks()) );
currentRemoveDestination.insert( deleteAction, collection );
currentRemoveDestination.insert( action, collection );
}
}
return currentRemoveDestination;
}
......@@ -1173,15 +1174,23 @@ void CollectionTreeView::slotMoveTracks()
}
}
void CollectionTreeView::slotRemoveTracks( Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )
void
CollectionTreeView::slotTrashTracks()
{
Q_UNUSED( buttons )
KAction *action = qobject_cast<KAction*>( sender() );
if( action )
{
bool skipTrash = modifiers.testFlag( Qt::ShiftModifier );
removeTracks( m_currentItems, !skipTrash );
}
if( !action )
return;
// TODO: can use m_currentRemoveDestination[ action ] and pass it to removeTracks()
removeTracks( m_currentItems, true /* use trash */ );
}
void CollectionTreeView::slotRemoveTracks()
{
KAction *action = qobject_cast<KAction*>( sender() );
if( !action )
return;
// TODO: can use m_currentRemoveDestination[ action ] and pass it to removeTracks()
removeTracks( m_currentItems, false /* do not use trash */ );
}
void CollectionTreeView::slotOrganize()
......
......@@ -85,7 +85,8 @@ class CollectionTreeView: public Amarok::PrettyTreeView
void slotEditTracks();
void slotCopyTracks();
void slotMoveTracks();
void slotRemoveTracks( Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
void slotTrashTracks();
void slotRemoveTracks();
void slotOrganize();
private:
......
Supports Markdown
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