From 28941371305de0bdbcc43e30d8c404953d047591 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Jun 2012 02:39:31 -0500 Subject: Additional GUI work, now ready for deployment process --- src/realmwizard.cpp | 69 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 17 deletions(-) (limited to 'src/realmwizard.cpp') 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 #include #include +#include #include #include @@ -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("Passwords do not match!

Please re-enter the new administration account password"), i18n("Input Error")); + return; + } + if (TQString(finishpage->ldapAdminPassword->password()) == "") { + KMessageBox::error(this, i18n("Password required!

Please enter the new administration account password"), 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("Unable to create new realm!

Details: %1").arg(errorString), i18n("Unable to create new realm")); -// } + } + else { + KMessageBox::error(this, i18n("Unable to create new realm!

Details: %1").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); } -- cgit v1.2.1