X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7904ae417af2b7b59ee54a9f875191e9e4802492..c527dc2172:/src/panels/places/placespanel.cpp diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 8d7f29384..8a8fa8a7d 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -182,6 +183,16 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) teardownAction = m_model->teardownAction(index); if (teardownAction) { + // Disable teardown option for root and home partitions + bool teardownEnabled = item->url() != QUrl::fromLocalFile(QDir::rootPath()); + if (teardownEnabled) { + KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(QDir::homePath()); + if (mountPoint && item->url() == QUrl::fromLocalFile(mountPoint->mountPoint())) { + teardownEnabled = false; + } + } + teardownAction->setEnabled(teardownEnabled); + teardownAction->setParent(&menu); menu.addAction(teardownAction); } @@ -201,14 +212,14 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) } } - QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme("window-new"), i18nc("@item:inmenu", "Open in New Window")); - QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@item:inmenu", "Open in New Tab")); + QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@item:inmenu", "Open in New Window")); + QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@item:inmenu", "Open in New Tab")); if (!isDevice && !isTrash) { menu.addSeparator(); } if (!isDevice) { - editAction = menu.addAction(QIcon::fromTheme("edit-entry"), i18nc("@item:inmenu", "Edit...")); + editAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-entry")), i18nc("@item:inmenu", "Edit...")); } QAction* removeAction = nullptr; @@ -216,7 +227,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) removeAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@item:inmenu", "Remove")); } - QAction* hideAction = menu.addAction(i18nc("@item:inmenu", "Hide")); + QAction* hideAction = menu.addAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Hide")); hideAction->setCheckable(true); hideAction->setChecked(item->isHidden()); @@ -269,7 +280,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) QAction* showAllAction = nullptr; if (m_model->hiddenCount() > 0) { - showAllAction = menu.addAction(i18nc("@item:inmenu", "Show All Entries")); + showAllAction = menu.addAction(QIcon::fromTheme(QStringLiteral("visibility")), i18nc("@item:inmenu", "Show All Entries")); showAllAction->setCheckable(true); showAllAction->setChecked(m_model->hiddenItemsShown()); } @@ -336,7 +347,7 @@ QAction *PlacesPanel::buildGroupContextMenu(QMenu *menu, int index) } KFilePlacesModel::GroupType groupType = m_model->groupType(index); - QAction *hideGroupAction = menu->addAction(i18nc("@item:inmenu", "Hide Section '%1'", m_model->item(index)->group())); + QAction *hideGroupAction = menu->addAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Hide Section '%1'", m_model->item(index)->group())); hideGroupAction->setCheckable(true); hideGroupAction->setChecked(m_model->isGroupHidden(groupType));