diff --git a/src/Makefile.am b/src/Makefile.am index 7e6c5d2..2d17844 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_ldap.la -kcm_ldap_la_SOURCES = ldap.cpp ldapconfigbase.ui realmpropertiesdialog.cpp realmpropertiesbase.ui bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp +kcm_ldap_la_SOURCES = ldap.cpp ldapconfigbase.ui realmpropertiesdialog.cpp bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp kcm_ldap_la_LIBADD = -lkio $(LIB_TDEUI) kcm_ldap_la_LDFLAGS = -avoid-version -module -no-undefined \ $(all_libraries) diff --git a/src/bondrealmpage.cpp b/src/bondrealmpage.cpp index 020c5a5..80f047a 100644 --- a/src/bondrealmpage.cpp +++ b/src/bondrealmpage.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "bondrealmpage.h" @@ -44,6 +45,7 @@ BondRealmPage::BondRealmPage(TQWidget *parent, const char *name ) : BondRealmPag connect(txtAdminServer, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); m_parentWizard = dynamic_cast(parent); + m_parentDialog = dynamic_cast(parent); } BondRealmPage::~BondRealmPage() { @@ -59,6 +61,14 @@ void BondRealmPage::validateEntries() { 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); + } + } } #include "bondrealmpage.moc" diff --git a/src/bondrealmpage.h b/src/bondrealmpage.h index 5117d7e..a73e166 100644 --- a/src/bondrealmpage.h +++ b/src/bondrealmpage.h @@ -27,6 +27,7 @@ class TQStringList; class KWizard; +class KDialogBase; /**Abstract class for the first wizard page. Sets the according selection on save() *@author Timothy Pearson @@ -44,6 +45,7 @@ public slots: private: KWizard* m_parentWizard; + KDialogBase* m_parentDialog; }; #endif diff --git a/src/ldap.cpp b/src/ldap.cpp index a3afbbf..2b230ba 100644 --- a/src/ldap.cpp +++ b/src/ldap.cpp @@ -37,6 +37,7 @@ #include "ldap.h" #include "bondwizard.h" +#include "realmpropertiesdialog.h" // FIXME // Connect this to CMake/Automake @@ -65,6 +66,7 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&) base = new LDAPConfigBase(this); layout->add(base); base->ldapRealmList->setAllColumnsShowFocus(true); + base->ldapRealmList->setFullWidth(true); setRootOnlyMsg(i18n("Bonded LDAP realms take effect system wide, and require administrator access to modify
To alter the system's bonded LDAP realms, click on the \"Administrator Mode\" button below.")); setUseRootOnlyMsg(true); @@ -75,6 +77,7 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&) connect(base->btnBondRealm, TQT_SIGNAL(clicked()), TQT_SLOT(bondToNewRealm())); connect(base->btnRemoveRealm, TQT_SIGNAL(clicked()), TQT_SLOT(removeRealm())); + connect(base->btnRealmProperties, TQT_SIGNAL(clicked()), TQT_SLOT(realmProperties())); load(); @@ -195,6 +198,9 @@ void LDAPConfig::save() { systemconfig->sync(); + // RAJA FIXME + // Write the appropriate /etc/krb5.conf file here! + load(); } @@ -250,6 +256,17 @@ void LDAPConfig::removeRealm() { } } +void LDAPConfig::realmProperties() { + TQListViewItem *selrealm = base->ldapRealmList->selectedItem(); + if (selrealm) { + RealmPropertiesDialog rpdialog(&m_realms, selrealm->text(1), this); + if (rpdialog.exec() == TQDialog::Accepted) { + updateRealmList(); + changed(); + } + } +} + int LDAPConfig::buttons() { return KCModule::Apply|KCModule::Help; } diff --git a/src/ldap.h b/src/ldap.h index 3494c12..93cdf10 100644 --- a/src/ldap.h +++ b/src/ldap.h @@ -78,6 +78,7 @@ class LDAPConfig: public KCModule void processLockouts(); void bondToNewRealm(); void removeRealm(); + void realmProperties(); private: void updateRealmList(); diff --git a/src/realmpropertiesbase.ui b/src/realmpropertiesbase.ui deleted file mode 100644 index 6e61a44..0000000 --- a/src/realmpropertiesbase.ui +++ /dev/null @@ -1,60 +0,0 @@ - -RealmPropertiesBase - - - RealmPropertiesBase - - - - 0 - 0 - 664 - 503 - - - - - 3 - 3 - 0 - 0 - - - - - 640 - 480 - - - - LDAP Realm Properties - - - - unnamed - - - - groupBox1 - - - - 7 - 7 - 0 - 0 - - - - Basic Settings - - - - unnamed - - - - - - - diff --git a/src/realmpropertiesdialog.cpp b/src/realmpropertiesdialog.cpp index 2ae9428..eaf09e2 100644 --- a/src/realmpropertiesdialog.cpp +++ b/src/realmpropertiesdialog.cpp @@ -20,23 +20,71 @@ #include #include +#include +#include #include #include #include #include #include +#include #include "realmpropertiesdialog.h" -RealmPropertiesDialog::RealmPropertiesDialog(LDAPRealmConfig* realm, TQWidget* parent, const char* name) - : KDialogBase(parent, name, true, i18n("Realm Properties"), Ok|Cancel, Ok, true), m_realmConfig(realm) +RealmPropertiesDialog::RealmPropertiesDialog(LDAPRealmConfigList *realmList, TQString realmName, TQWidget* parent, const char* name) + : KDialogBase(parent, name, true, i18n("Realm Properties"), Ok|Cancel, Ok, true), m_realmList(realmList), m_realmName(realmName) { - m_base = new RealmPropertiesBase(this); + m_base = new BondRealmPage(this); + + m_base->txtRealmName->setEnabled(false); + m_base->txtKDC->setEnabled(false); + m_base->txtKDCPort->setEnabled(false); + m_base->txtAdminServer->setEnabled(false); + m_base->txtAdminServerPort->setEnabled(false); + + m_base->px_introSidebar->hide(); + + LDAPRealmConfig realm = (*m_realmList)[m_realmName]; + + // Load values into dialog + m_base->txtRealmName->setText(realm.name); + m_base->txtUIDOffset->setValue(realm.uid_offset); + m_base->txtGIDOffset->setValue(realm.gid_offset); + m_base->txtDomains->setText(realm.domain_mappings.join("\n")); + m_base->txtKDC->setText(realm.kdc); + m_base->txtKDCPort->setValue(realm.kdc_port); + m_base->txtAdminServer->setText(realm.admin_server); + m_base->txtAdminServerPort->setValue(realm.admin_server_port); + m_base->checkRequireEKU->setChecked(realm.pkinit_require_eku); + m_base->checkRequireKrbtgtOtherName->setChecked(realm.pkinit_require_krbtgt_otherName); + m_base->checkWin2k->setChecked(realm.win2k_pkinit); + m_base->checkWin2kPkinitRequireBinding->setChecked(realm.win2k_pkinit_require_binding); + + setMainWidget(m_base); } -void RealmPropertiesDialog::slotOk() -{ - // accept(); or reject(); +void RealmPropertiesDialog::slotOk() { + // Load values into realmcfg + LDAPRealmConfig realm = (*m_realmList)[m_realmName]; + + realm.name = m_base->txtRealmName->text(); + realm.uid_offset = m_base->txtUIDOffset->value(); + realm.gid_offset = m_base->txtGIDOffset->value(); + realm.domain_mappings = TQStringList::split("\n", m_base->txtDomains->text(), FALSE); + realm.kdc = m_base->txtKDC->text(); + realm.kdc_port = m_base->txtKDCPort->value(); + realm.admin_server = m_base->txtAdminServer->text(); + realm.admin_server_port = m_base->txtAdminServerPort->value(); + realm.pkinit_require_eku = m_base->checkRequireEKU->isChecked(); + realm.pkinit_require_krbtgt_otherName = m_base->checkRequireKrbtgtOtherName->isChecked(); + realm.win2k_pkinit = m_base->checkWin2k->isChecked(); + realm.win2k_pkinit_require_binding = m_base->checkWin2kPkinitRequireBinding->isChecked(); + + // Remove m_realmName and re-add it + m_realmList->remove(m_realmName); + m_realmList->insert(m_realmName, realm); + + accept(); } #include "realmpropertiesdialog.moc" diff --git a/src/realmpropertiesdialog.h b/src/realmpropertiesdialog.h index 4c10062..c696cf0 100644 --- a/src/realmpropertiesdialog.h +++ b/src/realmpropertiesdialog.h @@ -24,21 +24,22 @@ #include #include "ldap.h" -#include "realmpropertiesbase.h" +#include "bondrealmpage.h" class RealmPropertiesDialog : public KDialogBase { Q_OBJECT public: - RealmPropertiesDialog(LDAPRealmConfig* realm, TQWidget* parent = 0, const char* name = 0); - + RealmPropertiesDialog(LDAPRealmConfigList *realmList, TQString realmName, TQWidget* parent = 0, const char* name = 0); + public slots: void slotOk(); private: - RealmPropertiesBase *m_base; - LDAPRealmConfig* m_realmConfig; + BondRealmPage *m_base; + LDAPRealmConfigList* m_realmList; + TQString m_realmName; }; #endif