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

0001 /*
0002     SPDX-FileCopyrightText: 2024 Kristen McWilliam <kmcwilliampublic@gmail.com>
0003 
0004     SPDX-License-Identifier: BSD-2-Clause
0005 */
0006 
0007 #include <KFileMetaData/UserMetaData>
0008 
0009 namespace Kerfuffle
0010 {
0011 
0012 /**
0013  * @class MetadataBackup
0014  * @brief A backup of the user metadata for an archive.
0015  *
0016  * When an archive is modified, its user metadata is removed. This class
0017  * holds a backup of the user metadata so that it can be restored after
0018  * the archive has been modified.
0019  */
0020 class MetadataBackup
0021 {
0022 public:
0023     MetadataBackup(const QString &filePath);
0024 
0025     /**
0026      * @brief The comment for the archive.
0027      */
0028     const QString comment() const;
0029 
0030     /**
0031      * @brief The rating for the archive.
0032      */
0033     int rating() const;
0034 
0035     /**
0036      * @brief The tags for the archive.
0037      */
0038     const QStringList tags() const;
0039 
0040     /**
0041      * @brief Restores the user metadata to the given file.
0042      */
0043     void restore(const QString &filePath);
0044 
0045 private:
0046     QString m_comment;
0047     int m_rating;
0048     QStringList m_tags;
0049 };
0050 
0051 } // namespace Kerfuffle