Ask for user confirmation because proceeding with recursive torrent download (security risk)

Fix "add file" dialog in torrent creation tool
This commit is contained in:
Christophe Dumez 2010-03-20 11:30:11 +00:00
parent 73c312ec1a
commit 530fbfc9b4
5 changed files with 45 additions and 12 deletions

View file

@ -117,6 +117,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString)));
connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
connect(BTSession, SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
connect(BTSession, SIGNAL(recursiveTorrentDownloadPossible(QTorrentHandle&)), this, SLOT(askRecursiveTorrentDownloadConfirmation(QTorrentHandle&)));
qDebug("create tabWidget");
tabs = new QTabWidget();
@ -413,6 +414,12 @@ void GUI::readParamsOnSocket() {
}
}
void GUI::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
if(QMessageBox::question(this, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(h.name()), QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) {
BTSession->recursiveTorrentDownload(h);
}
}
void GUI::handleDownloadFromUrlFailure(QString url, QString reason) const{
// Display a message box
QMessageBox::critical(0, tr("Url download error"), tr("Couldn't download file at url: %1, reason: %2.").arg(url).arg(reason));