|
|
@ -200,8 +200,8 @@ void torrentAdditionDialog::showLoadMagnetURI(QString magnet_uri) { |
|
|
|
|
|
|
|
|
|
|
|
// Disable Save path combox and browse button
|
|
|
|
// Disable Save path combox and browse button
|
|
|
|
// Save path should be default for magnet links
|
|
|
|
// Save path should be default for magnet links
|
|
|
|
savePathTxt->setEnabled(false); |
|
|
|
savePathTxt->setEnabled(true); |
|
|
|
browseButton->setEnabled(false); |
|
|
|
browseButton->setEnabled(true); |
|
|
|
|
|
|
|
|
|
|
|
// Get torrent hash
|
|
|
|
// Get torrent hash
|
|
|
|
hash = misc::magnetUriToHash(magnet_uri); |
|
|
|
hash = misc::magnetUriToHash(magnet_uri); |
|
|
@ -528,22 +528,23 @@ void torrentAdditionDialog::updateDiskSpaceLabels() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void torrentAdditionDialog::on_browseButton_clicked() { |
|
|
|
void torrentAdditionDialog::on_browseButton_clicked() { |
|
|
|
Q_ASSERT(!is_magnet); |
|
|
|
|
|
|
|
QString new_path; |
|
|
|
QString new_path; |
|
|
|
QString root_folder; |
|
|
|
QString root_folder; |
|
|
|
const QString label_name = comboLabel->currentText(); |
|
|
|
const QString label_name = comboLabel->currentText(); |
|
|
|
if (t->num_files() == 1) { |
|
|
|
if (!is_magnet) { |
|
|
|
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), savePathTxt->currentText(), QString(), 0, QFileDialog::DontConfirmOverwrite); |
|
|
|
if (t->num_files() == 1) { |
|
|
|
if (!new_path.isEmpty()) { |
|
|
|
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), savePathTxt->currentText(), QString(), 0, QFileDialog::DontConfirmOverwrite); |
|
|
|
QStringList path_parts = new_path.replace("\\", "/").split("/"); |
|
|
|
if (!new_path.isEmpty()) { |
|
|
|
const QString filename = path_parts.takeLast(); |
|
|
|
QStringList path_parts = new_path.replace("\\", "/").split("/"); |
|
|
|
// Append label
|
|
|
|
const QString filename = path_parts.takeLast(); |
|
|
|
if (QDir(path_parts.join(QDir::separator())) == QDir(defaultSavePath) && !label_name.isEmpty()) |
|
|
|
// Append label
|
|
|
|
path_parts << label_name; |
|
|
|
if (QDir(path_parts.join(QDir::separator())) == QDir(defaultSavePath) && !label_name.isEmpty()) |
|
|
|
// Append file name
|
|
|
|
path_parts << label_name; |
|
|
|
path_parts << filename; |
|
|
|
// Append file name
|
|
|
|
// Construct new_path
|
|
|
|
path_parts << filename; |
|
|
|
new_path = path_parts.join(QDir::separator()); |
|
|
|
// Construct new_path
|
|
|
|
|
|
|
|
new_path = path_parts.join(QDir::separator()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
QString truncated_path = getCurrentTruncatedSavePath(&root_folder); |
|
|
|
QString truncated_path = getCurrentTruncatedSavePath(&root_folder); |
|
|
|