Password is no longer saved with the connection list. Password is not entered along with other connection credentials. Password is now asked for when required. Still working on saving the password and auto retrieving it from the password manager.
47 lines
1.4 KiB
C++
47 lines
1.4 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();
|
|
|
|
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(int 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
|