mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
WebPage: Add supportedSchemes()
This commit is contained in:
parent
ee026bd40e
commit
e6601baf1f
|
@ -27,6 +27,7 @@
|
|||
#include "networkurlinterceptor.h"
|
||||
#include "schemehandlers/falkonschemehandler.h"
|
||||
#include "schemehandlers/extensionschemehandler.h"
|
||||
#include "webpage.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QDialog>
|
||||
|
@ -44,9 +45,11 @@ NetworkManager::NetworkManager(QObject *parent)
|
|||
: QNetworkAccessManager(parent)
|
||||
{
|
||||
// Create scheme handlers
|
||||
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("falkon"), new FalkonSchemeHandler());
|
||||
m_extensionScheme = new ExtensionSchemeManager();
|
||||
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("falkon"), new FalkonSchemeHandler());
|
||||
mApp->webProfile()->installUrlSchemeHandler(QByteArrayLiteral("extension"), m_extensionScheme);
|
||||
WebPage::addSupportedScheme(QSL("falkon"));
|
||||
WebPage::addSupportedScheme(QSL("extension"));
|
||||
|
||||
// Create url interceptor
|
||||
m_urlInterceptor = new NetworkUrlInterceptor(this);
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
||||
QUrl WebPage::s_lastUnsupportedUrl;
|
||||
QTime WebPage::s_lastUnsupportedUrlTime;
|
||||
QStringList s_supportedSchemes;
|
||||
|
||||
static const bool kEnableJsOutput = qEnvironmentVariableIsSet("FALKON_ENABLE_JS_OUTPUT");
|
||||
static const bool kEnableJsNonBlockDialogs = qEnvironmentVariableIsSet("FALKON_ENABLE_JS_NONBLOCK_DIALOGS");
|
||||
|
@ -198,6 +199,45 @@ bool WebPage::isLoading() const
|
|||
return m_loadProgress < 100;
|
||||
}
|
||||
|
||||
// static
|
||||
QStringList WebPage::internalSchemes()
|
||||
{
|
||||
return QStringList{
|
||||
QSL("http"),
|
||||
QSL("https"),
|
||||
QSL("file"),
|
||||
QSL("ftp"),
|
||||
QSL("data"),
|
||||
QSL("about"),
|
||||
QSL("view-source"),
|
||||
QSL("chrome")
|
||||
};
|
||||
}
|
||||
|
||||
// static
|
||||
QStringList WebPage::supportedSchemes()
|
||||
{
|
||||
if (s_supportedSchemes.isEmpty()) {
|
||||
s_supportedSchemes = internalSchemes();
|
||||
}
|
||||
return s_supportedSchemes;
|
||||
}
|
||||
|
||||
// static
|
||||
void WebPage::addSupportedScheme(const QString &scheme)
|
||||
{
|
||||
s_supportedSchemes = supportedSchemes();
|
||||
if (!s_supportedSchemes.contains(scheme)) {
|
||||
s_supportedSchemes.append(scheme);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void WebPage::removeSupportedScheme(const QString &scheme)
|
||||
{
|
||||
s_supportedSchemes.removeOne(scheme);
|
||||
}
|
||||
|
||||
void WebPage::urlChanged(const QUrl &url)
|
||||
{
|
||||
Q_UNUSED(url)
|
||||
|
|
|
@ -67,6 +67,11 @@ public:
|
|||
|
||||
bool isLoading() const;
|
||||
|
||||
static QStringList internalSchemes();
|
||||
static QStringList supportedSchemes();
|
||||
static void addSupportedScheme(const QString &scheme);
|
||||
static void removeSupportedScheme(const QString &scheme);
|
||||
|
||||
Q_SIGNALS:
|
||||
void privacyChanged(bool status);
|
||||
void printRequested();
|
||||
|
|
Loading…
Reference in New Issue
Block a user