mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Added new macros for checking QTWEBKIT version.
QTWEBKIT_FROM_2_2 - >= 2.2.0 QTWEBKIT_TO_2_2 - < 2.2.0 QTWEBKIT_FROM_2_3 - >= 2.3.0 QTWEBKIT_TO_2_3 - < 2.2.0 It also check whether Qt5 is used and if so, it will compile all features just like the QtWebKit version was 2.3.0
This commit is contained in:
parent
489b5bcc2f
commit
14ca6e2f0d
@ -377,7 +377,7 @@ void MainApplication::loadSettings()
|
||||
m_websettings->setMaximumPagesInCache(settings.value("maximumCachedPages", 3).toInt());
|
||||
m_websettings->setDefaultTextEncoding(settings.value("DefaultEncoding", m_websettings->defaultTextEncoding()).toString());
|
||||
|
||||
#if QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_FROM_2_3
|
||||
m_websettings->setAttribute(QWebSettings::CaretBrowsingEnabled, settings.value("CaretBrowsing", false).toBool());
|
||||
m_websettings->setAttribute(QWebSettings::ScrollAnimatorEnabled, settings.value("AnimateScrolling", true).toBool());
|
||||
#endif
|
||||
@ -387,7 +387,7 @@ void MainApplication::loadSettings()
|
||||
m_websettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
|
||||
#endif
|
||||
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
m_websettings->setAttribute(QWebSettings::HyperlinkAuditingEnabled, true);
|
||||
m_websettings->setAttribute(QWebSettings::JavascriptCanCloseWindows, settings.value("allowJavaScriptCloseWindow", false).toBool());
|
||||
#endif
|
||||
|
@ -407,7 +407,7 @@ void QupZilla::setupMenu()
|
||||
m_actionCaretBrowsing->setShortcut(QKeySequence("F7"));
|
||||
connect(m_actionCaretBrowsing, SIGNAL(triggered()), this, SLOT(triggerCaretBrowsing()));
|
||||
|
||||
#if QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_FROM_2_3
|
||||
m_actionCaretBrowsing->setVisible(true);
|
||||
#endif
|
||||
|
||||
@ -1093,7 +1093,7 @@ void QupZilla::changeEncoding()
|
||||
|
||||
void QupZilla::triggerCaretBrowsing()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_FROM_2_3
|
||||
bool enable = !mApp->webSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled);
|
||||
|
||||
Settings settings;
|
||||
|
@ -126,4 +126,16 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags)
|
||||
#define DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG true
|
||||
#endif
|
||||
|
||||
#define QTWEBKIT_FROM_2_2 \
|
||||
(QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0)))
|
||||
|
||||
#define QTWEBKIT_TO_2_2 \
|
||||
(QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 2, 0)))
|
||||
|
||||
#define QTWEBKIT_FROM_2_3 \
|
||||
(QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0)))
|
||||
|
||||
#define QTWEBKIT_TO_2_3 \
|
||||
(QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0)))
|
||||
|
||||
#endif // QZ_NAMESPACE_H
|
||||
|
@ -88,7 +88,7 @@ void BookmarksTree::refreshTree()
|
||||
}
|
||||
addTopLevelItem(newItem);
|
||||
|
||||
QTreeWidgetItem* bookmarksToolbar;
|
||||
QTreeWidgetItem* bookmarksToolbar = 0;
|
||||
if (m_viewType != SideBarView) {
|
||||
bookmarksToolbar = new QTreeWidgetItem(rootItem);
|
||||
bookmarksToolbar->setText(0, _bookmarksToolbar);
|
||||
|
@ -98,7 +98,7 @@ void CookieJar::loadSettings()
|
||||
m_blacklist = settings.value("blacklist", QStringList()).toStringList();
|
||||
settings.endGroup();
|
||||
|
||||
#if QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_FROM_2_3
|
||||
mApp->webSettings()->setThirdPartyCookiePolicy(m_blockThirdParty ?
|
||||
QWebSettings::AlwaysBlockThirdPartyCookies :
|
||||
QWebSettings::AlwaysAllowThirdPartyCookies);
|
||||
@ -137,7 +137,7 @@ bool CookieJar::rejectCookie(const QString &domain, const QNetworkCookie &cookie
|
||||
}
|
||||
|
||||
// This feature is now natively in QtWebKit in Qt 5
|
||||
#if QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_TO_2_3
|
||||
if (m_blockThirdParty) {
|
||||
bool result = blockThirdParty(cookieDomain, domain);
|
||||
if (result) {
|
||||
|
@ -63,7 +63,7 @@ QString UserAgentManager::userAgentForUrl(const QUrl &url) const
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_TO_2_3
|
||||
if (host.contains(QLatin1String("google"))) {
|
||||
return m_fakeUserAgent;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ JsOptions::JsOptions(QWidget* parent)
|
||||
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", false).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
#if (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 2, 0)) && QT_VERSION < 0x050000
|
||||
#if QTWEBKIT_TO_2_2
|
||||
ui->jscanCloseWindow->setHidden(true);
|
||||
#endif
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
ui->version->setText(" QupZilla v" + QupZilla::VERSION);
|
||||
ui->listWidget->setCurrentRow(currentSettingsPage);
|
||||
|
||||
#if QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_TO_2_3
|
||||
ui->caretBrowsing->setHidden(true);
|
||||
ui->animateScrolling->setHidden(true);
|
||||
#endif
|
||||
|
@ -12,7 +12,7 @@ HTML5PermissionsManager::HTML5PermissionsManager(QObject *parent)
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame *frame, const QWebPage::Feature &feature)
|
||||
{
|
||||
if (!frame || !page) {
|
||||
|
@ -15,7 +15,7 @@ class QT_QUPZILLA_EXPORT HTML5PermissionsManager : public QObject
|
||||
public:
|
||||
explicit HTML5PermissionsManager(QObject* parent);
|
||||
|
||||
#ifdef USE_QTWEBKIT_2_2
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
void requestPermissions(WebPage* page, QWebFrame* frame, const QWebPage::Feature &feature);
|
||||
void rememberPermissions(const QString &host, const QWebPage::Feature &feature,
|
||||
const QWebPage::PermissionPolicy &policy);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QWebFrame>
|
||||
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
HTML5PermissionsNotification::HTML5PermissionsNotification(const QString &host, QWebFrame *frame, const QWebPage::Feature &feature)
|
||||
: AnimatedWidget(AnimatedWidget::Down, 300, 0)
|
||||
, ui(new Ui::HTML5PermissionsNotification)
|
||||
@ -75,4 +75,4 @@ HTML5PermissionsNotification::~HTML5PermissionsNotification()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
#endif // (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#endif // QTWEBKIT_FROM_2_2
|
||||
|
@ -94,7 +94,7 @@ WebPage::WebPage(QupZilla* mainClass)
|
||||
|
||||
connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptObject()));
|
||||
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
connect(this, SIGNAL(featurePermissionRequested(QWebFrame*, QWebPage::Feature)), this, SLOT(featurePermissionRequested(QWebFrame*, QWebPage::Feature)));
|
||||
#endif
|
||||
|
||||
@ -392,7 +392,7 @@ void WebPage::windowCloseRequested()
|
||||
webView->closeView();
|
||||
}
|
||||
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
void WebPage::featurePermissionRequested(QWebFrame* frame, const QWebPage::Feature &feature)
|
||||
{
|
||||
mApp->html5permissions()->requestPermissions(this, frame, feature);
|
||||
|
@ -540,7 +540,7 @@ void WebView::bookmarkLink()
|
||||
|
||||
void WebView::showSourceOfSelection()
|
||||
{
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
showSource(page()->mainFrame(), selectedHtml());
|
||||
#endif
|
||||
}
|
||||
@ -778,7 +778,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
|
||||
mApp->plugins()->populateWebViewMenu(menu, this, hitTest);
|
||||
|
||||
|
||||
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
|
||||
#if QTWEBKIT_FROM_2_2
|
||||
// still bugged? in 4.8 RC (it shows selection of webkit's internal source, not html from page)
|
||||
// it may or may not be bug, but this implementation is useless for us
|
||||
//
|
||||
@ -1158,7 +1158,7 @@ void WebView::setZoom(int zoom)
|
||||
bool WebView::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
// This hack is no longer needed with QtWebKit 2.3 (bundled in Qt 5)
|
||||
#if QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0))
|
||||
#if QTWEBKIT_TO_2_3
|
||||
if (obj != this || m_disableTouchMocking) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user