┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places/placespanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels/places/placespanel.cpp')
-rw-r--r--src/panels/places/placespanel.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 7b4900f7c..1a8b0ecd4 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -258,6 +258,9 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
m_model->deleteItem(index);
} else if (action == hideAction) {
item->setHidden(hideAction->isChecked());
+ if (!m_model->hiddenCount()) {
+ showHiddenEntries(false);
+ }
} else if (action == openInNewWindowAction) {
Dolphin::openNewWindow({KFilePlacesModel::convertedUrl(m_model->data(index).value("url").toUrl())}, this);
} else if (action == openInNewTabAction) {
@@ -287,12 +290,11 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
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());
- }
+ QAction* showAllAction = menu.addAction(i18nc("@item:inmenu", "Show Hidden Places"));
+ showAllAction->setCheckable(true);
+ showAllAction->setChecked(m_model->hiddenItemsShown());
+ showAllAction->setIcon(QIcon::fromTheme(m_model->hiddenItemsShown() ? QStringLiteral("visibility") : QStringLiteral("hint")));
+ showAllAction->setEnabled(m_model->hiddenCount());
buildGroupContextMenu(&menu, m_controller->indexCloseToMousePressedPosition());
@@ -340,7 +342,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
if (action == addAction) {
addEntry();
} else if (action == showAllAction) {
- m_model->setHiddenItemsShown(showAllAction->isChecked());
+ showHiddenEntries(showAllAction->isChecked());
} else if (iconSizeActionMap.contains(action)) {
m_view->setIconSize(iconSizeActionMap.value(action));
}
@@ -362,6 +364,9 @@ QAction *PlacesPanel::buildGroupContextMenu(QMenu *menu, int index)
connect(hideGroupAction, &QAction::triggered, this, [this, groupType, hideGroupAction]{
m_model->setGroupHidden(groupType, hideGroupAction->isChecked());
+ if (!m_model->hiddenCount()) {
+ showHiddenEntries(false);
+ }
});
return hideGroupAction;
@@ -541,3 +546,17 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button)
}
}
}
+
+void PlacesPanel::showHiddenEntries(bool shown)
+{
+ m_model->setHiddenItemsShown(shown);
+ emit showHiddenEntriesChanged(shown);
+}
+
+int PlacesPanel::hiddenListCount()
+{
+ if(!m_model) {
+ return 0;
+ }
+ return m_model->hiddenCount();
+}