1 /* 2 SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de> 3 SPDX-FileCopyrightText: 2014-2016 Andrius Štikonas <andrius@stikonas.eu> 4 SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk> 5 6 SPDX-License-Identifier: GPL-3.0-or-later 7 */ 8 9 #ifndef KPMCORE_CREATEFILESYSTEMOPERATION_H 10 #define KPMCORE_CREATEFILESYSTEMOPERATION_H 11 12 #include "util/libpartitionmanagerexport.h" 13 14 #include "ops/operation.h" 15 16 #include "fs/filesystem.h" 17 18 #include <QString> 19 20 class Partition; 21 class OperationStack; 22 23 class DeleteFileSystemJob; 24 class CreateFileSystemJob; 25 class CheckFileSystemJob; 26 27 /** Create a FileSystem. 28 29 Creates a FileSystem on a given Partition and Device. 30 31 @author Volker Lanz <vl@fidra.de> 32 */ 33 class LIBKPMCORE_EXPORT CreateFileSystemOperation : public Operation 34 { 35 friend class OperationStack; 36 37 Q_DISABLE_COPY(CreateFileSystemOperation) 38 39 public: 40 CreateFileSystemOperation(Device& d, Partition& p, FileSystem::Type newType); 41 ~CreateFileSystemOperation(); 42 43 public: iconName()44 QString iconName() const override { 45 return QStringLiteral("draw-eraser"); 46 } 47 QString description() const override; 48 void preview() override; 49 void undo() override; 50 bool execute(Report& parent) override; 51 52 bool targets(const Device& d) const override; 53 bool targets(const Partition& p) const override; 54 55 protected: targetDevice()56 Device& targetDevice() { 57 return m_TargetDevice; 58 } targetDevice()59 const Device& targetDevice() const { 60 return m_TargetDevice; 61 } 62 partition()63 Partition& partition() { 64 return m_Partition; 65 } partition()66 const Partition& partition() const { 67 return m_Partition; 68 } 69 newFileSystem()70 FileSystem* newFileSystem() const { 71 return m_NewFileSystem; 72 } oldFileSystem()73 FileSystem* oldFileSystem() const { 74 return m_OldFileSystem; 75 } 76 deleteJob()77 DeleteFileSystemJob* deleteJob() { 78 return m_DeleteJob; 79 } createJob()80 CreateFileSystemJob* createJob() { 81 return m_CreateJob; 82 } checkJob()83 CheckFileSystemJob* checkJob() { 84 return m_CheckJob; 85 } 86 87 private: 88 Device& m_TargetDevice; 89 Partition& m_Partition; 90 FileSystem* m_NewFileSystem; 91 FileSystem* m_OldFileSystem; 92 DeleteFileSystemJob* m_DeleteJob; 93 CreateFileSystemJob* m_CreateJob; 94 CheckFileSystemJob* m_CheckJob; 95 }; 96 97 #endif 98