FEATURE: Added option to skip torrent deletion confirmation (Ville Kiiskinen)

This commit is contained in:
Christophe Dumez 2011-01-16 15:29:44 +00:00
commit 8fd7b86f45
4 changed files with 37 additions and 18 deletions

View file

@ -285,28 +285,29 @@ void TransferListWidget::pauseVisibleTorrents() {
void TransferListWidget::deleteSelectedTorrents() {
if(main_window->getCurrentTabWidget() != this) return;
const QStringList& hashes = getSelectedTorrentsHashes();
if(!hashes.empty()) {
bool delete_local_files = false;
if(DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) {
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
}
if(hashes.empty()) return;
bool delete_local_files = false;
if(Preferences().confirmTorrentDeletion() &&
!DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files))
return;
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
}
void TransferListWidget::deleteVisibleTorrents() {
if(nameFilterModel->rowCount() <= 0) return;
bool delete_local_files = false;
if(DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) {
QStringList hashes;
for(int i=0; i<nameFilterModel->rowCount(); ++i) {
const int row = mapToSource(nameFilterModel->index(i, 0)).row();
hashes << getHashFromRow(row);
}
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
if(Preferences().confirmTorrentDeletion() &&
!DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files))
return;
QStringList hashes;
for(int i=0; i<nameFilterModel->rowCount(); ++i) {
const int row = mapToSource(nameFilterModel->index(i, 0)).row();
hashes << getHashFromRow(row);
}
foreach(const QString &hash, hashes) {
BTSession->deleteTorrent(hash, delete_local_files);
}
}