File indexing completed on 2024-05-05 05:48:52

0001 /*
0002     SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
0003     SPDX-FileCopyrightText: 2016 Andrius Štikonas <andrius@stikonas.eu>
0004     SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
0005 
0006     SPDX-License-Identifier: GPL-3.0-or-later
0007 */
0008 
0009 #ifndef KPMCORE_REMOVEVOLUMEGROUPOPERATION_H
0010 #define KPMCORE_REMOVEVOLUMEGROUPOPERATION_H
0011 
0012 #include "util/libpartitionmanagerexport.h"
0013 
0014 #include "ops/operation.h"
0015 
0016 #include <QString>
0017 
0018 class PartitionTable;
0019 class RemoveVolumeGroupJob;
0020 class VolumeManagerDevice;
0021 class OperationStack;
0022 
0023 class LIBKPMCORE_EXPORT RemoveVolumeGroupOperation : public Operation
0024 {
0025     Q_DISABLE_COPY(RemoveVolumeGroupOperation)
0026 
0027     friend class OperationStack;
0028 
0029 public:
0030     explicit RemoveVolumeGroupOperation(VolumeManagerDevice& d);
0031 
0032 public:
0033     QString iconName() const override {
0034         return QStringLiteral("edit-delete");
0035     }
0036 
0037     QString description() const override;
0038 
0039     virtual bool targets(const Device&) const override {
0040         return true;
0041     }
0042     virtual bool targets(const Partition&) const override {
0043         return false;
0044     }
0045 
0046     virtual void preview() override;
0047     virtual void undo() override;
0048 
0049     static bool isRemovable(const VolumeManagerDevice* dev);
0050 
0051 protected:
0052     RemoveVolumeGroupJob* removeVolumeGroupJob() {
0053         return m_RemoveVolumeGroupJob;
0054     }
0055 
0056     VolumeManagerDevice& device() {
0057         return m_Device;
0058     }
0059 
0060 private:
0061     RemoveVolumeGroupJob* m_RemoveVolumeGroupJob;
0062     VolumeManagerDevice& m_Device;
0063     PartitionTable* m_PartitionTable;
0064 };
0065 
0066 #endif