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

0001 /*
0002 
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 */
0006 
0007 #ifndef KGPGSELECTSECRETKEY_H
0008 #define KGPGSELECTSECRETKEY_H
0009 
0010 #include <QDialog>
0011 
0012 class QCheckBox;
0013 class QComboBox;
0014 class QPushButton;
0015 class QTableView;
0016 
0017 class KGpgItemModel;
0018 class SelectSecretKeyProxyModel;
0019 
0020 class KgpgSelectSecretKey : public QDialog
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     /**
0026      * Constructor.
0027      * @param parent is the parent object
0028      * @param model pass a pointer to a KGpgItemModel that stores the keys
0029      * to select from
0030      * @param countkey set to the number of keys that you are going to sign, 0 if you are going to sign a file
0031      * @param allowLocal if option to sign keys locally should be offered (ignored if countkey == 0)
0032      * @param allowTerminal if option to sign keys in terminal should be offered (ignored if countkey > 1)
0033      */
0034     KgpgSelectSecretKey(QWidget *parent, KGpgItemModel *model, const int countkey = 0, const bool allowLocal = true, const bool allowTerminal = true);
0035     ~KgpgSelectSecretKey() override;
0036 
0037     QString getKeyID() const;
0038     QString getKeyMail() const;
0039     int getSignTrust() const;
0040 
0041     /**
0042      * @return true if the constructor is called with \em signkey to true
0043      * and if the user checked \em localsign
0044      * @return false otherwise
0045      */
0046     bool isLocalSign() const;
0047 
0048     /**
0049      * @return true if the constructor is called with \em signkey to true
0050      * and if the user checked \em terminalsign
0051      * @return false otherwise
0052      */
0053     bool isTerminalSign() const;
0054 
0055 private:
0056     void slotOk();
0057     void slotSelectionChanged();
0058 
0059     QCheckBox *m_localsign;
0060     QCheckBox *m_terminalsign;
0061 
0062     QPushButton *m_okButton;
0063 
0064     QComboBox *m_signtrust;
0065     QTableView *m_keyslist;
0066     SelectSecretKeyProxyModel *m_proxy;
0067 };
0068 
0069 #endif // KGPGSELECTSECRETKEY_H