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

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

#include "passwordpolicy.h"

#include <ntqvariant.h>
#include <kdatetimewidget.h>
#include <ntqlabel.h>
#include <ntqspinbox.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a PasswordPolicy as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
PasswordPolicy::PasswordPolicy( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "PasswordPolicy" );
    setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
    PasswordPolicyLayout = new TQVBoxLayout( this, 11, 6, "PasswordPolicyLayout"); 

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

    textLabel1_3 = new TQLabel( this, "textLabel1_3" );
    textLabel1_3->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignRight ) );

    layout3->addWidget( textLabel1_3, 2, 0 );

    textLabel1_2 = new TQLabel( this, "textLabel1_2" );
    textLabel1_2->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignRight ) );

    layout3->addWidget( textLabel1_2, 1, 0 );

    textLabel1_4 = new TQLabel( this, "textLabel1_4" );
    textLabel1_4->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignRight ) );

    layout3->addWidget( textLabel1_4, 3, 0 );

    kcfg_smax = new TQSpinBox( this, "kcfg_smax" );
    kcfg_smax->setMaxValue( 99999 );
    kcfg_smax->setMinValue( -1 );

    layout3->addWidget( kcfg_smax, 1, 1 );

    kcfg_sinact = new TQSpinBox( this, "kcfg_sinact" );
    kcfg_sinact->setMaxValue( 99999 );
    kcfg_sinact->setMinValue( -1 );

    layout3->addWidget( kcfg_sinact, 3, 1 );

    textLabel1 = new TQLabel( this, "textLabel1" );
    textLabel1->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignRight ) );

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

    kcfg_swarn = new TQSpinBox( this, "kcfg_swarn" );
    kcfg_swarn->setMaxValue( 99999 );
    kcfg_swarn->setMinValue( -1 );

    layout3->addWidget( kcfg_swarn, 2, 1 );

    kcfg_smin = new TQSpinBox( this, "kcfg_smin" );
    kcfg_smin->setMaxValue( 99999 );

    layout3->addWidget( kcfg_smin, 0, 1 );
    PasswordPolicyLayout->addLayout( layout3 );

    layout3_2 = new TQHBoxLayout( 0, 0, 6, "layout3_2"); 

    textLabel3 = new TQLabel( this, "textLabel3" );
    layout3_2->addWidget( textLabel3 );

    kcfg_sexpire = new KDateTimeWidget( this, "kcfg_sexpire" );
    kcfg_sexpire->setDateTime( TQDateTime( TQDate( 2000, 1, 1 ), TQTime( 0, 0, 0 ) ) );
    layout3_2->addWidget( kcfg_sexpire );

    kcfg_sneverexpire = new TQCheckBox( this, "kcfg_sneverexpire" );
    layout3_2->addWidget( kcfg_sneverexpire );
    PasswordPolicyLayout->addLayout( layout3_2 );
    spacer4 = new TQSpacerItem( 20, 40, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    PasswordPolicyLayout->addItem( spacer4 );
    languageChange();
    resize( TQSize(479, 157).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( kcfg_sneverexpire, TQ_SIGNAL( toggled(bool) ), kcfg_sexpire, TQ_SLOT( setDisabled(bool) ) );

    // tab order
    setTabOrder( kcfg_smin, kcfg_smax );
    setTabOrder( kcfg_smax, kcfg_swarn );
    setTabOrder( kcfg_swarn, kcfg_sinact );
    setTabOrder( kcfg_sinact, kcfg_sneverexpire );

    // buddies
    textLabel1_3->setBuddy( kcfg_swarn );
    textLabel1_2->setBuddy( kcfg_smax );
    textLabel1_4->setBuddy( kcfg_sinact );
    textLabel1->setBuddy( kcfg_smin );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void PasswordPolicy::languageChange()
{
    textLabel1_3->setText( tr2i18n( "Time before password expires to issue an expire warning:" ) );
    textLabel1_2->setText( tr2i18n( "Time when password expires after last password change:" ) );
    textLabel1_4->setText( tr2i18n( "Time when account will be disabled after expiration of password:" ) );
    kcfg_smax->setSuffix( tr2i18n( " days" ) );
    kcfg_smax->setSpecialValueText( tr2i18n( "Never" ) );
    kcfg_sinact->setSuffix( tr2i18n( " days" ) );
    kcfg_sinact->setSpecialValueText( tr2i18n( "Never" ) );
    textLabel1->setText( tr2i18n( "Time before password may not be changed after last password change:" ) );
    kcfg_swarn->setSuffix( tr2i18n( " days" ) );
    kcfg_swarn->setSpecialValueText( tr2i18n( "Never" ) );
    kcfg_smin->setSuffix( tr2i18n( " days" ) );
    kcfg_smin->setSpecialValueText( TQString::null );
    textLabel3->setText( tr2i18n( "Account will expire on:" ) );
    kcfg_sneverexpire->setText( tr2i18n( "Never" ) );
}

void PasswordPolicy::kcfg_sneverexpire_toggled(bool)
{
    tqWarning( "PasswordPolicy::kcfg_sneverexpire_toggled(bool): Not implemented yet" );
}

/****************************************************************************
** PasswordPolicy meta object code from reading C++ file 'passwordpolicy.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 "passwordpolicy.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 *PasswordPolicy::className() const
{
    return "PasswordPolicy";
}

TQMetaObject *PasswordPolicy::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_PasswordPolicy( "PasswordPolicy", &PasswordPolicy::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* PasswordPolicy::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 TQUParameter param_slot_0[] = {
	{ 0, &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_0 = {"kcfg_sneverexpire_toggled", 1, param_slot_0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "kcfg_sneverexpire_toggled(bool)", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"PasswordPolicy", parentObject,
	slot_tbl, 2,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_PasswordPolicy.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool PasswordPolicy::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: kcfg_sneverexpire_toggled((bool)static_QUType_bool.get(_o+1)); break;
    case 1: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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