mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 04:36:34 +01:00
WebInspector: Show close button only when docked
This commit is contained in:
parent
74fc271e25
commit
1af76cb2a9
@ -55,7 +55,6 @@ PopupWindow::PopupWindow(PopupWebView* view)
|
||||
m_menuBar = new QMenuBar(this);
|
||||
|
||||
QMenu* menuFile = new QMenu(tr("File"));
|
||||
menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), m_view, SLOT(savePageAs()))->setShortcut(QKeySequence("Ctrl+S"));
|
||||
menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), m_view, SLOT(sendPageByMail()));
|
||||
//menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print..."), m_view, SLOT(printPage()))->setShortcut(QKeySequence("Ctrl+P"));
|
||||
menuFile->addSeparator();
|
||||
|
@ -89,19 +89,21 @@ void WebInspector::unregisterView(QWebEngineView *view)
|
||||
|
||||
void WebInspector::loadFinished()
|
||||
{
|
||||
// Update close button
|
||||
page()->runJavaScript(QL1S("var toolbar = document.getElementsByClassName('inspector-view-toolbar')[1];"
|
||||
"var button = document.createElement('button');"
|
||||
"button.style.width = '22px';"
|
||||
"button.style.height = '22px';"
|
||||
"button.style.border = 'none';"
|
||||
"button.style.cursor = 'pointer';"
|
||||
"button.style.background = 'url(qrc:html/close.png) no-repeat';"
|
||||
"button.style.backgroundPosition = 'center center';"
|
||||
"button.addEventListener('click', function() {"
|
||||
" window.close();"
|
||||
"});"
|
||||
"toolbar.appendChild(button);"));
|
||||
// Show close button only when docked
|
||||
if (!isWindow()) {
|
||||
page()->runJavaScript(QL1S("var toolbar = document.getElementsByClassName('inspector-view-toolbar')[1];"
|
||||
"var button = document.createElement('button');"
|
||||
"button.style.width = '22px';"
|
||||
"button.style.height = '22px';"
|
||||
"button.style.border = 'none';"
|
||||
"button.style.cursor = 'pointer';"
|
||||
"button.style.background = 'url(qrc:html/close.png) no-repeat';"
|
||||
"button.style.backgroundPosition = 'center center';"
|
||||
"button.addEventListener('click', function() {"
|
||||
" window.close();"
|
||||
"});"
|
||||
"toolbar.appendChild(button);"));
|
||||
}
|
||||
|
||||
// Inspect element
|
||||
if (m_inspectElement) {
|
||||
|
Loading…
Reference in New Issue
Block a user