diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 15a3bfb2d..20762d063 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -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 diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index edc57ce77..8b289db6b 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -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() { diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index 3cc8cbadd..44cb7f6ba 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -188,9 +188,7 @@ private slots: void fullScreen(bool make); void changeEncoding(); -#if QT_VERSION >= 0x050000 void triggerCaretBrowsing(); -#endif void closeWindow(); bool quitApp(); diff --git a/src/lib/preferences/jsoptions.cpp b/src/lib/preferences/jsoptions.cpp index b16bae7c9..4db04b577 100644 --- a/src/lib/preferences/jsoptions.cpp +++ b/src/lib/preferences/jsoptions.cpp @@ -20,7 +20,9 @@ #include "mainapplication.h" #include "settings.h" +#include // QTWEBKIT_VERSION_CHECK macro #include +#include 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() diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index b251d80a2..cccb58641 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -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)