File indexing completed on 2025-01-05 04:55:47

0001 /*
0002     cryptoconfigmodule.h
0003 
0004     This file is part of libkleopatra
0005     SPDX-FileCopyrightText: 2004, 2005 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kleo_export.h"
0013 
0014 #include <KPageWidget>
0015 
0016 #include <QList>
0017 
0018 namespace QGpgME
0019 {
0020 class CryptoConfig;
0021 } // namespace QGpgME
0022 
0023 namespace Kleo
0024 {
0025 class CryptoConfigComponentGUI;
0026 
0027 /**
0028  * Crypto Config Module widget, dynamically generated from CryptoConfig
0029  * It's a simple QWidget so that it can be embedded into a dialog or into a KCModule.
0030  */
0031 class KLEO_EXPORT CryptoConfigModule : public KPageWidget
0032 {
0033     Q_OBJECT
0034 public:
0035     enum Layout { TabbedLayout, IconListLayout, LinearizedLayout };
0036     explicit CryptoConfigModule(QGpgME::CryptoConfig *config, QWidget *parent = nullptr);
0037     explicit CryptoConfigModule(QGpgME::CryptoConfig *config, Layout layout, QWidget *parent = nullptr);
0038 
0039     bool hasError() const;
0040 
0041     void save();
0042     void reset(); // i.e. reload current settings, discarding user input
0043     void defaults();
0044     void cancel();
0045 
0046 Q_SIGNALS:
0047     void changed();
0048 
0049 private:
0050     void init(Layout layout);
0051     static QStringList sortComponentList(const QStringList &components);
0052 
0053 public:
0054     static QStringList sortGroupList(const QString &moduleName, const QStringList &groups);
0055 
0056 private:
0057     QGpgME::CryptoConfig *mConfig = nullptr;
0058     QList<CryptoConfigComponentGUI *> mComponentGUIs;
0059 };
0060 
0061 }