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 @@ @@ -28,40 +28,36 @@
* Contact : chris@qbittorrent.org
*/
#include <QDebug>
#include <QShortcut>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <QTimer>
#include "transferlistwidget.h"
#include <QClipboard>
#include <QColor>
#include <QUrl>
#include <QMenu>
#include <QRegExp>
#include <QDebug>
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
#include <QWheelEvent>
#include <QRegExp>
#include <QShortcut>
#include <QTableView>
#include <QWheelEvent>
#include "transferlistwidget.h"
#include "autoexpandabledialog.h"
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrenthandle.h"
#include "base/logger.h"
#include "base/preferences.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 "speedlimitdlg.h"
#include "updownratiodlg.h"
#include "optionsdlg.h"
#include "mainwindow.h"
#include "base/preferences.h"
#include "torrentmodel.h"
#include "deletionconfirmationdlg.h"
#include "propertieswidget.h"
#include "guiiconprovider.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "autoexpandabledialog.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() @@ -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…
Cancel
Save