Public Member Functions | Protected Member Functions

UserEditor Class Reference
[Editors]

Editor for smartlet users. More...

#include <projecteditor.h>

Inheritance diagram for UserEditor:
Inheritance graph
[legend]
Collaboration diagram for UserEditor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UserEditor (QWidget *parent=0)

Protected Member Functions

virtual void onCurrentRecordChange (int row)

Detailed Description

Editor for smartlet users.


Constructor & Destructor Documentation

UserEditor::UserEditor ( QWidget parent = 0  )  [inline]

                                    : MappedBaseEditor(parent), privView(new PrivilegeEditor(this)) {
        setObjectName("UserEditor");
        setWindowTitle("User editor");

        //set source
        setTable("tbl_users", "user_name", Qt::AscendingOrder);
        model()->setRowIdentifierField("user_name");

        // widget setup
        QLabel *name = new QLabel("&Name*:", this);
        QLabel *pwd = new QLabel("&Password:", this);
        QLabel *priv = new QLabel("Project &rights:", this);
        QLineEdit *nameEdit = new QLineEdit(this);
        QLineEdit *pwdEdit = new QLineEdit(this);
        pwdEdit->setReadOnly(true);
        name->setBuddy(nameEdit);
        priv->setBuddy(privView);
        pwd->setBuddy(pwdEdit);

        // privilege box
        QGroupBox *privBox = new QGroupBox("Privileges", this);
        privBox->setLayout(new QVBoxLayout());
        QCheckBox *isAdmin = new QCheckBox("Admin", privBox);
        QCheckBox *canCreateProjects = new QCheckBox("Create projects", privBox);
        privBox->layout()->addWidget(isAdmin);
        privBox->layout()->addWidget(canCreateProjects);
        dynamic_cast<QBoxLayout*>(privBox->layout())->addStretch(0);

        // privileges hide columns
        privView->hideColumn("rls_user_name");

        // add widgets
        addWidget(name, 0, 0, 1, 1);
        addWidget(nameEdit, 0, 1, 1, 1, "user_name");
        addWidget(pwd, 1, 0, 1, 1);
        addWidget(pwdEdit, 1, 1, 1, 1, "password");
        addWidget(priv, 2, 0, 1, 2);
        addWidget(privView, 3, 0, 1, 2);
        addWidget(privBox, 0, 3, 4, 1);

        // add extra widget mappings
        addWidgetMapping(isAdmin, "isadmin");
        addWidgetMapping(canCreateProjects, "cancreateproject");

        // setup connections
        connect(nameEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));
        connect(isAdmin, SIGNAL(toggled(bool)), this, SLOT(updateButtons()));
        connect(canCreateProjects, SIGNAL(toggled(bool)), this, SLOT(updateButtons()));

        // update changes
        select();
        privView->select();
    }


Member Function Documentation

virtual void UserEditor::onCurrentRecordChange ( int  row  )  [inline, protected, virtual]

Reimplemented from MappedBaseEditor.

                                               {
        MappedBaseEditor::onCurrentRecordChange(row);
        updatePrivilegesView();
    }


The documentation for this class was generated from the following file: