Summary: | Cancel delete of playlist initialised by 'Delete' key not clean | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | James Duncan <james.t.duncan> |
Component: | Playlists/Saved Playlists | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | bart.cerneels, dennisfrancis.in |
Priority: | NOR | ||
Version: | 2.4-GIT | ||
Target Milestone: | 2.4.0 | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.4 |
Description
James Duncan
2010-09-10 10:02:49 UTC
I don't know how "major" this is, but it does cause unintended data loss, so I marked it as such... Major is OK. For the GUI row issues, see bug 250432 Hello, I have submitted a patch for this issue in the review-board. commit 22c4f116fbb9ab10650884d181dbe4e25ae2221e branch master Author: Bart Cerneels <bart.cerneels@kde.org> Date: Sun Nov 21 11:46:59 2010 +0100 Fix playlsit delete bugs. Using the playlist actions instead of removeRow(). Patch by Dennis Francis. Removed the expandToDepth( 0 ) hack because comment #6 in BR 245646. BUG:250746 BUG:250750 diff --git a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp index 2603e2f..45be175 100644 --- a/src/browsers/playlistbrowser/PlaylistBrowserView.cpp +++ b/src/browsers/playlistbrowser/PlaylistBrowserView.cpp @@ -263,8 +263,21 @@ PlaylistBrowserNS::PlaylistBrowserView::keyPressEvent( QKeyEvent *event ) { case Qt::Key_Delete: { - foreach( const QModelIndex &selectedIdx, selectedIndexes() ) - model()->removeRow( selectedIdx.row(), selectedIdx.parent() ); + QModelIndexList indices = selectedIndexes(); + QActionList actions = actionsFor( indices ); + + if( actions.isEmpty() ) + { + debug() <<"No actions !"; + return; + } + foreach( QAction *actn, actions ) + if( actn ) + if( actn->objectName() == "deleteAction" ) + { + actn->trigger(); + actn->setData( QVariant() ); + } return; } } diff --git a/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp b/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp index ae61504..bf679fc 100644 --- a/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp +++ b/src/core-impl/podcasts/sql/SqlPodcastProvider.cpp @@ -336,6 +336,7 @@ SqlPodcastProvider::playlistActions( Playlists::PlaylistPtr playlist ) { actionChannels = m_removeAction->data().value<Podcasts::SqlPodcastChannelList>(); } + m_removeAction->setObjectName( "deleteAction" ); actionChannels << sqlChannel; m_removeAction->setData( QVariant::fromValue( actionChannels ) ); @@ -392,6 +393,7 @@ SqlPodcastProvider::trackActions( Playlists::PlaylistPtr playlist, int trackInde m_deleteAction->setProperty( "popupdropper_svg_id", "delete" ); connect( m_deleteAction, SIGNAL( triggered() ), SLOT( slotDeleteDownloadedEpisodes() ) ); } + m_deleteAction->setObjectName( "deleteAction" ); if( m_writeTagsAction == 0 ) { diff --git a/src/playlistmanager/file/PlaylistFileProvider.cpp b/src/playlistmanager/file/PlaylistFileProvider.cpp index 573cdff..22e8abe 100644 --- a/src/playlistmanager/file/PlaylistFileProvider.cpp +++ b/src/playlistmanager/file/PlaylistFileProvider.cpp @@ -138,6 +138,7 @@ PlaylistFileProvider::playlistActions( Playlists::PlaylistPtr playlist ) m_deleteAction->setProperty( "popupdropper_svg_id", "delete" ); connect( m_deleteAction, SIGNAL( triggered() ), SLOT( slotDelete() ) ); } + m_deleteAction->setObjectName( "deleteAction" ); Playlists::PlaylistFileList actionList = m_deleteAction->data().value<Playlists::PlaylistFileList>(); @@ -181,6 +182,7 @@ PlaylistFileProvider::trackActions( Playlists::PlaylistPtr playlist, int trackIn "Remove From \"%1\"", playlist->name() ) ); } + m_removeTrackAction->setObjectName( "deleteAction" ); //Add the playlist/track combination to a QMultiMap that is stored in the action. //In the slot we use this data to remove that track from the playlist. PlaylistTrackMap playlistMap = m_removeTrackAction->data().value<PlaylistTrackMap>(); diff --git a/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp b/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp index 12da6ed..d2ae5b9 100644 --- a/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp +++ b/src/playlistmanager/sql/SqlUserPlaylistProvider.cpp @@ -178,6 +178,7 @@ SqlUserPlaylistProvider::playlistActions( Playlists::PlaylistPtr playlist ) m_deleteAction->setProperty( "popupdropper_svg_id", "delete" ); connect( m_deleteAction, SIGNAL( triggered() ), SLOT( slotDelete() ) ); } + m_deleteAction->setObjectName( "deleteAction" ); Playlists::SqlPlaylistList actionList = m_deleteAction->data().value<Playlists::SqlPlaylistList>(); actionList << sqlPlaylist; @@ -204,6 +205,8 @@ SqlUserPlaylistProvider::trackActions( Playlists::PlaylistPtr playlist, int trac m_removeTrackAction->setProperty( "popupdropper_svg_id", "delete" ); connect( m_removeTrackAction, SIGNAL( triggered() ), SLOT( slotRemove() ) ); } + m_removeTrackAction->setObjectName( "deleteAction" ); + //Add the playlist/track combination to a QMultiMap that is stored in the action. //In the slot we use this data to remove that track from the playlist. PlaylistTrackMap playlistMap = m_removeTrackAction->data().value<PlaylistTrackMap>(); |