Commit fb210d6e authored by David Hurka's avatar David Hurka 🐬
Browse files

Port to new KActionMenu popup mode API

Use KActionMenu and KToolBarPopupAction::setPopupMode()
methods instead of setDelayed() and setStickyMenu().
Are available since KF 5.77 and KF 5.78 respectively,
which is already required by Dolphin.
parent edd0034a
Pipeline #68487 passed with stage
in 5 minutes and 49 seconds
......@@ -1371,7 +1371,7 @@ void DolphinMainWindow::setupActions()
QMenu* menu = m_newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
menu->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
m_newFileMenu->setDelayed(false);
m_newFileMenu->setPopupMode(QToolButton::InstantPopup);
connect(menu, &QMenu::aboutToShow,
this, &DolphinMainWindow::updateNewMenu);
......@@ -1574,8 +1574,7 @@ void DolphinMainWindow::setupActions()
m_backAction->setObjectName(backAction->objectName());
m_backAction->setShortcuts(backAction->shortcuts());
}
m_backAction->setDelayed(true);
m_backAction->setStickyMenu(false);
m_backAction->setPopupMode(QToolButton::DelayedPopup);
connect(m_backAction, &QAction::triggered, this, &DolphinMainWindow::goBack);
connect(m_backAction->menu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu);
connect(m_backAction->menu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoBack);
......@@ -1618,8 +1617,7 @@ void DolphinMainWindow::setupActions()
m_forwardAction->setObjectName(forwardAction->objectName());
m_forwardAction->setShortcuts(forwardAction->shortcuts());
}
m_forwardAction->setDelayed(true);
m_forwardAction->setStickyMenu(false);
m_forwardAction->setPopupMode(QToolButton::DelayedPopup);
connect(m_forwardAction, &QAction::triggered, this, &DolphinMainWindow::goForward);
connect(m_forwardAction->menu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu);
connect(m_forwardAction->menu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoForward);
......@@ -1677,7 +1675,7 @@ void DolphinMainWindow::setupActions()
KActionMenu *bookmarkMenu = new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this);
bookmarkMenu->setIcon(QIcon::fromTheme(QStringLiteral("bookmarks")));
// Make the toolbar button version work properly on click
bookmarkMenu->setDelayed(false);
bookmarkMenu->setPopupMode(QToolButton::InstantPopup);
m_bookmarkHandler = new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu->menu(), this);
actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu);
......@@ -1979,7 +1977,7 @@ void DolphinMainWindow::setupDockWidgets()
KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Show Panels"), this);
actionCollection()->addAction(QStringLiteral("panels"), panelsMenu);
panelsMenu->setIcon(QIcon::fromTheme(QStringLiteral("view-sidetree")));
panelsMenu->setDelayed(false);
panelsMenu->setPopupMode(QToolButton::InstantPopup);
const KActionCollection* ac = actionCollection();
panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel")));
#ifdef HAVE_BALOO
......
......@@ -15,7 +15,7 @@
DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
KActionMenu(QIcon::fromTheme(QStringLiteral("edit-undo")), i18n("Recently Closed Tabs"), parent)
{
setDelayed(false);
setPopupMode(QToolButton::InstantPopup);
setEnabled(false);
m_clearListAction = new QAction(i18n("Empty Recently Closed Tabs"), this);
......
......@@ -41,7 +41,7 @@ DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionH
this, &DolphinRemoteEncoding::slotAboutToShow);
m_menu->setEnabled(false);
m_menu->setDelayed(false);
m_menu->setPopupMode(QToolButton::InstantPopup);
}
DolphinRemoteEncoding::~DolphinRemoteEncoding()
......
......@@ -259,7 +259,7 @@ void DolphinViewActionHandler::createActions()
KActionMenu* sortByActionMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("sort"));
sortByActionMenu->setIcon(QIcon::fromTheme(QStringLiteral("view-sort")));
sortByActionMenu->setText(i18nc("@action:inmenu View", "Sort By"));
sortByActionMenu->setDelayed(false);
sortByActionMenu->setPopupMode(QToolButton::InstantPopup);
const auto sortByActionGroupActions = sortByActionGroup->actions();
for (QAction* action : sortByActionGroupActions) {
......@@ -294,7 +294,7 @@ void DolphinViewActionHandler::createActions()
KActionMenu* visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info"));
visibleRolesMenu->setText(i18nc("@action:inmenu View", "Show Additional Information"));
visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo")));
visibleRolesMenu->setDelayed(false);
visibleRolesMenu->setPopupMode(QToolButton::InstantPopup);
const auto visibleRolesGroupActions = visibleRolesGroup->actions();
for (QAction* action : visibleRolesGroupActions) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment