mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[Menus] Menus are not closed when opening links with middle mouse button
It is the same behaviour as in Konqueror Closes #1165
This commit is contained in:
parent
0b8b969535
commit
28091f4957
@ -1,5 +1,7 @@
|
||||
Version 1.7.0
|
||||
* development version
|
||||
* completely rewritten bookmarks (including multi-level folders support)
|
||||
* menus are not closed when opening links with middle mouse button
|
||||
* added support for window.onload event
|
||||
* added support for external.AddSearchProvider js function
|
||||
|
||||
|
@ -123,8 +123,10 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
|
||||
setButtonIconSize(m_buttonAddTab);
|
||||
|
||||
m_menuBack = new Menu(this);
|
||||
m_menuBack->setCloseOnMiddleClick(true);
|
||||
m_buttonBack->setMenu(m_menuBack);
|
||||
m_menuForward = new Menu(this);
|
||||
m_menuForward->setCloseOnMiddleClick(true);
|
||||
m_buttonNext->setMenu(m_menuForward);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
|
@ -355,11 +355,6 @@ void MacMenuReceiver::bookmarkPage()
|
||||
callSlot("bookmarkPage");
|
||||
}
|
||||
|
||||
void MacMenuReceiver::loadFolderBookmarks(Menu* menu)
|
||||
{
|
||||
callSlot("loadFolderBookmarks", false, Q_ARG(Menu*, menu));
|
||||
}
|
||||
|
||||
void MacMenuReceiver::closeTab()
|
||||
{
|
||||
callSlot("closeTab");
|
||||
|
@ -137,7 +137,6 @@ private slots:
|
||||
void loadActionUrl(QObject* obj = 0);
|
||||
void loadActionUrlInNewTab(QObject* obj = 0);
|
||||
void loadActionUrlInNewNotSelectedTab(QObject* obj = 0);
|
||||
void loadFolderBookmarks(Menu* menu);
|
||||
|
||||
void closeTab();
|
||||
void restoreClosedTab(QObject* obj = 0);
|
||||
|
@ -32,6 +32,7 @@ PopupWebView::PopupWebView(QWidget* parent)
|
||||
, m_page(0)
|
||||
, m_menu(new Menu(this))
|
||||
{
|
||||
m_menu->setCloseOnMiddleClick(true);
|
||||
}
|
||||
|
||||
void PopupWebView::setWebPage(PopupWebPage* page)
|
||||
|
@ -22,14 +22,26 @@
|
||||
|
||||
Menu::Menu(QWidget* parent)
|
||||
: QMenu(parent)
|
||||
, m_closeOnMiddleClick(false)
|
||||
{
|
||||
}
|
||||
|
||||
Menu::Menu(const QString &title, QWidget* parent)
|
||||
: QMenu(title, parent)
|
||||
, m_closeOnMiddleClick(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool Menu::closeOnMiddleClick() const
|
||||
{
|
||||
return m_closeOnMiddleClick;
|
||||
}
|
||||
|
||||
void Menu::setCloseOnMiddleClick(bool close)
|
||||
{
|
||||
m_closeOnMiddleClick = close;
|
||||
}
|
||||
|
||||
void Menu::mouseReleaseEvent(QMouseEvent* e)
|
||||
{
|
||||
QAction* qact = activeAction();
|
||||
@ -59,7 +71,9 @@ void Menu::mouseReleaseEvent(QMouseEvent* e)
|
||||
e->accept();
|
||||
}
|
||||
else if (e->button() == Qt::MiddleButton || (e->button() == Qt::LeftButton && e->modifiers() == Qt::ControlModifier)) {
|
||||
closeAllMenus();
|
||||
if ((e->button() == Qt::MiddleButton && m_closeOnMiddleClick) || e->button() != Qt::MiddleButton) {
|
||||
closeAllMenus();
|
||||
}
|
||||
act->emitCtrlTriggered();
|
||||
e->accept();
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public:
|
||||
explicit Menu(QWidget* parent = 0);
|
||||
explicit Menu(const QString &title, QWidget* parent = 0);
|
||||
|
||||
// Default is false, menu will NOT be closed on middle click
|
||||
bool closeOnMiddleClick() const;
|
||||
void setCloseOnMiddleClick(bool close);
|
||||
|
||||
signals:
|
||||
void menuMiddleClicked(Menu*);
|
||||
|
||||
@ -42,6 +46,8 @@ private:
|
||||
void keyPressEvent(QKeyEvent* e);
|
||||
|
||||
void closeAllMenus();
|
||||
|
||||
bool m_closeOnMiddleClick;
|
||||
};
|
||||
|
||||
class QT_QUPZILLA_EXPORT Action : public QAction
|
||||
|
@ -44,6 +44,8 @@ TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
|
||||
, m_menu(new Menu(this))
|
||||
, m_mouseTrack(false)
|
||||
{
|
||||
m_menu->setCloseOnMiddleClick(true);
|
||||
|
||||
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
|
||||
connect(this, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
|
||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
|
||||
|
@ -930,6 +930,7 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
|
||||
if (frameAtPos && page()->mainFrame() != frameAtPos) {
|
||||
m_clickedFrame = frameAtPos;
|
||||
Menu* frameMenu = new Menu(tr("This frame"));
|
||||
frameMenu->setCloseOnMiddleClick(true);
|
||||
frameMenu->addAction(tr("Show &only this frame"), this, SLOT(loadClickedFrame()));
|
||||
Action* act = new Action(QIcon::fromTheme("tab-new", QIcon(":/icons/menu/tab-new.png")), tr("Show this frame in new &tab"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(loadClickedFrameInNewTab()));
|
||||
@ -1088,6 +1089,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
|
||||
|
||||
// Search with ...
|
||||
Menu* swMenu = new Menu(tr("Search with..."), menu);
|
||||
swMenu->setCloseOnMiddleClick(true);
|
||||
SearchEnginesManager* searchManager = mApp->searchEnginesManager();
|
||||
foreach (const SearchEngine &en, searchManager->allEngines()) {
|
||||
Action* act = new Action(en.icon, en.name);
|
||||
|
Loading…
Reference in New Issue
Block a user