1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-03-11 12:51:03 +00:00

Allow drag-n-drop magnet links to mainwindow. Closes #7742.

This commit is contained in:
Chocobo1 2017-11-21 14:13:36 +08:00
parent 4927d26877
commit 94aeac992c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -1242,7 +1242,8 @@ void MainWindow::dropEvent(QDropEvent *event)
// differentiate ".torrent" files and others // differentiate ".torrent" files and others
QStringList torrentFiles, otherFiles; QStringList torrentFiles, otherFiles;
foreach (const QString &file, files) { foreach (const QString &file, files) {
if (file.endsWith(C_TORRENT_FILE_EXTENSION, Qt::CaseInsensitive)) if (file.startsWith("magnet:", Qt::CaseInsensitive)
|| file.endsWith(C_TORRENT_FILE_EXTENSION, Qt::CaseInsensitive))
torrentFiles << file; torrentFiles << file;
else else
otherFiles << file; otherFiles << file;
@ -1251,7 +1252,6 @@ void MainWindow::dropEvent(QDropEvent *event)
// Download torrents // Download torrents
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled(); const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
foreach (const QString &file, torrentFiles) { foreach (const QString &file, torrentFiles) {
qDebug("Dropped file %s on download list", qUtf8Printable(file));
if (useTorrentAdditionDialog) if (useTorrentAdditionDialog)
AddNewTorrentDialog::show(file, this); AddNewTorrentDialog::show(file, this);
else else