diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1347,6 +1347,7 @@ panelsMenu->addAction(ac->action(QStringLiteral("show_folders_panel"))); panelsMenu->addAction(ac->action(QStringLiteral("show_terminal_panel"))); panelsMenu->addSeparator(); + panelsMenu->addAction(m_placesPanel->actionShowAllPlaces()); panelsMenu->addAction(lockLayoutAction); } diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -42,6 +42,7 @@ explicit PlacesPanel(QWidget* parent); ~PlacesPanel() override; void proceedWithTearDown(); + QAction* actionShowAllPlaces(); signals: void placeActivated(const QUrl& url); @@ -93,6 +94,7 @@ int m_itemDropEventIndex; QMimeData* m_itemDropEventMimeData; QDropEvent* m_itemDropEvent; + QAction* m_showAllAction; }; #endif // PLACESPANEL_H diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -64,6 +64,11 @@ m_itemDropEventMimeData(nullptr), m_itemDropEvent(nullptr) { + m_showAllAction = new QAction(QIcon::fromTheme(QStringLiteral("visibility")), i18nc("@item:inmenu", "Show All Entries")); + m_showAllAction->setCheckable(true); + connect(m_showAllAction, &QAction::triggered, this, [this]{ + m_model->setHiddenItemsShown(m_showAllAction->isChecked()); + }); } PlacesPanel::~PlacesPanel() @@ -280,18 +285,20 @@ selectClosestItem(); } +QAction * PlacesPanel::actionShowAllPlaces() +{ + return m_showAllAction; +} void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) { QMenu menu(this); QAction* addAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18nc("@item:inmenu", "Add Entry...")); - QAction* showAllAction = nullptr; if (m_model->hiddenCount() > 0) { - showAllAction = menu.addAction(QIcon::fromTheme(QStringLiteral("visibility")), i18nc("@item:inmenu", "Show All Entries")); - showAllAction->setCheckable(true); - showAllAction->setChecked(m_model->hiddenItemsShown()); + menu.addAction(m_showAllAction); + m_showAllAction->setChecked(m_model->hiddenItemsShown()); } buildGroupContextMenu(&menu, m_controller->indexCloseToMousePressedPosition()); @@ -339,8 +346,8 @@ if (action) { if (action == addAction) { addEntry(); - } else if (action == showAllAction) { - m_model->setHiddenItemsShown(showAllAction->isChecked()); + } else if (action == m_showAllAction) { + m_model->setHiddenItemsShown(m_showAllAction->isChecked()); } else if (iconSizeActionMap.contains(action)) { m_view->setIconSize(iconSizeActionMap.value(action)); }