From 0b44bd901f76bb75a05fe36d1d16b9c01706739b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sun, 3 Mar 2024 23:40:33 +0100 Subject: reset_cookies: remove dir from fs and restart proc --- src/webwindow.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/webwindow.cpp b/src/webwindow.cpp index db1944e..5f69b09 100644 --- a/src/webwindow.cpp +++ b/src/webwindow.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include "permissionmanager.hpp" @@ -17,7 +19,7 @@ WebWindow::WebWindow(const QString &url) this->web_configure(); this->profile.setPersistentCookiesPolicy( - QWebEngineProfile::ForcePersistentCookies); + QWebEngineProfile::AllowPersistentCookies); this->view.setPage(&this->page); this->view.setUrl(url); @@ -102,12 +104,16 @@ WebWindow::permissions() void WebWindow::reset_cookies() { - this->profile.cookieStore()->deleteAllCookies(); - this->profile.cookieStore()->loadAllCookies(); - this->profile.clearHttpCache(); - this->profile.clearAllVisitedLinks(); - this->profile.clientCertificateStore(); - this->view.reload(); + std::filesystem::remove_all(this->profile.persistentStoragePath().toStdString()); + QProcess process; + QStringList args = QApplication::instance()->arguments(); + + if (!args.contains("--open-at-startup")) { + args.append("--open-at-startup"); + } + + process.startDetached(args.front(), args); + this->quit(); } void -- cgit v1.2.3-70-g09d2