diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-11-28 22:47:42 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:06 +0100 |
commit | 66edb6d66102e2ae7c0fd234f932b515fe101635 (patch) | |
tree | 8959057e403502301683c01b8aac6eb18e675464 /src/webtab | |
parent | Open focused link when launched from web app (diff) | |
download | rekonq-66edb6d66102e2ae7c0fd234f932b515fe101635.tar.xz |
Restoring inspector, part 1
restored action and code to activate/deactivate it
Diffstat (limited to 'src/webtab')
-rw-r--r-- | src/webtab/webtab.cpp | 9 | ||||
-rw-r--r-- | src/webtab/webtab.h | 2 | ||||
-rw-r--r-- | src/webtab/webview.cpp | 18 | ||||
-rw-r--r-- | src/webtab/webview.h | 1 |
4 files changed, 13 insertions, 17 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(); |