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 @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -182,6 +183,16 @@ 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); }