mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 14:12:30 -06:00
Scan Folder dialog now remembers last location
Also fix fs_utils spacing
This commit is contained in:
@@ -1056,7 +1056,9 @@ int options_imp::getActionOnDblClOnTorrentFn() const {
|
||||
}
|
||||
|
||||
void options_imp::on_addScanFolderButton_clicked() {
|
||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Add directory to scan"));
|
||||
Preferences pref;
|
||||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Add directory to scan"),
|
||||
fsutils::toNativePath(fsutils::folderName(pref.getScanDirsLastPath())));
|
||||
if (!dir.isEmpty()) {
|
||||
const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, false);
|
||||
QString error;
|
||||
@@ -1071,6 +1073,7 @@ void options_imp::on_addScanFolderButton_clicked() {
|
||||
error = tr("Folder is not readable.");
|
||||
break;
|
||||
default:
|
||||
pref.setScanDirsLastPath(dir);
|
||||
addedScanDirs << dir;
|
||||
scanFoldersView->resizeColumnsToContents();
|
||||
enableApplyButton();
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
|
||||
QString lastLocationPath() const {
|
||||
return fsutils::fromNativePath(value(QString::fromUtf8("Preferences/Downloads/LastLocationPath"), QString()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
void setLastLocationPath(const QString &path) {
|
||||
setValue(QString::fromUtf8("Preferences/Downloads/LastLocationPath"), fsutils::fromNativePath(path));
|
||||
@@ -325,6 +325,14 @@ public:
|
||||
setValue(QString::fromUtf8("Preferences/Downloads/DownloadInScanDirs"), misc::toStringList(list));
|
||||
}
|
||||
|
||||
QString getScanDirsLastPath() const {
|
||||
return fsutils::fromNativePath(value(QString::fromUtf8("Preferences/Downloads/ScanDirsLastPath"), QString()).toString());
|
||||
}
|
||||
|
||||
void setScanDirsLastPath(const QString &path) {
|
||||
setValue(QString::fromUtf8("Preferences/Downloads/ScanDirsLastPath"), fsutils::fromNativePath(path));
|
||||
}
|
||||
|
||||
bool isTorrentExportEnabled() const {
|
||||
return !value(QString::fromUtf8("Preferences/Downloads/TorrentExportDir"), QString()).toString().isEmpty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user