mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
We depend against qt5.15
This commit is contained in:
parent
c6ad2708d4
commit
d6c4035ff6
@ -69,9 +69,7 @@
|
|||||||
#include <QtWebEngineWidgetsVersion>
|
#include <QtWebEngineWidgetsVersion>
|
||||||
#include <QtWebEngineCoreVersion>
|
#include <QtWebEngineCoreVersion>
|
||||||
|
|
||||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
#include <QWebEngineNotification>
|
#include <QWebEngineNotification>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <QtWin>
|
#include <QtWin>
|
||||||
@ -296,14 +294,12 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||||||
m_webProfile = isPrivate() ? new QWebEngineProfile() : QWebEngineProfile::defaultProfile();
|
m_webProfile = isPrivate() ? new QWebEngineProfile() : QWebEngineProfile::defaultProfile();
|
||||||
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
||||||
|
|
||||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
m_webProfile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) {
|
m_webProfile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) {
|
||||||
auto notifications = desktopNotifications();
|
auto notifications = desktopNotifications();
|
||||||
notifications->showNotification(
|
notifications->showNotification(
|
||||||
QPixmap::fromImage(notification->icon()), notification->title(), notification->message()
|
QPixmap::fromImage(notification->icon()), notification->title(), notification->message()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
|
|
||||||
m_networkManager = new NetworkManager(this);
|
m_networkManager = new NetworkManager(this);
|
||||||
|
|
||||||
@ -963,25 +959,15 @@ void MainApplication::loadSettings()
|
|||||||
webSettings->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
|
webSettings->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
|
||||||
webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
|
webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value(QSL("allowJavaScriptActivateWindow"), false).toBool());
|
webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value(QSL("allowJavaScriptActivateWindow"), false).toBool());
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value(QSL("allowJavaScriptPaste"), true).toBool());
|
webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value(QSL("allowJavaScriptPaste"), true).toBool());
|
||||||
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, settings.value(QSL("DisableVideoAutoPlay"), false).toBool());
|
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture, settings.value(QSL("DisableVideoAutoPlay"), false).toBool());
|
||||||
webSettings->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, settings.value(QSL("WebRTCPublicIpOnly"), true).toBool());
|
webSettings->setAttribute(QWebEngineSettings::WebRTCPublicInterfacesOnly, settings.value(QSL("WebRTCPublicIpOnly"), true).toBool());
|
||||||
webSettings->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes);
|
webSettings->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
webSettings->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, settings.value(QSL("DNSPrefetch"), true).toBool());
|
webSettings->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, settings.value(QSL("DNSPrefetch"), true).toBool());
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
webSettings->setAttribute(QWebEngineSettings::PdfViewerEnabled, settings.value(QSL("intPDFViewer"), false).toBool());
|
webSettings->setAttribute(QWebEngineSettings::PdfViewerEnabled, settings.value(QSL("intPDFViewer"), false).toBool());
|
||||||
webSettings->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, settings.value(QSL("screenCaptureEnabled"), false).toBool());
|
webSettings->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, settings.value(QSL("screenCaptureEnabled"), false).toBool());
|
||||||
#endif
|
|
||||||
|
|
||||||
webSettings->setDefaultTextEncoding(settings.value(QSL("DefaultEncoding"), webSettings->defaultTextEncoding()).toString());
|
webSettings->setDefaultTextEncoding(settings.value(QSL("DefaultEncoding"), webSettings->defaultTextEncoding()).toString());
|
||||||
|
|
||||||
|
@ -93,11 +93,7 @@ QSize BookmarksToolbarButton::sizeHint() const
|
|||||||
width = SEPARATOR_WIDTH;
|
width = SEPARATOR_WIDTH;
|
||||||
}
|
}
|
||||||
else if (!m_showOnlyIcon) {
|
else if (!m_showOnlyIcon) {
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
width += PADDING * 2 + fontMetrics().horizontalAdvance(m_bookmark->title());
|
width += PADDING * 2 + fontMetrics().horizontalAdvance(m_bookmark->title());
|
||||||
#else
|
|
||||||
width += PADDING * 2 + fontMetrics().width(m_bookmark->title());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (menu()) {
|
if (menu()) {
|
||||||
width += PADDING + 8;
|
width += PADDING + 8;
|
||||||
|
@ -36,9 +36,7 @@ CookieJar::CookieJar(QObject* parent)
|
|||||||
loadSettings();
|
loadSettings();
|
||||||
m_client->loadAllCookies();
|
m_client->loadAllCookies();
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
m_client->setCookieFilter(std::bind(&CookieJar::cookieFilter, this, std::placeholders::_1));
|
m_client->setCookieFilter(std::bind(&CookieJar::cookieFilter, this, std::placeholders::_1));
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(m_client, &QWebEngineCookieStore::cookieAdded, this, &CookieJar::slotCookieAdded);
|
connect(m_client, &QWebEngineCookieStore::cookieAdded, this, &CookieJar::slotCookieAdded);
|
||||||
connect(m_client, &QWebEngineCookieStore::cookieRemoved, this, &CookieJar::slotCookieRemoved);
|
connect(m_client, &QWebEngineCookieStore::cookieRemoved, this, &CookieJar::slotCookieRemoved);
|
||||||
@ -46,9 +44,7 @@ CookieJar::CookieJar(QObject* parent)
|
|||||||
|
|
||||||
CookieJar::~CookieJar()
|
CookieJar::~CookieJar()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
m_client->setCookieFilter(nullptr);
|
m_client->setCookieFilter(nullptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CookieJar::loadSettings()
|
void CookieJar::loadSettings()
|
||||||
@ -136,7 +132,6 @@ void CookieJar::slotCookieRemoved(const QNetworkCookie &cookie)
|
|||||||
emit cookieRemoved(cookie);
|
emit cookieRemoved(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
bool CookieJar::cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const
|
bool CookieJar::cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const
|
||||||
{
|
{
|
||||||
if (!m_allowCookies) {
|
if (!m_allowCookies) {
|
||||||
@ -168,7 +163,6 @@ bool CookieJar::cookieFilter(const QWebEngineCookieStore::FilterRequest &request
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool CookieJar::rejectCookie(const QString &domain, const QNetworkCookie &cookie, const QString &cookieDomain) const
|
bool CookieJar::rejectCookie(const QString &domain, const QNetworkCookie &cookie, const QString &cookieDomain) const
|
||||||
{
|
{
|
||||||
|
@ -56,9 +56,7 @@ private:
|
|||||||
void slotCookieAdded(const QNetworkCookie &cookie);
|
void slotCookieAdded(const QNetworkCookie &cookie);
|
||||||
void slotCookieRemoved(const QNetworkCookie &cookie);
|
void slotCookieRemoved(const QNetworkCookie &cookie);
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
bool cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const;
|
bool cookieFilter(const QWebEngineCookieStore::FilterRequest &request) const;
|
||||||
#endif
|
|
||||||
|
|
||||||
bool acceptCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &cookieSource) const;
|
bool acceptCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &cookieSource) const;
|
||||||
bool rejectCookie(const QString &domain, const QNetworkCookie &cookie, const QString &cookieDomain) const;
|
bool rejectCookie(const QString &domain, const QNetworkCookie &cookie, const QString &cookieDomain) const;
|
||||||
|
@ -75,10 +75,6 @@ CookieManager::CookieManager(QWidget *parent)
|
|||||||
ui->blackList->addItems(settings.value("blacklist", QStringList()).toStringList());
|
ui->blackList->addItems(settings.value("blacklist", QStringList()).toStringList());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
ui->filter3rdParty->hide();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ui->search->setPlaceholderText(tr("Search"));
|
ui->search->setPlaceholderText(tr("Search"));
|
||||||
ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed);
|
ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed);
|
||||||
ui->cookieTree->sortItems(0, Qt::AscendingOrder);
|
ui->cookieTree->sortItems(0, Qt::AscendingOrder);
|
||||||
|
@ -235,11 +235,9 @@ void DownloadItem::updateDownloadInfo(double currSpeed, qint64 received, qint64
|
|||||||
// | m_remTime | |m_currSize| |m_fileSize| |m_speed|
|
// | m_remTime | |m_currSize| |m_fileSize| |m_speed|
|
||||||
// Remaining 26 minutes - 339MB of 693 MB (350kB/s)
|
// Remaining 26 minutes - 339MB of 693 MB (350kB/s)
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
if (m_download->isPaused()) {
|
if (m_download->isPaused()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int estimatedTime = ((total - received) / 1024) / (currSpeed / 1024);
|
int estimatedTime = ((total - received) / 1024) / (currSpeed / 1024);
|
||||||
QString speed = currentSpeedToString(currSpeed);
|
QString speed = currentSpeedToString(currSpeed);
|
||||||
@ -283,7 +281,6 @@ void DownloadItem::stop()
|
|||||||
|
|
||||||
void DownloadItem::pauseResume()
|
void DownloadItem::pauseResume()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
if (m_download->isPaused()) {
|
if (m_download->isPaused()) {
|
||||||
m_download->resume();
|
m_download->resume();
|
||||||
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-pause")).pixmap(20, 20));
|
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-pause")).pixmap(20, 20));
|
||||||
@ -292,7 +289,6 @@ void DownloadItem::pauseResume()
|
|||||||
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-start")).pixmap(20, 20));
|
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-start")).pixmap(20, 20));
|
||||||
ui->downloadInfo->setText(tr("Paused - %1").arg(m_download->url().host()));
|
ui->downloadInfo->setText(tr("Paused - %1").arg(m_download->url().host()));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadItem::mouseDoubleClickEvent(QMouseEvent* e)
|
void DownloadItem::mouseDoubleClickEvent(QMouseEvent* e)
|
||||||
@ -312,13 +308,11 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
|
menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
if (m_download->isPaused()) {
|
if (m_download->isPaused()) {
|
||||||
menu.addAction(QIcon::fromTheme("media-playback-start"), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
menu.addAction(QIcon::fromTheme("media-playback-start"), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
||||||
} else {
|
} else {
|
||||||
menu.addAction(QIcon::fromTheme("media-playback-pause"), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
menu.addAction(QIcon::fromTheme("media-playback-pause"), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);
|
menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);
|
||||||
|
|
||||||
|
@ -133,22 +133,10 @@ void DownloadManager::closeDownloadTab(QWebEngineDownloadItem *item) const
|
|||||||
if (page->history()->count() != 0) {
|
if (page->history()->count() != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
Q_UNUSED(url)
|
Q_UNUSED(url)
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
if (page->url() != QUrl()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
QUrl tabUrl = page->requestedUrl();
|
|
||||||
if (tabUrl.isEmpty()) {
|
|
||||||
tabUrl = QUrl(view->webTab()->locationBar()->text());
|
|
||||||
}
|
|
||||||
return tabUrl.host() == url.host();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
if (!item->page()) {
|
if (!item->page()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -163,30 +151,6 @@ void DownloadManager::closeDownloadTab(QWebEngineDownloadItem *item) const
|
|||||||
if (testWebView(view, QUrl())) {
|
if (testWebView(view, QUrl())) {
|
||||||
view->closeView();
|
view->closeView();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
BrowserWindow* mainWindow = mApp->getWindow();
|
|
||||||
// If the main window was closed, there is no need to go further
|
|
||||||
if (mainWindow == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (testWebView(mainWindow->weView(), item->url())) {
|
|
||||||
mainWindow->weView()->closeView();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto windows = mApp->windows();
|
|
||||||
for (auto *window : windows) {
|
|
||||||
const auto tabs = window->tabWidget()->allTabs();
|
|
||||||
for (auto *tab : tabs) {
|
|
||||||
auto *view = tab->webView();
|
|
||||||
if (testWebView(view, item->url())) {
|
|
||||||
view->closeView();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWinTaskbarButton *DownloadManager::taskbarButton()
|
QWinTaskbarButton *DownloadManager::taskbarButton()
|
||||||
|
@ -142,11 +142,7 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
|
|||||||
leftPosition += m_padding * 2;
|
leftPosition += m_padding * 2;
|
||||||
|
|
||||||
// Trim link to maximum number of characters that can be visible, otherwise there may be perf issue with huge URLs
|
// Trim link to maximum number of characters that can be visible, otherwise there may be perf issue with huge URLs
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
const int maxChars = (opt.rect.width() - leftPosition) / opt.fontMetrics.horizontalAdvance(QL1C('i'));
|
const int maxChars = (opt.rect.width() - leftPosition) / opt.fontMetrics.horizontalAdvance(QL1C('i'));
|
||||||
#else
|
|
||||||
const int maxChars = (opt.rect.width() - leftPosition) / opt.fontMetrics.width(QL1C('i'));
|
|
||||||
#endif
|
|
||||||
QString link;
|
QString link;
|
||||||
const QByteArray linkArray = index.data(Qt::DisplayRole).toByteArray();
|
const QByteArray linkArray = index.data(Qt::DisplayRole).toByteArray();
|
||||||
if (!linkArray.startsWith("data") && !linkArray.startsWith("javascript")) {
|
if (!linkArray.startsWith("data") && !linkArray.startsWith("javascript")) {
|
||||||
@ -176,11 +172,7 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
|
|||||||
// Draw separator
|
// Draw separator
|
||||||
if (!link.isEmpty()) {
|
if (!link.isEmpty()) {
|
||||||
QChar separator = QL1C('-');
|
QChar separator = QL1C('-');
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
QRect separatorRect(leftPosition, center - linkMetrics.height() / 2, linkMetrics.horizontalAdvance(separator), linkMetrics.height());
|
QRect separatorRect(leftPosition, center - linkMetrics.height() / 2, linkMetrics.horizontalAdvance(separator), linkMetrics.height());
|
||||||
#else
|
|
||||||
QRect separatorRect(leftPosition, center - linkMetrics.height() / 2, linkMetrics.width(separator), linkMetrics.height());
|
|
||||||
#endif
|
|
||||||
style->drawItemText(painter, separatorRect, Qt::AlignCenter, textPalette, true, separator, colorRole);
|
style->drawItemText(painter, separatorRect, Qt::AlignCenter, textPalette, true, separator, colorRole);
|
||||||
leftPosition += separatorRect.width() + m_padding * 2;
|
leftPosition += separatorRect.width() + m_padding * 2;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,7 @@
|
|||||||
#include <QWebEngineCertificateError>
|
#include <QWebEngineCertificateError>
|
||||||
#include <QtWebEngineWidgetsVersion>
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
#include <QWebEngineUrlScheme>
|
#include <QWebEngineUrlScheme>
|
||||||
#endif
|
|
||||||
|
|
||||||
NetworkManager::NetworkManager(QObject *parent)
|
NetworkManager::NetworkManager(QObject *parent)
|
||||||
: QNetworkAccessManager(parent)
|
: QNetworkAccessManager(parent)
|
||||||
@ -59,11 +57,7 @@ NetworkManager::NetworkManager(QObject *parent)
|
|||||||
|
|
||||||
// Create url interceptor
|
// Create url interceptor
|
||||||
m_urlInterceptor = new NetworkUrlInterceptor(this);
|
m_urlInterceptor = new NetworkUrlInterceptor(this);
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
mApp->webProfile()->setUrlRequestInterceptor(m_urlInterceptor);
|
mApp->webProfile()->setUrlRequestInterceptor(m_urlInterceptor);
|
||||||
#else
|
|
||||||
mApp->webProfile()->setRequestInterceptor(m_urlInterceptor);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Create cookie jar
|
// Create cookie jar
|
||||||
mApp->cookieJar();
|
mApp->cookieJar();
|
||||||
@ -299,17 +293,12 @@ void NetworkManager::loadSettings()
|
|||||||
|
|
||||||
void NetworkManager::shutdown()
|
void NetworkManager::shutdown()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
mApp->webProfile()->setUrlRequestInterceptor(nullptr);
|
mApp->webProfile()->setUrlRequestInterceptor(nullptr);
|
||||||
#else
|
|
||||||
mApp->webProfile()->setRequestInterceptor(nullptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void NetworkManager::registerSchemes()
|
void NetworkManager::registerSchemes()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
QWebEngineUrlScheme falkonScheme("falkon");
|
QWebEngineUrlScheme falkonScheme("falkon");
|
||||||
falkonScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::ContentSecurityPolicyIgnored);
|
falkonScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::ContentSecurityPolicyIgnored);
|
||||||
falkonScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
|
falkonScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
|
||||||
@ -318,7 +307,6 @@ void NetworkManager::registerSchemes()
|
|||||||
extensionScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::ContentSecurityPolicyIgnored);
|
extensionScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::ContentSecurityPolicyIgnored);
|
||||||
extensionScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
|
extensionScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
|
||||||
QWebEngineUrlScheme::registerScheme(extensionScheme);
|
QWebEngineUrlScheme::registerScheme(extensionScheme);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
|
QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
#include <QWebEnginePage>
|
#include <QWebEnginePage>
|
||||||
#include <QtWebEngineWidgetsVersion>
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
#include <QWebEngineRegisterProtocolHandlerRequest>
|
#include <QWebEngineRegisterProtocolHandlerRequest>
|
||||||
#endif
|
|
||||||
|
|
||||||
ProtocolHandlerManager::ProtocolHandlerManager(QObject *parent)
|
ProtocolHandlerManager::ProtocolHandlerManager(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -83,10 +81,8 @@ void ProtocolHandlerManager::registerHandler(const QString &scheme, const QUrl &
|
|||||||
|
|
||||||
QWebEnginePage *page = new QWebEnginePage(this);
|
QWebEnginePage *page = new QWebEnginePage(this);
|
||||||
connect(page, &QWebEnginePage::loadFinished, page, &QObject::deleteLater);
|
connect(page, &QWebEnginePage::loadFinished, page, &QObject::deleteLater);
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this, [](QWebEngineRegisterProtocolHandlerRequest request) {
|
connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this, [](QWebEngineRegisterProtocolHandlerRequest request) {
|
||||||
request.accept();
|
request.accept();
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
page->setHtml(QSL("<script>navigator.registerProtocolHandler('%1', '%2', '')</script>").arg(scheme, urlString), url);
|
page->setHtml(QSL("<script>navigator.registerProtocolHandler('%1', '%2', '')</script>").arg(scheme, urlString), url);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,7 @@ QString QmlWebEngineUrlRequestJob::initiator() const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
QString initiatorString;
|
QString initiatorString;
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
initiatorString = QString::fromUtf8(m_job->initiator().toEncoded());
|
initiatorString = QString::fromUtf8(m_job->initiator().toEncoded());
|
||||||
#endif
|
|
||||||
return initiatorString;
|
return initiatorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,14 +30,6 @@ JsOptions::JsOptions(QWidget* parent)
|
|||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
ui->jscanActivateWindow->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
ui->jscanPaste->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("Web-Browser-Settings");
|
settings.beginGroup("Web-Browser-Settings");
|
||||||
ui->jscanOpenWindow->setChecked(settings.value("allowJavaScriptOpenWindow", false).toBool());
|
ui->jscanOpenWindow->setChecked(settings.value("allowJavaScriptOpenWindow", false).toBool());
|
||||||
|
@ -112,23 +112,6 @@ Preferences::Preferences(BrowserWindow* window)
|
|||||||
ui->checkUpdates->setVisible(false);
|
ui->checkUpdates->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
ui->disableVideoAutoPlay->setVisible(false);
|
|
||||||
ui->webRTCPublicIpOnly->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
ui->dnsPrefetch->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
ui->intPDFViewer->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 13, 2)
|
|
||||||
ui->screenCaptureEnabled->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
auto setCategoryIcon = [this](int index, const QIcon &icon) {
|
auto setCategoryIcon = [this](int index, const QIcon &icon) {
|
||||||
ui->listWidget->item(index)->setIcon(QIcon(icon.pixmap(32)));
|
ui->listWidget->item(index)->setIcon(QIcon(icon.pixmap(32)));
|
||||||
|
@ -138,12 +138,7 @@ ThemeManager::Theme ThemeManager::parseTheme(const QString &path, const QString
|
|||||||
info.name = metadata.name();
|
info.name = metadata.name();
|
||||||
info.description = metadata.comment();
|
info.description = metadata.comment();
|
||||||
info.author = metadata.value(QSL("X-Falkon-Author")).toString();
|
info.author = metadata.value(QSL("X-Falkon-Author")).toString();
|
||||||
#if QTCORE_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
info.themePath = path.chopped(1);
|
info.themePath = path.chopped(1);
|
||||||
#else
|
|
||||||
info.themePath = path;
|
|
||||||
info.themePath.chop(1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const QString iconName = metadata.icon();
|
const QString iconName = metadata.icon();
|
||||||
if (!iconName.isEmpty()) {
|
if (!iconName.isEmpty()) {
|
||||||
|
@ -1086,11 +1086,7 @@ QPixmap TabBarHelper::tabPixmap(int index) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (closeButton) {
|
if (closeButton) {
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
const int width = tab.fontMetrics.horizontalAdvance(tab.text) + closeButton->width();
|
const int width = tab.fontMetrics.horizontalAdvance(tab.text) + closeButton->width();
|
||||||
#else
|
|
||||||
const int width = tab.fontMetrics.width(tab.text) + closeButton->width();
|
|
||||||
#endif
|
|
||||||
tab.text = tab.fontMetrics.elidedText(tabText(index), Qt::ElideRight, width);
|
tab.text = tab.fontMetrics.elidedText(tabText(index), Qt::ElideRight, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,12 +40,6 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent)
|
|||||||
connect(ui->feature, SIGNAL(currentIndexChanged(int)), this, SLOT(featureIndexChanged()));
|
connect(ui->feature, SIGNAL(currentIndexChanged(int)), this, SLOT(featureIndexChanged()));
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &HTML5PermissionsDialog::saveSettings);
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &HTML5PermissionsDialog::saveSettings);
|
||||||
|
|
||||||
/* Hide unsupported HTML5 permissions */
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
ui->feature->removeItem(7);
|
|
||||||
ui->feature->removeItem(6);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
showFeaturePermissions(currentFeature());
|
showFeaturePermissions(currentFeature());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,12 +113,10 @@ QWebEnginePage::Feature HTML5PermissionsDialog::currentFeature() const
|
|||||||
return QWebEnginePage::MediaAudioVideoCapture;
|
return QWebEnginePage::MediaAudioVideoCapture;
|
||||||
case 5:
|
case 5:
|
||||||
return QWebEnginePage::MouseLock;
|
return QWebEnginePage::MouseLock;
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
case 6:
|
case 6:
|
||||||
return QWebEnginePage::DesktopVideoCapture;
|
return QWebEnginePage::DesktopVideoCapture;
|
||||||
case 7:
|
case 7:
|
||||||
return QWebEnginePage::DesktopAudioVideoCapture;
|
return QWebEnginePage::DesktopAudioVideoCapture;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
return QWebEnginePage::Notifications;
|
return QWebEnginePage::Notifications;
|
||||||
@ -154,13 +146,11 @@ void HTML5PermissionsDialog::loadSettings()
|
|||||||
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList();
|
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList();
|
||||||
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList();
|
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList();
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList();
|
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList();
|
||||||
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList();
|
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList();
|
||||||
|
|
||||||
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList();
|
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList();
|
||||||
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList();
|
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList();
|
||||||
#endif
|
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
@ -188,13 +178,11 @@ void HTML5PermissionsDialog::saveSettings()
|
|||||||
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]);
|
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]);
|
||||||
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]);
|
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]);
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]);
|
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]);
|
||||||
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]);
|
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]);
|
||||||
|
|
||||||
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
|
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
|
||||||
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
|
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
|
||||||
#endif
|
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
@ -97,13 +97,11 @@ void HTML5PermissionsManager::loadSettings()
|
|||||||
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList();
|
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList();
|
||||||
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList();
|
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList();
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList();
|
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList();
|
||||||
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList();
|
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList();
|
||||||
|
|
||||||
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList();
|
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList();
|
||||||
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList();
|
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList();
|
||||||
#endif
|
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
@ -131,13 +129,11 @@ void HTML5PermissionsManager::saveSettings()
|
|||||||
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]);
|
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]);
|
||||||
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]);
|
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]);
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]);
|
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]);
|
||||||
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]);
|
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]);
|
||||||
|
|
||||||
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
|
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]);
|
||||||
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
|
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]);
|
||||||
#endif
|
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,6 @@ HTML5PermissionsNotification::HTML5PermissionsNotification(const QUrl &origin, Q
|
|||||||
ui->textLabel->setText(tr("Allow %1 to hide your pointer?").arg(site));
|
ui->textLabel->setText(tr("Allow %1 to hide your pointer?").arg(site));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
case QWebEnginePage::DesktopVideoCapture:
|
case QWebEnginePage::DesktopVideoCapture:
|
||||||
ui->textLabel->setText(tr("Allow %1 to capture your screen?").arg(site));
|
ui->textLabel->setText(tr("Allow %1 to capture your screen?").arg(site));
|
||||||
break;
|
break;
|
||||||
@ -73,7 +72,6 @@ HTML5PermissionsNotification::HTML5PermissionsNotification(const QUrl &origin, Q
|
|||||||
case QWebEnginePage::DesktopAudioVideoCapture:
|
case QWebEnginePage::DesktopAudioVideoCapture:
|
||||||
ui->textLabel->setText(tr("Allow %1 to capture your screen and audio?").arg(site));
|
ui->textLabel->setText(tr("Allow %1 to capture your screen and audio?").arg(site));
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
qWarning() << "Unknown feature" << feature;
|
qWarning() << "Unknown feature" << feature;
|
||||||
break;
|
break;
|
||||||
|
@ -115,11 +115,7 @@ QSize ListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QMode
|
|||||||
p->setFixedHeight(m_itemHeight + 2 * frameWidth);
|
p->setFixedHeight(m_itemHeight + 2 * frameWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
int width = 2 * m_padding + option.fontMetrics.horizontalAdvance(index.data(Qt::DisplayRole).toString());
|
int width = 2 * m_padding + option.fontMetrics.horizontalAdvance(index.data(Qt::DisplayRole).toString());
|
||||||
#else
|
|
||||||
int width = 2 * m_padding + option.fontMetrics.width(index.data(Qt::DisplayRole).toString());
|
|
||||||
#endif
|
|
||||||
width = width > (m_iconSize + 2 * m_padding) ? width : m_iconSize + 2 * m_padding;
|
width = width > (m_iconSize + 2 * m_padding) ? width : m_iconSize + 2 * m_padding;
|
||||||
|
|
||||||
if (m_uniformItemSizes) {
|
if (m_uniformItemSizes) {
|
||||||
|
@ -397,11 +397,7 @@ QPixmap QzTools::createPixmapForSite(const QIcon &icon, const QString &title, co
|
|||||||
{
|
{
|
||||||
const QFontMetrics fontMetrics = QApplication::fontMetrics();
|
const QFontMetrics fontMetrics = QApplication::fontMetrics();
|
||||||
const int padding = 4;
|
const int padding = 4;
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
const int maxWidth = fontMetrics.horizontalAdvance(title.length() > url.length() ? title : url) + 3 * padding + 16;
|
const int maxWidth = fontMetrics.horizontalAdvance(title.length() > url.length() ? title : url) + 3 * padding + 16;
|
||||||
#else
|
|
||||||
const int maxWidth = fontMetrics.width(title.length() > url.length() ? title : url) + 3 * padding + 16;
|
|
||||||
#endif
|
|
||||||
const int width = qMin(maxWidth, 150);
|
const int width = qMin(maxWidth, 150);
|
||||||
const int height = fontMetrics.height() * 2 + fontMetrics.leading() + 2 * padding;
|
const int height = fontMetrics.height() * 2 + fontMetrics.leading() + 2 * padding;
|
||||||
|
|
||||||
|
@ -147,11 +147,6 @@ QString Scripts::setupWindowObject()
|
|||||||
" return false;"
|
" return false;"
|
||||||
"};"
|
"};"
|
||||||
"window.external = external;");
|
"window.external = external;");
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
source += QL1S("window.print = function() {"
|
|
||||||
" window.location = 'falkon:PrintPage';"
|
|
||||||
"};");
|
|
||||||
#endif
|
|
||||||
source += QL1S("})()");
|
source += QL1S("})()");
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
|
@ -68,27 +68,8 @@ void WebInspector::setView(WebView *view)
|
|||||||
m_view = view;
|
m_view = view;
|
||||||
Q_ASSERT(isEnabled());
|
Q_ASSERT(isEnabled());
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
page()->setInspectedPage(m_view->page());
|
page()->setInspectedPage(m_view->page());
|
||||||
connect(m_view, &WebView::pageChanged, this, &WebInspector::deleteLater);
|
connect(m_view, &WebView::pageChanged, this, &WebInspector::deleteLater);
|
||||||
#else
|
|
||||||
int port = qEnvironmentVariableIntValue("QTWEBENGINE_REMOTE_DEBUGGING");
|
|
||||||
QUrl inspectorUrl = QUrl(QSL("http://localhost:%1").arg(port));
|
|
||||||
int index = s_views.indexOf(m_view);
|
|
||||||
|
|
||||||
QNetworkReply *reply = mApp->networkManager()->get(QNetworkRequest(inspectorUrl.resolved(QUrl("json/list"))));
|
|
||||||
connect(reply, &QNetworkReply::finished, this, [=]() {
|
|
||||||
QJsonArray clients = QJsonDocument::fromJson(reply->readAll()).array();
|
|
||||||
QUrl pageUrl;
|
|
||||||
if (clients.size() > index) {
|
|
||||||
QJsonObject object = clients.at(index).toObject();
|
|
||||||
pageUrl = inspectorUrl.resolved(QUrl(object.value(QSL("devtoolsFrontendUrl")).toString()));
|
|
||||||
}
|
|
||||||
load(pageUrl);
|
|
||||||
pushView(this);
|
|
||||||
show();
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebInspector::inspectElement()
|
void WebInspector::inspectElement()
|
||||||
@ -98,11 +79,6 @@ void WebInspector::inspectElement()
|
|||||||
|
|
||||||
bool WebInspector::isEnabled()
|
bool WebInspector::isEnabled()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
if (!qEnvironmentVariableIsSet("QTWEBENGINE_REMOTE_DEBUGGING")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!mApp->webSettings()->testAttribute(QWebEngineSettings::JavascriptEnabled)) {
|
if (!mApp->webSettings()->testAttribute(QWebEngineSettings::JavascriptEnabled)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,7 @@
|
|||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QtWebEngineWidgetsVersion>
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
#include <QWebEngineRegisterProtocolHandlerRequest>
|
#include <QWebEngineRegisterProtocolHandlerRequest>
|
||||||
#endif
|
|
||||||
|
|
||||||
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
QString WebPage::s_lastUploadLocation = QDir::homePath();
|
||||||
QUrl WebPage::s_lastUnsupportedUrl;
|
QUrl WebPage::s_lastUnsupportedUrl;
|
||||||
@ -116,27 +114,20 @@ WebPage::WebPage(QObject* parent)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
connect(this, &QWebEnginePage::registerProtocolHandlerRequested, this, [this](QWebEngineRegisterProtocolHandlerRequest request) {
|
connect(this, &QWebEnginePage::registerProtocolHandlerRequested, this, [this](QWebEngineRegisterProtocolHandlerRequest request) {
|
||||||
delete m_registerProtocolHandlerRequest;
|
delete m_registerProtocolHandlerRequest;
|
||||||
m_registerProtocolHandlerRequest = new QWebEngineRegisterProtocolHandlerRequest(request);
|
m_registerProtocolHandlerRequest = new QWebEngineRegisterProtocolHandlerRequest(request);
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
connect(this, &QWebEnginePage::printRequested, this, &WebPage::printRequested);
|
connect(this, &QWebEnginePage::printRequested, this, &WebPage::printRequested);
|
||||||
connect(this, &QWebEnginePage::selectClientCertificate, this, [this](QWebEngineClientCertificateSelection selection) {
|
connect(this, &QWebEnginePage::selectClientCertificate, this, [this](QWebEngineClientCertificateSelection selection) {
|
||||||
// TODO: It should prompt user
|
// TODO: It should prompt user
|
||||||
selection.select(selection.certificates().at(0));
|
selection.select(selection.certificates().at(0));
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPage::~WebPage()
|
WebPage::~WebPage()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
delete m_registerProtocolHandlerRequest;
|
delete m_registerProtocolHandlerRequest;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_runningLoop) {
|
if (m_runningLoop) {
|
||||||
m_runningLoop->exit(1);
|
m_runningLoop->exit(1);
|
||||||
@ -513,21 +504,17 @@ QStringList WebPage::autoFillUsernames() const
|
|||||||
|
|
||||||
QUrl WebPage::registerProtocolHandlerRequestUrl() const
|
QUrl WebPage::registerProtocolHandlerRequestUrl() const
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
if (m_registerProtocolHandlerRequest && url().host() == m_registerProtocolHandlerRequest->origin().host()) {
|
if (m_registerProtocolHandlerRequest && url().host() == m_registerProtocolHandlerRequest->origin().host()) {
|
||||||
return m_registerProtocolHandlerRequest->origin();
|
return m_registerProtocolHandlerRequest->origin();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return QUrl();
|
return QUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WebPage::registerProtocolHandlerRequestScheme() const
|
QString WebPage::registerProtocolHandlerRequestScheme() const
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
if (m_registerProtocolHandlerRequest && url().host() == m_registerProtocolHandlerRequest->origin().host()) {
|
if (m_registerProtocolHandlerRequest && url().host() == m_registerProtocolHandlerRequest->origin().host()) {
|
||||||
return m_registerProtocolHandlerRequest->scheme();
|
return m_registerProtocolHandlerRequest->scheme();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +496,6 @@ void WebView::copyLinkToClipboard()
|
|||||||
|
|
||||||
void WebView::savePageAs()
|
void WebView::savePageAs()
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) {
|
page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) {
|
||||||
const QSet<QString> webPageTypes = {
|
const QSet<QString> webPageTypes = {
|
||||||
QSL("text/html"),
|
QSL("text/html"),
|
||||||
@ -508,9 +507,6 @@ void WebView::savePageAs()
|
|||||||
page()->download(url());
|
page()->download(url());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
#else
|
|
||||||
triggerPageAction(QWebEnginePage::SavePage);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::copyImageToClipboard()
|
void WebView::copyImageToClipboard()
|
||||||
@ -1252,14 +1248,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
bool WebView::focusNextPrevChild(bool next)
|
bool WebView::focusNextPrevChild(bool next)
|
||||||
{
|
{
|
||||||
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
// QTBUG-67043
|
|
||||||
// Workaround QtWebEngine issue where QWebEngineView loses focus on second load() call.
|
|
||||||
if (next) {
|
|
||||||
setFocus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return QWebEngineView::focusNextPrevChild(next);
|
return QWebEngineView::focusNextPrevChild(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1277,16 +1265,10 @@ bool WebView::eventFilter(QObject *obj, QEvent *event)
|
|||||||
|
|
||||||
// Hack to find widget that receives input events
|
// Hack to find widget that receives input events
|
||||||
if (obj == this && event->type() == QEvent::ChildAdded) {
|
if (obj == this && event->type() == QEvent::ChildAdded) {
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
QPointer<QWidget> child = qobject_cast<QWidget*>(static_cast<QChildEvent*>(event)->child());
|
QPointer<QWidget> child = qobject_cast<QWidget*>(static_cast<QChildEvent*>(event)->child());
|
||||||
QTimer::singleShot(0, this, [=]() {
|
QTimer::singleShot(0, this, [=]() {
|
||||||
if (child && child->inherits("QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget")) {
|
if (child && child->inherits("QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget")) {
|
||||||
m_rwhvqt = child;
|
m_rwhvqt = child;
|
||||||
#else
|
|
||||||
QTimer::singleShot(0, this, [this]() {
|
|
||||||
if (focusProxy() && m_rwhvqt != focusProxy()) {
|
|
||||||
m_rwhvqt = focusProxy();
|
|
||||||
#endif
|
|
||||||
m_rwhvqt->installEventFilter(this);
|
m_rwhvqt->installEventFilter(this);
|
||||||
if (QQuickWidget *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) {
|
if (QQuickWidget *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) {
|
||||||
w->setClearColor(palette().color(QPalette::Window));
|
w->setClearColor(palette().color(QPalette::Window));
|
||||||
|
@ -39,9 +39,7 @@ SearchToolBar::SearchToolBar(WebView* view, QWidget* parent)
|
|||||||
ui->previous->setShortcut(QKeySequence("Ctrl+Shift+G"));
|
ui->previous->setShortcut(QKeySequence("Ctrl+Shift+G"));
|
||||||
|
|
||||||
ui->resultsInfo->hide();
|
ui->resultsInfo->hide();
|
||||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
connect(view->page(), &QWebEnginePage::findTextFinished, this, &SearchToolBar::showSearchResults);
|
connect(view->page(), &QWebEnginePage::findTextFinished, this, &SearchToolBar::showSearchResults);
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
connect(ui->lineEdit, &QLineEdit::textEdited, this, &SearchToolBar::findNext);
|
connect(ui->lineEdit, &QLineEdit::textEdited, this, &SearchToolBar::findNext);
|
||||||
@ -142,7 +140,6 @@ void SearchToolBar::searchText(const QString &text)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
void SearchToolBar::showSearchResults(const QWebEngineFindTextResult &result)
|
void SearchToolBar::showSearchResults(const QWebEngineFindTextResult &result)
|
||||||
{
|
{
|
||||||
if (result.numberOfMatches() == 0) {
|
if (result.numberOfMatches() == 0) {
|
||||||
@ -154,7 +151,6 @@ void SearchToolBar::showSearchResults(const QWebEngineFindTextResult &result)
|
|||||||
QString::number(result.activeMatch()), QString::number(result.numberOfMatches())));
|
QString::number(result.activeMatch()), QString::number(result.numberOfMatches())));
|
||||||
ui->resultsInfo->show();
|
ui->resultsInfo->show();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool SearchToolBar::eventFilter(QObject* obj, QEvent* event)
|
bool SearchToolBar::eventFilter(QObject* obj, QEvent* event)
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
#include <QWebEnginePage>
|
#include <QWebEnginePage>
|
||||||
#include <QtWebEngineCoreVersion>
|
#include <QtWebEngineCoreVersion>
|
||||||
|
|
||||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
#include <QWebEngineFindTextResult>
|
#include <QWebEngineFindTextResult>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
@ -58,9 +56,7 @@ public Q_SLOTS:
|
|||||||
void findNext();
|
void findNext();
|
||||||
void findPrevious();
|
void findPrevious();
|
||||||
|
|
||||||
#if QTWEBENGINECORE_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
void showSearchResults(const QWebEngineFindTextResult &result);
|
void showSearchResults(const QWebEngineFindTextResult &result);
|
||||||
#endif
|
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
@ -71,11 +71,7 @@ bool GM_Plugin::acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEngi
|
|||||||
Q_UNUSED(page)
|
Q_UNUSED(page)
|
||||||
Q_UNUSED(isMainFrame)
|
Q_UNUSED(isMainFrame)
|
||||||
|
|
||||||
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
bool navigationType = type == QWebEnginePage::NavigationTypeLinkClicked || type == QWebEnginePage::NavigationTypeRedirect;
|
bool navigationType = type == QWebEnginePage::NavigationTypeLinkClicked || type == QWebEnginePage::NavigationTypeRedirect;
|
||||||
#else
|
|
||||||
bool navigationType = type == QWebEnginePage::NavigationTypeLinkClicked;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (navigationType && url.toString().endsWith(QLatin1String(".user.js"))) {
|
if (navigationType && url.toString().endsWith(QLatin1String(".user.js"))) {
|
||||||
m_manager->downloadScript(url);
|
m_manager->downloadScript(url);
|
||||||
|
@ -111,11 +111,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte
|
|||||||
const QString name = index.data(Qt::DisplayRole).toString();
|
const QString name = index.data(Qt::DisplayRole).toString();
|
||||||
const int leftTitleEdge = leftPosition + 2;
|
const int leftTitleEdge = leftPosition + 2;
|
||||||
const int rightTitleEdge = rightPosition - m_padding;
|
const int rightTitleEdge = rightPosition - m_padding;
|
||||||
#if QTGUI_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
|
||||||
const int leftPosForVersion = titleMetrics.horizontalAdvance(name) + m_padding;
|
const int leftPosForVersion = titleMetrics.horizontalAdvance(name) + m_padding;
|
||||||
#else
|
|
||||||
const int leftPosForVersion = titleMetrics.width(name) + m_padding;
|
|
||||||
#endif
|
|
||||||
QRect nameRect(leftTitleEdge, opt.rect.top() + m_padding, rightTitleEdge - leftTitleEdge, titleMetrics.height());
|
QRect nameRect(leftTitleEdge, opt.rect.top() + m_padding, rightTitleEdge - leftTitleEdge, titleMetrics.height());
|
||||||
painter->setFont(titleFont);
|
painter->setFont(titleFont);
|
||||||
style->drawItemText(painter, nameRect, Qt::AlignLeft, textPalette, true, name, colorRole);
|
style->drawItemText(painter, nameRect, Qt::AlignLeft, textPalette, true, name, colorRole);
|
||||||
|
Loading…
Reference in New Issue
Block a user