Add HamburgerMenu only once per instance

A new HamburgerMenu is added to the context menu each time it is opened
which causes a delay after enough invocations.  Skip adding another if
one has already been added.

BUG: 495029
This commit is contained in:
Blaise Duszynski
2025-02-06 19:11:31 -06:00
committed by Kurt Hindenburg
parent 33c026e2bb
commit ab751a3b16
2 changed files with 9 additions and 3 deletions

View File

@@ -128,6 +128,7 @@ SessionController::SessionController(Session *sessionParam, TerminalDisplay *vie
, _monitorProcessFinish(false)
, _monitorOnce(false)
, _escapedUrlFilter(nullptr)
, _addedHamburgerMenu(false)
{
Q_ASSERT(sessionParam);
Q_ASSERT(viewParam);
@@ -2089,9 +2090,12 @@ void SessionController::showDisplayContextMenu(const QPoint &position)
_preventClose = true;
auto hamburger = static_cast<KHamburgerMenu *>(actionCollection()->action(KStandardAction::name(KStandardAction::HamburgerMenu)));
if (hamburger) {
hamburger->addToMenu(popup);
if (!_addedHamburgerMenu) {
auto hamburger = static_cast<KHamburgerMenu *>(actionCollection()->action(KStandardAction::name(KStandardAction::HamburgerMenu)));
if (hamburger) {
hamburger->addToMenu(popup);
_addedHamburgerMenu = true;
}
}
// they are here.