summaryrefslogtreecommitdiff
path: root/examples/widgets/browser/tabwidget.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-08-06 19:04:58 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-08-20 18:15:27 +0200
commit63c45a18d37350e5455cf2869832e8b1743712a2 (patch)
tree76f775cd4f87dac796e79eece760d8b2c4ea7b9b /examples/widgets/browser/tabwidget.cpp
parent68f3331b98d4d9996732117549cbdf4ea80cac70 (diff)
downloadqtwebengine-63c45a18d37350e5455cf2869832e8b1743712a2.tar.gz
demo browser: Make it link.
The ifdefs should later be removed along with the feature implementations. Change-Id: If73f4c4c02c00e90d6cf54c6a08bb37f43fa95bc Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'examples/widgets/browser/tabwidget.cpp')
-rw-r--r--examples/widgets/browser/tabwidget.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/widgets/browser/tabwidget.cpp b/examples/widgets/browser/tabwidget.cpp
index 2a21cf33b..47bcc2261 100644
--- a/examples/widgets/browser/tabwidget.cpp
+++ b/examples/widgets/browser/tabwidget.cpp
@@ -473,10 +473,12 @@ WebView *TabWidget::newTab(bool makeCurrent)
setCurrentWidget(webView);
// webview actions
+#if defined(QWEBENGINEPAGE_ACTION)
for (int i = 0; i < m_actions.count(); ++i) {
WebActionMapper *mapper = m_actions[i];
mapper->addChild(webView->page()->action(mapper->webAction()));
}
+#endif
if (count() == 1)
currentChanged(currentIndex());
@@ -547,6 +549,7 @@ void TabWidget::closeTab(int index)
bool hasFocus = false;
if (WebView *tab = webView(index)) {
+#if defined(QWEBENGINEPAGE_ISMODIFIED)
if (tab->isModified()) {
QMessageBox closeConfirmation(tab);
closeConfirmation.setWindowFlags(Qt::Sheet);
@@ -560,10 +563,14 @@ void TabWidget::closeTab(int index)
if (closeConfirmation.exec() == QMessageBox::No)
return;
}
+#endif
hasFocus = tab->hasFocus();
+#if defined(QWEBENGINESETTINGS)
QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings();
- if (!globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled)) {
+ if (!globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled))
+#endif
+ {
m_recentlyClosedTabsAction->setEnabled(true);
m_recentlyClosedTabs.prepend(tab->url());
if (m_recentlyClosedTabs.size() >= TabWidget::m_recentlyClosedTabsSize)
@@ -794,10 +801,12 @@ QWebEnginePage::WebAction WebActionMapper::webAction() const
void WebActionMapper::rootTriggered()
{
+#if defined(QWEBENGINEPAGE_ACTION)
if (m_currentParent) {
QAction *gotoAction = m_currentParent->action(m_webAction);
gotoAction->trigger();
}
+#endif
}
void WebActionMapper::childChanged()
@@ -826,9 +835,11 @@ void WebActionMapper::updateCurrent(QWebEnginePage *currentParent)
m_root->setChecked(false);
return;
}
+#if defined(QWEBENGINEPAGE_ACTION)
QAction *source = m_currentParent->action(m_webAction);
m_root->setChecked(source->isChecked());
m_root->setEnabled(source->isEnabled());
+#endif
connect(m_currentParent, SIGNAL(destroyed(QObject*)),
this, SLOT(currentDestroyed()));
}