Commit 42529bca authored by Bart Cerneels's avatar Bart Cerneels
Browse files

Improve activate (double click) handling, fix bug.

BUG:297092
FIXED-IN:2.6
parent 6eab9b94
......@@ -48,6 +48,7 @@ PlaylistBrowserModel::PlaylistBrowserModel( int playlistCategory )
//common, unconditional actions
m_appendAction = new QAction( KIcon( "media-track-add-amarok" ), i18n( "&Add to Playlist" ),
this );
m_appendAction->setObjectName( "appendAction" );
m_appendAction->setProperty( "popupdropper_svg_id", "append" );
connect( m_appendAction, SIGNAL( triggered() ), this, SLOT( slotAppend() ) );
......@@ -55,6 +56,7 @@ PlaylistBrowserModel::PlaylistBrowserModel( int playlistCategory )
i18nc( "Replace the currently loaded tracks with these",
"&Replace Playlist" ),
this );
m_loadAction->setObjectName( "loadAction" );
m_loadAction->setProperty( "popupdropper_svg_id", "load" );
connect( m_loadAction, SIGNAL( triggered() ), this, SLOT( slotLoad() ) );
......
......@@ -292,7 +292,7 @@ void PlaylistBrowserNS::PlaylistBrowserView::contextMenuEvent( QContextMenuEvent
menu.exec( mapToGlobal( event->pos() ) );
//We keep the items that the actions need to be applied to in the actions private data.
//We keep the items that the action need to be applied to in the action's private data.
//Clear the data from all actions now that the context menu has executed.
foreach( QAction *action, actions )
action->setData( QVariant() );
......@@ -361,13 +361,16 @@ PlaylistBrowserNS::PlaylistBrowserView::slotActivated( const QModelIndex &idx )
QActionList idxActions = model()->data( idx,
PlaylistBrowserNS::PlaylistBrowserModel::ActionRole ).value<QActionList>();
//The first action is usually "Add to Playlist"
if( !idxActions.isEmpty() )
{
idxActions.first()->trigger();
//always needs to be done after activation.
idxActions.first()->setData( QVariant() );
}
//The first action is by convention "Add to Playlist" (see PlaylistBrowserModel)
Q_ASSERT(!idxActions.isEmpty());
QAction *appendAction = idxActions.first();
Q_ASSERT(appendAction->objectName() == "appendAction" );
appendAction->trigger();
//We keep the items that the action need to be applied to in the action's private data.
//Clear the data from all actions now that the context menu has executed.
foreach( QAction *action, idxActions )
action->setData( QVariant() );
}
#include "PlaylistBrowserView.moc"
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