1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Don't steal Ctrl+U/B/I shortcuts from page.

When writing eg. mail on gmail, you can make text bold,
underline and italic with Ctrl+U/B/I shortcuts.
It will now correctly process the web action instead
of showing bookmarks sidebar, source of page and page info.

Shortcut for bookmarks sidebar has been change to Ctrl+Shift+B
This commit is contained in:
nowrep 2013-01-26 21:58:09 +01:00
parent 84dc48ef67
commit 32f69c89be
4 changed files with 49 additions and 4 deletions

View File

@ -434,9 +434,12 @@ void QupZilla::setupMenu()
m_menuView->addAction(m_actionCaretBrowsing);
m_menuView->addAction(actionEncoding);
m_menuView->addSeparator();
m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), this, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
m_actionPageSource = m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), this, SLOT(showSource()));
m_actionPageSource->setShortcut(QKeySequence("Ctrl+U"));
m_actionPageSource->setEnabled(false);
m_menuView->addAction(m_actionShowFullScreen);
connect(m_menuView, SIGNAL(aboutToShow()), this, SLOT(aboutToShowViewMenu()));
connect(m_menuView, SIGNAL(aboutToHide()), this, SLOT(aboutToHideViewMenu()));
/****************
* History Menu *
@ -480,7 +483,9 @@ void QupZilla::setupMenu()
**************/
m_menuTools = new QMenu(tr("&Tools"));
m_menuTools->addAction(tr("&Web Search"), this, SLOT(webSearch()))->setShortcut(QKeySequence("Ctrl+K"));
m_menuTools->addAction(QIcon::fromTheme("dialog-information"), tr("Page &Info"), this, SLOT(showPageInfo()))->setShortcut(QKeySequence("Ctrl+I"));
m_actionPageInfo = m_menuTools->addAction(QIcon::fromTheme("dialog-information"), tr("Page &Info"), this, SLOT(showPageInfo()));
m_actionPageInfo->setShortcut(QKeySequence("Ctrl+I"));
m_actionPageInfo->setEnabled(false);
m_menuTools->addSeparator();
m_menuTools->addAction(tr("&Download Manager"), this, SLOT(showDownloadManager()))->setShortcut(QKeySequence("Ctrl+Y"));
m_menuTools->addAction(tr("&Cookies Manager"), this, SLOT(showCookieManager()));
@ -497,6 +502,8 @@ void QupZilla::setupMenu()
#if !defined(QZ_WS_X11) && !defined(Q_OS_MAC)
m_menuTools->addAction(m_actionPreferences);
#endif
connect(m_menuTools, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolsMenu()));
connect(m_menuTools, SIGNAL(aboutToHide()), this, SLOT(aboutToHideToolsMenu()));
/*************
* Help Menu *
@ -985,11 +992,18 @@ void QupZilla::aboutToShowViewMenu()
m_actionShowStatusbar->setChecked(statusBar()->isVisible());
m_actionShowBookmarksToolbar->setChecked(m_bookmarksToolbar->isVisible());
m_actionPageSource->setEnabled(true);
#if QTWEBKIT_FROM_2_3
m_actionCaretBrowsing->setChecked(mApp->webSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled));
#endif
}
void QupZilla::aboutToHideViewMenu()
{
m_actionPageSource->setEnabled(false);
}
void QupZilla::aboutToShowEditMenu()
{
WebView* view = weView();
@ -1014,6 +1028,16 @@ void QupZilla::aboutToHideEditMenu()
m_actionPreferences->setEnabled(true);
}
void QupZilla::aboutToShowToolsMenu()
{
m_actionPageInfo->setEnabled(true);
}
void QupZilla::aboutToHideToolsMenu()
{
m_actionPageInfo->setEnabled(false);
}
void QupZilla::aboutToShowEncodingMenu()
{
m_menuEncoding->clear();
@ -1742,6 +1766,20 @@ void QupZilla::keyPressEvent(QKeyEvent* event)
}
break;
case Qt::Key_I:
if (event->modifiers() == Qt::ControlModifier) {
showPageInfo();
event->accept();
}
break;
case Qt::Key_U:
if (event->modifiers() == Qt::ControlModifier) {
showSource();
event->accept();
}
break;
case Qt::Key_1:
number = 1;
break;

View File

@ -145,8 +145,11 @@ private slots:
void aboutToShowClosedTabsMenu();
void aboutToShowBookmarksMenu();
void aboutToShowViewMenu();
void aboutToHideViewMenu();
void aboutToShowEditMenu();
void aboutToHideEditMenu();
void aboutToShowToolsMenu();
void aboutToHideToolsMenu();
void aboutToShowEncodingMenu();
void searchOnPage();
@ -270,6 +273,8 @@ private:
QAction* m_actionReload;
QAction* m_actionCaretBrowsing;
QAction* m_actionRestoreTab;
QAction* m_actionPageInfo;
QAction* m_actionPageSource;
QLabel* m_privateBrowsing;
AdBlockIcon* m_adblockIcon;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 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
@ -126,7 +126,7 @@ void SideBarManager::refreshMenu()
m_menu->clear();
QAction* act = m_menu->addAction(SideBar::tr("Bookmarks"), this, SLOT(slotShowSideBar()));
act->setCheckable(true);
act->setShortcut(QKeySequence("Ctrl+B"));
act->setShortcut(QKeySequence("Ctrl+Shift+B"));
act->setData("Bookmarks");
act = m_menu->addAction(SideBar::tr("History"), this, SLOT(slotShowSideBar()));

View File

@ -66,7 +66,9 @@ WebView::WebView(QWidget* parent)
// Zoom levels same as in firefox
m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
#if QTWEBKIT_TO_2_3
installEventFilter(this);
#endif
}
QIcon WebView::icon() const