Store encrypted passwords with connections.
Closes #22 as encrypted password is now deleted as part of the connection record.
This commit is contained in:
parent
e5ae9663c4
commit
d489f11e52
11 changed files with 252 additions and 695 deletions
|
|
@ -64,6 +64,10 @@ public:
|
|||
std::variant<int, QSqlError> addGroup(QString group_name);
|
||||
std::optional<QSqlError> removeGroup(int row);
|
||||
int findGroup(int conngroup_id) const;
|
||||
|
||||
static ConnectionConfig* getConfigFromModelIndex(QModelIndex index);
|
||||
|
||||
static ConnectionGroup* getGroupFromModelIndex(QModelIndex index);
|
||||
private:
|
||||
using Groups = QVector<std::shared_ptr<ConnectionGroup>>;
|
||||
|
||||
|
|
@ -78,61 +82,4 @@ private:
|
|||
std::optional<QSqlError> saveToDb(const ConnectionConfig &cc);
|
||||
};
|
||||
|
||||
#if false
|
||||
/** \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:
|
||||
enum Columns {
|
||||
Description,
|
||||
Name,
|
||||
Host,
|
||||
Port,
|
||||
User,
|
||||
Password,
|
||||
DbName,
|
||||
|
||||
ColCount
|
||||
};
|
||||
|
||||
ConnectionListModel(QObject *parent);
|
||||
ConnectionListModel(const ConnectionListModel&) = delete;
|
||||
~ConnectionListModel() override;
|
||||
|
||||
// BEGIN Model/View related functions
|
||||
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;
|
||||
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
// END Model/View related functions
|
||||
|
||||
Expected<ConnectionConfig> get(int row);
|
||||
|
||||
void load();
|
||||
// Writes all entries to storage
|
||||
void save();
|
||||
// Writes the specified entry to storage
|
||||
void save(int index);
|
||||
/** Matches cc to the list by looking at its uuid.
|
||||
*
|
||||
* If it is not in the list it is added. If the uuid is in the list that entry is updated.
|
||||
* In both cases the data is also directly written to long term storage.
|
||||
*/
|
||||
void save(const ConnectionConfig &cc);
|
||||
static QString makeLongDescription(const ConnectionConfig &cfg);
|
||||
private:
|
||||
|
||||
using ConnectionList = QVector<ConnectionConfig>;
|
||||
ConnectionList m_connections;
|
||||
|
||||
QString iniFileName();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // CONNECTIONLISTMODEL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue