summaryrefslogtreecommitdiff
path: root/src/webtab
diff options
context:
space:
mode:
Diffstat (limited to 'src/webtab')
-rw-r--r--src/webtab/webtab.cpp35
-rw-r--r--src/webtab/webtab.h4
-rw-r--r--src/webtab/webview.cpp15
-rw-r--r--src/webtab/webview.h3
4 files changed, 40 insertions, 17 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 5349d599..1f6789f2 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -62,6 +62,7 @@
#include <QVBoxLayout>
#include <QPrintDialog>
#include <QPrinter>
+#include <QSplitter>
#include <QWebSettings>
@@ -276,7 +277,7 @@ void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u)
m_part = p;
qobject_cast<QVBoxLayout *>(layout())->insertWidget(1, p->widget());
p->openUrl(u);
- m_webView->hide();
+ view()->hide();
emit titleChanged(u.url());
return;
@@ -286,7 +287,7 @@ void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u)
return;
// Part NO more exists. Let's clean up from webtab
- m_webView->show();
+ view()->show();
qobject_cast<QVBoxLayout *>(layout())->removeWidget(m_part->widget());
delete m_part;
m_part = 0;
@@ -311,7 +312,7 @@ void WebTab::loadFinished()
if (page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
return;
- QString pageTitle = (page() && page()->isOnRekonqPage()) ? url().url() : m_webView->title();
+ QString pageTitle = (page() && page()->isOnRekonqPage()) ? url().url() : view()->title();
HistoryManager::self()->addHistoryEntry(url(), pageTitle);
}
@@ -379,7 +380,7 @@ void WebTab::zoomIn()
else
m_zoomFactor++;
- m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+ view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
emit infoToShow(i18n("Zooming: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
}
@@ -394,7 +395,7 @@ void WebTab::zoomOut()
}
m_zoomFactor--;
- m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+ view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
emit infoToShow(i18n("Zooming: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
}
@@ -403,7 +404,7 @@ void WebTab::zoomOut()
void WebTab::zoomDefault()
{
m_zoomFactor = 10;
- m_webView->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
+ view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10);
emit infoToShow(i18n("Default zoom: ") + QString::number(m_zoomFactor * 10) + QL1S("%"));
}
@@ -426,6 +427,26 @@ void WebTab::webAppIconChanged()
void WebTab::toggleInspector(bool on)
{
+ if (on)
+ {
+ page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, on);
+
+ if (m_inspector.isNull())
+ {
+ m_inspector = new QWebInspector(this);
+ m_inspector.data()->setPage(page());
+ }
+
+ qobject_cast<QVBoxLayout *>(layout())->insertWidget(-1, m_inspector.data());
+ m_inspector.data()->show();
+
+ return;
+ }
+ // else
+
+ qobject_cast<QVBoxLayout *>(layout())->removeWidget(m_inspector.data());
+
+ m_inspector.data()->hide();
+
page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, on);
- kDebug() << "TOGGLED: " << on;
}
diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h
index 0a12c756..2b0f70f3 100644
--- a/src/webtab/webtab.h
+++ b/src/webtab/webtab.h
@@ -40,6 +40,7 @@
// Qt Includes
#include <QWidget>
+#include <QWebInspector>
// Forward Declarations
class NotificationBar;
@@ -119,7 +120,8 @@ private:
QWeakPointer<WalletBar> m_walletBar;
QWeakPointer<PreviewSelectorBar> m_previewSelectorBar;
-
+ QWeakPointer<QWebInspector> m_inspector;
+
KParts::ReadOnlyPart *m_part;
int m_zoomFactor;
diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp
index ec74be1e..2a73b050 100644
--- a/src/webtab/webview.cpp
+++ b/src/webtab/webview.cpp
@@ -98,6 +98,7 @@ WebView::WebView(QWidget* parent)
, m_isViewSmoothScrolling(false)
, m_accessKeysPressed(false)
, m_accessKeysActive(false)
+ , m_parentTab(qobject_cast<WebTab *>(parent))
{
// loadUrl signal
connect(this, SIGNAL(loadUrl(KUrl, Rekonq::OpenType)), rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
@@ -162,10 +163,7 @@ void WebView::setPage(WebPage *pg)
{
KWebView::setPage(pg);
- WebTab *tab = qobject_cast<WebTab *>(parent());
- if (!tab)
- return;
- WebWindow *w = tab->webWindow();
+ WebWindow *w = m_parentTab->webWindow();
if (w && w->window())
pg->setWindow(w->window());
}
@@ -268,8 +266,8 @@ bool WebView::popupSpellMenu(QContextMenuEvent *event)
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
m_contextMenuHitResult = page()->mainFrame()->hitTestContent(event->pos());
- WebTab *tab = qobject_cast<WebTab *>(parent());
- WebWindow *webwin = tab->webWindow();
+
+ WebWindow *webwin = m_parentTab->webWindow();
KMenu menu(this);
QAction *a;
@@ -333,7 +331,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow));
a = new KAction(KIcon("document-print-frame"), i18n("Print Frame"), this);
- connect(a, SIGNAL(triggered()), tab, SLOT(printFrame()));
+ connect(a, SIGNAL(triggered()), m_parentTab, SLOT(printFrame()));
frameMenu->addAction(a);
menu.addAction(frameMenu);
@@ -761,8 +759,7 @@ void WebView::openLinkInNewTab()
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
- WebTab *tab = qobject_cast<WebTab *>(parent());
- WebWindow *webwin = tab->webWindow();
+ WebWindow *webwin = m_parentTab->webWindow();
if (webwin)
emit loadUrl(url, Rekonq::NewTab);
diff --git a/src/webtab/webview.h b/src/webtab/webview.h
index f7c16546..4510bec3 100644
--- a/src/webtab/webview.h
+++ b/src/webtab/webview.h
@@ -43,6 +43,7 @@
// Forward Declarations
class WebPage;
+class WebTab;
class QLabel;
class QTimer;
@@ -164,6 +165,8 @@ private:
QHash<QChar, QWebElement> m_accessKeyNodes;
bool m_accessKeysPressed;
bool m_accessKeysActive;
+
+ WebTab *m_parentTab;
};
#endif