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

0001 /*
0002     SPDX-FileCopyrightText: 2008 Harald Hvaal <haraldhv@stud.ntnu.no>
0003     SPDX-FileCopyrightText: 2009 Raphael Kubo da Costa <rakuco@FreeBSD.org>
0004     SPDX-FileCopyrightText: 2015 Elvis Angelaccio <elvis.angelaccio@kde.org>
0005     SPDX-FileCopyrightText: 2016 Ragnar Thomsen <rthomsen6@gmail.com>
0006 
0007     SPDX-License-Identifier: BSD-2-Clause
0008 */
0009 
0010 #ifndef CREATEDIALOG_H
0011 #define CREATEDIALOG_H
0012 
0013 #include "archive_kerfuffle.h"
0014 #include "kerfuffle_export.h"
0015 #include "pluginmanager.h"
0016 
0017 #include <KConfigGroup>
0018 
0019 #include <QDialog>
0020 #include <QMimeType>
0021 
0022 class QUrl;
0023 class QVBoxLayout;
0024 
0025 namespace Kerfuffle
0026 {
0027 class KERFUFFLE_EXPORT CreateDialog : public QDialog
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit CreateDialog(QWidget *parent, const QString &caption, const QUrl &startDir);
0033     void setFileName(const QString &fileName);
0034     QUrl selectedUrl() const;
0035     QString password() const;
0036     QMimeType currentMimeType() const;
0037     bool setMimeType(const QString &mimeTypeName);
0038     int compressionLevel() const;
0039     QString compressionMethod() const;
0040     QString encryptionMethod() const;
0041     ulong volumeSize() const;
0042 
0043     /**
0044      * @return Whether the user can encrypt the new archive.
0045      */
0046     bool isEncryptionAvailable() const;
0047 
0048     /**
0049      * @return Whether the user has chosen to encrypt the new archive.
0050      */
0051     bool isEncryptionEnabled() const;
0052 
0053     /**
0054      * @return Whether the user can encrypt the list of files in the new archive.
0055      */
0056     bool isHeaderEncryptionAvailable() const;
0057 
0058     /**
0059      * @return Whether the user has chosen to encrypt the list of files in the new archive.
0060      */
0061     bool isHeaderEncryptionEnabled() const;
0062 
0063 public Q_SLOTS:
0064     void accept() override;
0065 
0066 private:
0067     void loadConfiguration();
0068 
0069     class CreateDialogUI *m_ui;
0070     QVBoxLayout *m_vlayout;
0071     KConfigGroup m_config;
0072     QStringList m_supportedMimeTypes;
0073     PluginManager m_pluginManger;
0074 
0075 private Q_SLOTS:
0076     void slotFileNameEdited(const QString &text);
0077     void slotUpdateWidgets(int index);
0078     void slotUpdateDefaultMimeType();
0079     void slotUpdateFilenameExtension(int index);
0080 };
0081 }
0082 
0083 #endif