itom
|
class for for visualizing the available users More...
#include <UserModel.h>
Public Types | |
enum | UserModelIndex { umiName = 0 , umiId = 1 , umiRole = 2 , umiIniFile = 3 , umiFeatures = 4 , umiPassword = 5 } |
Public Member Functions | |
UserModel () | |
~UserModel () | |
QString | getRoleName (const UserRole &role) const |
QString | getFeatureName (const UserFeature &feature) const |
QVariant | data (const QModelIndex &index, int role) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
QModelIndex | parent (const QModelIndex &index) const |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
int | addUser (const UserInfoStruct &newUser) |
void | removeAllUsers () |
bool | removeUser (const QModelIndex &index) |
QModelIndex | getUser (const QString &userId) const |
bool | hasPassword (const QModelIndex &index) const |
bool | checkPassword (const QModelIndex &index, const QString &password) const |
QString | getUserName (const QModelIndex &index) const |
QString | getUserId (const QModelIndex &index) const |
UserRole | getUserRole (const QModelIndex &index) const |
UserFeatures | getUserFeatures (const QModelIndex &index) const |
QString | getUserSettingsFile (const QModelIndex &index) const |
QModelIndex | currentUser () const |
bool | setCurrentUser (const QString &userId) |
Private Attributes | |
QList< QString > | m_headers |
string list of names of column headers | |
QList< QVariant > | m_alignment |
list of alignments for the corresponding headers | |
QList< UserInfoStruct > | m_userInfo |
list with user information | |
QModelIndex | m_currentUser |
the model index of the currently logged-in user | |
class for for visualizing the available users
The UserModel is used in the initially shown user list. It contains the userId (which is the user name part of the ini-file name), the plain text user name and the ini-file.
ito::UserModel::UserModel | ( | ) |
constructor
constructor, creating column headers for the tree view
ito::UserModel::~UserModel | ( | ) |
destructor - clean up, clear header and alignment list
int ito::UserModel::addUser | ( | const UserInfoStruct & | newUser | ) |
Adds a user to the current model
newUser | Struct containing new User |
returns the passed row as index, as the users are arranged in a simple one dimensional list
int ito::UserModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return column count
[in] | parent | parent of current item |
QVariant ito::UserModel::data | ( | const QModelIndex & | index, |
int | role ) const |
return data elements for a given row
[in] | index | index for which the data elements should be delivered |
[in] | role | the current role of the model |
This method is actually used to fill the tree view. It returns the data for the selected element, depending as well on the column of the selected element, passed in index.column. The method here is divided into two parts. The first one handles requests for root elements (plugins) the second one is used for child elements (instances of plugins).
QVariant ito::UserModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole ) const |
return the header / captions for the tree view model
QModelIndex ito::UserModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() ) const |
return current index element
[in] | row | row of current element |
[in] | column | column of current element |
[in] | parent | parent of current element |
returns the passed row as index, as the users are arranged in a simple one dimensional list
QModelIndex ito::UserModel::parent | ( | const QModelIndex & | index | ) | const |
return parent element
[in] | index | the element's index for which the parent should be returned |
int ito::UserModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return number of rows
[in] | parent | parent of current item |