aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Keshav Bhatt <keshavnrj@gmail.com>2022-07-04 23:21:32 +0530
committerLibravatar Keshav Bhatt <keshavnrj@gmail.com>2022-07-04 23:21:32 +0530
commit6c6275c34bfc4d1e37dfa50495c977af485f9cf0 (patch)
treea0c927fac781ecb1eddba0ec3eb7d8af338cba56 /src
parent974933d025cbfee79fe4f987ad62272621e7e373 (diff)
downloadwhatsie-6c6275c34bfc4d1e37dfa50495c977af485f9cf0.tar.gz
whatsie-6c6275c34bfc4d1e37dfa50495c977af485f9cf0.zip
fix(web): bypass lock check while loading quirk
- just reload without asking while loading quirks
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp40
-rw-r--r--src/mainwindow.h2
2 files changed, 23 insertions, 19 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 3cc8367..5a7e6e2 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -500,8 +500,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
this->hide();
event->ignore();
if (settings.value("firstrun_tray", true).toBool()) {
- notify(QApplication::applicationName(),
- "Minimized to system tray.");
+ notify(QApplication::applicationName(), "Minimized to system tray.");
settings.setValue("firstrun_tray", false);
}
return;
@@ -579,9 +578,7 @@ void MainWindow::createActions() {
reloadAction = new QAction(tr("Re&load"), this);
reloadAction->setShortcut(Qt::Key_F5);
- connect(reloadAction, &QAction::triggered,this, [=]{
- this->doReload();
- });
+ connect(reloadAction, &QAction::triggered, this, [=] { this->doReload(); });
addAction(reloadAction);
lockAction = new QAction(tr("Loc&k"), this);
@@ -1072,7 +1069,7 @@ void MainWindow::loadingQuirk(QString test) {
if (correctlyLoaderRetries > -1) {
qWarning() << test << "checkLoadedCorrectly()/loadingQuirk()/doReload()"
<< correctlyLoaderRetries;
- doReload();
+ doReload(false, false, true);
correctlyLoaderRetries--;
} else {
utils::delete_cache(webEngine->page()->profile()->cachePath());
@@ -1181,22 +1178,29 @@ bool MainWindow::isPhoneNumber(const QString &phoneNumber) {
return reg.match(phoneNumber).hasMatch();
}
-void MainWindow::doReload(bool byPassCache, bool isAskedByCLI) {
- if (lockWidget && !lockWidget->getIsLocked()) {
- this->notify(QApplication::applicationName(), QObject::tr("Reloading..."));
+void MainWindow::doReload(bool byPassCache, bool isAskedByCLI,
+ bool byLoadingQuirk) {
+ if (byLoadingQuirk) {
+ this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache,
+ byPassCache);
} else {
- QString error = tr("Unlock to Reload the App.");
- if (isAskedByCLI) {
- this->notify(QApplication::applicationName() + "| Error", error);
+ if (lockWidget && !lockWidget->getIsLocked()) {
+ this->notify(QApplication::applicationName(),
+ QObject::tr("Reloading..."));
} else {
- QMessageBox::critical(this, QApplication::applicationName() + "| Error",
- error);
+ QString error = tr("Unlock to Reload the App.");
+ if (isAskedByCLI) {
+ this->notify(QApplication::applicationName() + "| Error", error);
+ } else {
+ QMessageBox::critical(this, QApplication::applicationName() + "| Error",
+ error);
+ }
+ this->show();
+ return;
}
- this->show();
- return;
+ this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache,
+ byPassCache);
}
- this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache,
- byPassCache);
}
void MainWindow::toggleMute(const bool &checked) {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index f8a4ff5..76abe86 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -55,7 +55,7 @@ public slots:
void alreadyRunning(bool notify = false);
void notify(QString title, QString message);
void toggleTheme();
- void doReload(bool byPassCache = false, bool isAskedByCLI = false);
+ void doReload(bool byPassCache = false, bool isAskedByCLI = false, bool byLoadingQuirk = false);
void newChat();
protected slots:
void closeEvent(QCloseEvent *event) override;