diff options
Diffstat (limited to 'src/ldap.cpp')
-rw-r--r-- | src/ldap.cpp | 74 |
1 files changed, 57 insertions, 17 deletions
diff --git a/src/ldap.cpp b/src/ldap.cpp index 2cd0d27..7038989 100644 --- a/src/ldap.cpp +++ b/src/ldap.cpp @@ -22,6 +22,7 @@ #include <klocale.h> #include <kglobal.h> +#include <kcombobox.h> #include <kparts/genericfactory.h> #include <ksimpleconfig.h> #include <kglobalsettings.h> @@ -35,31 +36,24 @@ #include <tqheader.h> #include "ldap.h" +#include "bondwizard.h" // FIXME // Connect this to CMake/Automake #define KDE_CONFDIR "/etc/trinity" -typedef KGenericFactory<ldap, TQWidget> ldapFactory; +typedef KGenericFactory<LDAPConfig, TQWidget> ldapFactory; K_EXPORT_COMPONENT_FACTORY( kcm_ldap, ldapFactory("kcmldap")) -KSimpleConfig *systemconfig; +KSimpleConfig *systemconfig = 0; -ldap::ldap(TQWidget *parent, const char *name, const TQStringList&) +LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&) : KCModule(parent, name), myAboutData(0) { TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/ldap/ldapconfigrc" )); - base = new LDAPConfigBase(this); - layout->add(base); - - setRootOnlyMsg(i18n("<b>Bonded LDAP realms take effect system wide, and require administrator access to modify</b><br>To alter the system's bonded LDAP realms, click on the \"Administrator Mode\" button below.")); - setUseRootOnlyMsg(true); - - load(); - KAboutData* about = new KAboutData("ldap", I18N_NOOP("TDE LDAP Manager"), "0.1", I18N_NOOP("TDE LDAP Manager Control Panel Module"), KAboutData::License_GPL, @@ -68,34 +62,80 @@ ldap::ldap(TQWidget *parent, const char *name, const TQStringList&) about->addAuthor("Timothy Pearson", 0, "[email protected]"); setAboutData( about ); + base = new LDAPConfigBase(this); + layout->add(base); + + setRootOnlyMsg(i18n("<b>Bonded LDAP realms take effect system wide, and require administrator access to modify</b><br>To alter the system's bonded LDAP realms, click on the \"Administrator Mode\" button below.")); + setUseRootOnlyMsg(true); + + connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); + connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(processLockouts())); + + connect(base->btnBondRealm, TQT_SIGNAL(clicked()), TQT_SLOT(bondToNewRealm())); + + load(); if (getuid() != 0 || !systemconfig->checkConfigFilesWritable( true )) { base->systemEnableSupport->setEnabled(false); } + + processLockouts(); }; -ldap::~ldap() { +LDAPConfig::~LDAPConfig() { delete systemconfig; } -void ldap::load() { +void LDAPConfig::load() { kgs = new KGlobalSettings(); KStandardDirs *ksd = new KStandardDirs(); + + load(false); +} + +void LDAPConfig::load(bool useDefaults ) +{ + //Update the toggle buttons with the current configuration + systemconfig->setReadDefaults( useDefaults ); + + systemconfig->setGroup(NULL); + base->systemEnableSupport->setChecked(systemconfig->readBoolEntry("EnableLDAP", false)); + + // Load realms + TQStringList cfgRealms = systemconfig->groupList(); + for (TQStringList::Iterator i(cfgRealms.begin()); i != cfgRealms.end(); ++i) { + (void)new TQListViewItem(base->ldapRealmList, "RAJA", *i); + } + + emit changed(useDefaults); } -void ldap::defaults() { +void LDAPConfig::defaults() { } -void ldap::save() { +void LDAPConfig::save() { } -int ldap::buttons() { +void LDAPConfig::processLockouts() { + bool panelIsEnabled = base->systemEnableSupport->isChecked(); + + base->groupRealms->setEnabled(panelIsEnabled); +} + +void LDAPConfig::bondToNewRealm() { + // RAJA FIXME + + BondWizard *bondwizard = new BondWizard(this); + bondwizard->show(); +} + +int LDAPConfig::buttons() { return KCModule::Apply|KCModule::Help; } -TQString ldap::quickHelp() const +TQString LDAPConfig::quickHelp() const { return i18n("This module configures which LDAP realms TDE uses for authentication."); } |