When editing tags in the playlist using the F2 shortcut, edit the current track, not the last one that was right-clicked on.

This commit is contained in:
David Sansome 2010-08-30 16:49:10 +00:00
parent 1453d264dd
commit 572a4730cb
1 changed files with 19 additions and 1 deletions

View File

@ -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 ; i<ui_->playlist->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() {