mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
BrowserWindow: showWebInspector -> toggleWebInspector
Using the Web Inspector action while inspector is already visible will close it.
This commit is contained in:
parent
ecfae5512a
commit
730577c0e4
@ -389,7 +389,7 @@ void BrowserWindow::setupMenu()
|
||||
connect(openLocationAction, SIGNAL(activated()), this, SLOT(openLocation()));
|
||||
|
||||
QShortcut* inspectorAction = new QShortcut(QKeySequence(QSL("F12")), this);
|
||||
connect(inspectorAction, SIGNAL(activated()), this, SLOT(showWebInspector()));
|
||||
connect(inspectorAction, SIGNAL(activated()), this, SLOT(toggleWebInspector()));
|
||||
}
|
||||
|
||||
QAction* BrowserWindow::createEncodingAction(const QString &codecName,
|
||||
@ -807,6 +807,13 @@ void BrowserWindow::showWebInspector()
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::toggleWebInspector()
|
||||
{
|
||||
if (weView() && weView()->webTab()) {
|
||||
weView()->webTab()->toggleWebInspector();
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::refreshHistory()
|
||||
{
|
||||
m_navigationToolbar->refreshHistory();
|
||||
|
@ -121,6 +121,7 @@ public slots:
|
||||
void setWindowTitle(const QString &t);
|
||||
|
||||
void showWebInspector();
|
||||
void toggleWebInspector();
|
||||
void showHistoryManager();
|
||||
|
||||
void toggleShowMenubar();
|
||||
|
@ -326,9 +326,9 @@ void MainMenu::showAdBlockDialog()
|
||||
AdBlockManager::instance()->showDialog();
|
||||
}
|
||||
|
||||
void MainMenu::showWebInspector()
|
||||
void MainMenu::toggleWebInspector()
|
||||
{
|
||||
callSlot("showWebInspector");
|
||||
callSlot("toggleWebInspector");
|
||||
}
|
||||
|
||||
void MainMenu::showClearRecentHistoryDialog()
|
||||
@ -600,7 +600,7 @@ void MainMenu::init()
|
||||
ADD_ACTION("Tools/DownloadManager", m_menuTools, QIcon(), tr("&Download Manager"), SLOT(showDownloadManager()), "Ctrl+Y");
|
||||
ADD_ACTION("Tools/CookiesManager", m_menuTools, QIcon(), tr("&Cookies Manager"), SLOT(showCookieManager()), "");
|
||||
ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), "");
|
||||
ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(showWebInspector()), "Ctrl+Shift+I");
|
||||
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");
|
||||
m_menuTools->addSeparator();
|
||||
|
||||
|
@ -89,7 +89,7 @@ private slots:
|
||||
void showDownloadManager();
|
||||
void showCookieManager();
|
||||
void showAdBlockDialog();
|
||||
void showWebInspector();
|
||||
void toggleWebInspector();
|
||||
void showClearRecentHistoryDialog();
|
||||
|
||||
// Help menu
|
||||
|
@ -69,8 +69,7 @@ void TabbedWebView::setBrowserWindow(BrowserWindow* window)
|
||||
|
||||
void TabbedWebView::inspectElement()
|
||||
{
|
||||
if (m_window)
|
||||
m_window->showWebInspector();
|
||||
m_webTab->showWebInspector();
|
||||
}
|
||||
|
||||
WebTab* TabbedWebView::webTab() const
|
||||
|
@ -151,6 +151,17 @@ void WebTab::showWebInspector()
|
||||
m_splitter->addWidget(inspector);
|
||||
}
|
||||
|
||||
void WebTab::toggleWebInspector()
|
||||
{
|
||||
if (m_splitter->count() == 1) {
|
||||
showWebInspector();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_splitter->count() > 1 && m_splitter->widget(1)->inherits("WebInspector"))
|
||||
delete m_splitter->widget(1);
|
||||
}
|
||||
|
||||
QUrl WebTab::url() const
|
||||
{
|
||||
if (isRestored()) {
|
||||
|
@ -84,7 +84,9 @@ public:
|
||||
int tabIndex() const;
|
||||
|
||||
bool isCurrentTab() const;
|
||||
|
||||
void showWebInspector();
|
||||
void toggleWebInspector();
|
||||
|
||||
bool isRestored() const;
|
||||
void restoreTab(const SavedTab &tab);
|
||||
|
Loading…
Reference in New Issue
Block a user