Add deactivatable check to deactivate VG operation.
This commit is contained in:
parent
3eda1d79c6
commit
a8139278db
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "core/volumemanagerdevice.h"
|
||||
#include "core/partitiontable.h"
|
||||
#include "core/partition.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
@ -57,3 +58,17 @@ void DeactivateVolumeGroupOperation::undo()
|
|||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
||||
bool DeactivateVolumeGroupOperation::isDeactivatable(const VolumeManagerDevice* dev)
|
||||
{
|
||||
if (dev->type() == Device::LVM_Device) {
|
||||
for (const auto &p : dev->partitionTable()->children()) {
|
||||
if (p->isMounted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
virtual void preview() override;
|
||||
virtual void undo() override;
|
||||
|
||||
static bool isDeactivatable(const VolumeManagerDevice* dev);
|
||||
|
||||
protected:
|
||||
DeactivateVolumeGroupJob* deactivateVolumeGroupJob() {
|
||||
return m_DeactivateVolumeGroupJob;
|
||||
|
|
Loading…
Reference in New Issue