mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 03:14:44 +00:00
- Ignore permanent deletion button when no torrent is selected
- When a selected torrent is deleted, select next suitable torrent
This commit is contained in:
parent
148d175ab0
commit
038c326f81
@ -383,6 +383,20 @@ void FinishedTorrents::deleteTorrent(QString hash){
|
||||
qDebug("Torrent is not in finished list, nothing to delete");
|
||||
return;
|
||||
}
|
||||
// Select item just under (or above nothing under) the one that was deleted
|
||||
QModelIndex current_prox_index = proxyModel->mapFromSource(finishedListModel->index(row, 0, finishedList->rootIndex()));
|
||||
bool was_selected = finishedList->selectionModel()->isSelected(current_prox_index);
|
||||
if(finishedListModel->rowCount() > 1 && was_selected) {
|
||||
QModelIndex under_prox_index;
|
||||
if(current_prox_index.row() == finishedListModel->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);
|
||||
finishedList->setCurrentIndex(under_prox_index);
|
||||
finishedList->update();
|
||||
}
|
||||
// Actually delete the row
|
||||
finishedListModel->removeRow(row);
|
||||
--nbFinished;
|
||||
emit finishedTorrentsNumberChanged(nbFinished);
|
||||
|
@ -868,6 +868,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if(hashes.empty()) return;
|
||||
int ret;
|
||||
if(inDownloadList) {
|
||||
ret = QMessageBox::question(
|
||||
@ -919,7 +920,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if(!hashes.size()) return;
|
||||
if(hashes.empty()) return;
|
||||
int ret;
|
||||
if(inDownloadList) {
|
||||
ret = QMessageBox::question(
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user