From 7bd19f769650423847ba74191da65e947893216d Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 21 Sep 2011 17:48:39 +0300 Subject: [PATCH] Several fixes to the merge request --- src/preferences/preferences.h | 8 ------ src/torrentadditiondlg.cpp | 29 ++++++------------- src/torrentadditiondlg.ui | 52 +++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 52 deletions(-) diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index a77bb2a6d..d19cf6abf 100644 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -229,14 +229,6 @@ public: setValue("Preferences/Downloads/AppendLabel", b); } - bool rememberLastLocation() const { - return value(QString::fromUtf8("Preferences/Downloads/RememberLastLocation"), false).toBool(); - } - - void setRememberLastLocation(bool b) { - setValue("Preferences/Downloads/RememberLastLocation", b); - } - QString lastLocationPath() const { return value(QString::fromUtf8("Preferences/Downloads/LastLocationPath"), QString()).toString(); } diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index b63561a82..364193aea 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -87,18 +87,8 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) : // Important: as a default, it inserts at the bottom which is not desirable savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent); //torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch); - QString lastLocation = pref.lastLocationPath(); - checkLastFolder->setChecked(pref.rememberLastLocation()); - //lastLocation will always have '/' as separator since it is saved in - //::on_OkButton_clicked() after the conversion is done. - if (pref.rememberLastLocation() && !lastLocation.isEmpty() && QFile(lastLocation).exists()) - defaultSavePath = lastLocation; - else - { - defaultSavePath = pref.getSavePath(); - //In case of the LastLocationPath doesn't exist anymore, empty the string - pref.setLastLocationPath(QString()); - } + defaultSavePath = pref.getSavePath(); + //In case of the LastLocationPath doesn't exist anymore, empty the string appendLabelToSavePath = pref.appendTorrentLabel(); QString display_path = defaultSavePath.replace("\\", "/"); @@ -613,6 +603,7 @@ void torrentAdditionDialog::savePiecesPriorities(){ } void torrentAdditionDialog::on_OkButton_clicked(){ + Preferences pref; qDebug() << "void torrentAdditionDialog::on_OkButton_clicked() - ENTER"; if(savePathTxt->currentText().trimmed().isEmpty()){ QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path")); @@ -691,6 +682,11 @@ void torrentAdditionDialog::on_OkButton_clicked(){ } // Save path history saveTruncatedPathHistory(); + + // Set as default save path if necessary + if (checkLastFolder->isChecked()) + pref.setSavePath(getCurrentTruncatedSavePath()); + // Check if savePath exists if(!savePath.exists()){ if(!savePath.mkpath(savePath.path())){ @@ -698,14 +694,7 @@ void torrentAdditionDialog::on_OkButton_clicked(){ return; } } - //Save last location path - {//limit the scope of pref - Preferences pref; - bool isChecked = checkLastFolder->isChecked(); - if (pref.rememberLastLocation() != isChecked) pref.setRememberLastLocation(isChecked); - if (pref.rememberLastLocation() && save_path != pref.lastLocationPath()) - pref.setLastLocationPath(save_path); -} + // save filtered files if(!is_magnet && t->num_files() > 1) savePiecesPriorities(); diff --git a/src/torrentadditiondlg.ui b/src/torrentadditiondlg.ui index b91efd640..931b1c09e 100644 --- a/src/torrentadditiondlg.ui +++ b/src/torrentadditiondlg.ui @@ -29,8 +29,8 @@ - - + + @@ -43,23 +43,34 @@ - - - - - 0 - 0 - - - - true - - + + + + + + + 0 + 0 + + + + true + + + + + + + ... + + + + - - + + - ... + Set as default save path @@ -281,13 +292,6 @@ - - - - Remember last used folder - - -