2020-09-30 23:28:47 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2014-2016 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk>
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2020-09-30 23:28:47 +01:00
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KPMCORE_CREATEPARTITIONTABLEOPERATION_H
|
2017-09-10 20:12:52 +01:00
|
|
|
#define KPMCORE_CREATEPARTITIONTABLEOPERATION_H
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2016-05-06 22:36:24 +01:00
|
|
|
#include "util/libpartitionmanagerexport.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2016-05-06 22:36:24 +01:00
|
|
|
#include "ops/operation.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2016-05-06 22:36:24 +01:00
|
|
|
#include "core/partitiontable.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
class CreatePartitionTableJob;
|
|
|
|
class PartitionTable;
|
|
|
|
class OperationStack;
|
|
|
|
|
|
|
|
/** Create a PartitionTable.
|
2015-07-13 15:16:36 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2015-06-04 01:29:22 +01:00
|
|
|
*/
|
|
|
|
class LIBKPMCORE_EXPORT CreatePartitionTableOperation : public Operation
|
|
|
|
{
|
2015-07-13 15:16:36 +01:00
|
|
|
Q_DISABLE_COPY(CreatePartitionTableOperation)
|
|
|
|
|
|
|
|
friend class OperationStack;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CreatePartitionTableOperation(Device& d, PartitionTable::TableType t);
|
|
|
|
CreatePartitionTableOperation(Device& d, PartitionTable* ptable);
|
|
|
|
~CreatePartitionTableOperation();
|
|
|
|
|
|
|
|
public:
|
2016-04-27 21:54:02 +01:00
|
|
|
QString iconName() const override {
|
2015-07-13 15:16:36 +01:00
|
|
|
return QStringLiteral("edit-clear");
|
|
|
|
}
|
2016-04-27 21:54:02 +01:00
|
|
|
QString description() const override;
|
|
|
|
void preview() override;
|
|
|
|
void undo() override;
|
|
|
|
bool execute(Report& parent) override;
|
2015-07-13 15:16:36 +01:00
|
|
|
|
2016-05-17 18:01:31 +01:00
|
|
|
bool targets(const Device& d) const override;
|
|
|
|
bool targets(const Partition&) const override{
|
2015-07-13 15:16:36 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool canCreate(const Device* device);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Device& targetDevice() {
|
|
|
|
return m_TargetDevice;
|
|
|
|
}
|
|
|
|
const Device& targetDevice() const {
|
|
|
|
return m_TargetDevice;
|
|
|
|
}
|
|
|
|
|
|
|
|
PartitionTable* partitionTable() {
|
|
|
|
return m_PartitionTable;
|
|
|
|
}
|
|
|
|
const PartitionTable* partitionTable() const {
|
|
|
|
return m_PartitionTable;
|
|
|
|
}
|
|
|
|
|
|
|
|
PartitionTable* oldPartitionTable() {
|
|
|
|
return m_OldPartitionTable;
|
|
|
|
}
|
|
|
|
void setOldPartitionTable(PartitionTable* old) {
|
|
|
|
m_OldPartitionTable = old;
|
|
|
|
}
|
|
|
|
|
|
|
|
CreatePartitionTableJob* createPartitionTableJob() {
|
|
|
|
return m_CreatePartitionTableJob;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Device& m_TargetDevice;
|
|
|
|
PartitionTable* m_OldPartitionTable;
|
|
|
|
PartitionTable* m_PartitionTable;
|
|
|
|
CreatePartitionTableJob* m_CreatePartitionTableJob;
|
2015-06-04 01:29:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|