1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Hide "Inspect Element" when web inspector is not enabled

Closes #1905
This commit is contained in:
David Rosca 2016-04-05 09:19:57 +02:00
parent effda91f7c
commit 055210ca0a
3 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2014-2016 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,6 +32,7 @@
#include "clearprivatedata.h"
#include "qzsettings.h"
#include "pluginproxy.h"
#include "webinspector.h"
#include <QApplication>
#include <QMetaObject>
@ -587,6 +588,9 @@ void MainMenu::init()
ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(toggleWebInspector()), "Ctrl+Shift+I");
ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del");
if (!WebInspector::isEnabled())
m_actions.value(QSL("Tools/WebInspector"))->setVisible(false);
m_submenuExtensions = new QMenu(tr("&Extensions"));
m_submenuExtensions->menuAction()->setVisible(false);
m_menuTools->addMenu(m_submenuExtensions);

View File

@ -96,8 +96,10 @@ void PopupWebView::_contextMenuEvent(QContextMenuEvent *event)
createContextMenu(m_menu, hitTest);
m_menu->addSeparator();
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
if (WebInspector::isEnabled()) {
m_menu->addSeparator();
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
}
if (!m_menu->isEmpty()) {
// Prevent choosing first option with double rightclick

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2015 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,6 +31,7 @@
#include "adblockicon.h"
#include "locationbar.h"
#include "webhittestresult.h"
#include "webinspector.h"
#include <QHostInfo>
#include <QContextMenuEvent>
@ -206,8 +207,10 @@ void TabbedWebView::_contextMenuEvent(QContextMenuEvent *event)
m_menu->addAction(m_window->adBlockIcon()->menuAction());
}
m_menu->addSeparator();
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
if (WebInspector::isEnabled()) {
m_menu->addSeparator();
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
}
if (!m_menu->isEmpty()) {
// Prevent choosing first option with double rightclick