- BUGFIX: Ignore permanent deletion button when no torrent is selected

- BUGFIX: When a selected torrent is deleted, select next suitable torrent
  - Bump to v1.5.3
This commit is contained in:
Christophe Dumez
2009-09-30 20:33:26 +00:00
parent 9500b212c7
commit 7a685f5ab6
7 changed files with 36 additions and 5 deletions

View File

@@ -198,6 +198,20 @@ void DownloadingTorrents::deleteTorrent(QString hash) {
qDebug("torrent is not in download list, nothing to delete");
return;
}
// Select item just under (or above nothing under) the one that was deleted
QModelIndex current_prox_index = proxyModel->mapFromSource(DLListModel->index(row, 0, downloadList->rootIndex()));
bool was_selected = downloadList->selectionModel()->isSelected(current_prox_index);
if(DLListModel->rowCount() > 1 && was_selected) {
QModelIndex under_prox_index;
if(current_prox_index.row() == DLListModel->rowCount()-1)
under_prox_index = proxyModel->index(current_prox_index.row()-1, 0);
else
under_prox_index = proxyModel->index(current_prox_index.row()+1, 0);
//downloadList->selectionModel()->select(under_prox_index, QItemSelectionModel::Current|QItemSelectionModel::Columns|QItemSelectionModel::Select);
downloadList->setCurrentIndex(under_prox_index);
downloadList->update();
}
// Actually delete the row
DLListModel->removeRow(row);
--nbTorrents;
emit unfinishedTorrentsNumberChanged(nbTorrents);