mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 09:50:12 +00:00
Adjust to changes in KToolBarPopupAction
`menu()` will be null, instead use the provided `popupMenu()`. Use `KToolBarPopupAction`'s mode enum instead of `QToolBar`'s
This commit is contained in:
parent
be81255383
commit
23b7d64d9c
|
@ -818,10 +818,11 @@ void DolphinMainWindow::slotAboutToShowBackPopupMenu()
|
||||||
{
|
{
|
||||||
const KUrlNavigator *urlNavigator = m_activeViewContainer->urlNavigatorInternalWithHistory();
|
const KUrlNavigator *urlNavigator = m_activeViewContainer->urlNavigatorInternalWithHistory();
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
m_backAction->menu()->clear();
|
QMenu *menu = m_backAction->popupMenu();
|
||||||
|
menu->clear();
|
||||||
for (int i = urlNavigator->historyIndex() + 1; i < urlNavigator->historySize() && entries < MaxNumberOfNavigationentries; ++i, ++entries) {
|
for (int i = urlNavigator->historyIndex() + 1; i < urlNavigator->historySize() && entries < MaxNumberOfNavigationentries; ++i, ++entries) {
|
||||||
QAction *action = urlNavigatorHistoryAction(urlNavigator, i, m_backAction->menu());
|
QAction *action = urlNavigatorHistoryAction(urlNavigator, i, menu);
|
||||||
m_backAction->menu()->addAction(action);
|
menu->addAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,10 +847,10 @@ void DolphinMainWindow::slotAboutToShowForwardPopupMenu()
|
||||||
{
|
{
|
||||||
const KUrlNavigator *urlNavigator = m_activeViewContainer->urlNavigatorInternalWithHistory();
|
const KUrlNavigator *urlNavigator = m_activeViewContainer->urlNavigatorInternalWithHistory();
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
m_forwardAction->menu()->clear();
|
QMenu *menu = m_forwardAction->popupMenu();
|
||||||
for (int i = urlNavigator->historyIndex() - 1; i >= 0 && entries < MaxNumberOfNavigationentries; --i, ++entries) {
|
for (int i = urlNavigator->historyIndex() - 1; i >= 0 && entries < MaxNumberOfNavigationentries; --i, ++entries) {
|
||||||
QAction *action = urlNavigatorHistoryAction(urlNavigator, i, m_forwardAction->menu());
|
QAction *action = urlNavigatorHistoryAction(urlNavigator, i, menu);
|
||||||
m_forwardAction->menu()->addAction(action);
|
menu->addAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1712,7 +1713,7 @@ void DolphinMainWindow::setupActions()
|
||||||
toggleSelectionModeToolBarAction->setWhatsThis(toggleSelectionModeAction->whatsThis());
|
toggleSelectionModeToolBarAction->setWhatsThis(toggleSelectionModeAction->whatsThis());
|
||||||
actionCollection()->addAction(QStringLiteral("toggle_selection_mode_tool_bar"), toggleSelectionModeToolBarAction);
|
actionCollection()->addAction(QStringLiteral("toggle_selection_mode_tool_bar"), toggleSelectionModeToolBarAction);
|
||||||
toggleSelectionModeToolBarAction->setCheckable(true);
|
toggleSelectionModeToolBarAction->setCheckable(true);
|
||||||
toggleSelectionModeToolBarAction->setPopupMode(QToolButton::DelayedPopup);
|
toggleSelectionModeToolBarAction->setPopupMode(KToolBarPopupAction::DelayedPopup);
|
||||||
connect(toggleSelectionModeToolBarAction, &QAction::triggered, toggleSelectionModeAction, &QAction::trigger);
|
connect(toggleSelectionModeToolBarAction, &QAction::triggered, toggleSelectionModeAction, &QAction::trigger);
|
||||||
connect(toggleSelectionModeAction, &QAction::toggled, toggleSelectionModeToolBarAction, &QAction::setChecked);
|
connect(toggleSelectionModeAction, &QAction::toggled, toggleSelectionModeToolBarAction, &QAction::setChecked);
|
||||||
|
|
||||||
|
@ -1801,10 +1802,10 @@ void DolphinMainWindow::setupActions()
|
||||||
m_backAction->setObjectName(backAction->objectName());
|
m_backAction->setObjectName(backAction->objectName());
|
||||||
m_backAction->setShortcuts(backAction->shortcuts());
|
m_backAction->setShortcuts(backAction->shortcuts());
|
||||||
}
|
}
|
||||||
m_backAction->setPopupMode(QToolButton::DelayedPopup);
|
m_backAction->setPopupMode(KToolBarPopupAction::DelayedPopup);
|
||||||
connect(m_backAction, &QAction::triggered, this, &DolphinMainWindow::goBack);
|
connect(m_backAction, &QAction::triggered, this, &DolphinMainWindow::goBack);
|
||||||
connect(m_backAction->menu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu);
|
connect(m_backAction->popupMenu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu);
|
||||||
connect(m_backAction->menu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoBack);
|
connect(m_backAction->popupMenu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoBack);
|
||||||
actionCollection()->addAction(m_backAction->objectName(), m_backAction);
|
actionCollection()->addAction(m_backAction->objectName(), m_backAction);
|
||||||
|
|
||||||
auto backShortcuts = m_backAction->shortcuts();
|
auto backShortcuts = m_backAction->shortcuts();
|
||||||
|
@ -1842,18 +1843,18 @@ void DolphinMainWindow::setupActions()
|
||||||
m_forwardAction->setObjectName(forwardAction->objectName());
|
m_forwardAction->setObjectName(forwardAction->objectName());
|
||||||
m_forwardAction->setShortcuts(forwardAction->shortcuts());
|
m_forwardAction->setShortcuts(forwardAction->shortcuts());
|
||||||
}
|
}
|
||||||
m_forwardAction->setPopupMode(QToolButton::DelayedPopup);
|
m_forwardAction->setPopupMode(KToolBarPopupAction::DelayedPopup);
|
||||||
connect(m_forwardAction, &QAction::triggered, this, &DolphinMainWindow::goForward);
|
connect(m_forwardAction, &QAction::triggered, this, &DolphinMainWindow::goForward);
|
||||||
connect(m_forwardAction->menu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu);
|
connect(m_forwardAction->popupMenu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu);
|
||||||
connect(m_forwardAction->menu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoForward);
|
connect(m_forwardAction->popupMenu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoForward);
|
||||||
actionCollection()->addAction(m_forwardAction->objectName(), m_forwardAction);
|
actionCollection()->addAction(m_forwardAction->objectName(), m_forwardAction);
|
||||||
actionCollection()->setDefaultShortcuts(m_forwardAction, m_forwardAction->shortcuts());
|
actionCollection()->setDefaultShortcuts(m_forwardAction, m_forwardAction->shortcuts());
|
||||||
|
|
||||||
// enable middle-click to open in a new tab
|
// enable middle-click to open in a new tab
|
||||||
auto *middleClickEventFilter = new MiddleClickActionEventFilter(this);
|
auto *middleClickEventFilter = new MiddleClickActionEventFilter(this);
|
||||||
connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotBackForwardActionMiddleClicked);
|
connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotBackForwardActionMiddleClicked);
|
||||||
m_backAction->menu()->installEventFilter(middleClickEventFilter);
|
m_backAction->popupMenu()->installEventFilter(middleClickEventFilter);
|
||||||
m_forwardAction->menu()->installEventFilter(middleClickEventFilter);
|
m_forwardAction->popupMenu()->installEventFilter(middleClickEventFilter);
|
||||||
KStandardAction::up(this, &DolphinMainWindow::goUp, actionCollection());
|
KStandardAction::up(this, &DolphinMainWindow::goUp, actionCollection());
|
||||||
QAction *homeAction = KStandardAction::home(this, &DolphinMainWindow::goHome, actionCollection());
|
QAction *homeAction = KStandardAction::home(this, &DolphinMainWindow::goHome, actionCollection());
|
||||||
homeAction->setWhatsThis(xi18nc("@info:whatsthis",
|
homeAction->setWhatsThis(xi18nc("@info:whatsthis",
|
||||||
|
|
Loading…
Reference in a new issue