Browse Source

Properly fix the handling of default save path store/load. Bug introduced in dd34663224

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
829425831f
  1. 16
      src/gui/addnewtorrentdialog.cpp
  2. 1
      src/gui/addnewtorrentdialog.h

16
src/gui/addnewtorrentdialog.cpp

@ -58,7 +58,6 @@ @@ -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) @@ -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() @@ -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() @@ -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() @@ -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));

1
src/gui/addnewtorrentdialog.h

@ -97,7 +97,6 @@ private: @@ -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;

Loading…
Cancel
Save