Added list of databases and roles.

Roles works for atleast 9.3 and up.

Reorganizing code for communicating with database.
This commit is contained in:
eelke 2017-02-18 12:05:48 +01:00
parent 8c077b3d5f
commit 2d962334da
28 changed files with 881 additions and 428 deletions

39
src/RolesTableModel.h Normal file
View file

@ -0,0 +1,39 @@
#ifndef ROLESTABLEMODEL_H
#define ROLESTABLEMODEL_H
#include <QAbstractTableModel>
class PgAuthIdContainer;
/** Class for displaying the list of roles of a server in a QTableView
*
*/
class RolesTableModel : public QAbstractTableModel {
Q_OBJECT
public:
enum e_Columns : int { NameCol, SuperCol, InheritCol, CreateRoleCol,
CreateDBCol, CanLoginCol, ReplicationCol,
BypassRlsCol, ConnlimitCol, ValidUntilCol };
explicit RolesTableModel(QObject *parent);
void setRoleList(const PgAuthIdContainer* roles);
// 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;
private:
const PgAuthIdContainer *m_roles = nullptr;
};
#endif // ROLESTABLEMODEL_H