┌   ┐
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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 983f3f392..8a8fa8a7d 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -44,6 +44,7 @@
#include <KIO/Job>
#include <KIconLoader>
#include <KLocalizedString>
+#include <KMountPoint>
#include <QGraphicsSceneDragDropEvent>
#include <QIcon>
@@ -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);
}