From 53a778c1ebab4473da8ae7b18fd2f2ac75b9690a Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Thu, 13 May 2021 16:49:27 +0000 Subject: Re-arrange the contents of the hamburger menu To improve usability, the entries in the hamburger menu are changed. Maybe the biggest fault of the previous menu contents were that there were too many actions. The new menu contents are composed of all the actions which are necessary to use Dolphin and those which are very useful and should be of interest for most users. Some menu contents change depending on the state of the application. We can be more bold in only showing what really seems necessary because this commit activates the special sub-menu of KHamburgerMenu that helps users discover all further features of Dolphin. The hamburger menu is from now on also added to the context menus in the view when both the menu bar and toolbar are hidden. This allows users to hide both of them and still use all features of Dolphin. --- src/dolphincontextmenu.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/dolphincontextmenu.cpp') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index ed6db0c12..4b287981c 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,9 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, m_selectedItems = view->selectedItems(); installEventFilter(this); + + static_cast(m_mainWindow->actionCollection()-> + action(QStringLiteral("hamburger_menu")))->addToMenu(this); } DolphinContextMenu::~DolphinContextMenu() @@ -149,8 +153,6 @@ void DolphinContextMenu::openTrashContextMenu() QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties")); addAction(propertiesAction); - addShowMenuBarAction(); - if (exec(m_pos) == emptyTrashAction) { Trash::empty(m_mainWindow); } @@ -361,8 +363,6 @@ void DolphinContextMenu::openViewportContextMenu() QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties")); addAction(propertiesAction); - addShowMenuBarAction(); - exec(m_pos); } @@ -423,16 +423,6 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties& } } -void DolphinContextMenu::addShowMenuBarAction() -{ - const KActionCollection* ac = m_mainWindow->actionCollection(); - QAction* showMenuBar = ac->action(KStandardAction::name(KStandardAction::ShowMenubar)); - if (!m_mainWindow->menuBar()->isVisible() && !m_mainWindow->toolBar()->isVisible()) { - addSeparator(); - addAction(showMenuBar); - } -} - bool DolphinContextMenu::placeExists(const QUrl& url) const { const KFilePlacesModel* placesModel = DolphinPlacesModelSingleton::instance().placesModel(); -- cgit v1.3