diff options
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/ldapcontroller.cpp | 62 | ||||
-rw-r--r-- | src/ldapcontroller.h | 27 | ||||
-rw-r--r-- | src/processingdialog.cpp | 203 | ||||
-rw-r--r-- | src/processingdialog.h | 76 | ||||
-rw-r--r-- | src/realmconfigpage.h | 2 | ||||
-rw-r--r-- | src/realmfinishpage.cpp | 29 | ||||
-rw-r--r-- | src/realmfinishpage.h | 16 | ||||
-rw-r--r-- | src/realmwizard.cpp | 69 | ||||
-rw-r--r-- | src/realmwizard.h | 4 |
10 files changed, 464 insertions, 26 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 377ec45..50e7e52 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ METASOURCES = AUTO # Install this plugin in the KDE modules directory kde_module_LTLIBRARIES = kcm_ldapcontroller.la -kcm_ldapcontroller_la_SOURCES = ldapcontroller.cpp ldapcontrollerconfigbase.ui realmwizard.cpp realmintropagedlg.ui realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp +kcm_ldapcontroller_la_SOURCES = ldapcontroller.cpp ldapcontrollerconfigbase.ui realmwizard.cpp realmintropagedlg.ui realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp processingdialog.cpp kcm_ldapcontroller_la_LIBADD = -lkio $(LIB_TDEUI) kcm_ldapcontroller_la_LDFLAGS = -avoid-version -module -no-undefined \ $(all_libraries) diff --git a/src/ldapcontroller.cpp b/src/ldapcontroller.cpp index a774263..ba7f5de 100644 --- a/src/ldapcontroller.cpp +++ b/src/ldapcontroller.cpp @@ -18,6 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> + #include <tqlayout.h> #include <klocale.h> @@ -39,6 +43,7 @@ #include "ldapcontroller.h" #include "realmwizard.h" +#include "processingdialog.h" // FIXME // Connect this to CMake/Automake @@ -80,6 +85,8 @@ LDAPController::LDAPController(TQWidget *parent, const char *name, const TQStrin connect(m_base->systemEnableSupport, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts())); connect(m_base->systemRole, TQT_SIGNAL(activated(const TQString&)), this, TQT_SLOT(systemRoleChanged())); + m_fqdn = getMachineFQDN(); + load(); if (getuid() != 0 || !m_systemconfig->checkConfigFilesWritable( true )) { @@ -92,6 +99,33 @@ LDAPController::LDAPController(TQWidget *parent, const char *name, const TQStrin LDAPController::~LDAPController() { } +// FIXME +// This should be moved to a TDE core library +TQString LDAPController::getMachineFQDN() { + struct addrinfo hints, *info, *p; + int gai_result; + + char hostname[1024]; + hostname[1023] = '\0'; + gethostname(hostname, 1023); + + memset(&hints, 0, sizeof hints); + hints.ai_family = AF_UNSPEC; // IPV4 or IPV6 + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + + if ((gai_result = getaddrinfo(hostname, NULL, &hints, &info)) != 0) { + return TQString(hostname); + } + TQString fqdn = TQString(hostname); + for (p=info; p!=NULL; p=p->ai_next) { + fqdn = TQString(p->ai_canonname); + } + freeaddrinfo(info); + + return fqdn; +} + void LDAPController::systemRoleChanged() { if (m_base->systemRole->currentItem() != m_prevRole) { if (m_base->systemRole->currentItem() == ROLE_REALM_CONTROLLER) { @@ -115,7 +149,7 @@ void LDAPController::systemRoleChanged() { // Something will probably change save(); - RealmWizard realmwizard(this, this); + RealmWizard realmwizard(this, m_fqdn, this); if (realmwizard.exec() < 0) { // Wizard was cancelled // Back out all changes! @@ -139,10 +173,21 @@ void LDAPController::processLockouts() { m_base->systemRole->setEnabled(enabled); } -void LDAPController::load() { +void LDAPController::load() { + bool thisIsMyMachine; + m_systemconfig->setGroup(NULL); m_base->systemEnableSupport->setChecked(m_systemconfig->readBoolEntry("EnableLDAP", false)); + if (m_fqdn == m_systemconfig->readEntry("HostFQDN", "")) { + thisIsMyMachine = true; + } + else { + thisIsMyMachine = false; + } TQString ldapRole = m_systemconfig->readEntry("LDAPRole", "Workstation"); + if (!thisIsMyMachine) { + ldapRole = "Workstation"; + } if (ldapRole == "Realm Controller") { m_base->systemRole->setCurrentItem(ROLE_REALM_CONTROLLER); } @@ -179,6 +224,19 @@ void LDAPController::save() { load(); } +int LDAPController::createNewLDAPRealm(TQWidget* dialogparent, LDAPRealmConfig realmconfig, TQString adminUserName, const char * adminPassword, TQString adminRealm, TQString *errstr) { + ProcessingDialog pdialog(dialogparent); + pdialog.setStatusMessage(i18n("Loading data for realm deployment...")); + pdialog.raise(); + pdialog.setActiveWindow(); +tqApp->processEvents(); +sleep(1); +tqApp->processEvents(); +sleep(5); + // RAJA FIXME + pdialog.closeDialog(); +} + int LDAPController::buttons() { return KCModule::Apply|KCModule::Help; } diff --git a/src/ldapcontroller.h b/src/ldapcontroller.h index a88ebfd..b09a46c 100644 --- a/src/ldapcontroller.h +++ b/src/ldapcontroller.h @@ -32,6 +32,25 @@ #include "ldapcontrollerconfigbase.h" +// PRIVATE +class LDAPRealmConfig +{ + public: + TQString name; + bool bonded; + long uid_offset; + long gid_offset; + TQStringList domain_mappings; + TQString kdc; + int kdc_port; + TQString admin_server; + int admin_server_port; + bool pkinit_require_eku; + bool pkinit_require_krbtgt_otherName; + bool win2k_pkinit; + bool win2k_pkinit_require_binding; +}; + class LDAPController: public KCModule { Q_OBJECT @@ -47,6 +66,13 @@ class LDAPController: public KCModule virtual TQString quickHelp() const; virtual const KAboutData *aboutData() const { return myAboutData; }; + public: + int createNewLDAPRealm(TQWidget* dialogparent, LDAPRealmConfig realmconfig, TQString adminUserName, const char * adminPassword, TQString adminRealm, TQString *errstr); + + // FIXME + // This should be moved to a TDE core library + TQString getMachineFQDN(); + private slots: void systemRoleChanged(); void processLockouts(); @@ -57,6 +83,7 @@ class LDAPController: public KCModule LDAPControllerConfigBase *m_base; KSimpleConfig *m_systemconfig; + TQString m_fqdn; int m_prevRole; }; diff --git a/src/processingdialog.cpp b/src/processingdialog.cpp new file mode 100644 index 0000000..a545a39 --- /dev/null +++ b/src/processingdialog.cpp @@ -0,0 +1,203 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 <kconfig.h> +#include <kapplication.h> +#include <kdialog.h> +#include <klocale.h> +#include <kiconloader.h> + +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqguardedptr.h> +#include <tqlineedit.h> +#include <tqvaluelist.h> +#include <tqtimer.h> +#include <tqcursor.h> +#include <tqlabel.h> +#include <tqstyle.h> +#include <tqimage.h> + +#ifdef Q_WS_X11 +#include <netwm.h> +#endif + +#include "processingdialog.h" + +ProcessingDialogHeader::ProcessingDialogHeader(TQWidget* parent) + : TQWidget( parent, "", Qt::WDestructiveClose ) +{ + TQVBoxLayout* vbox = new TQVBoxLayout( this ); + + TQFrame* frame = new TQFrame( this ); + frame->setFrameStyle( TQFrame::NoFrame ); + frame->setLineWidth( 0 ); + // we need to set the minimum size for the window + frame->setMinimumWidth(400); + vbox->addWidget( frame ); + TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, 0, KDialog::spacingHint() ); + TQHBoxLayout* centerbox = new TQHBoxLayout( KDialog::spacingHint() ); + TQHBoxLayout* seperatorbox = new TQHBoxLayout( 0 ); + centerbox->setMargin(0); + seperatorbox->setMargin(0); + + TQWidget* ticon = new TQWidget( frame ); + KIconLoader * ldr = KGlobal::iconLoader(); + TQPixmap trinityPixmap = ldr->loadIcon("kmenu", KIcon::Panel, KIcon::SizeLarge, KIcon::DefaultState, 0L, true); + + // Manually draw the alpha portions of the icon onto the widget background color... + TQRgb backgroundRgb = ticon->paletteBackgroundColor().rgb(); + TQImage correctedImage = trinityPixmap.convertToImage(); + correctedImage = correctedImage.convertDepth(32); + correctedImage.setAlphaBuffer(true); + int w = correctedImage.width(); + int h = correctedImage.height(); + for (int y = 0; y < h; ++y) { + TQRgb *ls = (TQRgb *)correctedImage.scanLine( y ); + for (int x = 0; x < w; ++x) { + TQRgb l = ls[x]; + float alpha_adjust = tqAlpha( l )/255.0; + int r = int( (tqRed( l ) * alpha_adjust) + (tqRed( backgroundRgb ) * (1.0-alpha_adjust)) ); + int g = int( (tqGreen( l ) * alpha_adjust) + (tqGreen( backgroundRgb ) * (1.0-alpha_adjust)) ); + int b = int( (tqBlue( l ) * alpha_adjust) + (tqBlue( backgroundRgb ) * (1.0-alpha_adjust)) ); + int a = int( 255 ); + ls[x] = tqRgba( r, g, b, a ); + } + } + trinityPixmap.convertFromImage(correctedImage); + + ticon->setBackgroundPixmap(trinityPixmap); + ticon->setMinimumSize(trinityPixmap.size()); + ticon->setMaximumSize(trinityPixmap.size()); + ticon->resize(trinityPixmap.size()); + centerbox->addWidget( ticon, AlignCenter ); + + TQWidget* swidget = new TQWidget( frame ); + swidget->resize(2, frame->sizeHint().width()); + swidget->setBackgroundColor(Qt::black); + seperatorbox->addWidget( swidget, AlignCenter ); + + TQLabel* label = new TQLabel( i18n("Trinity Desktop Environment"), frame ); + TQFont fnt = label->font(); + fnt.setBold( true ); + fnt.setPointSize( fnt.pointSize() * 3 / 2 ); + label->setFont( fnt ); + centerbox->addWidget( label, AlignCenter ); + + gbox->addLayout(centerbox, 0, 0); + gbox->addLayout(seperatorbox, 1, 0); + + setFixedSize( sizeHint() ); +} + +ProcessingDialogHeader::~ProcessingDialogHeader() +{ +} + +ProcessingDialog::ProcessingDialog(TQWidget* parent) + : TQWidget( parent, "systemmodaldialogclass", Qt::WType_Dialog | Qt::WDestructiveClose ), m_keepOnTopTimer(NULL), m_allowClose(false) + +{ + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + + TQVBoxLayout* vbox = new TQVBoxLayout( this ); + + TQFrame* frame = new TQFrame( this ); + frame->setFrameStyle( TQFrame::NoFrame ); + frame->setLineWidth( style().pixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) ); + // we need to set the minimum size for the window + frame->setMinimumWidth(400); + vbox->addWidget( frame ); + TQGridLayout* gbox = new TQGridLayout( frame, 1, 1, KDialog::marginHint(), KDialog::spacingHint() ); + TQHBoxLayout* centerbox = new TQHBoxLayout( frame, 0, KDialog::spacingHint() ); + + m_statusLabel = new TQLabel( i18n("Pondering what to do next").append("..."), frame ); + TQFont fnt = m_statusLabel->font(); + fnt.setBold( false ); + fnt.setPointSize( fnt.pointSize() * 1 ); + m_statusLabel->setFont( fnt ); + gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 0, AlignLeft | AlignVCenter ); + + ProcessingDialogHeader *theader = new ProcessingDialogHeader(this); + centerbox->addWidget( theader, AlignCenter ); + + gbox->addLayout(centerbox, 0, 0); + + setFixedSize( sizeHint() ); + setCaption( i18n("Please wait...") ); + + // Center the dialog + TQSize sh = sizeHint(); + TQRect rect = parent->geometry(); + move(rect.x() + (rect.width() - sh.width())/2, rect.y() + (rect.height() - sh.height())/2); + + show(); + keepMeOnTop(); +} + +ProcessingDialog::~ProcessingDialog() +{ + m_keepOnTopTimer->stop(); + delete m_keepOnTopTimer; +} + +void ProcessingDialog::keepMeOnTop() +{ + if (!m_keepOnTopTimer) { + m_keepOnTopTimer = new TQTimer(); + connect(m_keepOnTopTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(keepMeOnTop())); + m_keepOnTopTimer->start(100, FALSE); + } + setActiveWindow(); + raise(); + setFocus(); +} + +void ProcessingDialog::setStatusMessage(TQString message) +{ + if (message == "") { + m_statusLabel->setText(i18n("Pondering what to do next").append("...")); + } + else { + m_statusLabel->setText(message); + } +} + +void ProcessingDialog::closeDialog() +{ + m_allowClose = true; + close(); +} + +void ProcessingDialog::closeEvent(TQCloseEvent *e) +{ + //--------------------------------------------- + // Don't call the base function because + // we want to ignore the close event + //--------------------------------------------- + + if (m_allowClose) + TQWidget::closeEvent(e); +} + +#include "processingdialog.moc"
\ No newline at end of file diff --git a/src/processingdialog.h b/src/processingdialog.h new file mode 100644 index 0000000..982d6eb --- /dev/null +++ b/src/processingdialog.h @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 PROCESSINGDIALOG_H +#define PROCESSINGDIALOG_H + +#include <tqdialog.h> +#include <tdelibs_export.h> + +class TQLayoutItem; + + /** + * \brief A modal dialog header + * + * Internal use only + * + * @author Timothy Pearson <[email protected]> + */ +class TDEUI_EXPORT ProcessingDialogHeader : public TQWidget +{ + Q_OBJECT + + public: + ProcessingDialogHeader( TQWidget* parent ); + ~ProcessingDialogHeader(); +}; + + /** + * \brief A modal dialog + * + * This displays a special TDE modal dialog, + * which is used to present noninterruptible + * messages to the user. + * + * @author Timothy Pearson <[email protected]> + */ +class TQLabel; +class TDEUI_EXPORT ProcessingDialog : public TQWidget +{ + Q_OBJECT + + public: + ProcessingDialog( TQWidget* parent ); + ~ProcessingDialog(); + + void setStatusMessage(TQString message); + void closeDialog(); + + protected slots: + void keepMeOnTop(); + void closeEvent(TQCloseEvent *e); + + private: + TQTimer* m_keepOnTopTimer; + TQLabel* m_statusLabel; + bool m_allowClose; +}; + +#endif // PROCESSINGDIALOG_H
\ No newline at end of file diff --git a/src/realmconfigpage.h b/src/realmconfigpage.h index 642d622..99ff81f 100644 --- a/src/realmconfigpage.h +++ b/src/realmconfigpage.h @@ -40,8 +40,6 @@ public: public slots: void validateEntries(); - -private slots: void realmNameChanged(); private: diff --git a/src/realmfinishpage.cpp b/src/realmfinishpage.cpp index c9eb64e..c71fc0b 100644 --- a/src/realmfinishpage.cpp +++ b/src/realmfinishpage.cpp @@ -30,16 +30,45 @@ #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" RealmFinishPage::RealmFinishPage(TQWidget *parent, const char *name ) : RealmFinishPageDlg(parent,name) { px_introSidebar->setPixmap(UserIcon("step3.png")); + + connect(ldapAdminUsername, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + m_parentWizard = dynamic_cast<KWizard*>(parent); + m_parentDialog = dynamic_cast<KDialogBase*>(parent); } RealmFinishPage::~RealmFinishPage(){ // } +void RealmFinishPage::validateEntries() { + if (m_parentWizard) { + if (ldapAdminUsername->text() != "") { + m_parentWizard->finishButton()->setEnabled(true); + } + else { + m_parentWizard->finishButton()->setEnabled(false); + } + } + if (m_parentDialog) { + if (ldapAdminUsername->text() != "") { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } +} + #include "realmfinishpage.moc" diff --git a/src/realmfinishpage.h b/src/realmfinishpage.h index 3f03e7c..969d13b 100644 --- a/src/realmfinishpage.h +++ b/src/realmfinishpage.h @@ -21,6 +21,8 @@ #ifndef REALMFINISHPAGE_H #define REALMFINISHPAGE_H +#include <kwizard.h> + #include "realmfinishpagedlg.h" class TQStringList; @@ -31,9 +33,17 @@ class TQStringList; class RealmFinishPage : public RealmFinishPageDlg { Q_OBJECT -public: - RealmFinishPage(TQWidget *parent=0, const char *name=0); - ~RealmFinishPage(); + + public: + RealmFinishPage(TQWidget *parent=0, const char *name=0); + ~RealmFinishPage(); + + public slots: + void validateEntries(); + + private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; }; #endif 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); } diff --git a/src/realmwizard.h b/src/realmwizard.h index 111019f..35624e7 100644 --- a/src/realmwizard.h +++ b/src/realmwizard.h @@ -41,7 +41,7 @@ class RealmWizard : public KWizard { Q_OBJECT public: /** construtor */ - RealmWizard(LDAPController* controller, TQWidget* parent=0, const char *name=0); + RealmWizard(LDAPController* controller, TQString fqdn, TQWidget* parent=0, const char *name=0); /** destructor */ ~RealmWizard(); @@ -72,6 +72,8 @@ private: RealmFinishPage* finishpage; bool realm_dirty; LDAPController* m_controller; + LDAPRealmConfig m_realmconfig; + TQString m_fqdn; protected: // Protected methods // the close button on the titlebar sets e->accept() which we don't want. |