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