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

0001 /*
0002     SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu>
0004     SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk>
0005 
0006     SPDX-License-Identifier: GPL-3.0-or-later
0007 */
0008 
0009 #ifndef KPMCORE_BACKUPOPERATION_H
0010 #define KPMCORE_BACKUPOPERATION_H
0011 
0012 #include "util/libpartitionmanagerexport.h"
0013 
0014 #include "ops/operation.h"
0015 
0016 #include <QString>
0017 
0018 class Partition;
0019 class Device;
0020 class BackupFileSystemJob;
0021 
0022 /** Back up a FileSystem.
0023     @author Volker Lanz <vl@fidra.de>
0024 */
0025 class LIBKPMCORE_EXPORT BackupOperation : public Operation
0026 {
0027     Q_DISABLE_COPY(BackupOperation)
0028 
0029 public:
0030     BackupOperation(Device& targetDevice, Partition& backupPartition, const QString& filename);
0031 
0032 public:
0033     QString iconName() const override {
0034         return QStringLiteral("document-export");
0035     }
0036     QString description() const override;
0037     void preview() override {}
0038     void undo() override {}
0039 
0040     bool targets(const Device&) const override {
0041         return false;
0042     }
0043     bool targets(const Partition&) const override{
0044         return false;
0045     }
0046 
0047     static bool canBackup(const Partition* p);
0048 
0049 protected:
0050     Device& targetDevice() {
0051         return m_TargetDevice;
0052     }
0053 
0054     const Device& targetDevice() const {
0055         return m_TargetDevice;
0056     }
0057 
0058     Partition& backupPartition() {
0059         return m_BackupPartition;
0060     }
0061     const Partition& backupPartition() const {
0062         return m_BackupPartition;
0063     }
0064 
0065     const QString& fileName() const {
0066         return m_FileName;
0067     }
0068 
0069     BackupFileSystemJob* backupJob() {
0070         return m_BackupJob;
0071     }
0072 
0073 private:
0074     Device& m_TargetDevice;
0075     Partition& m_BackupPartition;
0076     const QString m_FileName;
0077     BackupFileSystemJob* m_BackupJob;
0078 };
0079 
0080 #endif