Bug 225791

Summary: after starting playing "up" or "down"-keys jumps to the first playlist entry
Product: [Applications] amarok Reporter: Kostya Sha <gentoo.integer>
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: kfunk, nhn, teo
Priority: NOR    
Version: 2.2.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Kostya Sha 2010-02-07 03:49:19 UTC
Version:            (using KDE 4.3.5)
OS:                Linux
Installed from:    Gentoo Packages

1. add songs to amarok playlist
2. Double click on the song in the middle of playlist
3. press "up" or "down" key
It jumps to the first playlist entry.

Expected:
Go to +/- entry from current playing now.
Amarok 2.2.2
Comment 1 Dan Meltzer 2010-02-07 04:35:42 UTC
This looks like a bug in our keeping the selection model in sync...
Comment 2 Nikolaj Hald Nielsen 2010-02-24 15:54:32 UTC
commit c6fccef763abfc752e1d11a81a7ff8b419db473c
Author: Nikolaj Hald Nielsen <nhn@kde.org>
Date:   Wed Feb 24 15:49:28 2010 +0100

    Set the "current index" to the activated row, when activating a row in the playlist. This prevents keyboard navigation going astray when starting playback of a track.
    
    BUG: 225791

diff --git a/src/playlist/view/listview/PrettyListView.cpp b/src/playlist/view/listview/PrettyListView.cpp
index f36b3a1..4e9f415 100644
--- a/src/playlist/view/listview/PrettyListView.cpp
+++ b/src/playlist/view/listview/PrettyListView.cpp
@@ -254,6 +254,11 @@ Playlist::PrettyListView::trackActivated( const QModelIndex& idx )
     DEBUG_BLOCK
     m_skipAutoScroll = true; // we don't want to do crazy view changes when selecting an item in the view
     Actions::instance()->play( idx );
+
+    //make sure that the track we just activated is also set as the current index or
+    //the selected index will get moved to the first row, making keyboard navigation difficult (BUG 225791)
+    selectionModel()->setCurrentIndex( idx, QItemSelectionModel::ClearAndSelect );
+    
 }
 
 void