pgLab/pglab/ConnectionListModel.h
eelke e36924c087 Passwords are now saved in a password manager.
The password manager uses strong encryption using a key derived from the passphrase using
scrypt key strengthening algorithm. This ensures encryption is performed using a strong key
and that brute forcing the passphrase is time consuming.

If the user loses his passphrase no recovery is possible.
2018-11-08 21:50:49 +01:00

47 lines
1.5 KiB
C++

#ifndef CONNECTIONLISTMODEL_H
#define CONNECTIONLISTMODEL_H
#include <vector>
#include <memory>
#include <QAbstractListModel>
#include "ConnectionConfig.h"
#include "Expected.h"
class ConnectionList;
/** \brief Model class for the list of connections.
*
* This class also allows for the editing of the list.
*/
class ConnectionListModel : public QAbstractListModel {
Q_OBJECT
public:
ConnectionListModel(ConnectionList *conns, QObject *parent);
ConnectionListModel(const ConnectionListModel&) = delete;
~ConnectionListModel() override;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &/*parent*/) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
// virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
void newItem();
Expected<ConnectionConfig> get(size_t row);
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
void save();
void save(size_t index);
void save(size_t index, const ConnectionConfig &cc);
static QString makeLongDescription(const ConnectionConfig &cfg);
private:
ConnectionList *m_connections;
};
#endif // CONNECTIONLISTMODEL_H