Add skeleton secondary realm wizard

pull/1/head
Timothy Pearson 13 years ago
parent a74f58160a
commit e2d9b461c3

@ -1,12 +1,12 @@
INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde
METASOURCES = AUTO
SUBDIRS = primaryrealmwizard
SUBDIRS = primaryrealmwizard secondaryrealmwizard
# Install this plugin in the KDE modules directory
kde_module_LTLIBRARIES = kcm_ldapcontroller.la
kcm_ldapcontroller_la_SOURCES = ldapcontroller.cpp ldapcontrollerconfigbase.ui processingdialog.cpp sha1.cc
kcm_ldapcontroller_la_LIBADD = primaryrealmwizard/libprimaryrealmwizard.la -lkio $(LIB_TDEUI) -ltdeldap
kcm_ldapcontroller_la_LIBADD = primaryrealmwizard/libprimaryrealmwizard.la secondaryrealmwizard/libsecondaryrealmwizard.la -lkio $(LIB_TDEUI) -ltdeldap
kcm_ldapcontroller_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries)

@ -51,7 +51,8 @@
#include "sha1.h"
#include "ldapcontroller.h"
#include "primaryrealmwizard/realmwizard.h"
#include "primaryrealmwizard/primaryrealmwizard.h"
#include "secondaryrealmwizard/secondaryrealmwizard.h"
#include "processingdialog.h"
#include "ldapcontrollerconfigbase.h"
@ -146,7 +147,6 @@ LDAPController::~LDAPController() {
void LDAPController::systemRoleChanged() {
if (m_base->systemRole->currentItem() != m_prevRole) {
if (m_base->systemRole->currentItem() == ROLE_PRIMARY_REALM_CONTROLLER) {
// Verify that this workstation was not already bonded to an LDAP realm!
bool bonded = false;
TQStringList cfgRealms = m_systemconfig->groupList();
@ -159,19 +159,20 @@ void LDAPController::systemRoleChanged() {
}
}
if (m_base->systemRole->currentItem() == ROLE_PRIMARY_REALM_CONTROLLER) {
if (bonded) {
KMessageBox::error(0, i18n("<qt>You are already bonded to a realm!<p>Please unbond from all realms before selecting a Realm Controller role</qt>"), i18n("Common Sense Failure"));
m_base->systemRole->setCurrentItem(0);
m_base->systemRole->setCurrentItem(m_prevRole);
}
else {
// Something will probably change
save();
RealmWizard realmwizard(this, m_fqdn, m_certconfig, this);
PrimaryRealmWizard realmwizard(this, m_fqdn, m_certconfig, this);
if (realmwizard.exec() < 0) {
// Wizard was cancelled
// Back out all changes!
m_base->systemRole->setCurrentItem(ROLE_WORKSTATION);
m_base->systemRole->setCurrentItem(m_prevRole);
save();
}
else {
@ -185,8 +186,34 @@ void LDAPController::systemRoleChanged() {
}
else if (m_base->systemRole->currentItem() == ROLE_SECONDARY_REALM_CONTROLLER) {
// RAJA FIXME
#if 0
KMessageBox::error(0, i18n("<qt>Secondary realm controller support is not yet available<p>If you want to see it implemented, contact the Trinity Desktop developers</qt>"), i18n("Feature Not Yet Available"));
m_base->systemRole->setCurrentItem(m_prevRole);
#else
if (bonded) {
KMessageBox::error(0, i18n("<qt>You are already bonded to a realm!<p>Please unbond from all realms before selecting a Realm Controller role</qt>"), i18n("Common Sense Failure"));
m_base->systemRole->setCurrentItem(m_prevRole);
}
else {
// Something will probably change
save();
SecondaryRealmWizard realmwizard(this, m_fqdn, m_certconfig, this);
if (realmwizard.exec() < 0) {
// Wizard was cancelled
// Back out all changes!
m_base->systemRole->setCurrentItem(m_prevRole);
save();
}
else {
// Wizard completed; commit changes
save();
}
// Something probably changed
load();
}
#endif
}
else if (m_base->systemRole->currentItem() == ROLE_WORKSTATION) {
if (KMessageBox::warningYesNo(this, i18n("<qt><b>WARNING</b><br>You are attempting to demote a realm controller<p>This action will <b>PERMANENTLY DESTROY</b> the realm directory stored on this machine<p>If you do not want to do this, select <b>Cancel</b> below</qt>"), i18n("Are you absolutely sure?"), TQString("Continue"), TQString("Cancel")) == KMessageBox::Yes) {

@ -2,4 +2,4 @@ INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde -I$(top_srcdir)/src
METASOURCES = AUTO
noinst_LTLIBRARIES = libprimaryrealmwizard.la
libprimaryrealmwizard_la_SOURCES = realmwizard.cpp realmintropagedlg.ui certconfigpagedlg.ui certconfigpage.cpp realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp
libprimaryrealmwizard_la_SOURCES = primaryrealmwizard.cpp realmintropagedlg.ui certconfigpagedlg.ui certconfigpage.cpp realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp

@ -40,7 +40,7 @@
#include "certconfigpage.h"
CertConfigPage::CertConfigPage(TQWidget *parent, const char *name ) : CertConfigPageDlg(parent,name) {
PrimaryCertConfigPage::PrimaryCertConfigPage(TQWidget *parent, const char *name ) : PrimaryCertConfigPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step2.png"));
@ -66,11 +66,11 @@ CertConfigPage::CertConfigPage(TQWidget *parent, const char *name ) : CertConfig
m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
CertConfigPage::~CertConfigPage() {
PrimaryCertConfigPage::~PrimaryCertConfigPage() {
//
}
void CertConfigPage::setUseGeneratedKeys(int state) {
void PrimaryCertConfigPage::setUseGeneratedKeys(int state) {
if (state == TQButton::On) {
generateKeysDisabled->setChecked(false);
@ -79,7 +79,7 @@ void CertConfigPage::setUseGeneratedKeys(int state) {
}
}
void CertConfigPage::setUseProvidedKeys(int state) {
void PrimaryCertConfigPage::setUseProvidedKeys(int state) {
if (state == TQButton::On) {
generateKeysEnabled->setChecked(false);
@ -88,7 +88,7 @@ void CertConfigPage::setUseProvidedKeys(int state) {
}
}
void CertConfigPage::processLockouts() {
void PrimaryCertConfigPage::processLockouts() {
kerberosPEM->setEnabled(generateKeysDisabled->isOn());
kerberosPEMKEY->setEnabled(generateKeysDisabled->isOn());
kerberosCRT->setEnabled(generateKeysDisabled->isOn());
@ -105,7 +105,7 @@ void CertConfigPage::processLockouts() {
emailAddress->setEnabled(generateKeysEnabled->isOn());
}
void CertConfigPage::validateEntries() {
void PrimaryCertConfigPage::validateEntries() {
if (m_parentWizard) {
if (generateKeysEnabled->isOn()) {
if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) {

@ -31,12 +31,12 @@ class TQStringList;
*@author Timothy Pearson
*/
class CertConfigPage : public CertConfigPageDlg {
class PrimaryCertConfigPage : public PrimaryCertConfigPageDlg {
Q_OBJECT
public:
CertConfigPage(TQWidget *parent=0, const char *name=0);
~CertConfigPage();
PrimaryCertConfigPage(TQWidget *parent=0, const char *name=0);
~PrimaryCertConfigPage();
public slots:
void validateEntries();

@ -1,8 +1,8 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>CertConfigPageDlg</class>
<class>PrimaryCertConfigPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>CertConfigPageDlg</cstring>
<cstring>PrimaryCertConfigPageDlg</cstring>
</property>
<property name="geometry">
<rect>

@ -57,27 +57,27 @@
#include "certconfigpage.h"
#include "realmfinishpage.h"
#include "realmwizard.h"
#include "realmwizard.moc"
#include "primaryrealmwizard.h"
#include "primaryrealmwizard.moc"
RealmWizard::RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget *parent, const char *name)
PrimaryRealmWizard::PrimaryRealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget *parent, const char *name)
: KWizard(parent, name, true), m_controller(controller), m_fqdn(fqdn), m_certconfig(certinfo) {
setCaption(i18n("LDAP Realm Wizard"));
intropage = new RealmIntroPage(this);
intropage = new PrimaryRealmIntroPage(this);
addPage (intropage, i18n( "Step 1: Introduction" ) );
setHelpEnabled(TQWizard::page(0), false);
realmpage = new RealmConfigPage(this);
realmpage = new PrimaryRealmConfigPage(this);
addPage (realmpage, i18n( "Step 2: Set Up New Realm" ) );
setHelpEnabled(TQWizard::page(1), false);
certpage = new CertConfigPage(this);
certpage = new PrimaryCertConfigPage(this);
addPage (certpage, i18n( "Step 3: Set Up Certificates" ) );
setHelpEnabled(TQWizard::page(2), false);
finishpage = new RealmFinishPage(this);
finishpage = new PrimaryRealmFinishPage(this);
addPage (finishpage, i18n( "Step 4: Initialize New Realm" ) );
setHelpEnabled(TQWizard::page(3), false);
@ -121,11 +121,11 @@ RealmWizard::RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConf
setPosition();
}
RealmWizard::~RealmWizard() {
PrimaryRealmWizard::~PrimaryRealmWizard() {
}
void RealmWizard::next() {
void PrimaryRealmWizard::next() {
if (currentPage()==intropage) {
TQWizard::next();
realmpage->validateEntries();
@ -222,15 +222,15 @@ void RealmWizard::next() {
}
}
void RealmWizard::slotNext() {
void PrimaryRealmWizard::slotNext() {
TQWizard::next();
}
void RealmWizard::back() {
void PrimaryRealmWizard::back() {
TQWizard::back();
}
bool RealmWizard::askClose(){
bool PrimaryRealmWizard::askClose(){
TQString text;
if (currentPage()==intropage) {
return true;
@ -259,13 +259,13 @@ 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 PrimaryRealmWizard::reject() {
if (askClose()){
done(-1);
}
}
void RealmWizard::closeEvent(TQCloseEvent* e){
void PrimaryRealmWizard::closeEvent(TQCloseEvent* e){
if ( askClose() )
done(0);
else
@ -273,7 +273,7 @@ void RealmWizard::closeEvent(TQCloseEvent* e){
}
/** maybe call a dialog that the wizard has finished. */
void RealmWizard::accept() {
void PrimaryRealmWizard::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"));
@ -306,13 +306,13 @@ void RealmWizard::accept() {
}
/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */
void RealmWizard::setDefaults() {
void PrimaryRealmWizard::setDefaults() {
// if(realm_dirty)
// realmpage->save(false);
}
/** there seems to be a bug in TQWizard, that makes this evil hack necessary */
void RealmWizard::setPosition() {
void PrimaryRealmWizard::setPosition() {
TQSize hint = intropage->sizeHint();
TQSize realm_size = realmpage->sizeHint();
TQSize finish_size = finishpage->sizeHint();

@ -18,8 +18,8 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef BONDWIZARD_H
#define BONDWIZARD_H
#ifndef PRIMARYREALMWIZARD_H
#define PRIMARYREALMWIZARD_H
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -32,19 +32,19 @@
/** prototypes */
class KLanguageCombo;
class RealmIntroPage;
class RealmConfigPage;
class CertConfigPage;
class RealmFinishPage;
class PrimaryRealmIntroPage;
class PrimaryRealmConfigPage;
class PrimaryCertConfigPage;
class PrimaryRealmFinishPage;
/** RealmWizard is the base class of the project */
class RealmWizard : public KWizard {
/** PrimaryRealmWizard is the base class of the project */
class PrimaryRealmWizard : public KWizard {
Q_OBJECT
public:
/** construtor */
RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0);
PrimaryRealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0);
/** destructor */
~RealmWizard();
~PrimaryRealmWizard();
virtual void next();
virtual void back();
@ -68,10 +68,10 @@ private:
void setPosition();
private:
RealmIntroPage* intropage;
RealmConfigPage* realmpage;
CertConfigPage* certpage;
RealmFinishPage* finishpage;
PrimaryRealmIntroPage* intropage;
PrimaryRealmConfigPage* realmpage;
PrimaryCertConfigPage* certpage;
PrimaryRealmFinishPage* finishpage;
bool realm_dirty;
LDAPController* m_controller;
LDAPRealmConfig m_realmconfig;

@ -38,7 +38,7 @@
#include "realmconfigpage.h"
RealmConfigPage::RealmConfigPage(TQWidget *parent, const char *name ) : RealmConfigPageDlg(parent,name) {
PrimaryRealmConfigPage::PrimaryRealmConfigPage(TQWidget *parent, const char *name ) : PrimaryRealmConfigPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step2.png"));
@ -52,11 +52,11 @@ RealmConfigPage::RealmConfigPage(TQWidget *parent, const char *name ) : RealmCon
m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
RealmConfigPage::~RealmConfigPage() {
PrimaryRealmConfigPage::~PrimaryRealmConfigPage() {
//
}
void RealmConfigPage::validateEntries() {
void PrimaryRealmConfigPage::validateEntries() {
if (m_parentWizard) {
if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) {
m_parentWizard->nextButton()->setEnabled(true);
@ -75,7 +75,7 @@ void RealmConfigPage::validateEntries() {
}
}
void RealmConfigPage::realmNameChanged() {
void PrimaryRealmConfigPage::realmNameChanged() {
TQString realmName = txtRealmName->text();
txtRealmName->setText(realmName.upper());

@ -31,12 +31,12 @@ class TQStringList;
*@author Timothy Pearson
*/
class RealmConfigPage : public RealmConfigPageDlg {
class PrimaryRealmConfigPage : public PrimaryRealmConfigPageDlg {
Q_OBJECT
public:
RealmConfigPage(TQWidget *parent=0, const char *name=0);
~RealmConfigPage();
PrimaryRealmConfigPage(TQWidget *parent=0, const char *name=0);
~PrimaryRealmConfigPage();
public slots:
void validateEntries();

@ -1,8 +1,8 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>RealmConfigPageDlg</class>
<class>PrimaryRealmConfigPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>RealmConfigPageDlg</cstring>
<cstring>PrimaryRealmConfigPageDlg</cstring>
</property>
<property name="geometry">
<rect>

@ -38,7 +38,7 @@
#include "realmfinishpage.h"
RealmFinishPage::RealmFinishPage(TQWidget *parent, const char *name ) : RealmFinishPageDlg(parent,name) {
PrimaryRealmFinishPage::PrimaryRealmFinishPage(TQWidget *parent, const char *name ) : PrimaryRealmFinishPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step3.png"));
@ -51,11 +51,11 @@ RealmFinishPage::RealmFinishPage(TQWidget *parent, const char *name ) : RealmFin
m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
RealmFinishPage::~RealmFinishPage(){
PrimaryRealmFinishPage::~PrimaryRealmFinishPage(){
//
}
void RealmFinishPage::validateEntries() {
void PrimaryRealmFinishPage::validateEntries() {
if (m_parentWizard) {
if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) {
m_parentWizard->finishButton()->setEnabled(true);

@ -31,12 +31,12 @@ class TQStringList;
*@author Timothy Pearson
*/
class RealmFinishPage : public RealmFinishPageDlg {
class PrimaryRealmFinishPage : public PrimaryRealmFinishPageDlg {
Q_OBJECT
public:
RealmFinishPage(TQWidget *parent=0, const char *name=0);
~RealmFinishPage();
PrimaryRealmFinishPage(TQWidget *parent=0, const char *name=0);
~PrimaryRealmFinishPage();
public slots:
void validateEntries();

@ -1,8 +1,8 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>RealmFinishPageDlg</class>
<class>PrimaryRealmFinishPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>RealmFinishPageDlg</cstring>
<cstring>PrimaryRealmFinishPageDlg</cstring>
</property>
<grid>
<property name="name">

@ -33,12 +33,12 @@
#include "realmintropage.h"
RealmIntroPage::RealmIntroPage(TQWidget *parent, const char *name ) : RealmIntroPageDlg(parent,name) {
PrimaryRealmIntroPage::PrimaryRealmIntroPage(TQWidget *parent, const char *name ) : PrimaryRealmIntroPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step1.png"));
}
RealmIntroPage::~RealmIntroPage(){
PrimaryRealmIntroPage::~PrimaryRealmIntroPage(){
//
}

@ -29,11 +29,11 @@ class TQStringList;
*@author Timothy Pearson
*/
class RealmIntroPage : public RealmIntroPageDlg {
class PrimaryRealmIntroPage : public PrimaryRealmIntroPageDlg {
Q_OBJECT
public:
RealmIntroPage(TQWidget *parent=0, const char *name=0);
~RealmIntroPage();
PrimaryRealmIntroPage(TQWidget *parent=0, const char *name=0);
~PrimaryRealmIntroPage();
};
#endif

@ -1,8 +1,8 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>RealmIntroPageDlg</class>
<class>PrimaryRealmIntroPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>RealmIntroPageDlg</cstring>
<cstring>PrimaryRealmIntroPageDlg</cstring>
</property>
<property name="geometry">
<rect>

@ -0,0 +1,5 @@
INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde -I$(top_srcdir)/src
METASOURCES = AUTO
noinst_LTLIBRARIES = libsecondaryrealmwizard.la
libsecondaryrealmwizard_la_SOURCES = secondaryrealmwizard.cpp realmintropagedlg.ui certconfigpagedlg.ui certconfigpage.cpp realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp

@ -0,0 +1,147 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <tqstringlist.h>
#include <tqlabel.h>
#include <tqmap.h>
#include <kapplication.h>
#include <ksimpleconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
#include <dcopclient.h>
#include <kprocess.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <kwizard.h>
#include <kdialogbase.h>
#include <tqpushbutton.h>
#include <tqradiobutton.h>
#include <kurlrequester.h>
#include "certconfigpage.h"
SecondaryCertConfigPage::SecondaryCertConfigPage(TQWidget *parent, const char *name ) : SecondaryCertConfigPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step2.png"));
connect(generateKeysEnabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseGeneratedKeys(int)));
connect(generateKeysDisabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseProvidedKeys(int)));
connect(kerberosPEM, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(kerberosPEMKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(kerberosCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(kerberosKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(ldapCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(ldapKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(organizationName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(orgUnitName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(commonName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(localityName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(stateOrProvinceName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(countryName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(emailAddress, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
m_parentWizard = dynamic_cast<KWizard*>(parent);
m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
SecondaryCertConfigPage::~SecondaryCertConfigPage() {
//
}
void SecondaryCertConfigPage::setUseGeneratedKeys(int state) {
if (state == TQButton::On) {
generateKeysDisabled->setChecked(false);
processLockouts();
validateEntries();
}
}
void SecondaryCertConfigPage::setUseProvidedKeys(int state) {
if (state == TQButton::On) {
generateKeysEnabled->setChecked(false);
processLockouts();
validateEntries();
}
}
void SecondaryCertConfigPage::processLockouts() {
kerberosPEM->setEnabled(generateKeysDisabled->isOn());
kerberosPEMKEY->setEnabled(generateKeysDisabled->isOn());
kerberosCRT->setEnabled(generateKeysDisabled->isOn());
kerberosKEY->setEnabled(generateKeysDisabled->isOn());
ldapCRT->setEnabled(generateKeysDisabled->isOn());
ldapKEY->setEnabled(generateKeysDisabled->isOn());
organizationName->setEnabled(generateKeysEnabled->isOn());
orgUnitName->setEnabled(generateKeysEnabled->isOn());
commonName->setEnabled(generateKeysEnabled->isOn());
localityName->setEnabled(generateKeysEnabled->isOn());
stateOrProvinceName->setEnabled(generateKeysEnabled->isOn());
countryName->setEnabled(generateKeysEnabled->isOn());
emailAddress->setEnabled(generateKeysEnabled->isOn());
}
void SecondaryCertConfigPage::validateEntries() {
if (m_parentWizard) {
if (generateKeysEnabled->isOn()) {
if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) {
m_parentWizard->nextButton()->setEnabled(true);
}
else {
m_parentWizard->nextButton()->setEnabled(false);
}
}
else {
if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) {
m_parentWizard->nextButton()->setEnabled(true);
}
else {
m_parentWizard->nextButton()->setEnabled(false);
}
}
}
if (m_parentDialog) {
if (generateKeysEnabled->isOn()) {
if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) {
m_parentDialog->enableButton(KDialogBase::Ok, true);
}
else {
m_parentDialog->enableButton(KDialogBase::Ok, false);
}
}
else {
if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) {
m_parentDialog->enableButton(KDialogBase::Ok, true);
}
else {
m_parentDialog->enableButton(KDialogBase::Ok, false);
}
}
}
}
#include "certconfigpage.moc"

@ -0,0 +1,54 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef CERTCONFIGPAGE_H
#define CERTCONFIGPAGE_H
#include <kwizard.h>
#include "certconfigpagedlg.h"
class TQStringList;
/**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson
*/
class SecondaryCertConfigPage : public SecondaryCertConfigPageDlg {
Q_OBJECT
public:
SecondaryCertConfigPage(TQWidget *parent=0, const char *name=0);
~SecondaryCertConfigPage();
public slots:
void validateEntries();
void processLockouts();
private slots:
void setUseGeneratedKeys(int state);
void setUseProvidedKeys(int state);
private:
KWizard* m_parentWizard;
KDialogBase* m_parentDialog;
};
#endif

@ -0,0 +1,319 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>SecondaryCertConfigPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>SecondaryCertConfigPageDlg</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>678</width>
<height>452</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1">
<property name="name">
<cstring>px_introSidebar</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>430</height>
</size>
</property>
<property name="frameShape">
<enum>Panel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupCertInfo</cstring>
</property>
<property name="title">
<string>Realm Certificate Information (required)</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQRadioButton" row="0" column="0">
<property name="name">
<cstring>generateKeysEnabled</cstring>
</property>
<property name="text">
<string>Generate New Certificates and Keys</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Organization</string>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="1" colspan="3">
<property name="name">
<cstring>organizationName</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Division/Unit</string>
</property>
</widget>
<widget class="TQLineEdit" row="2" column="1" colspan="3">
<property name="name">
<cstring>orgUnitName</cstring>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Certificate Owner</string>
</property>
</widget>
<widget class="TQLineEdit" row="3" column="1" colspan="3">
<property name="name">
<cstring>commonName</cstring>
</property>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>City/Locality</string>
</property>
</widget>
<widget class="TQLineEdit" row="4" column="1" colspan="3">
<property name="name">
<cstring>localityName</cstring>
</property>
</widget>
<widget class="TQLabel" row="5" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>State/Province</string>
</property>
</widget>
<widget class="TQLineEdit" row="5" column="1" colspan="1">
<property name="name">
<cstring>stateOrProvinceName</cstring>
</property>
</widget>
<widget class="TQLabel" row="5" column="2">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Country</string>
</property>
</widget>
<widget class="TQLineEdit" row="5" column="3" colspan="1">
<property name="name">
<cstring>countryName</cstring>
</property>
<property name="maxLength">
<number>2</number>
</property>
</widget>
<widget class="TQLabel" row="6" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Administrative Email</string>
</property>
</widget>
<widget class="TQLineEdit" row="6" column="1" colspan="3">
<property name="name">
<cstring>emailAddress</cstring>
</property>
</widget>
<widget class="TQRadioButton" row="10" column="0">
<property name="name">
<cstring>generateKeysDisabled</cstring>
</property>
<property name="text">
<string>Install Provided Certificates and Keys</string>
</property>
</widget>
<widget class="TQLabel" row="11" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Kerberos PKI CA Public Certificate</string>
</property>
</widget>
<widget class="KURLRequester" row="11" column="1" colspan="3">
<property name="name">
<cstring>kerberosPEM</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.pem|PKI Certificate Files (*.pem)</cstring>
</property>
</widget>
<widget class="TQLabel" row="12" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Kerberos PKI CA Private Key</string>
</property>
</widget>
<widget class="KURLRequester" row="12" column="1" colspan="3">
<property name="name">
<cstring>kerberosPEMKEY</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.key|Private Key (*.key)</cstring>
</property>
</widget>
<widget class="TQLabel" row="13" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Kerberos Public Certificate</string>
</property>
</widget>
<widget class="KURLRequester" row="13" column="1" colspan="3">
<property name="name">
<cstring>kerberosCRT</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.crt|Public Certificate (*.crt)</cstring>
</property>
</widget>
<widget class="TQLabel" row="14" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Kerberos Private Key</string>
</property>
</widget>
<widget class="KURLRequester" row="14" column="1" colspan="3">
<property name="name">
<cstring>kerberosKEY</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.key|Private Key (*.key)</cstring>
</property>
</widget>
<widget class="TQLabel" row="15" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>LDAP TLS Public Certificate</string>
</property>
</widget>
<widget class="KURLRequester" row="15" column="1" colspan="3">
<property name="name">
<cstring>ldapCRT</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.crt|Public Certificate (*.crt)</cstring>
</property>
</widget>
<widget class="TQLabel" row="16" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>LDAP TLS Private Key</string>
</property>
</widget>
<widget class="KURLRequester" row="16" column="1" colspan="3">
<property name="name">
<cstring>ldapKEY</cstring>
</property>
<property name="mode">
<number>25</number>
</property>
<property name="filter">
<cstring>*.key|Private Key (*.key)</cstring>
</property>
</widget>
</grid>
</widget>
<spacer row="3" column="1">
<property name="name">
<cstring>Spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
<spacer row="7" column="1">
<property name="name">
<cstring>Spacer5</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

@ -0,0 +1,90 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <tqstringlist.h>
#include <tqlabel.h>
#include <tqmap.h>
#include <kapplication.h>
#include <ksimpleconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
#include <dcopclient.h>
#include <kprocess.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <kwizard.h>
#include <kdialogbase.h>
#include <tqpushbutton.h>
#include "realmconfigpage.h"
SecondaryRealmConfigPage::SecondaryRealmConfigPage(TQWidget *parent, const char *name ) : SecondaryRealmConfigPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step2.png"));
connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(txtKDC, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(txtAdminServer, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(realmNameChanged()));
m_parentWizard = dynamic_cast<KWizard*>(parent);
m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
SecondaryRealmConfigPage::~SecondaryRealmConfigPage() {
//
}
void SecondaryRealmConfigPage::validateEntries() {
if (m_parentWizard) {
if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) {
m_parentWizard->nextButton()->setEnabled(true);
}
else {
m_parentWizard->nextButton()->setEnabled(false);
}
}
if (m_parentDialog) {
if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) {
m_parentDialog->enableButton(KDialogBase::Ok, true);
}
else {
m_parentDialog->enableButton(KDialogBase::Ok, false);
}
}
}
void SecondaryRealmConfigPage::realmNameChanged() {
TQString realmName = txtRealmName->text();
txtRealmName->setText(realmName.upper());
TQString defaultDomainAliases;
defaultDomainAliases = realmName.lower();
defaultDomainAliases += "\n";
defaultDomainAliases += ".";
defaultDomainAliases += realmName.lower();
txtDomains->setText(defaultDomainAliases);
}
#include "realmconfigpage.moc"

@ -0,0 +1,50 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef REALMCONFIGPAGE_H
#define REALMCONFIGPAGE_H
#include <kwizard.h>
#include "realmconfigpagedlg.h"
class TQStringList;
/**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson
*/
class SecondaryRealmConfigPage : public SecondaryRealmConfigPageDlg {
Q_OBJECT
public:
SecondaryRealmConfigPage(TQWidget *parent=0, const char *name=0);
~SecondaryRealmConfigPage();
public slots:
void validateEntries();
void realmNameChanged();
private:
KWizard* m_parentWizard;
KDialogBase* m_parentDialog;
};
#endif

@ -0,0 +1,293 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>SecondaryRealmConfigPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>SecondaryRealmConfigPageDlg</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>678</width>
<height>452</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1">
<property name="name">
<cstring>px_introSidebar</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>430</height>
</size>
</property>
<property name="frameShape">
<enum>Panel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupRealmInfo</cstring>
</property>
<property name="title">
<string>Basic Realm Information (required)</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Realm Name</string>
</property>
</widget>
<widget class="KLineEdit" row="0" column="1" colspan="3">
<property name="name">
<cstring>txtRealmName</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Key Distribution Server [KDC]</string>
</property>
</widget>
<widget class="KLineEdit" row="1" column="1">
<property name="name">
<cstring>txtKDC</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="2">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>port</string>
</property>
</widget>
<widget class="KIntNumInput" row="1" column="3">
<property name="name">
<cstring>txtKDCPort</cstring>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="maxValue">
<number>99999</number>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Administration Server</string>
</property>
</widget>
<widget class="KLineEdit" row="2" column="1">
<property name="name">
<cstring>txtAdminServer</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="2">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>port</string>
</property>
</widget>
<widget class="KIntNumInput" row="2" column="3">
<property name="name">
<cstring>txtAdminServerPort</cstring>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="maxValue">
<number>99999</number>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>labelUIDOffset</cstring>
</property>
<property name="text">
<string>UID offset</string>
</property>
<property name="hidden">
<string>true</string>
</property>
</widget>
<widget class="KIntNumInput" row="3" column="1" colspan="3">
<property name="name">
<cstring>txtUIDOffset</cstring>
</property>
<property name="minValue">
<number>100</number>
</property>
<property name="maxValue">
<number>99999</number>
</property>
<property name="hidden">
<string>true</string>
</property>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>labelGIDOffset</cstring>
</property>
<property name="text">
<string>GID offset</string>
</property>
<property name="hidden">
<string>true</string>
</property>
</widget>
<widget class="KIntNumInput" row="4" column="1" colspan="3">
<property name="name">
<cstring>txtGIDOffset</cstring>
</property>
<property name="minValue">
<number>100</number>
</property>
<property name="maxValue">
<number>99999</number>
</property>
<property name="hidden">
<string>true</string>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="1">
<property name="name">
<cstring>groupDomainAliases</cstring>
</property>
<property name="title">
<string>Realm Domain Aliases (optional)</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Enter each domain alias on a new line below</string>
</property>
</widget>
<widget class="KTextEdit" row="1" column="0">
<property name="name">
<cstring>txtDomains</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="2" column="1">
<property name="name">
<cstring>groupAdvancedPKInit</cstring>
</property>
<property name="title">
<string>Advanced PKInit Settings (optional)</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>checkRequireEKU</cstring>
</property>
<property name="text">
<string>Require EKU</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="1">
<property name="name">
<cstring>checkRequireKrbtgtOtherName</cstring>
</property>
<property name="text">
<string>Require KRB TGT Other Name</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="0">
<property name="name">
<cstring>checkWin2k</cstring>
</property>
<property name="text">
<string>Windows 2000 Compatibility</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="1">
<property name="name">
<cstring>checkWin2kPkinitRequireBinding</cstring>
</property>
<property name="text">
<string>Require Windows 2000 Binding</string>
</property>
</widget>
</grid>
</widget>
<spacer row="3" column="1">
<property name="name">
<cstring>Spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
<spacer row="7" column="1">
<property name="name">
<cstring>Spacer5</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

@ -0,0 +1,77 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <tqstringlist.h>
#include <tqlabel.h>
#include <tqmap.h>
#include <kapplication.h>
#include <ksimpleconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
#include <dcopclient.h>
#include <kprocess.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <kwizard.h>
#include <kdialogbase.h>
#include <tqpushbutton.h>
#include "realmfinishpage.h"
SecondaryRealmFinishPage::SecondaryRealmFinishPage(TQWidget *parent, const char *name ) : SecondaryRealmFinishPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step3.png"));
connect(ldapAdminUsername, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(ldapAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(ldapMachineAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
connect(ldapStandardUserGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries()));
m_parentWizard = dynamic_cast<KWizard*>(parent);
m_parentDialog = dynamic_cast<KDialogBase*>(parent);
}
SecondaryRealmFinishPage::~SecondaryRealmFinishPage(){
//
}
void SecondaryRealmFinishPage::validateEntries() {
if (m_parentWizard) {
if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) {
m_parentWizard->finishButton()->setEnabled(true);
}
else {
m_parentWizard->finishButton()->setEnabled(false);
}
}
if (m_parentDialog) {
if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) {
m_parentDialog->enableButton(KDialogBase::Ok, true);
}
else {
m_parentDialog->enableButton(KDialogBase::Ok, false);
}
}
}
#include "realmfinishpage.moc"

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef REALMFINISHPAGE_H
#define REALMFINISHPAGE_H
#include <kwizard.h>
#include "realmfinishpagedlg.h"
class TQStringList;
/**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson
*/
class SecondaryRealmFinishPage : public SecondaryRealmFinishPageDlg {
Q_OBJECT
public:
SecondaryRealmFinishPage(TQWidget *parent=0, const char *name=0);
~SecondaryRealmFinishPage();
public slots:
void validateEntries();
private:
KWizard* m_parentWizard;
KDialogBase* m_parentDialog;
};
#endif

@ -0,0 +1,181 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>SecondaryRealmFinishPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>SecondaryRealmFinishPageDlg</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0" rowspan="11" colspan="1">
<property name="name">
<cstring>px_introSidebar</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>430</height>
</size>
</property>
<property name="frameShape">
<enum>Panel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
<widget class="TQLabel" row="0" column="1" colspan="2">
<property name="name">
<cstring>yad_string</cstring>
</property>
<property name="text">
<string>&lt;h3&gt;You're almost done!&lt;/h3&gt;</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="1" colspan="2">
<property name="name">
<cstring>passprompt</cstring>
</property>
<property name="text">
<string>Please provide new LDAP realm administrator credentials below to finish setup</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
<widget class="KLineEdit" row="2" column="2">
<property name="name">
<cstring>ldapAdminUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="3" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<widget class="KPasswordEdit" row="3" column="2">
<property name="name">
<cstring>ldapAdminPassword</cstring>
</property>
</widget>
<widget class="TQLabel" row="4" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Confirm Password</string>
</property>
</widget>
<widget class="KPasswordEdit" row="4" column="2">
<property name="name">
<cstring>ldapConfirmAdminPassword</cstring>
</property>
</widget>
<widget class="TQLabel" row="5" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Realm Administration Group</string>
</property>
</widget>
<widget class="KLineEdit" row="5" column="2">
<property name="name">
<cstring>ldapAdminGroupname</cstring>
</property>
</widget>
<widget class="TQLabel" row="6" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Machine Administration Group</string>
</property>
</widget>
<widget class="KLineEdit" row="6" column="2">
<property name="name">
<cstring>ldapMachineAdminGroupname</cstring>
</property>
</widget>
<widget class="TQLabel" row="7" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>Standard User Group</string>
</property>
</widget>
<widget class="KLineEdit" row="7" column="2">
<property name="name">
<cstring>ldapStandardUserGroupname</cstring>
</property>
</widget>
<widget class="TQLabel" row="8" column="1">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>LDAP Realm</string>
</property>
</widget>
<widget class="KLineEdit" row="8" column="2">
<property name="name">
<cstring>ldapAdminRealm</cstring>
</property>
</widget>
<spacer row="9" column="1">
<property name="name">
<cstring>Spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
<spacer row="10" column="1">
<property name="name">
<cstring>Spacer5</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

@ -0,0 +1,45 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <tqstringlist.h>
#include <tqlabel.h>
#include <tqmap.h>
#include <kapplication.h>
#include <ksimpleconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
#include <dcopclient.h>
#include <kprocess.h>
#include "realmintropage.h"
SecondaryRealmIntroPage::SecondaryRealmIntroPage(TQWidget *parent, const char *name ) : SecondaryRealmIntroPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step1.png"));
}
SecondaryRealmIntroPage::~SecondaryRealmIntroPage(){
//
}
#include "realmintropage.moc"

@ -0,0 +1,39 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef REALMINTROPAGE_H
#define REALMINTROPAGE_H
#include "realmintropagedlg.h"
class TQStringList;
/**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson
*/
class SecondaryRealmIntroPage : public SecondaryRealmIntroPageDlg {
Q_OBJECT
public:
SecondaryRealmIntroPage(TQWidget *parent=0, const char *name=0);
~SecondaryRealmIntroPage();
};
#endif

@ -0,0 +1,119 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>SecondaryRealmIntroPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>SecondaryRealmIntroPageDlg</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>678</width>
<height>452</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1">
<property name="name">
<cstring>px_introSidebar</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>430</height>
</size>
</property>
<property name="frameShape">
<enum>Panel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
<widget class="TQLabel" row="0" column="1">
<property name="name">
<cstring>txt_welcome</cstring>
</property>
<property name="text">
<string>&lt;h3&gt;Welcome to the TDE LDAP Realm Setup Wizard!&lt;/h3&gt;</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="1">
<property name="name">
<cstring>TextLabel6</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;p&gt;This Wizard will help you create a new LDAP realm in four quick, easy steps.&lt;/p&gt;
&lt;p&gt;Please note that this Wizard will overwrite any existing LDAP realms and data.&lt;/p&gt;
&lt;p&gt;If you wish to quit the Wizard, click &lt;b&gt;Cancel&lt;/b&gt; at any time.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;NOTE:&lt;/b&gt; Kerberos and LDAP rely heavily on proper DNS resolution in order to function correctly. Therefore, you must have functional forward and reverse DNS entries for this system in order to complete this Wizard.&lt;/p&gt;</string>
</property>
<property name="textFormat">
<enum>RichText</enum>
</property>
<property name="alignment">
<set>WordBreak|AlignTop|AlignLeft</set>
</property>
<property name="vAlign" stdset="0">
</property>
<property name="wordwrap" stdset="0">
</property>
</widget>
<spacer row="2" column="1">
<property name="name">
<cstring>Spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
<spacer row="7" column="1">
<property name="name">
<cstring>Spacer5</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

@ -0,0 +1,337 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <unistd.h>
#include <tqpushbutton.h>
#include <tqlabel.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqfile.h>
#include <tqtimer.h>
#include <tqcursor.h>
#include <tqspinbox.h>
#include <tqcheckbox.h>
#include <tqradiobutton.h>
#include <ksimpleconfig.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kstandarddirs.h>
#include <klocale.h>
#include <kapplication.h>
#include <klistview.h>
#include <krun.h>
#include <kmessagebox.h>
#include <kconfig.h>
#include <knuminput.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <kpassdlg.h>
#include <kurlrequester.h>
#include <ksslcertificate.h>
#include <stdlib.h>
#include <kdebug.h>
#include "realmintropage.h"
#include "realmconfigpage.h"
#include "certconfigpage.h"
#include "realmfinishpage.h"
#include "secondaryrealmwizard.h"
#include "secondaryrealmwizard.moc"
SecondaryRealmWizard::SecondaryRealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget *parent, const char *name)
: KWizard(parent, name, true), m_controller(controller), m_fqdn(fqdn), m_certconfig(certinfo) {
setCaption(i18n("LDAP Realm Wizard"));
intropage = new SecondaryRealmIntroPage(this);
addPage (intropage, i18n( "Step 1: Introduction" ) );
setHelpEnabled(TQWizard::page(0), false);
realmpage = new SecondaryRealmConfigPage(this);
addPage (realmpage, i18n( "Step 2: Set Up New Realm" ) );
setHelpEnabled(TQWizard::page(1), false);
certpage = new SecondaryCertConfigPage(this);
addPage (certpage, i18n( "Step 3: Set Up Certificates" ) );
setHelpEnabled(TQWizard::page(2), false);
finishpage = new SecondaryRealmFinishPage(this);
addPage (finishpage, i18n( "Step 4: Initialize New Realm" ) );
setHelpEnabled(TQWizard::page(3), false);
// 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();
certpage->generateKeysEnabled->setChecked(true);
finishpage->ldapAdminGroupname->setText("realmadmins");
finishpage->ldapMachineAdminGroupname->setText("machineadmins");
finishpage->ldapStandardUserGroupname->setText("standardusers");
// Load certificate info
certpage->organizationName->setText(m_certconfig.organizationName);
certpage->orgUnitName->setText(m_certconfig.orgUnitName);
certpage->commonName->setText(m_certconfig.commonName);
certpage->localityName->setText(m_certconfig.localityName);
certpage->stateOrProvinceName->setText(m_certconfig.stateOrProvinceName);
certpage->countryName->setText(m_certconfig.countryName);
certpage->emailAddress->setText(m_certconfig.emailAddress);
// Other setup
finishpage->ldapAdminRealm->setEnabled(false);
// Kerberos won't work unless the DNS suffix matches the realm name
realmpage->txtRealmName->setEnabled(false);
setFinishEnabled(TQWizard::page(3), true);
setPosition();
}
SecondaryRealmWizard::~SecondaryRealmWizard() {
}
void SecondaryRealmWizard::next() {
if (currentPage()==intropage) {
TQWizard::next();
realmpage->validateEntries();
}
else if (currentPage()==realmpage) {
// Save realm information
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();
certpage->processLockouts();
certpage->validateEntries();
}
else if (currentPage()==certpage) {
// Save certificate information
m_certconfig.generate_certs = certpage->generateKeysEnabled->isOn();
m_certconfig.provided_kerberos_pem = certpage->kerberosPEM->url();
m_certconfig.provided_kerberos_pemkey = certpage->kerberosPEMKEY->url();
m_certconfig.provided_kerberos_crt = certpage->kerberosCRT->url();
m_certconfig.provided_kerberos_key = certpage->kerberosKEY->url();
m_certconfig.provided_ldap_crt = certpage->ldapCRT->url();
m_certconfig.provided_ldap_key = certpage->ldapKEY->url();
if (m_certconfig.generate_certs) {
m_certconfig.organizationName = certpage->organizationName->text();
m_certconfig.orgUnitName = certpage->orgUnitName->text();
m_certconfig.commonName = certpage->commonName->text();
m_certconfig.localityName = certpage->localityName->text();
m_certconfig.stateOrProvinceName = certpage->stateOrProvinceName->text();
m_certconfig.countryName = certpage->countryName->text();
m_certconfig.emailAddress = certpage->emailAddress->text();
}
else {
// If generate_certs == false, we need to load m_certconfig structure with data from the provided certificate
// If this is not done, the automatic certificate updater will fail!
TQFile file(m_certconfig.provided_kerberos_pem);
if (file.open(IO_ReadOnly)) {
TQByteArray ba = file.readAll();
file.close();
TQCString ssldata(ba);
ssldata.replace("-----BEGIN CERTIFICATE-----", "");
ssldata.replace("-----END CERTIFICATE-----", "");
ssldata.replace("\n", "");
KSSLCertificate* cert = KSSLCertificate::fromString(ssldata);
if (cert) {
TQString subj = cert->getSubject();
TQStringList subjList = TQStringList::split("/", subj, false);
for (TQStringList::Iterator it = subjList.begin(); it != subjList.end(); ++it) {
TQStringList kvPair = TQStringList::split("=", *it, false);
if (kvPair[0] == "O") {
m_certconfig.organizationName = kvPair[1];
}
else if (kvPair[0] == "OU") {
m_certconfig.orgUnitName = kvPair[1];
}
else if (kvPair[0] == "CN") {
m_certconfig.commonName = kvPair[1];
}
else if (kvPair[0] == "L") {
m_certconfig.localityName = kvPair[1];
}
else if (kvPair[0] == "ST") {
m_certconfig.stateOrProvinceName = kvPair[1];
}
else if (kvPair[0] == "C") {
m_certconfig.countryName = kvPair[1];
}
else if (kvPair[0] == "emailAddress") {
m_certconfig.emailAddress = kvPair[1];
}
}
delete cert;
}
}
}
TQWizard::next();
finishpage->validateEntries();
}
if (currentPage()==finishpage) {
finishButton()->setFocus();
}
}
void SecondaryRealmWizard::slotNext() {
TQWizard::next();
}
void SecondaryRealmWizard::back() {
TQWizard::back();
}
bool SecondaryRealmWizard::askClose(){
TQString text;
if (currentPage()==intropage) {
return true;
}
else {
if ((currentPage()==certpage) || (currentPage()==finishpage)) {
text = i18n("<p>Are you sure you want to quit the LDAP Realm 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 Realm Wizard?</p>"
"<p>If not, click <b>Cancel</b> to return and finish setup.</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;
}
}
}
/** the cancel button is connected to the reject() slot of TQDialog,
* so we have to reimplement this here to add a dialogbox to ask if we
* really want to quit the wizard.
*/
void SecondaryRealmWizard::reject() {
if (askClose()){
done(-1);
}
}
void SecondaryRealmWizard::closeEvent(TQCloseEvent* e){
if ( askClose() )
done(0);
else
e->ignore();
}
/** maybe call a dialog that the wizard has finished. */
void SecondaryRealmWizard::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;
// FIXME
// root account should not be locked to "admin"!
// when fixing, please fix the other instance of locked "admin" in ldapcontroller.cpp ::load()
backButton()->setEnabled(false);
nextButton()->setEnabled(false);
finishButton()->setEnabled(false);
cancelButton()->setEnabled(false);
if (m_controller->createNewLDAPRealm(this, m_realmconfig, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminGroupname->text(), finishpage->ldapMachineAdminGroupname->text(), finishpage->ldapStandardUserGroupname->text(), finishpage->ldapAdminPassword->password(), "admin", finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), m_certconfig, &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"));
}
backButton()->setEnabled(true);
finishButton()->setEnabled(true);
cancelButton()->setEnabled(true);
}
/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */
void SecondaryRealmWizard::setDefaults() {
// if(realm_dirty)
// realmpage->save(false);
}
/** there seems to be a bug in TQWizard, that makes this evil hack necessary */
void SecondaryRealmWizard::setPosition() {
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());
// set the position
TQRect rect = KGlobalSettings::desktopGeometry(TQCursor::pos());
int w = rect.x() + (rect.width() - hint.width())/2 - 9;
int h = rect.y() + (rect.height() - hint.height())/2;
move(w, h);
}

@ -0,0 +1,87 @@
/***************************************************************************
* Copyright (C) 2012 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef SECONDARYREALMWIZARD_H
#define SECONDARYREALMWIZARD_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kapplication.h>
#include <kwizard.h>
#include "ldapcontroller.h"
/** prototypes */
class KLanguageCombo;
class SecondaryRealmIntroPage;
class SecondaryRealmConfigPage;
class SecondaryCertConfigPage;
class SecondaryRealmFinishPage;
/** SecondaryRealmWizard is the base class of the project */
class SecondaryRealmWizard : public KWizard {
Q_OBJECT
public:
/** construtor */
SecondaryRealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0);
/** destructor */
~SecondaryRealmWizard();
virtual void next();
virtual void back();
public slots: // Public slots
/** calls all save functions after resetting all fields to Trinity default */
void setDefaults();
/** the cancel button is connected to the reject() slot of TQDialog,
* so we have to reimplement this here to add a dialogbox to
* ask if we really want to quit the wizard.
*/
void reject();
/** maybe call a dialog that the wizard has finished.
* Calls applySettings() to save the current selection.
*/
void accept();
/** We need this to use it in a TQTimer */
void slotNext();
private:
void setPosition();
private:
SecondaryRealmIntroPage* intropage;
SecondaryRealmConfigPage* realmpage;
SecondaryCertConfigPage* certpage;
SecondaryRealmFinishPage* finishpage;
bool realm_dirty;
LDAPController* m_controller;
LDAPRealmConfig m_realmconfig;
TQString m_fqdn;
LDAPCertConfig m_certconfig;
protected: // Protected methods
// the close button on the titlebar sets e->accept() which we don't want.
virtual void closeEvent(TQCloseEvent*);
bool askClose();
};
#endif
Loading…
Cancel
Save