From 0d9aedc087f56a3da35b6abc8a0ee233c2d2483b Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 13 Apr 2025 20:06:58 +0530 Subject: Add downloads_dir configuration + auto-accept download requests --- src/WindowMediator.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/WindowMediator.cpp') diff --git a/src/WindowMediator.cpp b/src/WindowMediator.cpp index a2ff2a6..f27e009 100644 --- a/src/WindowMediator.cpp +++ b/src/WindowMediator.cpp @@ -16,9 +16,6 @@ WindowMediator::WindowMediator(WebViewStack *webview_stack) : webview_stack(webv connect(this, &WindowMediator::webview_closed, webview_stack, &WebViewStack::close); connect(this, &WindowMediator::webview_selected, webview_stack, &WebViewStack::focus_webview); - auto *profile = webview_stack->get_profile(); - connect(this, &WindowMediator::set_user_agent, profile, &QWebEngineProfile::setHttpUserAgent); - // Delegate signal connect(webview_stack, &WebViewStack::new_window_requested, this, &WindowMediator::new_window_requested); @@ -26,6 +23,17 @@ WindowMediator::WindowMediator(WebViewStack *webview_stack) : webview_stack(webv &WindowMediator::close_window_requested); } +void WindowMediator::update_user_agent(const QString &user_agent) { + auto *profile = webview_stack->get_profile(); + profile->setHttpUserAgent(user_agent); +} + +void WindowMediator::update_downloads_dir(const QString &downloads_dir) { + qDebug() << "::: dl in med" << downloads_dir; + auto *profile = webview_stack->get_profile(); + profile->setDownloadPath(downloads_dir); +} + WindowMediator::~WindowMediator() { disconnect(this); delete webview_stack; -- cgit v1.3.1