From 6f3ec0170e08d1be6f7aafd59804dc8a09201160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Wed, 2 Jul 2014 15:59:34 +0200 Subject: [PATCH] Argh, forgot to commit those files --- src/modules/partition/DeletePartitionJob.cpp | 49 ++++++++++++++++++ src/modules/partition/DeletePartitionJob.h | 53 ++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 src/modules/partition/DeletePartitionJob.cpp create mode 100644 src/modules/partition/DeletePartitionJob.h diff --git a/src/modules/partition/DeletePartitionJob.cpp b/src/modules/partition/DeletePartitionJob.cpp new file mode 100644 index 000000000..8eb1c8485 --- /dev/null +++ b/src/modules/partition/DeletePartitionJob.cpp @@ -0,0 +1,49 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Aurélien Gâteau + * + * Calamares 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. + * + * Calamares 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 Calamares. If not, see . + */ + +#include + +// CalaPM +#include +#include +#include +#include + +DeletePartitionJob::DeletePartitionJob( Device* device, Partition* partition ) + : m_device( device ) + , m_partition( partition ) +{ +} + +QString +DeletePartitionJob::prettyName() +{ + return tr( "Delete partition %1" ).arg( m_partition->partitionPath() ); +} + +void +DeletePartitionJob::exec() +{ +} + +void +DeletePartitionJob::updatePreview() +{ + m_partition->parent()->remove( m_partition ); + m_device->partitionTable()->updateUnallocated( *m_device ); +} diff --git a/src/modules/partition/DeletePartitionJob.h b/src/modules/partition/DeletePartitionJob.h new file mode 100644 index 000000000..ce98a5ac2 --- /dev/null +++ b/src/modules/partition/DeletePartitionJob.h @@ -0,0 +1,53 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Aurélien Gâteau + * + * Calamares 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. + * + * Calamares 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 Calamares. If not, see . + */ + +#ifndef DELETEPARTITIONJOB_H +#define DELETEPARTITIONJOB_H + +#include + +class Device; +class Partition; +class FileSystem; + +class DeletePartitionJob : public Calamares::Job +{ + Q_OBJECT +public: + DeletePartitionJob( Device* device, Partition* partition ); + QString prettyName() override; + void exec() override; + + void updatePreview(); + Device* device() const + { + return m_device; + } + + Partition* partition() const + { + return m_partition; + } + +private: + Device* m_device; + Partition* m_partition; + FileSystem* m_fs; +}; + +#endif /* DELETEPARTITIONJOB_H */