diff options
author | Andreas Loibl <andreas@andreas-loibl.de> | 2011-03-17 05:07:10 +0100 |
---|---|---|
committer | Andreas Loibl <andreas@andreas-loibl.de> | 2011-03-17 05:07:10 +0100 |
commit | 00286a5db286e21a766b6af057052dc5d17561ad (patch) | |
tree | 7232dadf6dc3570705c3104fe0c000f480c7a0ee /wizard/usercfg.cpp | |
download | acritoxinstaller-00286a5db286e21a766b6af057052dc5d17561ad.zip acritoxinstaller-00286a5db286e21a766b6af057052dc5d17561ad.tar.gz |
Initial commit
Diffstat (limited to 'wizard/usercfg.cpp')
-rw-r--r-- | wizard/usercfg.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/wizard/usercfg.cpp b/wizard/usercfg.cpp new file mode 100644 index 0000000..0e625d6 --- /dev/null +++ b/wizard/usercfg.cpp @@ -0,0 +1,52 @@ +#include <QtGui> +#include "usercfg.h" +#include "../listdelegate.h" +#include "../listitem.h" + +wpUserCfg::wpUserCfg(QWidget *parent) : QWizardPage(parent) +{ + setupUi(this); + connect(realname, SIGNAL(editingFinished()), this, SLOT(realnameChanged())); + connect(realname, SIGNAL(textChanged(QString)), this, SLOT(updateStatus())); + connect(username, SIGNAL(textChanged(QString)), this, SLOT(updateStatus())); + + QValidator* usernameValidator = new QRegExpValidator(QRegExp("[a-zA-Z0-9-_.]*"), this); + username->setValidator( usernameValidator ); + + backend = Backend::instance(); + complete = false; + updateStatus(); +} + +void wpUserCfg::initializePage() +{ +} + +void wpUserCfg::realnameChanged() +{ + if(username->text().length()) return; + if(realname->text().contains(" ")) + username->setText(backend->cleanUsername(realname->text().section(" ",0,0).toLower())); + updateStatus(); +} + +void wpUserCfg::updateStatus() +{ + complete = false; + if(realname->text().length() && username->text().length()) complete = true; + emit completeChanged(); +} + +bool wpUserCfg::isComplete() const +{ + return complete; +} + +bool wpUserCfg::validatePage() +{ + if(!complete) return false; + backend->cfg("username", username->text()); + backend->cfg("realname", realname->text()); + return true; +} + |