mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Port to Qt 5.6
This commit is contained in:
parent
94d89e4fa6
commit
9cb66878ff
@ -46,7 +46,6 @@
|
|||||||
#include "searchenginesmanager.h"
|
#include "searchenginesmanager.h"
|
||||||
#include "desktopnotificationsfactory.h"
|
#include "desktopnotificationsfactory.h"
|
||||||
#include "html5permissions/html5permissionsmanager.h"
|
#include "html5permissions/html5permissionsmanager.h"
|
||||||
#include "network/schemehandlers/qupzillaschemehandler.h"
|
|
||||||
#include "scripts.h"
|
#include "scripts.h"
|
||||||
|
|
||||||
#include <QWebEngineSettings>
|
#include <QWebEngineSettings>
|
||||||
@ -247,6 +246,8 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||||||
m_webProfile = isPrivate() ? new QWebEngineProfile(this) : QWebEngineProfile::defaultProfile();
|
m_webProfile = isPrivate() ? new QWebEngineProfile(this) : QWebEngineProfile::defaultProfile();
|
||||||
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
||||||
|
|
||||||
|
m_networkManager = new NetworkManager(this);
|
||||||
|
|
||||||
// Setup QWebChannel userscript
|
// Setup QWebChannel userscript
|
||||||
QWebEngineScript script;
|
QWebEngineScript script;
|
||||||
script.setName(QSL("_qupzilla_webchannel"));
|
script.setName(QSL("_qupzilla_webchannel"));
|
||||||
@ -278,9 +279,6 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||||||
if (!noAddons)
|
if (!noAddons)
|
||||||
m_plugins->loadPlugins();
|
m_plugins->loadPlugins();
|
||||||
|
|
||||||
// Create scheme handlers
|
|
||||||
new QupZillaSchemeHandler(this);
|
|
||||||
|
|
||||||
BrowserWindow* window = createWindow(Qz::BW_FirstAppWindow, startUrl);
|
BrowserWindow* window = createWindow(Qz::BW_FirstAppWindow, startUrl);
|
||||||
connect(window, SIGNAL(startingCompleted()), this, SLOT(restoreOverrideCursor()));
|
connect(window, SIGNAL(startingCompleted()), this, SLOT(restoreOverrideCursor()));
|
||||||
|
|
||||||
@ -545,9 +543,6 @@ BrowsingLibrary* MainApplication::browsingLibrary()
|
|||||||
|
|
||||||
NetworkManager *MainApplication::networkManager()
|
NetworkManager *MainApplication::networkManager()
|
||||||
{
|
{
|
||||||
if (!m_networkManager) {
|
|
||||||
m_networkManager = new NetworkManager(this);
|
|
||||||
}
|
|
||||||
return m_networkManager;
|
return m_networkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "passwordmanager.h"
|
#include "passwordmanager.h"
|
||||||
#include "sslerrordialog.h"
|
#include "sslerrordialog.h"
|
||||||
|
#include "network/schemehandlers/qupzillaschemehandler.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
@ -31,11 +32,15 @@
|
|||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineCertificateError>
|
#include <QWebEngineCertificateError>
|
||||||
|
|
||||||
NetworkManager::NetworkManager(QObject *parent)
|
NetworkManager::NetworkManager(QObject *parent)
|
||||||
: QNetworkAccessManager(parent)
|
: QNetworkAccessManager(parent)
|
||||||
{
|
{
|
||||||
|
// Create scheme handlers
|
||||||
|
mApp->webProfile()->installUrlSchemeHandler(new QupZillaSchemeHandler(this));
|
||||||
|
|
||||||
connect(this, &QNetworkAccessManager::authenticationRequired, this, [this](QNetworkReply *reply, QAuthenticator *auth) {
|
connect(this, &QNetworkAccessManager::authenticationRequired, this, [this](QNetworkReply *reply, QAuthenticator *auth) {
|
||||||
authentication(reply->url(), auth);
|
authentication(reply->url(), auth);
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtWebEngineWidgets/private/qwebengineurlrequestjob_p.h>
|
#include <QWebEngineUrlRequestJob>
|
||||||
|
|
||||||
static QString authorString(const char* name, const QString &mail)
|
static QString authorString(const char* name, const QString &mail)
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ static QString authorString(const char* name, const QString &mail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QupZillaSchemeHandler::QupZillaSchemeHandler(QObject *parent)
|
QupZillaSchemeHandler::QupZillaSchemeHandler(QObject *parent)
|
||||||
: QWebEngineUrlSchemeHandler(QByteArrayLiteral("qupzilla"), mApp->webProfile(), parent)
|
: QWebEngineUrlSchemeHandler(QByteArrayLiteral("qupzilla"), parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#ifndef QUPZILLASCHEMEHANDLER_H
|
#ifndef QUPZILLASCHEMEHANDLER_H
|
||||||
#define QUPZILLASCHEMEHANDLER_H
|
#define QUPZILLASCHEMEHANDLER_H
|
||||||
|
|
||||||
#include <QtWebEngineWidgets/private/qwebengineurlschemehandler_p.h>
|
#include <QWebEngineUrlSchemeHandler>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
|
|
||||||
|
@ -435,23 +435,17 @@ void WebView::copyLinkToClipboard()
|
|||||||
|
|
||||||
void WebView::downloadLinkToDisk()
|
void WebView::downloadLinkToDisk()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
triggerPageAction(QWebEnginePage::DownloadLinkToDisk);
|
triggerPageAction(QWebEnginePage::DownloadLinkToDisk);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::downloadImageToDisk()
|
void WebView::downloadImageToDisk()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
triggerPageAction(QWebEnginePage::DownloadImageToDisk);
|
triggerPageAction(QWebEnginePage::DownloadImageToDisk);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::downloadMediaToDisk()
|
void WebView::downloadMediaToDisk()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
triggerPageAction(QWebEnginePage::DownloadMediaToDisk);
|
triggerPageAction(QWebEnginePage::DownloadMediaToDisk);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position)
|
void WebView::openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position)
|
||||||
@ -715,9 +709,7 @@ void WebView::createLinkContextMenu(QMenu* menu, const WebHitTestResult &hitTest
|
|||||||
bData << hitTest.linkUrl() << hitTest.linkTitle();
|
bData << hitTest.linkUrl() << hitTest.linkTitle();
|
||||||
menu->addAction(QIcon::fromTheme("bookmark-new"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(bData);
|
menu->addAction(QIcon::fromTheme("bookmark-new"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(bData);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadLinkToDisk()));
|
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadLinkToDisk()));
|
||||||
#endif
|
|
||||||
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send link..."), this, SLOT(sendLinkByMail()))->setData(hitTest.linkUrl());
|
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send link..."), this, SLOT(sendLinkByMail()))->setData(hitTest.linkUrl());
|
||||||
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.linkUrl());
|
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.linkUrl());
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
@ -738,9 +730,7 @@ void WebView::createImageContextMenu(QMenu* menu, const WebHitTestResult &hitTes
|
|||||||
menu->addAction(act);
|
menu->addAction(act);
|
||||||
menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image ad&dress"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.imageUrl());
|
menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy image ad&dress"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.imageUrl());
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save image as..."), this, SLOT(downloadImageToDisk()));
|
menu->addAction(QIcon::fromTheme("document-save"), tr("&Save image as..."), this, SLOT(downloadImageToDisk()));
|
||||||
#endif
|
|
||||||
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send image..."), this, SLOT(sendLinkByMail()))->setData(hitTest.imageUrl());
|
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send image..."), this, SLOT(sendLinkByMail()))->setData(hitTest.imageUrl());
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
@ -833,9 +823,7 @@ void WebView::createMediaContextMenu(QMenu *menu, const WebHitTestResult &hitTes
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy Media Address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.mediaUrl());
|
menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy Media Address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.mediaUrl());
|
||||||
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("&Send Media Address"), this, SLOT(sendLinkByMail()))->setData(hitTest.mediaUrl());
|
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("&Send Media Address"), this, SLOT(sendLinkByMail()))->setData(hitTest.mediaUrl());
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
menu->addAction(QIcon::fromTheme("document-save"), tr("Save Media To &Disk"), this, SLOT(downloadMediaToDisk()));
|
menu->addAction(QIcon::fromTheme("document-save"), tr("Save Media To &Disk"), this, SLOT(downloadMediaToDisk()));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::checkForForm(QAction *action, const QPoint &pos)
|
void WebView::checkForForm(QAction *action, const QPoint &pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user