#include <kdialog.h>
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/usr/src/ports/kdebase3/kdebase3-3.5.10-11.i686/src/kdebase-3.5.10/kcontrol/kio/socksbase.ui'
**
** Created by User Interface Compiler
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "socksbase.h"

#include <qvariant.h>
#include <kdialog.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlabel.h>
#include <kurlrequester.h>
#include <qgroupbox.h>
#include <qheader.h>
#include <qlistview.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/*
 *  Constructs a SocksBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
SocksBase::SocksBase( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "SocksBase" );
    SocksBaseLayout = new QVBoxLayout( this, 0, KDialog::spacingHint(), "SocksBaseLayout"); 

    _c_enableSocks = new QCheckBox( this, "_c_enableSocks" );
    SocksBaseLayout->addWidget( _c_enableSocks );

    bg = new QButtonGroup( this, "bg" );
    bg->setEnabled( FALSE );
    bg->setColumnLayout(0, Qt::Vertical );
    bg->layout()->setSpacing( KDialog::spacingHint() );
    bg->layout()->setMargin( KDialog::marginHint() );
    bgLayout = new QGridLayout( bg->layout() );
    bgLayout->setAlignment( Qt::AlignTop );

    _c_detect = new QRadioButton( bg, "_c_detect" );
    bg->insert( _c_detect, 1 );

    bgLayout->addWidget( _c_detect, 0, 0 );

    _c_NEC = new QRadioButton( bg, "_c_NEC" );
    bg->insert( _c_NEC, 2 );

    bgLayout->addWidget( _c_NEC, 0, 1 );

    _c_custom = new QRadioButton( bg, "_c_custom" );
    bg->insert( _c_custom, 4 );

    bgLayout->addMultiCellWidget( _c_custom, 1, 1, 0, 2 );

    Layout6 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout6"); 

    _c_customLabel = new QLabel( bg, "_c_customLabel" );
    _c_customLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)1, 0, 0, _c_customLabel->sizePolicy().hasHeightForWidth() ) );
    _c_customLabel->setIndent( 20 );
    Layout6->addWidget( _c_customLabel );

    _c_customPath = new KURLRequester( bg, "_c_customPath" );
    _c_customPath->setMinimumSize( QSize( 0, 20 ) );
    Layout6->addWidget( _c_customPath );

    bgLayout->addMultiCellLayout( Layout6, 2, 2, 0, 2 );

    _c_Dante = new QRadioButton( bg, "_c_Dante" );
    bg->insert( _c_Dante, 3 );

    bgLayout->addWidget( _c_Dante, 0, 2 );
    SocksBaseLayout->addWidget( bg );

    _c_addPaths = new QGroupBox( this, "_c_addPaths" );
    _c_addPaths->setEnabled( FALSE );
    _c_addPaths->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _c_addPaths->sizePolicy().hasHeightForWidth() ) );
    _c_addPaths->setColumnLayout(0, Qt::Vertical );
    _c_addPaths->layout()->setSpacing( KDialog::spacingHint() );
    _c_addPaths->layout()->setMargin( KDialog::marginHint() );
    _c_addPathsLayout = new QVBoxLayout( _c_addPaths->layout() );
    _c_addPathsLayout->setAlignment( Qt::AlignTop );

    _c_libs = new QListView( _c_addPaths, "_c_libs" );
    _c_libs->addColumn( tr2i18n( "Path" ) );
    _c_libs->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, _c_libs->sizePolicy().hasHeightForWidth() ) );
    _c_addPathsLayout->addWidget( _c_libs );

    _c_newPath = new KURLRequester( _c_addPaths, "_c_newPath" );
    _c_newPath->setMinimumSize( QSize( 0, 25 ) );
    _c_addPathsLayout->addWidget( _c_newPath );

    Layout1 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout1"); 
    Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
    Layout1->addItem( Spacer1 );

    _c_add = new QPushButton( _c_addPaths, "_c_add" );
    Layout1->addWidget( _c_add );

    _c_remove = new QPushButton( _c_addPaths, "_c_remove" );
    Layout1->addWidget( _c_remove );
    _c_addPathsLayout->addLayout( Layout1 );
    SocksBaseLayout->addWidget( _c_addPaths );

    Layout2 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout2"); 
    Spacer2 = new QSpacerItem( 20, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout2->addItem( Spacer2 );

    _c_test = new QPushButton( this, "_c_test" );
    _c_test->setEnabled( FALSE );
    Layout2->addWidget( _c_test );
    SocksBaseLayout->addLayout( Layout2 );
    languageChange();
    resize( QSize(455, 402).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( _c_enableSocks, SIGNAL( toggled(bool) ), bg, SLOT( setEnabled(bool) ) );
    connect( _c_enableSocks, SIGNAL( toggled(bool) ), _c_addPaths, SLOT( setEnabled(bool) ) );
    connect( _c_enableSocks, SIGNAL( toggled(bool) ), _c_test, SLOT( setEnabled(bool) ) );

    // buddies
    _c_customLabel->setBuddy( _c_customPath );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SocksBase::languageChange()
{
    setCaption( tr2i18n( "SOCKS" ) );
    _c_enableSocks->setText( tr2i18n( "&Enable SOCKS support" ) );
    QWhatsThis::add( _c_enableSocks, tr2i18n( "Check this to enable SOCKS4 and SOCKS5 support in KDE applications and I/O subsystems." ) );
    bg->setTitle( tr2i18n( "SOCKS Implementation" ) );
    _c_detect->setText( tr2i18n( "A&uto detect" ) );
    QWhatsThis::add( _c_detect, tr2i18n( "If you select Autodetect, then KDE will automatically search for an implementation of SOCKS on your computer." ) );
    _c_NEC->setText( tr2i18n( "&NEC SOCKS" ) );
    QWhatsThis::add( _c_NEC, tr2i18n( "This will force KDE to use NEC SOCKS if it can be found." ) );
    _c_custom->setText( tr2i18n( "Use &custom library" ) );
    QWhatsThis::add( _c_custom, tr2i18n( "Select custom if you wish to use an unlisted SOCKS library. Please note that this may not always work as it depends on the API of the library which you specify (below)." ) );
    _c_customLabel->setText( tr2i18n( "&Path:" ) );
    QWhatsThis::add( _c_customPath, tr2i18n( "Enter the path to an unsupported SOCKS library." ) );
    _c_Dante->setText( tr2i18n( "&Dante" ) );
    QWhatsThis::add( _c_Dante, tr2i18n( "This will force KDE to use Dante if it can be found." ) );
    _c_addPaths->setTitle( tr2i18n( "Additional Library Search Paths" ) );
    QWhatsThis::add( _c_addPaths, tr2i18n( "Here you can specify additional directories to search for the SOCKS libraries. /usr/lib, /usr/local/lib, /usr/local/socks5/lib and /opt/socks5/lib are already searched by default." ) );
    _c_libs->header()->setLabel( 0, tr2i18n( "Path" ) );
    QWhatsThis::add( _c_libs, tr2i18n( "This is the list of additional paths that will be searched." ) );
    _c_add->setText( tr2i18n( "&Add" ) );
    _c_remove->setText( tr2i18n( "&Remove" ) );
    _c_test->setText( tr2i18n( "&Test" ) );
    QWhatsThis::add( _c_test, tr2i18n( "Click here to test SOCKS support." ) );
}

#include "socksbase.moc"
