diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-16 00:41:57 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-16 00:41:57 +0200 |
| commit | 33c91102a58e2fbcf9d7a66e33b41a65fa3f0e0c (patch) | |
| tree | a724f0c3dcc48c8ce1f78c2665fe8ef170acb379 /src/trustedhostcollection.hpp | |
| parent | 5bb3f3f92e62a0af02fe475943759b8c25cd4592 (diff) | |
| download | kristall-33c91102a58e2fbcf9d7a66e33b41a65fa3f0e0c.tar.gz | |
Adds improved client certificate management, adds server certificate management.
Diffstat (limited to 'src/trustedhostcollection.hpp')
| -rw-r--r-- | src/trustedhostcollection.hpp | 48 |
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 |
