summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webtab/webtab.cpp9
-rw-r--r--src/webtab/webtab.h2
-rw-r--r--src/webtab/webview.cpp18
-rw-r--r--src/webtab/webview.h1
-rw-r--r--src/webwindow/webwindow.cpp6
-rw-r--r--src/webwindow/webwindow.h2
6 files changed, 20 insertions, 18 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 510177e6..5349d599 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -63,6 +63,8 @@
#include <QPrintDialog>
#include <QPrinter>
+#include <QWebSettings>
+
WebTab::WebTab(QWidget *parent)
: QWidget(parent)
@@ -420,3 +422,10 @@ void WebTab::webAppIconChanged()
{
setWindowIcon(IconManager::self()->iconForUrl(url()));
}
+
+
+void WebTab::toggleInspector(bool on)
+{
+ page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, on);
+ kDebug() << "TOGGLED: " << on;
+}
diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h
index 361da2c4..0a12c756 100644
--- a/src/webtab/webtab.h
+++ b/src/webtab/webtab.h
@@ -102,6 +102,8 @@ private Q_SLOTS:
void webAppTitleChanged(QString);
void webAppIconChanged();
+ void toggleInspector(bool);
+
Q_SIGNALS:
void loadProgressing();
void titleChanged(const QString &);
diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp
index 0cc09574..ec74be1e 100644
--- a/src/webtab/webview.cpp
+++ b/src/webtab/webview.cpp
@@ -274,9 +274,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
KMenu menu(this);
QAction *a;
- KAction *inspectAction = new KAction(KIcon("layer-visible-on"), i18n("Inspect Element"), this);
- connect(inspectAction, SIGNAL(triggered(bool)), this, SLOT(inspect()));
-
KAction *sendByMailAction = new KAction(this);
sendByMailAction->setIcon(KIcon("mail-send"));
connect(sendByMailAction, SIGNAL(triggered(bool)), this, SLOT(sendByMail()));
@@ -359,7 +356,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (webwin)
{
menu.addAction(webwin->actionByName("page_source"));
- menu.addAction(inspectAction);
+ menu.addAction(webwin->actionByName("web_inspector"));
}
}
@@ -542,7 +539,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(sendByMailAction);
if (webwin)
- menu.addAction(inspectAction);
+ menu.addAction(webwin->actionByName("web_inspector"));
// SPELL CHECK Actions
if (m_contextMenuHitResult.isContentEditable())
@@ -1045,17 +1042,6 @@ void WebView::wheelEvent(QWheelEvent *event)
}
-void WebView::inspect()
-{
- WebTab *tab = qobject_cast<WebTab *>(parent());
- WebWindow *webwin = tab->webWindow();
- QAction *a = webwin->actionByName("web_inspector");
- if (a && !a->isChecked())
- a->trigger();
- pageAction(QWebPage::InspectElement)->trigger();
-}
-
-
void WebView::scrollFrameChanged()
{
// do the scrolling
diff --git a/src/webtab/webview.h b/src/webtab/webview.h
index 2ff877e1..f7c16546 100644
--- a/src/webtab/webview.h
+++ b/src/webtab/webview.h
@@ -108,7 +108,6 @@ private Q_SLOTS:
void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
void slotCopyImageLocation();
- void inspect();
void scrollFrameChanged();
void scrollTick();
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index be2ba5da..35c6aed9 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -323,6 +323,12 @@ void WebWindow::setupActions()
a = new KAction(KIcon("tools-wizard"), i18n("Sync"), this); // FIXME sync icon!!
actionCollection()->addAction(QL1S("sync"), a);
connect(a, SIGNAL(triggered(bool)), SyncManager::self(), SLOT(showSettings()));
+
+ // web inspector
+ a = new KAction(KIcon("layer-visible-on"), i18n("&Inspect"), this);
+ a->setCheckable(true);
+ actionCollection()->addAction(QL1S("web_inspector"), a);
+ connect(a, SIGNAL(triggered(bool)), _tab, SLOT(toggleInspector(bool)));
}
diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h
index c37704d5..ce71e7b9 100644
--- a/src/webwindow/webwindow.h
+++ b/src/webwindow/webwindow.h
@@ -112,7 +112,7 @@ private Q_SLOTS:
void updateHistoryActions();
void openNewWindow();
-
+
/**
* Notifies a message in a popup
*/