summaryrefslogtreecommitdiffstats
path: root/src/bondwizard.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-05-18 16:03:27 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-05-18 16:03:27 -0500
commit37acc91cacd3f5c85e3254fcfd5794fcdcbadc27 (patch)
tree8a724d562c4bf6b2024340f507f58b1d4cf82af6 /src/bondwizard.cpp
parent96936f9f1272296b22c7ed6d6e68e944ba78a6b6 (diff)
downloadkcmldap-37acc91cacd3f5c85e3254fcfd5794fcdcbadc27.tar.gz
kcmldap-37acc91cacd3f5c85e3254fcfd5794fcdcbadc27.zip
Can now add/remove realms to TDE config file
Diffstat (limited to 'src/bondwizard.cpp')
-rw-r--r--src/bondwizard.cpp103
1 files changed, 78 insertions, 25 deletions
diff --git a/src/bondwizard.cpp b/src/bondwizard.cpp
index 3a7fc17..eeddfa6 100644
--- a/src/bondwizard.cpp
+++ b/src/bondwizard.cpp
@@ -27,6 +27,7 @@
#include <tqfile.h>
#include <tqtimer.h>
#include <tqcursor.h>
+#include <tqspinbox.h>
#include <ksimpleconfig.h>
#include <kglobal.h>
@@ -38,29 +39,45 @@
#include <krun.h>
#include <kmessagebox.h>
#include <kconfig.h>
+#include <knuminput.h>
+#include <klineedit.h>
+#include <ktextedit.h>
#include <stdlib.h>
#include <kdebug.h>
+#include "bondintropage.h"
#include "bondrealmpage.h"
#include "bondfinishpage.h"
#include "bondwizard.h"
#include "bondwizard.moc"
-BondWizard::BondWizard(TQWidget *parent, const char *name)
- : KWizard(parent, name, true) {
+BondWizard::BondWizard(LDAPRealmConfigList *realmlist, LDAPConfig *ldapconfig, TQWidget *parent, const char *name)
+ : KWizard(parent, name, true), m_realmList(realmlist), m_ldapConfig(ldapconfig) {
- realmpage= new BondRealmPage(this);
- addPage( realmpage, i18n( "Step 1: Introduction" ) );
+ setCaption(i18n("LDAP Bonding Wizard"));
+
+ intropage = new BondIntroPage(this);
+ addPage (intropage, i18n( "Step 1: Introduction" ) );
setHelpEnabled(TQWizard::page(0), false);
- finishpage= new BondFinishPage(this);
- addPage(finishpage, i18n( "Step 2: I want it my Way..." ) );
+ realmpage = new BondRealmPage(this);
+ addPage (realmpage, i18n( "Step 2: Add New Realm" ) );
setHelpEnabled(TQWizard::page(1), false);
- setFinishEnabled(TQWizard::page(1), true);
+ finishpage = new BondFinishPage(this);
+ addPage (finishpage, i18n( "Step 3: Bond to 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);
+
+ setFinishEnabled(TQWizard::page(2), true);
setPosition();
}
@@ -70,12 +87,38 @@ BondWizard::~BondWizard() {
void BondWizard::next() {
- if(currentPage()==realmpage) {
- realm_dirty=true; // set the dirty flag, changes done that need reverting
- // realmpage->save();
+ if (currentPage()==intropage) {
TQWizard::next();
+ realmpage->validateEntries();
}
- if(currentPage()==finishpage) {
+ else if (currentPage()==realmpage) {
+ // Save realm information
+ LDAPRealmConfig realm;
+
+ realm.name = realmpage->txtRealmName->text();
+ realm.bonded = false;
+ realm.uid_offset = realmpage->txtUIDOffset->value();
+ realm.gid_offset = realmpage->txtGIDOffset->value();
+ realm.domain_mappings = TQStringList::split("\n", realmpage->txtDomains->text(), FALSE);
+ realm.kdc = realmpage->txtKDC->text();
+ realm.kdc_port = realmpage->txtKDCPort->value();
+ realm.admin_server = realmpage->txtAdminServer->text();
+ realm.admin_server_port = realmpage->txtAdminServerPort->value();
+ realm.pkinit_require_eku = realmpage->checkRequireEKU->isChecked();
+ realm.pkinit_require_krbtgt_otherName = realmpage->checkRequireKrbtgtOtherName->isChecked();
+ realm.win2k_pkinit = realmpage->checkWin2k->isChecked();
+ realm.win2k_pkinit_require_binding = realmpage->checkWin2kPkinitRequireBinding->isChecked();
+
+ if (!m_realmList->contains(realm.name)) {
+ m_realmList->insert(realm.name, realm);
+ m_ldapConfig->save();
+ TQWizard::next();
+ }
+ else {
+ KMessageBox::error(this, i18n("<qt><b>The specified realm is already known to this system.</b><p>If the realm name is correct, please exit the Wizard and select 'Re-Bond to Realm' in the LDAP configuration module.</qt>"), i18n("Duplicate Realm Entry Detected"));
+ }
+ }
+ if (currentPage()==finishpage) {
finishButton()->setFocus();
}
}
@@ -90,20 +133,25 @@ void BondWizard::back() {
bool BondWizard::askClose(){
TQString text;
- if (currentPage()==realmpage) {
- text = i18n("<p>Are you sure you want to quit the LDAP Bonding Wizard?</p>"
- "<p>If yes, click <b>Quit</b> and all changes will be lost."
- "<br>If not, click <b>Cancel</b> to return and finish your setup.</p>");
- } else {
- text = i18n("<p>Are you sure you want to quit the LDAP Bonding Wizard?</p>"
- "<p>If not, click <b>Cancel</b> to return and finish bonding.</p>");
- }
- int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit());
- if(status==KMessageBox::Continue){
- setDefaults();
+ if (currentPage()==intropage) {
return true;
- } else {
- return false;
+ }
+ else {
+ if (currentPage()==realmpage) {
+ text = i18n("<p>Are you sure you want to quit the LDAP Bonding Wizard?</p>"
+ "<p>If yes, click <b>Quit</b> and all changes will be lost."
+ "<br>If not, click <b>Cancel</b> to return and finish your setup.</p>");
+ } else {
+ text = i18n("<p>Are you sure you want to quit the LDAP Bonding Wizard?</p>"
+ "<p>If not, click <b>Cancel</b> to return and finish bonding.</p>");
+ }
+ int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit());
+ if(status==KMessageBox::Continue){
+ setDefaults();
+ return true;
+ } else {
+ return false;
+ }
}
}
@@ -137,14 +185,19 @@ void BondWizard::setDefaults(){
/** there seems to be a bug in TQWizard, that makes this evil hack necessary */
void BondWizard::setPosition() {
- TQSize hint = realmpage->sizeHint();
+ TQSize hint = intropage->sizeHint();
+ TQSize realm_size = realmpage->sizeHint();
TQSize finish_size = finishpage->sizeHint();
// get the width of the broadest child-widget
+ if ( hint.width() < realm_size.width() )
+ hint.setWidth(realm_size.width());
if ( hint.width() < finish_size.width() )
hint.setWidth(finish_size.width());
// get the height of the highest child-widget
+ if ( hint.height() < realm_size.height() )
+ hint.setHeight(realm_size.height());
if ( hint.height() < finish_size.height() )
hint.setHeight(finish_size.height());