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

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

#include "walletconfigwidget.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqtabwidget.h>
#include <ntqcheckbox.h>
#include <ntqgroupbox.h>
#include <ntqspinbox.h>
#include <ntqlabel.h>
#include <ntqcombobox.h>
#include <ntqheader.h>
#include <ntqlistview.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

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

    tabWidget2 = new TQTabWidget( this, "tabWidget2" );

    tab = new TQWidget( tabWidget2, "tab" );
    tabLayout = new TQVBoxLayout( tab, 11, 6, "tabLayout"); 

    _enabled = new TQCheckBox( tab, "_enabled" );
    _enabled->setChecked( true );
    tabLayout->addWidget( _enabled );

    groupBox2 = new TQGroupBox( tab, "groupBox2" );
    groupBox2->setColumnLayout(0, TQt::Vertical );
    groupBox2->layout()->setSpacing( 6 );
    groupBox2->layout()->setMargin( 11 );
    groupBox2Layout = new TQVBoxLayout( groupBox2->layout() );
    groupBox2Layout->setAlignment( TQt::AlignTop );

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

    _closeIdle = new TQCheckBox( groupBox2, "_closeIdle" );
    _closeIdle->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 2, 0, _closeIdle->sizePolicy().hasHeightForWidth() ) );
    layout1->addWidget( _closeIdle );

    _idleTime = new TQSpinBox( groupBox2, "_idleTime" );
    _idleTime->setEnabled( false );
    _idleTime->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, _idleTime->sizePolicy().hasHeightForWidth() ) );
    _idleTime->setMaxValue( 999 );
    _idleTime->setMinValue( 1 );
    _idleTime->setLineStep( 5 );
    _idleTime->setValue( 10 );
    layout1->addWidget( _idleTime );
    spacer12 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout1->addItem( spacer12 );
    groupBox2Layout->addLayout( layout1 );

    _screensaverLock = new TQCheckBox( groupBox2, "_screensaverLock" );
    groupBox2Layout->addWidget( _screensaverLock );

    _autoclose = new TQCheckBox( groupBox2, "_autoclose" );
    groupBox2Layout->addWidget( _autoclose );
    tabLayout->addWidget( groupBox2 );

    groupBox4 = new TQGroupBox( tab, "groupBox4" );
    groupBox4->setColumnLayout(0, TQt::Vertical );
    groupBox4->layout()->setSpacing( 6 );
    groupBox4->layout()->setMargin( 11 );
    groupBox4Layout = new TQGridLayout( groupBox4->layout() );
    groupBox4Layout->setAlignment( TQt::AlignTop );
    spacer7 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    groupBox4Layout->addMultiCell( spacer7, 0, 1, 1, 1 );

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

    groupBox4Layout->addWidget( textLabel1_2, 0, 0 );

    _localWalletSelected = new TQCheckBox( groupBox4, "_localWalletSelected" );

    groupBox4Layout->addWidget( _localWalletSelected, 1, 0 );

    _defaultWallet = new TQComboBox( false, groupBox4, "_defaultWallet" );
    _defaultWallet->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, _defaultWallet->sizePolicy().hasHeightForWidth() ) );

    groupBox4Layout->addWidget( _defaultWallet, 0, 2 );

    _localWallet = new TQComboBox( false, groupBox4, "_localWallet" );
    _localWallet->setEnabled( false );
    _localWallet->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, _localWallet->sizePolicy().hasHeightForWidth() ) );

    groupBox4Layout->addWidget( _localWallet, 1, 2 );

    _newLocalWallet = new TQPushButton( groupBox4, "_newLocalWallet" );
    _newLocalWallet->setEnabled( false );

    groupBox4Layout->addWidget( _newLocalWallet, 1, 3 );

    _newWallet = new TQPushButton( groupBox4, "_newWallet" );

    groupBox4Layout->addWidget( _newWallet, 0, 3 );
    tabLayout->addWidget( groupBox4 );

    groupBox3 = new TQGroupBox( tab, "groupBox3" );
    groupBox3->setColumnLayout(0, TQt::Vertical );
    groupBox3->layout()->setSpacing( 6 );
    groupBox3->layout()->setMargin( 11 );
    groupBox3Layout = new TQGridLayout( groupBox3->layout() );
    groupBox3Layout->setAlignment( TQt::AlignTop );
    spacer6 = new TQSpacerItem( 20, 20, TQSizePolicy::Fixed, TQSizePolicy::Minimum );
    groupBox3Layout->addItem( spacer6, 1, 0 );

    _launchManager = new TQCheckBox( groupBox3, "_launchManager" );
    _launchManager->setChecked( true );

    groupBox3Layout->addMultiCellWidget( _launchManager, 0, 0, 0, 1 );

    _autocloseManager = new TQCheckBox( groupBox3, "_autocloseManager" );

    groupBox3Layout->addWidget( _autocloseManager, 1, 1 );
    tabLayout->addWidget( groupBox3 );
    spacer4 = new TQSpacerItem( 31, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    tabLayout->addItem( spacer4 );
    tabWidget2->insertTab( tab, TQString::fromLatin1("") );

    tab_2 = new TQWidget( tabWidget2, "tab_2" );
    tabLayout_2 = new TQGridLayout( tab_2, 1, 1, 11, 6, "tabLayout_2"); 

    _openPrompt = new TQCheckBox( tab_2, "_openPrompt" );
    _openPrompt->setChecked( true );

    tabLayout_2->addWidget( _openPrompt, 0, 0 );

    _accessList = new TQListView( tab_2, "_accessList" );
    _accessList->addColumn( tr2i18n( "Wallet" ) );
    _accessList->addColumn( tr2i18n( "Application" ) );
    _accessList->addColumn( tr2i18n( "Policy" ) );
    _accessList->setRootIsDecorated( true );

    tabLayout_2->addWidget( _accessList, 1, 0 );
    tabWidget2->insertTab( tab_2, TQString::fromLatin1("") );

    WalletConfigWidgetLayout->addMultiCellWidget( tabWidget2, 0, 0, 0, 1 );

    _launch = new TQPushButton( this, "_launch" );

    WalletConfigWidgetLayout->addWidget( _launch, 1, 1 );
    spacer2 = new TQSpacerItem( 369, 21, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    WalletConfigWidgetLayout->addItem( spacer2, 1, 0 );
    languageChange();
    resize( TQSize(585, 450).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( _localWalletSelected, TQ_SIGNAL( toggled(bool) ), _newLocalWallet, TQ_SLOT( setEnabled(bool) ) );
    connect( _localWalletSelected, TQ_SIGNAL( toggled(bool) ), _localWallet, TQ_SLOT( setEnabled(bool) ) );
    connect( _closeIdle, TQ_SIGNAL( toggled(bool) ), _idleTime, TQ_SLOT( setEnabled(bool) ) );
    connect( _enabled, TQ_SIGNAL( toggled(bool) ), groupBox2, TQ_SLOT( setEnabled(bool) ) );
    connect( _enabled, TQ_SIGNAL( toggled(bool) ), groupBox4, TQ_SLOT( setEnabled(bool) ) );
    connect( _enabled, TQ_SIGNAL( toggled(bool) ), groupBox3, TQ_SLOT( setEnabled(bool) ) );
    connect( _closeIdle, TQ_SIGNAL( toggled(bool) ), _idleTime, TQ_SLOT( setEnabled(bool) ) );
    connect( _launchManager, TQ_SIGNAL( toggled(bool) ), _autocloseManager, TQ_SLOT( setEnabled(bool) ) );

    // tab order
    setTabOrder( _enabled, _closeIdle );
    setTabOrder( _closeIdle, _idleTime );
    setTabOrder( _idleTime, _screensaverLock );
    setTabOrder( _screensaverLock, _autoclose );
    setTabOrder( _autoclose, _defaultWallet );
    setTabOrder( _defaultWallet, _newWallet );
    setTabOrder( _newWallet, _localWalletSelected );
    setTabOrder( _localWalletSelected, _localWallet );
    setTabOrder( _localWallet, _newLocalWallet );
    setTabOrder( _newLocalWallet, _launchManager );
    setTabOrder( _launchManager, _autocloseManager );
    setTabOrder( _autocloseManager, tabWidget2 );
    setTabOrder( tabWidget2, _openPrompt );
    setTabOrder( _openPrompt, _accessList );
    setTabOrder( _accessList, _launch );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void WalletConfigWidget::languageChange()
{
    _enabled->setText( tr2i18n( "&Enable the TDE wallet subsystem" ) );
    TQWhatsThis::add( _enabled, tr2i18n( "<p>The wallet subsytem allows a convenient and secure way to manage all your passwords. You can decide if you want to use this system with this option.</p>" ) );
    groupBox2->setTitle( tr2i18n( "Close Wallet" ) );
    TQWhatsThis::add( groupBox2, tr2i18n( "It is best to close your wallets when you are not using them to prevent others from viewing or using them." ) );
    _closeIdle->setText( tr2i18n( "Close when unused for:" ) );
    TQWhatsThis::add( _closeIdle, tr2i18n( "<p><b>Close wallet after a period of inactivity</b><br>When a wallet is closed the password is needed to access it again.</p>" ) );
    _idleTime->setSuffix( tr2i18n( " min" ) );
    TQWhatsThis::add( _idleTime, tr2i18n( "<p><b>Close wallet after a period of inactivity</b><br>When a wallet is closed the password is needed to access it again.</p>" ) );
    _screensaverLock->setText( tr2i18n( "Close when screensaver starts" ) );
    TQWhatsThis::add( _screensaverLock, tr2i18n( "<p><b>Close wallet as soon as the screensaver starts.</b><br>When a wallet is closed the password is needed to access it again.</p>" ) );
    _autoclose->setText( tr2i18n( "Close when last application stops using it" ) );
    TQWhatsThis::add( _autoclose, tr2i18n( "<p><b>Close wallet as soon as applications that use it have stopped.</b><br>Note that your wallets will only be closed when all applications that use it have stopped.<br>When a wallet is closed the password is needed to access it again.</p>" ) );
    groupBox4->setTitle( tr2i18n( "Automatic Wallet Selection" ) );
    textLabel1_2->setText( tr2i18n( "Select wallet to use as default:" ) );
    _localWalletSelected->setText( tr2i18n( "Different wallet for local passwords:" ) );
    _newLocalWallet->setText( tr2i18n( "New..." ) );
    _newWallet->setText( tr2i18n( "New..." ) );
    groupBox3->setTitle( tr2i18n( "Wallet Manager" ) );
    _launchManager->setText( tr2i18n( "Show manager in system tray" ) );
    _autocloseManager->setText( tr2i18n( "Hide system tray icon when last wallet closes" ) );
    tabWidget2->changeTab( tab, tr2i18n( "Wallet Preferences" ) );
    _openPrompt->setText( tr2i18n( "&Prompt when an application accesses an open wallet" ) );
    _accessList->header()->setLabel( 0, tr2i18n( "Wallet" ) );
    _accessList->header()->setLabel( 1, tr2i18n( "Application" ) );
    _accessList->header()->setLabel( 2, tr2i18n( "Policy" ) );
    tabWidget2->changeTab( tab_2, tr2i18n( "Access Control" ) );
    _launch->setText( tr2i18n( "&Launch Wallet Manager" ) );
}

void WalletConfigWidget::_storeTogether_toggled(bool)
{
    tqWarning( "WalletConfigWidget::_storeTogether_toggled(bool): Not implemented yet" );
}

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

TQMetaObject *WalletConfigWidget::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_WalletConfigWidget( "WalletConfigWidget", &WalletConfigWidget::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

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

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

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

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

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

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