diff --git a/src/ops/CMakeLists.txt b/src/ops/CMakeLists.txt index 9ceda6e..d61b13b 100644 --- a/src/ops/CMakeLists.txt +++ b/src/ops/CMakeLists.txt @@ -8,6 +8,7 @@ set(OPS_SRC ops/createpartitiontableoperation.cpp ops/createvolumegroupoperation.cpp ops/removevolumegroupoperation.cpp + ops/deactivatevolumegroupoperation.cpp ops/resizevolumegroupoperation.cpp ops/setfilesystemlabeloperation.cpp ops/setpartflagsoperation.cpp @@ -24,6 +25,7 @@ set(OPS_LIB_HDRS ops/createpartitiontableoperation.h ops/createvolumegroupoperation.h ops/removevolumegroupoperation.h + ops/deactivatevolumegroupoperation.h ops/resizevolumegroupoperation.h ops/deleteoperation.h ops/newoperation.h diff --git a/src/ops/deactivatevolumegroupoperation.cpp b/src/ops/deactivatevolumegroupoperation.cpp new file mode 100644 index 0000000..7dd5748 --- /dev/null +++ b/src/ops/deactivatevolumegroupoperation.cpp @@ -0,0 +1,54 @@ +/************************************************************************* + * Copyright (C) 2016 by Chantara Tith * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 3 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see .* + *************************************************************************/ + +#include "ops/deactivatevolumegroupoperation.h" +#include "jobs/deactivatevolumegroupjob.h" +#include "jobs/deactivatelogicalvolumejob.h" + +#include "core/volumemanagerdevice.h" +#include "core/partitiontable.h" + +#include + +#include + +/** Creates a new RemoveVolumeGroupOperation. + @param d the Device to create the new PartitionTable on + @param t the type for the new PartitionTable +*/ +DeactivateVolumeGroupOperation::DeactivateVolumeGroupOperation(VolumeManagerDevice& dev) : + Operation(), + m_DeactivateVolumeGroupJob(new DeactivateVolumeGroupJob(dev)), + m_DeactivateLogicalVolumeJob(new DeactivateLogicalVolumeJob(dev)), + m_Device(dev) +{ + addJob(deactivateLogicalVolumeJob()); + addJob(deactivateVolumeGroupJob()); +} + +QString DeactivateVolumeGroupOperation::description() const +{ + return xi18nc("@info/plain", "Deactivate volume group."); +} + +void DeactivateVolumeGroupOperation::preview() +{ +} + +void DeactivateVolumeGroupOperation::undo() +{ +} diff --git a/src/ops/deactivatevolumegroupoperation.h b/src/ops/deactivatevolumegroupoperation.h new file mode 100644 index 0000000..d6675d2 --- /dev/null +++ b/src/ops/deactivatevolumegroupoperation.h @@ -0,0 +1,79 @@ +/************************************************************************* + * Copyright (C) 2016 by Chantara Tith * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 3 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see .* + *************************************************************************/ + +#if !defined(DEACTIVATEVOLUMEGROUPOPERATION_H) + +#define DEACTIVATEVOLUMEGROUPOPERATION_H + +#include "util/libpartitionmanagerexport.h" + +#include "ops/operation.h" + +#include + + +class DeactivateLogicalVolumeJob; +class DeactivateVolumeGroupJob; +class VolumeManagerDevice; +class OperationStack; + +class LIBKPMCORE_EXPORT DeactivateVolumeGroupOperation : public Operation +{ + Q_DISABLE_COPY(DeactivateVolumeGroupOperation) + + friend class OperationStack; + +public: + DeactivateVolumeGroupOperation(VolumeManagerDevice& dev); + +public: + QString iconName() const override { + return QStringLiteral("edit-delete"); + } + + QString description() const override; + + virtual bool targets(const Device&) const override { + return true; + } + virtual bool targets(const Partition&) const override { + return false; + } + + virtual void preview() override; + virtual void undo() override; + +protected: + DeactivateVolumeGroupJob* deactivateVolumeGroupJob() { + return m_DeactivateVolumeGroupJob; + } + + DeactivateLogicalVolumeJob* deactivateLogicalVolumeJob() { + return m_DeactivateLogicalVolumeJob; + } + + VolumeManagerDevice& device() { + return m_Device; + } + +private: + DeactivateVolumeGroupJob* m_DeactivateVolumeGroupJob; + DeactivateLogicalVolumeJob* m_DeactivateLogicalVolumeJob; + VolumeManagerDevice& m_Device; +}; + +#endif