From 022eac590ea9ba74ed68fb0a6d15b3ec5b0b17e9 Mon Sep 17 00:00:00 2001 From: Chantara Tith Date: Mon, 15 Aug 2016 00:28:30 +0700 Subject: [PATCH] Use deactivate VG operation to check if a volume is deactivatable. --- src/gui/mainwindow.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 9a3aca3..d3a3a2e 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -509,16 +509,8 @@ void MainWindow::enableActions() actionCollection()->action(QStringLiteral("removeVolumeGroup"))->setEnabled(removable); 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; - } - } - } + bool deactivatable = lvmDevice ? + DeactivateVolumeGroupOperation::isDeactivatable(dynamic_cast(pmWidget().selectedDevice())) : false; actionCollection()->action(QStringLiteral("deactivateVolumeGroup"))->setEnabled(deactivatable); actionCollection()->action(QStringLiteral("deactivateVolumeGroup"))->setVisible(lvmDevice); -- 2.44.2