diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index a01fac943..b46719a8d 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -58,7 +58,6 @@ #define SETTINGS_KEY(name) "AddNewTorrentDialog/" name const QString KEY_ENABLED = SETTINGS_KEY("Enabled"); -const QString KEY_DEFAULTSAVEPATH = SETTINGS_KEY("DefaultSavePath"); const QString KEY_DEFAULTCATEGORY = SETTINGS_KEY("DefaultCategory"); const QString KEY_TREEHEADERSTATE = SETTINGS_KEY("TreeHeaderState"); const QString KEY_WIDTH = SETTINGS_KEY("Width"); @@ -394,7 +393,7 @@ void AddNewTorrentDialog::onSavePathChanged(int index) ui->defaultSavePathCheckBox->setChecked(false); ui->defaultSavePathCheckBox->setVisible( QDir(ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString()) - != QDir(defaultSavePath())); + != QDir(BitTorrent::Session::instance()->defaultSavePath())); // Remember index m_oldIndex = index; @@ -567,7 +566,7 @@ void AddNewTorrentDialog::setdialogPosition() void AddNewTorrentDialog::populateSavePathComboBox() { - QString defSavePath = defaultSavePath(); + QString defSavePath = BitTorrent::Session::instance()->defaultSavePath(); ui->savePathComboBox->clear(); ui->savePathComboBox->addItem(Utils::Fs::toNativePath(defSavePath), defSavePath); @@ -645,10 +644,8 @@ void AddNewTorrentDialog::accept() if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode. params.savePath = savePath; saveSavePathHistory(); - if (ui->defaultSavePathCheckBox->isChecked()) { - settings()->storeValue(KEY_DEFAULTSAVEPATH, savePath); + if (ui->defaultSavePathCheckBox->isChecked()) BitTorrent::Session::instance()->setDefaultSavePath(savePath); - } } setEnabled(!ui->never_show_cb->isChecked()); @@ -746,13 +743,6 @@ void AddNewTorrentDialog::setupTreeview() setdialogPosition(); } -QString AddNewTorrentDialog::defaultSavePath() const -{ - return Utils::Fs::fromNativePath( - settings()->loadValue(KEY_DEFAULTSAVEPATH, - BitTorrent::Session::instance()->defaultSavePath()).toString()); -} - void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason) { MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason)); diff --git a/src/gui/addnewtorrentdialog.h b/src/gui/addnewtorrentdialog.h index 20938896b..0853f565f 100644 --- a/src/gui/addnewtorrentdialog.h +++ b/src/gui/addnewtorrentdialog.h @@ -97,7 +97,6 @@ private: void saveState(); void setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText = QString()); void setupTreeview(); - QString defaultSavePath() const; void setCommentText(const QString &str) const; void showEvent(QShowEvent *event) override;