Do not allow deactivating LVM VG devices that have mounted partitions.
This commit is contained in:
parent
22173b75a6
commit
b8c1acc7b6
|
@ -506,6 +506,15 @@ void MainWindow::enableActions()
|
|||
actionCollection()->action(QStringLiteral("removeVolumeGroup"))->setVisible(lvmDevice);
|
||||
|
||||
bool deactivatable = lvmDevice;
|
||||
if(lvmDevice) {
|
||||
const auto logicalVolumes = pmWidget().selectedDevice()->partitionTable()->children();
|
||||
for (const auto &p : logicalVolumes) {
|
||||
if (p->isMounted()) {
|
||||
deactivatable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
actionCollection()->action(QStringLiteral("deactivateVolumeGroup"))->setEnabled(deactivatable);
|
||||
actionCollection()->action(QStringLiteral("deactivateVolumeGroup"))->setVisible(lvmDevice);
|
||||
|
||||
|
|
Loading…
Reference in New Issue