From 572a4730cb7caf35e479e53132255e5873d310b9 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 30 Aug 2010 16:49:10 +0000 Subject: [PATCH] When editing tags in the playlist using the F2 shortcut, edit the current track, not the last one that was right-clicked on. --- src/ui/mainwindow.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 3835f68c4..892dfecae 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1168,7 +1168,25 @@ void MainWindow::SelectionSetValue() { } void MainWindow::EditValue() { - ui_->playlist->view()->edit(playlist_menu_index_); + QModelIndex current = ui_->playlist->view()->currentIndex(); + if (!current.isValid()) + return; + + // Edit the last column that was right-clicked on. If nothing's ever been + // right clicked then look for the first editable column. + int column = playlist_menu_index_.column(); + if (column == -1) { + for (int i=0 ; iplaylist->view()->model()->columnCount() ; ++i) { + if (ui_->playlist->view()->isColumnHidden(i)) + continue; + if (!Playlist::column_is_editable(Playlist::Column(i))) + continue; + column = i; + break; + } + } + + ui_->playlist->view()->edit(current.sibling(current.row(), column)); } void MainWindow::AddFile() {