diff --git a/src/confirmdeletiondlg.ui b/src/confirmdeletiondlg.ui index 1e53b5d62..e52301997 100644 --- a/src/confirmdeletiondlg.ui +++ b/src/confirmdeletiondlg.ui @@ -44,7 +44,7 @@ - Are you sure you want to delete the selected torrents from the transfer list? + deletion message goes here Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/src/deletionconfirmationdlg.h b/src/deletionconfirmationdlg.h index 7959c74d1..8fcef5a2d 100644 --- a/src/deletionconfirmationdlg.h +++ b/src/deletionconfirmationdlg.h @@ -40,8 +40,12 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { Q_OBJECT public: - DeletionConfirmationDlg(QWidget *parent=0): QDialog(parent) { + DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name): QDialog(parent) { setupUi(this); + if (size == 1) + label->setText(tr("Are you sure you want to delete \"%1\" from the transfer list?", "Are you sure you want to delete \"ubuntu-linux-iso\" from the transfer list?").arg(name)); + else + label->setText(tr("Are you sure you want to delete these %1 torrents from the transfer list?", "Are you sure you want to delete these 5 torrents from the transfer list?").arg(QString::number(size))); // Icons lbl_warn->setPixmap(IconProvider::instance()->getIcon("dialog-warning").pixmap(lbl_warn->height())); lbl_warn->setFixedWidth(lbl_warn->height()); @@ -57,10 +61,10 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { return checkPermDelete->isChecked(); } - static bool askForDeletionConfirmation(bool *delete_local_files) { - DeletionConfirmationDlg dlg; + static bool askForDeletionConfirmation(bool& delete_local_files, const int& size, const QString& name) { + DeletionConfirmationDlg dlg(NULL, size, name); if (dlg.exec() == QDialog::Accepted) { - *delete_local_files = dlg.shouldDeleteLocalFiles(); + delete_local_files = dlg.shouldDeleteLocalFiles(); return true; } return false; diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 45c6e2f99..6f0b6f929 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -305,9 +305,10 @@ void TransferListWidget::deleteSelectedTorrents() { if (main_window->getCurrentTabWidget() != this) return; const QStringList& hashes = getSelectedTorrentsHashes(); if (hashes.empty()) return; + QTorrentHandle torrent = BTSession->getTorrentHandle(hashes[0]); bool delete_local_files = false; if (Preferences().confirmTorrentDeletion() && - !DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) + !DeletionConfirmationDlg::askForDeletionConfirmation(delete_local_files, hashes.size(), torrent.name())) return; foreach (const QString &hash, hashes) { BTSession->deleteTorrent(hash, delete_local_files); @@ -316,9 +317,10 @@ void TransferListWidget::deleteSelectedTorrents() { void TransferListWidget::deleteVisibleTorrents() { if (nameFilterModel->rowCount() <= 0) return; + QTorrentHandle torrent = BTSession->getTorrentHandle(getHashFromRow(0)); bool delete_local_files = false; if (Preferences().confirmTorrentDeletion() && - !DeletionConfirmationDlg::askForDeletionConfirmation(&delete_local_files)) + !DeletionConfirmationDlg::askForDeletionConfirmation(delete_local_files, nameFilterModel->rowCount(), torrent.name())) return; QStringList hashes; for (int i=0; irowCount(); ++i) {