diff options
author | Timothy Pearson <[email protected]> | 2012-05-31 15:04:42 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-05-31 15:04:42 -0500 |
commit | 15ed3f5aa021307cadfdd59bcf0a4f51008cb0ef (patch) | |
tree | 99af61c1b6966f116ff07164a3a005be241f9290 /src/ldapcontroller.cpp | |
parent | 9ce051cdff3caa7d3c584d3e2934258f5195014a (diff) | |
download | kcmldapcontroller-15ed3f5aa021307cadfdd59bcf0a4f51008cb0ef.tar.gz kcmldapcontroller-15ed3f5aa021307cadfdd59bcf0a4f51008cb0ef.zip |
Add wizard skeleton for future development
Diffstat (limited to 'src/ldapcontroller.cpp')
-rw-r--r-- | src/ldapcontroller.cpp | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/src/ldapcontroller.cpp b/src/ldapcontroller.cpp index b8a75a8..88fc9a4 100644 --- a/src/ldapcontroller.cpp +++ b/src/ldapcontroller.cpp @@ -34,6 +34,8 @@ #include <tqdir.h> #include <tqheader.h> #include <kcombobox.h> +#include <kmessagebox.h> +#include <tqcheckbox.h> #include "ldapcontroller.h" @@ -41,6 +43,9 @@ // Connect this to CMake/Automake #define KDE_CONFDIR "/etc/trinity" +#define ROLE_WORKSTATION 0 +#define ROLE_REALM_CONTROLLER 1 + typedef KGenericFactory<LDAPController, TQWidget> ldapFactory; K_EXPORT_COMPONENT_FACTORY( kcm_ldapcontroller, ldapFactory("kcmldapcontroller")) @@ -64,19 +69,20 @@ LDAPController::LDAPController(TQWidget *parent, const char *name, const TQStrin layout->add(m_base); m_base->systemRole->clear(); - m_base->systemRole->insertItem("Workstation", -1); - m_base->systemRole->insertItem("Realm Controller", -1); - m_base->systemRole->setCurrentItem(0); + m_base->systemRole->insertItem("Workstation", ROLE_WORKSTATION); + m_base->systemRole->insertItem("Realm Controller", ROLE_REALM_CONTROLLER); setRootOnlyMsg(i18n("<b>LDAP controller settings take effect system wide, and require administrator access to modify</b><br>To alter the system's realm controller settings, click on the \"Administrator Mode\" button below.")); setUseRootOnlyMsg(true); + connect(m_base->systemEnableSupport, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); + connect(m_base->systemEnableSupport, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts())); connect(m_base->systemRole, TQT_SIGNAL(activated(const TQString&)), this, TQT_SLOT(systemRoleChanged())); load(); if (getuid() != 0 || !m_systemconfig->checkConfigFilesWritable( true )) { - m_base->systemRole->setEnabled(false); + m_base->systemEnableSupport->setEnabled(false); } processLockouts(); @@ -86,17 +92,52 @@ LDAPController::~LDAPController() { } void LDAPController::systemRoleChanged() { - // RAJA FIXME - // Verify that this workstation was not already bonded to an LDAP realm! - changed(); + if (m_base->systemRole->currentItem() != m_prevRole) { + if (m_base->systemRole->currentItem() == ROLE_REALM_CONTROLLER) { + // Verify that this workstation was not already bonded to an LDAP realm! + bool bonded = false; + TQStringList cfgRealms = m_systemconfig->groupList(); + for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) { + if ((*it).startsWith("LDAPRealm-")) { + m_systemconfig->setGroup(*it); + if (m_systemconfig->readBoolEntry("bonded", false) == true) { + bonded = true; + } + } + } + + 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); + } + else { + // RAJA FIXME + changed(); + } + } + if (m_base->systemRole->currentItem() == ROLE_WORKSTATION) { + // RAJA FIXME + } + } } void LDAPController::processLockouts() { - // + bool enabled = (m_base->systemEnableSupport->isEnabled() && m_base->systemEnableSupport->isChecked()); + + m_base->systemRole->setEnabled(enabled); } -void LDAPController::load() { - // +void LDAPController::load() { + m_systemconfig->setGroup(NULL); + m_base->systemEnableSupport->setChecked(m_systemconfig->readBoolEntry("EnableLDAP", false)); + TQString ldapRole = m_systemconfig->readEntry("LDAPRole", "Workstation"); + if (ldapRole == "RealmController") { + m_base->systemRole->setCurrentItem(ROLE_REALM_CONTROLLER); + } + else { + m_base->systemRole->setCurrentItem(ROLE_WORKSTATION); + } + m_prevRole = m_base->systemRole->currentItem(); } void LDAPController::defaults() { |