diff options
| author | Andrea Diamantini <adjam7@gmail.com> | 2010-01-07 03:44:00 +0100 | 
|---|---|---|
| committer | Andrea Diamantini <adjam7@gmail.com> | 2010-01-07 03:44:00 +0100 | 
| commit | dd86373f521a46a7a8abba6381963ee14daeef2f (patch) | |
| tree | b4079b0c0fbc4a3a3783fcccb48facc22dcbf5a8 | |
| parent | 0.3.27 (diff) | |
| download | rekonq-dd86373f521a46a7a8abba6381963ee14daeef2f.tar.xz | |
A new inspection action in contextual menu
| -rw-r--r-- | src/webview.cpp | 24 | ||||
| -rw-r--r-- | src/webview.h | 1 | 
2 files changed, 16 insertions, 9 deletions
| diff --git a/src/webview.cpp b/src/webview.cpp index 0bd590da..292eb364 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -274,15 +274,13 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)              }              menu.addAction(mainwindow->actionByName("page_source")); - -            QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); -            menu.addAction(addBookmarkAction); - -            if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) -            { -                // Developer Extras actions -                menu.addAction(pageAction(KWebPage::InspectElement)); -            } +             +            a = new KAction( KIcon("layer-visible-on"), i18n("Inspect Element"), this); +            connect(a, SIGNAL(triggered(bool)), this, SLOT(inspect())); +            menu.addAction(a); +             +            a = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); +            menu.addAction(a);          }          if(mainwindow->isFullScreen()) @@ -400,3 +398,11 @@ void WebView::keyPressEvent(QKeyEvent *event)      KWebView::keyPressEvent(event);  } + + +void WebView::inspect() +{ +    QAction *a = Application::instance()->mainWindow()->actionByName("web_inspector"); +    if(a && !a->isChecked()) +        a->trigger(); +} diff --git a/src/webview.h b/src/webview.h index ef520a15..d34d108b 100644 --- a/src/webview.h +++ b/src/webview.h @@ -59,6 +59,7 @@ private slots:      void openLinkInNewWindow();      void openLinkInNewTab();      void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); +    void inspect();  private:      WebPage *const m_page; | 
