diff options
author | Timothy Pearson <[email protected]> | 2012-06-01 02:39:31 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-06-01 02:39:31 -0500 |
commit | 28941371305de0bdbcc43e30d8c404953d047591 (patch) | |
tree | 4b6bb2ca8cce0b096c7156ef731241c27335c1ef /src/realmwizard.cpp | |
parent | 46d1d860d1ae8c455f19b4fd125eba4e0268022a (diff) | |
download | kcmldapcontroller-28941371305de0bdbcc43e30d8c404953d047591.tar.gz kcmldapcontroller-28941371305de0bdbcc43e30d8c404953d047591.zip |
Additional GUI work, now ready for deployment process
Diffstat (limited to 'src/realmwizard.cpp')
-rw-r--r-- | src/realmwizard.cpp | 69 |
1 files changed, 52 insertions, 17 deletions
diff --git a/src/realmwizard.cpp b/src/realmwizard.cpp index 6cca2ec..a8c9b81 100644 --- a/src/realmwizard.cpp +++ b/src/realmwizard.cpp @@ -28,6 +28,7 @@ #include <tqtimer.h> #include <tqcursor.h> #include <tqspinbox.h> +#include <tqcheckbox.h> #include <ksimpleconfig.h> #include <kglobal.h> @@ -55,8 +56,8 @@ #include "realmwizard.h" #include "realmwizard.moc" -RealmWizard::RealmWizard(LDAPController* controller, TQWidget *parent, const char *name) - : KWizard(parent, name, true), m_controller(controller) { +RealmWizard::RealmWizard(LDAPController* controller, TQString fqdn, TQWidget *parent, const char *name) + : KWizard(parent, name, true), m_controller(controller), m_fqdn(fqdn) { setCaption(i18n("LDAP Realm Wizard")); @@ -71,12 +72,22 @@ RealmWizard::RealmWizard(LDAPController* controller, TQWidget *parent, const cha finishpage = new RealmFinishPage(this); addPage (finishpage, i18n( "Step 3: Initialize New Realm" ) ); setHelpEnabled(TQWizard::page(2), false); -// -// // Set up some defaults -// realmpage->txtKDCPort->setValue(88); -// realmpage->txtAdminServerPort->setValue(749); -// realmpage->txtUIDOffset->setValue(5000); -// realmpage->txtGIDOffset->setValue(5000); + + // Set up some defaults + realmpage->txtKDCPort->setValue(88); + realmpage->txtAdminServerPort->setValue(749); + realmpage->txtUIDOffset->setValue(5000); + realmpage->txtGIDOffset->setValue(5000); + realmpage->txtGIDOffset->setValue(5000); + TQString domainGuess = m_fqdn; + int firstDot = domainGuess.find("."); + if (firstDot >= 0) { + domainGuess.remove(0, firstDot+1); + } + realmpage->txtRealmName->setText(domainGuess); + realmpage->txtKDC->setText(m_fqdn); + realmpage->txtAdminServer->setText(m_fqdn); + realmpage->realmNameChanged(); // Other setup finishpage->ldapAdminRealm->setEnabled(false); @@ -97,9 +108,23 @@ void RealmWizard::next() { } else if (currentPage()==realmpage) { // Save realm information - // RAJA FIXME + m_realmconfig.name = realmpage->txtRealmName->text(); + m_realmconfig.bonded = false; + m_realmconfig.uid_offset = realmpage->txtUIDOffset->value(); + m_realmconfig.gid_offset = realmpage->txtGIDOffset->value(); + m_realmconfig.domain_mappings = TQStringList::split("\n", realmpage->txtDomains->text(), FALSE); + m_realmconfig.kdc = realmpage->txtKDC->text(); + m_realmconfig.kdc_port = realmpage->txtKDCPort->value(); + m_realmconfig.admin_server = realmpage->txtAdminServer->text(); + m_realmconfig.admin_server_port = realmpage->txtAdminServerPort->value(); + m_realmconfig.pkinit_require_eku = realmpage->checkRequireEKU->isChecked(); + m_realmconfig.pkinit_require_krbtgt_otherName = realmpage->checkRequireKrbtgtOtherName->isChecked(); + m_realmconfig.win2k_pkinit = realmpage->checkWin2k->isChecked(); + m_realmconfig.win2k_pkinit_require_binding = realmpage->checkWin2kPkinitRequireBinding->isChecked(); + finishpage->ldapAdminRealm->setText(realmpage->txtRealmName->text()); TQWizard::next(); + finishpage->validateEntries(); } if (currentPage()==finishpage) { finishButton()->setFocus(); @@ -149,7 +174,7 @@ bool RealmWizard::askClose(){ * so we have to reimplement this here to add a dialogbox to ask if we * really want to quit the wizard. */ -void RealmWizard::reject(){ +void RealmWizard::reject() { if (askClose()){ done(-1); } @@ -163,20 +188,30 @@ void RealmWizard::closeEvent(TQCloseEvent* e){ } /** maybe call a dialog that the wizard has finished. */ -void RealmWizard::accept(){ +void RealmWizard::accept() { + // Validate entries + if (TQString(finishpage->ldapAdminPassword->password()) != TQString(finishpage->ldapConfirmAdminPassword->password())) { + KMessageBox::error(this, i18n("<qt><b>Passwords do not match!</b><p>Please re-enter the new administration account password</qt>"), i18n("Input Error")); + return; + } + if (TQString(finishpage->ldapAdminPassword->password()) == "") { + KMessageBox::error(this, i18n("<qt><b>Password required!</b><p>Please enter the new administration account password</qt>"), i18n("Input Error")); + return; + } + // Try to create realm TQString errorString; // RAJA FIXME -// if (m_ldapConfig->bondRealm(m_finalRealm, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), &errorString) == 0) { + if (m_controller->createNewLDAPRealm(this, m_realmconfig, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), &errorString) == 0) { done(0); -// } -// else { -// KMessageBox::error(this, i18n("<qt><b>Unable to create new realm!</b><p>Details: %1</qt>").arg(errorString), i18n("Unable to create new realm")); -// } + } + else { + KMessageBox::error(this, i18n("<qt><b>Unable to create new realm!</b><p>Details: %1</qt>").arg(errorString), i18n("Unable to create new realm")); + } } /** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */ -void RealmWizard::setDefaults(){ +void RealmWizard::setDefaults() { // if(realm_dirty) // realmpage->save(false); } |