Replace 2 cases of getLVs with LVPathList.

This commit is contained in:
Andrius Štikonas 2016-09-05 17:29:09 +01:00
parent 10a2aca527
commit 29cb8f6201
1 changed files with 8 additions and 3 deletions

View File

@ -514,8 +514,12 @@ void MainWindow::enableActions()
bool lvmDevice = pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::LVM_Device;
bool removable = false;
if (lvmDevice && !LvmDevice::getLVs(pmWidget().selectedDevice()->name()).count())
removable = true;
if (lvmDevice) {
LvmDevice* d = static_cast<LvmDevice*>(pmWidget().selectedDevice());
if(!d->LVPathList()->count())
removable = true;
}
actionCollection()->action(QStringLiteral("removeVolumeGroup"))->setEnabled(removable);
actionCollection()->action(QStringLiteral("removeVolumeGroup"))->setVisible(lvmDevice);
@ -1111,7 +1115,8 @@ void MainWindow::onRemoveVolumeGroup()
{
Device* tmpDev = pmWidget().selectedDevice();
if (tmpDev->type() == Device::LVM_Device) {
if (LvmDevice::getLVs(tmpDev->name()).count()) {
LvmDevice* d = static_cast<LvmDevice*>(tmpDev);
if(!d->LVPathList()->count()) {
KMessageBox::error(this, xi18nc("@info", "Could not remove <filename>%1</filename>. There are still Logical Volumes on the Volume Group.", tmpDev->name()), i18nc("@title:window", "Error Removing Volume Group"));
} else {
operationStack().push(new RemoveVolumeGroupOperation( *(dynamic_cast<LvmDevice*>(tmpDev)) ));