]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/views/BrowserView.cpp
Add a download location setting.
[PrivacyBrowserPC.git] / src / views / BrowserView.cpp
index 2a23d8126ca54b80aa8afdf7747c79be853cacf0..f17a237d6d33d962db9315eb3a9602504f79bddc 100644 (file)
@@ -663,8 +663,15 @@ void BrowserView::showSaveDialog(QWebEngineDownloadItem *downloadItemPointer) co
 
 void BrowserView::showSaveFilePickerDialog(QUrl &downloadUrl, QString &suggestedFileName)
 {
+    // Get the download location.
+    QString downloadDirectory = Settings::downloadLocation();
+
+    // Resolve the system download directory if specified.
+    if (downloadDirectory == QStringLiteral("System Download Directory"))
+        downloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+
     // Create a save file dialog.
-    QFileDialog *saveFileDialogPointer = new QFileDialog(this, i18nc("Save file dialog caption", "Save File"), QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
+    QFileDialog *saveFileDialogPointer = new QFileDialog(this, i18nc("Save file dialog caption", "Save File"), downloadDirectory);
 
     // Tell the dialog to use a save button.
     saveFileDialogPointer->setAcceptMode(QFileDialog::AcceptSave);
@@ -672,7 +679,7 @@ void BrowserView::showSaveFilePickerDialog(QUrl &downloadUrl, QString &suggested
     // Populate the file name from the download item pointer.
     saveFileDialogPointer->selectFile(suggestedFileName);
 
-    // Prevent interaction with the parent windows while the dialog is open.
+    // Prevent interaction with the parent window while the dialog is open.
     saveFileDialogPointer->setWindowModality(Qt::WindowModal);
 
     // Process the saving of the file.  The save file dialog pointer must be captured directly instead of by reference or nasty crashes occur.