aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-03-03 23:40:33 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2024-03-03 23:40:33 +0100
commit0b44bd901f76bb75a05fe36d1d16b9c01706739b (patch)
tree3a03769383a2f3e79f1bfb3560019ff4f0c04350 /src
parent9e258f0cc2f1f952c0f76a113446aa6d3b7795a6 (diff)
reset_cookies: remove dir from fs and restart proc
Diffstat (limited to 'src')
-rw-r--r--src/webwindow.cpp20
1 files 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 <QtWebEngineCore/QWebEngineCookieStore>
#include <QtWebEngineCore/QWebEngineNewWindowRequest>
#include <QtWidgets/QApplication>
+#include <QtCore/QProcess>
+#include <filesystem>
#include <iostream>
#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