kpmcore/src/ops/setfilesystemlabeloperation.h

80 lines
1.8 KiB
C
Raw Permalink Normal View History

/*
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>
SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef KPMCORE_SETFILESYSTEMLABELOPERATION_H
#define KPMCORE_SETFILESYSTEMLABELOPERATION_H
2016-05-06 22:36:24 +01:00
#include "util/libpartitionmanagerexport.h"
2016-05-06 22:36:24 +01:00
#include "ops/operation.h"
#include <QString>
class OperationStack;
class Partition;
class SetFileSystemLabelJob;
/** Set a FileSystem label.
2015-07-13 15:16:36 +01:00
Sets the FileSystem label for the given Partition.
2015-07-13 15:16:36 +01:00
@author Volker Lanz <vl@fidra.de>
*/
class LIBKPMCORE_EXPORT SetFileSystemLabelOperation : public Operation
{
2015-07-13 15:16:36 +01:00
friend class OperationStack;
Q_DISABLE_COPY(SetFileSystemLabelOperation)
public:
SetFileSystemLabelOperation(Partition& p, const QString& newlabel);
public:
QString iconName() const override {
2015-07-13 15:16:36 +01:00
return QStringLiteral("edit-rename");
}
QString description() const override;
void preview() override;
void undo() 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& p) const override;
2015-07-13 15:16:36 +01:00
protected:
Partition& labeledPartition() {
return m_LabeledPartition;
}
const Partition& labeledPartition() const {
return m_LabeledPartition;
}
const QString& oldLabel() const {
return m_OldLabel;
}
const QString& newLabel() const {
return m_NewLabel;
}
void setOldLabel(const QString& l) {
m_OldLabel = l;
}
SetFileSystemLabelJob* labelJob() {
return m_LabelJob;
}
private:
Partition& m_LabeledPartition;
QString m_OldLabel;
QString m_NewLabel;
SetFileSystemLabelJob* m_LabelJob;
};
#endif