File indexing completed on 2024-05-12 04:46:01

0001 #pragma once
0002 
0003 #include <QObject>
0004 
0005 #include <MauiKit3/Core/fmh.h>
0006 #include <MauiKit3/Core/mauilist.h>
0007 
0008 class KArchive;
0009 class CompressedFileModel : public MauiList
0010 {
0011     Q_OBJECT
0012 public:
0013     explicit CompressedFileModel(QObject *parent);
0014     const FMH::MODEL_LIST &items() const override final;
0015 
0016     void setUrl(const QUrl &url);
0017 
0018 private:
0019     FMH::MODEL_LIST m_list;
0020     QUrl m_url;
0021 };
0022 
0023 class CompressedFile : public QObject
0024 {
0025     Q_OBJECT
0026     Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
0027     Q_PROPERTY(CompressedFileModel *model READ model CONSTANT FINAL)
0028 
0029 public:
0030     explicit CompressedFile(QObject *parent = nullptr);
0031     static KArchive *getKArchiveObject(const QUrl &url);
0032 
0033     void setUrl(const QUrl &url);
0034     QUrl url() const;
0035 
0036     CompressedFileModel *model() const;
0037 
0038 public Q_SLOTS:
0039     void extract(const QUrl &where, const QString &directory = QString());
0040     bool compress(const QVariantList &files, const QUrl &where, const QString &fileName, const int &compressTypeSelected);
0041 
0042 private:
0043     QUrl m_url;
0044     CompressedFileModel *m_model;
0045 
0046 Q_SIGNALS:
0047     void urlChanged();
0048     void extractionFinished(QUrl url);
0049     void compressionFinished(QUrl url);
0050 };