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

0001 /*
0002     SPDX-FileCopyrightText: 2002 Jean-Baptiste Mardelle <bj@altern.org>
0003     SPDX-FileCopyrightText: 2007 Jimmy Gilles <jimmygilles@gmail.com>
0004     SPDX-FileCopyrightText: 2008, 2009, 2010, 2012, 2014, 2016, 2017 Rolf Eike Beer <kde@opensource.sf-tec.de>
0005     SPDX-FileCopyrightText: 2011 Philip G. Lee <rocketman768@gmail.com>
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef KGPGKEYINFODIALOG_H
0010 #define KGPGKEYINFODIALOG_H
0011 
0012 #include <QColor>
0013 #include <QDialog>
0014 #include <QLabel>
0015 #include <QString>
0016 
0017 #include "ui_kgpgKeyInfo.h"
0018 
0019 class QDialogButtonBox;
0020 
0021 class KGpgItemModel;
0022 class KGpgKeyNode;
0023 class KGpgChangeKey;
0024 
0025 class KgpgTrustLabel : public QWidget
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit KgpgTrustLabel(QWidget *parent = nullptr);
0031 
0032     void setText(const QString &text);
0033     void setColor(const QColor &color);
0034 
0035     QString text() const;
0036     QColor color() const;
0037 
0038 private:
0039     void change();
0040 
0041     QLabel *m_text_w;
0042     QLabel *m_color_w;
0043 
0044     QString m_text;
0045     QColor m_color;
0046 };
0047 
0048 class KgpgKeyInfo : public QDialog, public Ui::kgpgKeyInfo
0049 {
0050     Q_OBJECT
0051 
0052     KgpgKeyInfo() = delete;
0053     Q_DISABLE_COPY(KgpgKeyInfo)
0054 public:
0055     KgpgKeyInfo(KGpgKeyNode *node, KGpgItemModel *model, QWidget *parent);
0056     ~KgpgKeyInfo() override;
0057 
0058     KGpgChangeKey *keychange;
0059 
0060 Q_SIGNALS:
0061     void keyNeedsRefresh(KGpgKeyNode *node);
0062 
0063 private:
0064     void reloadKey();
0065     void reloadNode();
0066     void displayKey();
0067     void setControlEnable(const bool b);
0068     void okButtonClicked();
0069     void applyButtonClicked();
0070     void cancelButtonClicked();
0071 
0072 private Q_SLOTS:
0073     void slotOpenUrl();
0074 
0075     void slotChangeDate();
0076 
0077     void slotDisableKey(const bool ison);
0078 
0079     void slotChangePass();
0080     void slotInfoPasswordChanged(int result);
0081 
0082     void slotChangeTrust(const int newtrust);
0083 
0084     void slotLoadPhoto(const QString &uid);
0085 
0086     void slotApplied(int result);
0087 
0088     void slotKeyExpanded();
0089 
0090 private:
0091     KGpgKeyNode *m_node;
0092     KGpgItemModel * const m_model;
0093 
0094     KgpgTrustLabel * const m_trust;
0095 
0096     QDialogButtonBox *buttonBox;
0097 
0098     bool m_keywaschanged;
0099     bool m_closewhendone;
0100 };
0101 
0102 #endif // KGPGKEYINFODIALOG_H