mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
Merge pull request #6581 from Chocobo1/set_location
Fix cancel "Set location" causes files move to installation dir
This commit is contained in:
commit
b2528f7573
@ -28,40 +28,36 @@
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include <QDebug>
|
||||
#include <QShortcut>
|
||||
#include <QStandardItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QColor>
|
||||
#include <QUrl>
|
||||
#include <QMenu>
|
||||
#include <QRegExp>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QWheelEvent>
|
||||
#include <QTableView>
|
||||
|
||||
#include "transferlistwidget.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QRegExp>
|
||||
#include <QShortcut>
|
||||
#include <QTableView>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/torrentfilter.h"
|
||||
#include "transferlistdelegate.h"
|
||||
#include "previewselect.h"
|
||||
#include "speedlimitdlg.h"
|
||||
#include "updownratiodlg.h"
|
||||
#include "optionsdlg.h"
|
||||
#include "mainwindow.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "torrentmodel.h"
|
||||
#include "deletionconfirmationdlg.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "base/torrentfilter.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "deletionconfirmationdlg.h"
|
||||
#include "guiiconprovider.h"
|
||||
#include "mainwindow.h"
|
||||
#include "optionsdlg.h"
|
||||
#include "previewselect.h"
|
||||
#include "speedlimitdlg.h"
|
||||
#include "torrentmodel.h"
|
||||
#include "transferlistdelegate.h"
|
||||
#include "transferlistsortmodel.h"
|
||||
#include "updownratiodlg.h"
|
||||
|
||||
static QStringList extractHashes(const QList<BitTorrent::TorrentHandle *> &torrents);
|
||||
|
||||
@ -256,12 +252,14 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
||||
|
||||
const QString newLocation = QFileDialog::getExistingDirectory(this, tr("Choose save path"), oldLocation,
|
||||
QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
|
||||
if (!QDir(newLocation).exists()) return;
|
||||
if (newLocation.isEmpty() || !QDir(newLocation).exists()) return;
|
||||
qDebug("New location is %s", qPrintable(newLocation));
|
||||
|
||||
// Actually move storage
|
||||
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
|
||||
foreach (BitTorrent::TorrentHandle *const torrent, torrents) {
|
||||
Logger::instance()->addMessage(tr("Set location: moving \"%1\", from \"%2\" to \"%3\"", "Set location: moving \"ubuntu_16_04.iso\", from \"/home/dir1\" to \"/home/dir2\"").arg(torrent->name()).arg(torrent->savePath()).arg(newLocation));
|
||||
torrent->move(Utils::Fs::expandPathAbs(newLocation));
|
||||
}
|
||||
}
|
||||
|
||||
void TransferListWidget::pauseAllTorrents()
|
||||
|
Loading…
Reference in New Issue
Block a user