Browse Source

Merge pull request #6581 from Chocobo1/set_location

Fix cancel "Set location" causes files move to installation dir
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
b2528f7573
  1. 46
      src/gui/transferlistwidget.cpp

46
src/gui/transferlistwidget.cpp

@ -28,40 +28,36 @@
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include <QDebug> #include "transferlistwidget.h"
#include <QShortcut>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <QTimer>
#include <QClipboard> #include <QClipboard>
#include <QColor> #include <QDebug>
#include <QUrl>
#include <QMenu>
#include <QRegExp>
#include <QFileDialog> #include <QFileDialog>
#include <QMenu>
#include <QMessageBox> #include <QMessageBox>
#include <QWheelEvent> #include <QRegExp>
#include <QShortcut>
#include <QTableView> #include <QTableView>
#include <QWheelEvent>
#include "transferlistwidget.h" #include "autoexpandabledialog.h"
#include "base/bittorrent/session.h" #include "base/bittorrent/session.h"
#include "base/bittorrent/torrenthandle.h" #include "base/bittorrent/torrenthandle.h"
#include "base/logger.h"
#include "base/preferences.h"
#include "base/torrentfilter.h" #include "base/torrentfilter.h"
#include "transferlistdelegate.h" #include "base/utils/fs.h"
#include "base/utils/string.h"
#include "deletionconfirmationdlg.h"
#include "guiiconprovider.h"
#include "mainwindow.h"
#include "optionsdlg.h"
#include "previewselect.h" #include "previewselect.h"
#include "speedlimitdlg.h" #include "speedlimitdlg.h"
#include "updownratiodlg.h"
#include "optionsdlg.h"
#include "mainwindow.h"
#include "base/preferences.h"
#include "torrentmodel.h" #include "torrentmodel.h"
#include "deletionconfirmationdlg.h" #include "transferlistdelegate.h"
#include "propertieswidget.h"
#include "guiiconprovider.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "transferlistsortmodel.h" #include "transferlistsortmodel.h"
#include "updownratiodlg.h"
static QStringList extractHashes(const QList<BitTorrent::TorrentHandle *> &torrents); static QStringList extractHashes(const QList<BitTorrent::TorrentHandle *> &torrents);
@ -256,13 +252,15 @@ void TransferListWidget::setSelectedTorrentsLocation()
const QString newLocation = QFileDialog::getExistingDirectory(this, tr("Choose save path"), oldLocation, const QString newLocation = QFileDialog::getExistingDirectory(this, tr("Choose save path"), oldLocation,
QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails); 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)); qDebug("New location is %s", qPrintable(newLocation));
// Actually move storage // 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)); torrent->move(Utils::Fs::expandPathAbs(newLocation));
} }
}
void TransferListWidget::pauseAllTorrents() void TransferListWidget::pauseAllTorrents()
{ {

Loading…
Cancel
Save