1 /*
2 
3     SPDX-License-Identifier: GPL-2.0-or-later
4 
5 */
6 
7 #ifndef KGPGSELECTSECRETKEY_H
8 #define KGPGSELECTSECRETKEY_H
9 
10 #include <QDialog>
11 
12 class QCheckBox;
13 class QComboBox;
14 class QPushButton;
15 class QTableView;
16 
17 class KGpgItemModel;
18 class SelectSecretKeyProxyModel;
19 
20 class KgpgSelectSecretKey : public QDialog
21 {
22     Q_OBJECT
23 
24 public:
25     /**
26      * Constructor.
27      * @param parent is the parent object
28      * @param model pass a pointer to a KGpgItemModel that stores the keys
29      * to select from
30      * @param countkey set to the number of keys that you are going to sign, 0 if you are going to sign a file
31      * @param allowLocal if option to sign keys locally should be offered (ignored if countkey == 0)
32      * @param allowTerminal if option to sign keys in terminal should be offered (ignored if countkey > 1)
33      */
34     KgpgSelectSecretKey(QWidget *parent, KGpgItemModel *model, const int countkey = 0, const bool allowLocal = true, const bool allowTerminal = true);
35     ~KgpgSelectSecretKey() override;
36 
37     QString getKeyID() const;
38     QString getKeyMail() const;
39     int getSignTrust() const;
40 
41     /**
42      * @return true if the constructor is called with \em signkey to true
43      * and if the user checked \em localsign
44      * @return false otherwise
45      */
46     bool isLocalSign() const;
47 
48     /**
49      * @return true if the constructor is called with \em signkey to true
50      * and if the user checked \em terminalsign
51      * @return false otherwise
52      */
53     bool isTerminalSign() const;
54 
55 private:
56     void slotOk();
57     void slotSelectionChanged();
58 
59     QCheckBox *m_localsign;
60     QCheckBox *m_terminalsign;
61 
62     QPushButton *m_okButton;
63 
64     QComboBox *m_signtrust;
65     QTableView *m_keyslist;
66     SelectSecretKeyProxyModel *m_proxy;
67 };
68 
69 #endif // KGPGSELECTSECRETKEY_H
70