aboutsummaryrefslogtreecommitdiff
path: root/src/dialogs/certificateselectiondialog.hpp
blob: 117e99168223c9d6421c3aa528bdfb902b99aa49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CERTIFICATESELECTIONDIALOG_HPP
#define CERTIFICATESELECTIONDIALOG_HPP

#include <QDialog>

#include "cryptoidentity.hpp"

namespace Ui {
class CertificateSelectionDialog;
}

class CertificateSelectionDialog : public QDialog
{
    Q_OBJECT

public:
    explicit CertificateSelectionDialog(QWidget *parent = nullptr);
    ~CertificateSelectionDialog();

    void setServerQuery(QString const & query);

    CryptoIdentity identity() const;

private slots:
    void on_use_temp_cert_30m_clicked();

    void on_use_temp_cert_1h_clicked();

    void on_use_temp_cert_12h_clicked();

    void on_use_temp_cert_24h_clicked();

    void on_use_temp_cert_48h_clicked();

    void on_create_new_cert_clicked();

    void on_use_selected_cert_clicked();

    void on_certificates_doubleClicked(const QModelIndex &index);

private:
    //! Creates an anonymous identity with a randomly chosen name that
    //! will time out on `timeout`, then accepts the dialog.
    void acceptTemporaryWithTimeout(const QDateTime &timeout);


    void on_currentChanged(const QModelIndex &current, const QModelIndex &previous);
private:
    Ui::CertificateSelectionDialog *ui;

    CryptoIdentity cryto_identity;
};

#endif // CERTIFICATESELECTIONDIALOG_HPP