#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'ldapsettings.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "ldapsettings.h"

#include <ntqvariant.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <ntqlineedit.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a LdapSettings as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
LdapSettings::LdapSettings( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "LdapSettings" );
    LdapSettingsLayout = new TQVBoxLayout( this, 11, 6, "LdapSettingsLayout"); 

    layout9 = new TQGridLayout( 0, 1, 1, 0, 6, "layout9"); 

    kcfg_ldapuserfilter = new TQLineEdit( this, "kcfg_ldapuserfilter" );

    layout9->addMultiCellWidget( kcfg_ldapuserfilter, 1, 1, 1, 3 );

    kcfg_ldapgrouprdn = new KComboBox( false, this, "kcfg_ldapgrouprdn" );

    layout9->addWidget( kcfg_ldapgrouprdn, 2, 3 );

    kcfg_ldapgroupbase = new KLineEdit( this, "kcfg_ldapgroupbase" );

    layout9->addWidget( kcfg_ldapgroupbase, 2, 1 );

    kcfg_ldappasswordhash = new KComboBox( false, this, "kcfg_ldappasswordhash" );

    layout9->addWidget( kcfg_ldappasswordhash, 4, 1 );

    textLabel1 = new TQLabel( this, "textLabel1" );

    layout9->addWidget( textLabel1, 0, 0 );

    textLabel1_4_2 = new TQLabel( this, "textLabel1_4_2" );

    layout9->addWidget( textLabel1_4_2, 3, 0 );

    textLabel5 = new TQLabel( this, "textLabel5" );

    layout9->addWidget( textLabel5, 4, 2 );

    textLabel1_4 = new TQLabel( this, "textLabel1_4" );

    layout9->addWidget( textLabel1_4, 1, 0 );

    kcfg_ldapuserbase = new KLineEdit( this, "kcfg_ldapuserbase" );

    layout9->addWidget( kcfg_ldapuserbase, 0, 1 );

    kcfg_ldapgroupfilter = new TQLineEdit( this, "kcfg_ldapgroupfilter" );

    layout9->addMultiCellWidget( kcfg_ldapgroupfilter, 3, 3, 1, 3 );

    kcfg_ldapstructural = new KComboBox( false, this, "kcfg_ldapstructural" );

    layout9->addWidget( kcfg_ldapstructural, 4, 3 );

    textLabel3 = new TQLabel( this, "textLabel3" );

    layout9->addWidget( textLabel3, 2, 2 );

    kcfg_ldapuserrdn = new KComboBox( false, this, "kcfg_ldapuserrdn" );

    layout9->addWidget( kcfg_ldapuserrdn, 0, 3 );

    textLabel1_2 = new TQLabel( this, "textLabel1_2" );

    layout9->addWidget( textLabel1_2, 2, 0 );

    textLabel2 = new TQLabel( this, "textLabel2" );

    layout9->addWidget( textLabel2, 0, 2 );

    textLabel4 = new TQLabel( this, "textLabel4" );

    layout9->addWidget( textLabel4, 4, 0 );
    LdapSettingsLayout->addLayout( layout9 );

    kcfg_ldapshadow = new TQCheckBox( this, "kcfg_ldapshadow" );
    LdapSettingsLayout->addWidget( kcfg_ldapshadow );

    kcfg_ldapcnfullname = new TQCheckBox( this, "kcfg_ldapcnfullname" );
    LdapSettingsLayout->addWidget( kcfg_ldapcnfullname );

    kcfg_ldapgecos = new TQCheckBox( this, "kcfg_ldapgecos" );
    LdapSettingsLayout->addWidget( kcfg_ldapgecos );
    spacer6 = new TQSpacerItem( 20, 40, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    LdapSettingsLayout->addItem( spacer6 );
    languageChange();
    resize( TQSize(394, 227).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // tab order
    setTabOrder( kcfg_ldapuserbase, kcfg_ldapuserrdn );
    setTabOrder( kcfg_ldapuserrdn, kcfg_ldapuserfilter );
    setTabOrder( kcfg_ldapuserfilter, kcfg_ldapgroupbase );
    setTabOrder( kcfg_ldapgroupbase, kcfg_ldapgrouprdn );
    setTabOrder( kcfg_ldapgrouprdn, kcfg_ldapgroupfilter );
    setTabOrder( kcfg_ldapgroupfilter, kcfg_ldappasswordhash );
    setTabOrder( kcfg_ldappasswordhash, kcfg_ldapstructural );
    setTabOrder( kcfg_ldapstructural, kcfg_ldapshadow );
    setTabOrder( kcfg_ldapshadow, kcfg_ldapcnfullname );

    // buddies
    textLabel1->setBuddy( kcfg_ldapuserbase );
    textLabel1_4_2->setBuddy( kcfg_ldapgroupfilter );
    textLabel5->setBuddy( kcfg_ldapstructural );
    textLabel1_4->setBuddy( kcfg_ldapuserfilter );
    textLabel3->setBuddy( kcfg_ldapgrouprdn );
    textLabel1_2->setBuddy( kcfg_ldapgroupbase );
    textLabel2->setBuddy( kcfg_ldapuserrdn );
    textLabel4->setBuddy( kcfg_ldappasswordhash );
}

/*
 *  Destroys the object and frees any allocated resources
 */
LdapSettings::~LdapSettings()
{
    // no need to delete child widgets, TQt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void LdapSettings::languageChange()
{
    kcfg_ldapgrouprdn->clear();
    kcfg_ldapgrouprdn->insertItem( tr2i18n( "cn" ) );
    kcfg_ldapgrouprdn->insertItem( tr2i18n( "gidNumber" ) );
    kcfg_ldappasswordhash->clear();
    kcfg_ldappasswordhash->insertItem( tr2i18n( "Plain Text" ) );
    kcfg_ldappasswordhash->insertItem( tr2i18n( "CRYPT" ) );
    kcfg_ldappasswordhash->insertItem( tr2i18n( "MD5" ) );
    kcfg_ldappasswordhash->insertItem( tr2i18n( "SMD5" ) );
    kcfg_ldappasswordhash->insertItem( tr2i18n( "SHA" ) );
    kcfg_ldappasswordhash->insertItem( tr2i18n( "SSHA" ) );
    textLabel1->setText( tr2i18n( "User base:" ) );
    textLabel1_4_2->setText( tr2i18n( "Group filter:" ) );
    textLabel5->setText( tr2i18n( "Structural objectclass:" ) );
    textLabel1_4->setText( tr2i18n( "User filter:" ) );
    kcfg_ldapstructural->clear();
    kcfg_ldapstructural->insertItem( tr2i18n( "account" ) );
    kcfg_ldapstructural->insertItem( tr2i18n( "inetOrgPerson" ) );
    textLabel3->setText( tr2i18n( "Group RDN prefix:" ) );
    kcfg_ldapuserrdn->clear();
    kcfg_ldapuserrdn->insertItem( tr2i18n( "uid" ) );
    kcfg_ldapuserrdn->insertItem( tr2i18n( "uidNumber" ) );
    kcfg_ldapuserrdn->insertItem( tr2i18n( "cn" ) );
    textLabel1_2->setText( tr2i18n( "Group base:" ) );
    textLabel2->setText( tr2i18n( "User RDN prefix:" ) );
    textLabel4->setText( tr2i18n( "Password hash:" ) );
    kcfg_ldapshadow->setText( tr2i18n( "Manage shadowAccount objectclass" ) );
    kcfg_ldapcnfullname->setText( tr2i18n( "Store the user's full name in the cn attribute" ) );
    kcfg_ldapgecos->setText( tr2i18n( "Update the gecos attribute" ) );
}

/****************************************************************************
** LdapSettings meta object code from reading C++ file 'ldapsettings.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "ldapsettings.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *LdapSettings::className() const
{
    return "LdapSettings";
}

TQMetaObject *LdapSettings::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_LdapSettings( "LdapSettings", &LdapSettings::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString LdapSettings::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "LdapSettings", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString LdapSettings::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "LdapSettings", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* LdapSettings::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQWidget::staticMetaObject();
    static const TQUMethod slot_0 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"LdapSettings", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_LdapSettings.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* LdapSettings::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "LdapSettings" ) )
	return this;
    return TQWidget::tqt_cast( clname );
}

bool LdapSettings::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool LdapSettings::tqt_emit( int _id, TQUObject* _o )
{
    return TQWidget::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool LdapSettings::tqt_property( int id, int f, TQVariant* v)
{
    return TQWidget::tqt_property( id, f, v);
}

bool LdapSettings::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
