From 474b9212a6630c8404d5f4cf7aa02428deddd3fd Mon Sep 17 00:00:00 2001 From: Keshav Bhatt Date: Wed, 30 Mar 2022 04:24:36 +0530 Subject: feat: v4.0 (#35) * add new widgets * feat: version 4.0 - SystemTray: tray icon uses png rather than svg - SystemTray: added settings to lets user change the systemtray icon click behavior(minimize/maximize on right click) - Download: added settiing that lets user set default download directory, avoid asking while saving files - Lock: added setting to let user change current set password for lock screen - Lock: current set password now hidden by default and can be revealed for 5 seconds by pressing view button - Style/Theme: added ability to change widget style on the fly, added default light palatte (prevent breaking of light theme on KDE EVs) - Theme: dark theme update - WebApp: added setting to set zoom factor when window is maximized and fullscreen (gives user ability to set different zoom factor for Normal , Maximized/Fullscreen WindowStates) - Setting: settings UI is more oraganized - WebApp: enable JavaScript execCommand("paste") - WebApp: tested for new WhatsApp Web that lets users use whatsie without requiring the phone connected to internet --- src/downloadmanagerwidget.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src/downloadmanagerwidget.cpp') diff --git a/src/downloadmanagerwidget.cpp b/src/downloadmanagerwidget.cpp index 6480e10..7f5b300 100644 --- a/src/downloadmanagerwidget.cpp +++ b/src/downloadmanagerwidget.cpp @@ -3,6 +3,7 @@ #include "downloadwidget.h" #include +#include #include DownloadManagerWidget::DownloadManagerWidget(QWidget *parent) @@ -14,23 +15,18 @@ void DownloadManagerWidget::downloadRequested( QWebEngineDownloadItem *download) { Q_ASSERT(download && download->state() == QWebEngineDownloadItem::DownloadRequested); - QString path; - - bool usenativeFileDialog = - settings.value("useNativeFileDialog", false).toBool(); - if (usenativeFileDialog == false) { - path = QFileDialog::getSaveFileName(this, tr("Save as"), download->downloadFileName(), - tr("Any file (*)"), nullptr, - QFileDialog::DontUseNativeDialog); - } else { - path = QFileDialog::getSaveFileName(this, tr("Save as"), download->downloadFileName(), - tr("Any file (*)"), nullptr); - } - - if (path.isEmpty()) - return; - - download->setDownloadFileName(path); + QString path = + settings + .value("defaultDownloadLocation", + QStandardPaths::writableLocation( + QStandardPaths::DownloadLocation) + + QDir::separator() + QApplication::applicationName()) + .toString(); + QDir d; + d.mkpath(path); + + download->setDownloadFileName(path + QDir::separator() + + download->downloadFileName()); download->accept(); add(new DownloadWidget(download)); show(); -- cgit v1.2.3