1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Enable new features in QtWebKit 2.3.0

Also hiding new features in preferences if building
with older QtWebKit versions.
This commit is contained in:
nowrep 2013-01-09 18:47:36 +01:00
parent 151bba6293
commit 64a180d1fe
5 changed files with 18 additions and 8 deletions

View File

@ -375,7 +375,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
#if QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
m_websettings->setAttribute(QWebSettings::CaretBrowsingEnabled, settings.value("CaretBrowsing", false).toBool());
m_websettings->setAttribute(QWebSettings::ScrollAnimatorEnabled, settings.value("AnimateScrolling", true).toBool());
#endif

View File

@ -401,11 +401,14 @@ void QupZilla::setupMenu()
m_menuEncoding = new QMenu(this);
actionEncoding->setMenu(m_menuEncoding);
connect(m_menuEncoding, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu()));
#if QT_VERSION >= 0x050000
m_actionCaretBrowsing = new QAction(tr("Enable &Caret Browsing"), this);
m_actionCaretBrowsing->setVisible(false);
m_actionCaretBrowsing->setCheckable(true);
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))
m_actionCaretBrowsing->setVisible(true);
#endif
QMenu* toolbarsMenu = new QMenu(tr("Toolbars"));
@ -428,9 +431,7 @@ void QupZilla::setupMenu()
m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), this, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-"));
m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), this, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0"));
m_menuView->addSeparator();
#if QT_VERSION >= 0x050000
m_menuView->addAction(m_actionCaretBrowsing);
#endif
m_menuView->addAction(actionEncoding);
m_menuView->addSeparator();
m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), this, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
@ -1088,9 +1089,9 @@ void QupZilla::changeEncoding()
}
}
#if QT_VERSION >= 0x050000
void QupZilla::triggerCaretBrowsing()
{
#if QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 3, 0))
bool enable = !mApp->webSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled);
Settings settings;
@ -1099,8 +1100,8 @@ void QupZilla::triggerCaretBrowsing()
settings.endGroup();
mApp->webSettings()->setAttribute(QWebSettings::CaretBrowsingEnabled, enable);
}
#endif
}
void QupZilla::bookmarkPage()
{

View File

@ -188,9 +188,7 @@ private slots:
void fullScreen(bool make);
void changeEncoding();
#if QT_VERSION >= 0x050000
void triggerCaretBrowsing();
#endif
void closeWindow();
bool quitApp();

View File

@ -20,7 +20,9 @@
#include "mainapplication.h"
#include "settings.h"
#include <QWebPage> // QTWEBKIT_VERSION_CHECK macro
#include <QFileDialog>
#include <QDebug>
JsOptions::JsOptions(QWidget* parent)
: QDialog(parent)
@ -38,6 +40,10 @@ JsOptions::JsOptions(QWidget* parent)
ui->jscanHideTool->setChecked(settings.value("allowJavaScriptHideToolBar", true).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("allowJavaScriptAccessClipboard", false).toBool());
settings.endGroup();
#if (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 2, 0)) && QT_VERSION < 0x050000
ui->jscanCloseWindow->setHidden(true);
#endif
}
void JsOptions::accept()

View File

@ -460,6 +460,11 @@ 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))
ui->caretBrowsing->setHidden(true);
ui->animateScrolling->setHidden(true);
#endif
}
void Preferences::showStackedPage(QListWidgetItem* item)