diff options
Diffstat (limited to 'Userland/Applications/CertificateSettings/CertificateStore.h')
-rw-r--r-- | Userland/Applications/CertificateSettings/CertificateStore.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Userland/Applications/CertificateSettings/CertificateStore.h b/Userland/Applications/CertificateSettings/CertificateStore.h new file mode 100644 index 0000000000..ffcc3fd4f1 --- /dev/null +++ b/Userland/Applications/CertificateSettings/CertificateStore.h @@ -0,0 +1,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; +}; +} |