File indexing completed on 2021-12-21 14:36:54

0001 /*
0002     SPDX-FileCopyrightText: 2002 Jean-Baptiste Mardelle <bj@altern.org>
0003     SPDX-FileCopyrightText: 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Rolf Eike Beer <kde@opensource.sf-tec.de>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KGPGOPTIONS_H
0008 #define KGPGOPTIONS_H
0009 
0010 #include "ui_conf_gpg.h"
0011 #include "ui_conf_ui2.h"
0012 #include "ui_conf_servers.h"
0013 #include "ui_conf_misc.h"
0014 #include "ui_conf_decryption.h"
0015 
0016 #include "core/kgpgkey.h"
0017 
0018 #include <QPixmap>
0019 #include <QString>
0020 
0021 #include <KConfigDialog>
0022 
0023 class KFontChooser;
0024 class KConfig;
0025 
0026 class Encryption;
0027 class GpgServerModel;
0028 class KGpgItemModel;
0029 class KeyListProxyModel;
0030 
0031 class Decryption : public QWidget, public Ui::Decryption
0032 {
0033 public:
0034   explicit Decryption(QWidget *parent = nullptr)
0035     : QWidget( parent)
0036   {
0037     setupUi(this);
0038   }
0039 };
0040 
0041 class MiscConf : public QWidget, public Ui::MiscConf
0042 {
0043 public:
0044   explicit MiscConf(QWidget *parent = nullptr)
0045     : QWidget( parent )
0046   {
0047     setupUi( this );
0048   }
0049 };
0050 
0051 
0052 class UIConf : public QWidget, public Ui::UIConf
0053 {
0054 public:
0055   explicit UIConf(QWidget *parent = nullptr)
0056     : QWidget( parent )
0057   {
0058     setupUi( this );
0059   }
0060 };
0061 
0062 class ServerConf : public QWidget, public Ui::ServerConf
0063 {
0064 public:
0065   explicit ServerConf(QWidget *parent = nullptr)
0066     : QWidget( parent )
0067   {
0068     setupUi( this );
0069   }
0070 };
0071 
0072 
0073 class GPGConf : public QWidget, public Ui::GPGConf
0074 {
0075 public:
0076   explicit GPGConf(QWidget *parent = nullptr)
0077     : QWidget( parent )
0078   {
0079     setupUi( this );
0080   }
0081 };
0082 
0083 
0084 class kgpgOptions : public KConfigDialog
0085 {
0086     Q_OBJECT
0087 
0088 public:
0089     explicit kgpgOptions(QWidget *parent = nullptr, KGpgItemModel *model = nullptr);
0090     ~kgpgOptions() override;
0091 
0092 Q_SIGNALS:
0093     void updateDisplay();
0094     void settingsUpdated();
0095     void changeFont(QFont);
0096     void homeChanged();
0097     void refreshTrust(KgpgCore::KgpgKeyTrust, QColor);
0098 
0099 private Q_SLOTS:
0100     void slotChangeHome();
0101     void slotAddKeyServer();
0102     void slotChangeEncryptTo();
0103     void slotDelKeyServer();
0104     void slotEditKeyServer();
0105     void slotEditKeyServer(const QModelIndex &index);
0106     void slotChangeKeyServerButtonEnable();
0107     void slotDefaultKeyServer();
0108     void updateWidgets() override;
0109     void updateWidgetsDefault() override;
0110     void updateSettings() override;
0111     void listKeys();
0112     void slotInstallDecrypt(const QString &mimetype);
0113     void slotInstallSign(const QString &mimetype);
0114     void slotRemoveMenu(const QString &menu);
0115     void slotSystrayEnable();
0116 
0117 protected:
0118     bool hasChanged() override;
0119     bool isDefault() override;
0120 
0121 private:
0122     QStringList names;
0123     QStringList ids;
0124     QString alwaysKeyID;
0125     QString fileEncryptionKey;
0126     QString gpgConfigPath;
0127     QString keyServer;                    ///< Server stored in GnuPG config
0128     QStringList serverList;               ///< Servers stored in kgpgrc
0129     QString defaultKeyServer;             ///< Default keyserver
0130     QStringList defaultServerList;        ///< Default list of servers including the default key server;
0131     QString defaultConfigPath;
0132     QString defaultHomePath;
0133     QString defaultBinPath;
0134     QColor keyUltimate;
0135     QColor keyGood;
0136     QColor keyExpired;
0137     QColor keyMarginal;
0138     QColor keyBad;
0139     QColor keyUnknown;
0140     QColor keyRev;
0141 
0142     KConfig *m_config;
0143 
0144     Encryption * const m_page1;
0145     Decryption * const m_page2;
0146     UIConf * const m_page3;
0147     GPGConf * const m_page4;
0148     ServerConf * const m_page6;
0149     MiscConf * const m_page7;
0150 
0151     GpgServerModel * const m_serverModel; ///< model holding the servers
0152     KFontChooser * const m_fontchooser;
0153 
0154     bool m_useagent;
0155     bool m_defaultuseagent;
0156     bool m_encrypttoalways;
0157     bool m_defaultencrypttoalways;
0158     bool m_showsystray;
0159     int m_trayaction;
0160     int m_mailUats;
0161     int m_emailSortingIndex;
0162     QString m_emailTemplate;
0163 
0164     KGpgItemModel * const m_model;
0165     KeyListProxyModel * const m_combomodel;
0166 
0167     bool isValidKeyserver(const QString &);
0168 };
0169 
0170 #endif // KGPGOPTIONS_H