mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Make qupzilla:restore working also with disabled JavaScript
Instead of temporarily enabling JavaScript, make the page functional without it.
This commit is contained in:
parent
7ebd4039f8
commit
e41b0edf0a
@ -275,9 +275,6 @@ void BrowserWindow::postLaunch()
|
||||
if (mApp->isStartingAfterCrash()) {
|
||||
addTab = false;
|
||||
startUrl.clear();
|
||||
// qupzilla:restore needs JavaScript enabled
|
||||
// correct value is then restored in MainApplication::destroyRestoreManager
|
||||
mApp->webSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
|
||||
m_tabWidget->addView(QUrl("falkon:restore"), Qz::NT_CleanSelectedTabAtTheEnd);
|
||||
}
|
||||
else if (mApp->afterLaunch() == MainApplication::SelectSession || mApp->afterLaunch() == MainApplication::RestoreSession) {
|
||||
|
@ -468,10 +468,6 @@ void MainApplication::destroyRestoreManager()
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore JavaScript settings
|
||||
const bool jsEnabled = Settings().value(QSL("Web-Browser-Settings/allowJavaScript"), true).toBool();
|
||||
m_webProfile->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, jsEnabled);
|
||||
|
||||
delete m_restoreManager;
|
||||
m_restoreManager = 0;
|
||||
}
|
||||
|
@ -120,6 +120,17 @@ li {padding: 5px;}
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#listview td.js-disabled
|
||||
{
|
||||
text-align: center;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
#listview tbody tr.js-disabled:hover
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -299,11 +310,18 @@ function init()
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="recovery-items">
|
||||
<noscript>
|
||||
<tr class="js-disabled">
|
||||
<td class="js-disabled">%JAVASCRIPT-DISABLED%</td>
|
||||
</tr>
|
||||
</noscript>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input class="button" type="button" id="start-new-session-button" value="%BUTTON-START-NEW%" onclick="startNewSession();">
|
||||
<input class="button" type="button" id="restore-session-button" value=" %BUTTON-RESTORE% " onclick="restoreSession();">
|
||||
<form>
|
||||
<input class="button" type="submit" id="start-new-session-button" name="new-session" value="%BUTTON-START-NEW%" onclick="startNewSession();return false;">
|
||||
<input class="button" type="submit" id="restore-session-button" name="restore-session" value=" %BUTTON-RESTORE% " onclick="restoreSession();return false;">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "datapaths.h"
|
||||
#include "iconprovider.h"
|
||||
#include "sessionmanager.h"
|
||||
#include "restoremanager.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QSettings>
|
||||
@ -46,6 +47,10 @@ FalkonSchemeHandler::FalkonSchemeHandler(QObject *parent)
|
||||
|
||||
void FalkonSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
|
||||
{
|
||||
if (handleRequest(job)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList knownPages;
|
||||
knownPages << "about" << "reportbug" << "start" << "speeddial" << "config" << "restore" << "adblock";
|
||||
|
||||
@ -55,6 +60,25 @@ void FalkonSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
|
||||
job->fail(QWebEngineUrlRequestJob::UrlInvalid);
|
||||
}
|
||||
|
||||
bool FalkonSchemeHandler::handleRequest(QWebEngineUrlRequestJob *job)
|
||||
{
|
||||
QUrlQuery query(job->requestUrl());
|
||||
if (!query.isEmpty() && job->requestUrl().path() == QL1S("restore")) {
|
||||
if (mApp->restoreManager()) {
|
||||
if (query.hasQueryItem(QSL("new-session"))) {
|
||||
mApp->restoreManager()->clearRestoreData();
|
||||
} else if (query.hasQueryItem(QSL("restore-session"))) {
|
||||
mApp->restoreSession(nullptr, mApp->restoreManager()->restoreData());
|
||||
}
|
||||
}
|
||||
mApp->destroyRestoreManager();
|
||||
job->redirect(QUrl(QSL("falkon:start")));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FalkonSchemeReply::FalkonSchemeReply(QWebEngineUrlRequestJob *job, QObject *parent)
|
||||
: QIODevice(parent)
|
||||
, m_loaded(false)
|
||||
@ -282,7 +306,7 @@ QString FalkonSchemeReply::speeddialPage()
|
||||
dPage.replace(QLatin1String("%TITLE-WARN%"), tr("Are you sure you want to remove this speed dial?"));
|
||||
dPage.replace(QLatin1String("%TITLE-WARN-REL%"), tr("Are you sure you want to reload all speed dials?"));
|
||||
dPage.replace(QLatin1String("%TITLE-FETCHTITLE%"), tr("Load title from page"));
|
||||
dPage.replace(QLatin1String("%JAVASCRIPT-DISABLED%"), tr("SpeedDial requires JavaScript enabled."));
|
||||
dPage.replace(QLatin1String("%JAVASCRIPT-DISABLED%"), tr("SpeedDial requires enabled JavaScript."));
|
||||
dPage.replace(QLatin1String("%URL%"), tr("Url"));
|
||||
dPage.replace(QLatin1String("%TITLE%"), tr("Title"));
|
||||
dPage.replace(QLatin1String("%APPLY%"), tr("Apply"));
|
||||
@ -333,6 +357,7 @@ QString FalkonSchemeReply::restorePage()
|
||||
rPage.replace(QLatin1String("%WINDOWS-AND-TABS%"), tr("Windows and Tabs"));
|
||||
rPage.replace(QLatin1String("%BUTTON-START-NEW%"), tr("Start New Session"));
|
||||
rPage.replace(QLatin1String("%BUTTON-RESTORE%"), tr("Restore"));
|
||||
rPage.replace(QLatin1String("%JAVASCRIPT-DISABLED%"), tr("Requires enabled JavaScript."));
|
||||
rPage = QzTools::applyDirectionToPage(rPage);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* Falkon - Qt web browser
|
||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,6 +30,9 @@ public:
|
||||
explicit FalkonSchemeHandler(QObject *parent = Q_NULLPTR);
|
||||
|
||||
void requestStarted(QWebEngineUrlRequestJob *job) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool handleRequest(QWebEngineUrlRequestJob *job);
|
||||
};
|
||||
|
||||
class FALKON_EXPORT FalkonSchemeReply : public QIODevice
|
||||
|
Loading…
Reference in New Issue
Block a user