blob: ffcc3fd4f105039b3f850e5fc5933f82693406bf (
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
|
/*
* Copyright (c) 2023, Fabian Dellwing <fabian@dellwing.net>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Model.h>
#include <LibGUI/SettingsWindow.h>
#include <LibGUI/TableView.h>
#include <LibTLS/Certificate.h>
namespace CertificateSettings {
class CertificateStoreModel : public GUI::Model {
public:
enum Column {
IssuedTo,
IssuedBy,
Expire,
__Count
};
static NonnullRefPtr<CertificateStoreModel> create();
virtual ~CertificateStoreModel() override = default;
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_certificates.size(); }
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual DeprecatedString column_name(int) const override;
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual ErrorOr<void> load();
private:
Vector<Certificate> m_certificates;
};
class CertificateStoreWidget : public GUI::SettingsWindow::Tab {
C_OBJECT_ABSTRACT(CertStoreWidget)
public:
virtual ~CertificateStoreWidget() override = default;
static ErrorOr<NonnullRefPtr<CertificateStoreWidget>> try_create();
virtual void apply_settings() override {};
private:
CertificateStoreWidget() = default;
ErrorOr<void> initialize();
RefPtr<CertificateStoreModel> m_root_ca_model;
RefPtr<GUI::TableView> m_root_ca_tableview;
};
}
|