aboutsummaryrefslogtreecommitdiff
path: root/src/trustedhostcollection.hpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-16 00:41:57 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-16 00:41:57 +0200
commit33c91102a58e2fbcf9d7a66e33b41a65fa3f0e0c (patch)
treea724f0c3dcc48c8ce1f78c2665fe8ef170acb379 /src/trustedhostcollection.hpp
parent5bb3f3f92e62a0af02fe475943759b8c25cd4592 (diff)
downloadkristall-33c91102a58e2fbcf9d7a66e33b41a65fa3f0e0c.tar.gz
Adds improved client certificate management, adds server certificate management.
Diffstat (limited to 'src/trustedhostcollection.hpp')
-rw-r--r--src/trustedhostcollection.hpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/trustedhostcollection.hpp b/src/trustedhostcollection.hpp
new file mode 100644
index 0000000..6974a10
--- /dev/null
+++ b/src/trustedhostcollection.hpp
@@ -0,0 +1,48 @@
+#ifndef TRUSTEDHOSTCOLLECTION_HPP
+#define TRUSTEDHOSTCOLLECTION_HPP
+
+#include <QAbstractTableModel>
+
+#include "trustedhost.hpp"
+#include <optional>
+
+class TrustedHostCollection : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ explicit TrustedHostCollection(QObject *parent = nullptr);
+
+ TrustedHostCollection(TrustedHostCollection const &);
+ TrustedHostCollection(TrustedHostCollection &&);
+
+ // Header:
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+
+ // Basic functionality:
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+
+public:
+ TrustedHostCollection & operator=(TrustedHostCollection const &);
+ TrustedHostCollection & operator=(TrustedHostCollection &&);
+
+ void clear();
+
+ bool insert(TrustedHost const & host);
+
+ std::optional<TrustedHost> get(QString const & host_name) const;
+
+ std::optional<TrustedHost> get(QModelIndex const & index) const;
+
+ void remove(QModelIndex const & index);
+
+ QVector<TrustedHost> getAll() const;
+
+private:
+ QVector<TrustedHost> items;
+};
+
+#endif // TRUSTEDHOSTCOLLECTION_HPP