blob: 521bc935223bd1a3cec304e1634218d78b36b512 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#ifndef USERSDIALOG_H_
#define USERSDIALOG_H_
#include <QCloseEvent>
#include <QDateTime>
#include <QDialog>
#include <QList>
#include <QStandardItemModel>
namespace Ui {
class UsersDialog;
}
class QListWidgetItem;
/*!
\struct UserInfo
\brief Stores key info lines including validity, creation date and more.
*/
struct UserInfo {
UserInfo() : validity('-'), have_secret(false), enabled(false) {}
/**
* @brief UserInfo::fullyValid when validity is f or u.
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
*/
bool fullyValid() { return validity == 'f' || validity == 'u'; }
/**
* @brief UserInfo::marginallyValid when validity is m.
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
*/
bool marginallyValid() { return validity == 'm'; }
/**
* @brief UserInfo::isValid when fullyValid or marginallyValid.
*/
bool isValid() { return fullyValid() || marginallyValid(); }
/**
* @brief UserInfo::name full name
*/
QString name;
/**
* @brief UserInfo::key_id hexadecimal representation
*/
QString key_id;
/**
* @brief UserInfo::validity GnuPG representation of validity
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
*/
char validity;
/**
* @brief UserInfo::have_secret secret key is available
* (can decrypt with this key)
*/
bool have_secret;
/**
* @brief UserInfo::enabled
*/
bool enabled;
/**
* @brief UserInfo::expiry date/time key expires
*/
QDateTime expiry;
/**
* @brief UserInfo::created date/time key was created
*/
QDateTime created;
};
/*!
\class UsersDialog
\brief Handles listing and editing of GPG users.
Selection of whom to encrypt to.
*/
class UsersDialog : public QDialog {
Q_OBJECT
public:
explicit UsersDialog(QWidget *parent = 0);
~UsersDialog();
void setUsers(QList<UserInfo> *);
protected:
void closeEvent(QCloseEvent *event);
void keyPressEvent(QKeyEvent *event);
private slots:
void itemChange(QListWidgetItem *item);
void on_lineEdit_textChanged(const QString &filter);
void on_checkBox_clicked();
private:
Ui::UsersDialog *ui;
QList<UserInfo> *userList;
void populateList(const QString &filter);
};
#endif // USERSDIALOG_H_
|