|
|
@ -654,25 +654,26 @@ void TransferListWidget::setSelectedTorrentsLocation() { |
|
|
|
if(hashes.isEmpty()) return; |
|
|
|
if(hashes.isEmpty()) return; |
|
|
|
QString dir; |
|
|
|
QString dir; |
|
|
|
const QDir saveDir(TorrentPersistentData::getSavePath(hashes.first())); |
|
|
|
const QDir saveDir(TorrentPersistentData::getSavePath(hashes.first())); |
|
|
|
qDebug("Torrent save path is %s", qPrintable(saveDir.absolutePath())); |
|
|
|
qDebug("Old save path is %s", qPrintable(saveDir.absolutePath())); |
|
|
|
if(saveDir.exists()){ |
|
|
|
QFileDialog dlg(this, tr("Choose save path"), saveDir.absolutePath()); |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.path()); |
|
|
|
dlg.setConfirmOverwrite(false); |
|
|
|
}else{ |
|
|
|
dlg.setFileMode(QFileDialog::Directory); |
|
|
|
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath()); |
|
|
|
dlg.setOption(QFileDialog::ShowDirsOnly, true); |
|
|
|
} |
|
|
|
dlg.setFilter(QDir::AllDirs); |
|
|
|
if(!dir.isNull()){ |
|
|
|
dlg.setAcceptMode(QFileDialog::AcceptSave); |
|
|
|
|
|
|
|
dlg.setNameFilterDetailsVisible(false); |
|
|
|
|
|
|
|
if(dlg.exec()) |
|
|
|
|
|
|
|
dir = dlg.selectedFiles().first(); |
|
|
|
|
|
|
|
if(!dir.isNull()) { |
|
|
|
|
|
|
|
qDebug("New path is %s", qPrintable(dir)); |
|
|
|
// Check if savePath exists
|
|
|
|
// Check if savePath exists
|
|
|
|
QDir savePath(misc::expandPath(dir)); |
|
|
|
QDir savePath(misc::expandPath(dir)); |
|
|
|
if(!savePath.exists()){ |
|
|
|
qDebug("New path after clean up is %s", qPrintable(savePath.absolutePath())); |
|
|
|
if(!savePath.mkpath(savePath.absolutePath())){ |
|
|
|
|
|
|
|
QMessageBox::critical(0, tr("Save path creation error"), tr("Could not create the save path")); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach(const QString & hash, hashes) { |
|
|
|
foreach(const QString & hash, hashes) { |
|
|
|
// Actually move storage
|
|
|
|
// Actually move storage
|
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
if(!BTSession->useTemporaryFolder() || h.is_seed()) { |
|
|
|
if(!BTSession->useTemporaryFolder() || h.is_seed()) { |
|
|
|
|
|
|
|
if(!savePath.exists()) savePath.mkpath(savePath.absolutePath()); |
|
|
|
h.move_storage(savePath.absolutePath()); |
|
|
|
h.move_storage(savePath.absolutePath()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
TorrentPersistentData::saveSavePath(h.hash(), savePath.absolutePath()); |
|
|
|
TorrentPersistentData::saveSavePath(h.hash(), savePath.absolutePath()); |
|
|
|