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

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

#include "knetattach.h"

#include <ntqvariant.h>
#include <tdeio/netaccess.h>
#include <tdemessagebox.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <tdeglobalsettings.h>
#include <ksimpleconfig.h>
#include <tdeapplication.h>
#include <kstandarddirs.h>
#include <kdirnotify_stub.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <ntqpushbutton.h>
#include <ntqwidget.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqlabel.h>
#include <ntqspinbox.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "knetattach.ui.h"

/*
 *  Constructs a KNetAttach as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qwizard will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qwizard.
 */
KNetAttach::KNetAttach( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : KWizard( parent, name, modal, fl )
{
    if ( !name )
	setName( "KNetAttach" );
    TQFont f( font() );
    f.setPointSize( 16 );
    setTitleFont( f );

    _folderType = new TQWidget( this, "_folderType" );
    _folderTypeLayout = new TQGridLayout( _folderType, 1, 1, 11, 6, "_folderTypeLayout"); 

    buttonGroup1 = new TQButtonGroup( _folderType, "buttonGroup1" );
    buttonGroup1->setFrameShape( TQButtonGroup::NoFrame );
    buttonGroup1->setFrameShadow( TQButtonGroup::Plain );
    buttonGroup1->setColumnLayout(0, TQt::Vertical );
    buttonGroup1->layout()->setSpacing( 6 );
    buttonGroup1->layout()->setMargin( 0 );
    buttonGroup1Layout = new TQGridLayout( buttonGroup1->layout() );
    buttonGroup1Layout->setAlignment( TQt::AlignTop );

    _webfolder = new TQRadioButton( buttonGroup1, "_webfolder" );
    _webfolder->setChecked( true );

    buttonGroup1Layout->addMultiCellWidget( _webfolder, 0, 0, 0, 1 );

    _ftp = new TQRadioButton( buttonGroup1, "_ftp" );

    buttonGroup1Layout->addMultiCellWidget( _ftp, 1, 1, 0, 1 );

    _smb = new TQRadioButton( buttonGroup1, "_smb" );

    buttonGroup1Layout->addMultiCellWidget( _smb, 2, 2, 0, 1 );

    _sftp = new TQRadioButton( buttonGroup1, "_sftp" );
    _sftp->setChecked( false );

    buttonGroup1Layout->addMultiCellWidget( _sftp, 3, 3, 0, 1 );

    _fish = new TQRadioButton( buttonGroup1, "_fish" );
    _fish->setChecked( false );

    buttonGroup1Layout->addMultiCellWidget( _fish, 4, 4, 0, 1 );

    _recent = new TQRadioButton( buttonGroup1, "_recent" );

    buttonGroup1Layout->addWidget( _recent, 5, 0 );

    _recentConnectionName = new KComboBox( false, buttonGroup1, "_recentConnectionName" );
    _recentConnectionName->setEnabled( false );
    _recentConnectionName->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, _recentConnectionName->sizePolicy().hasHeightForWidth() ) );
    _recentConnectionName->setMinimumSize( TQSize( 250, 0 ) );

    buttonGroup1Layout->addWidget( _recentConnectionName, 5, 1 );

    _folderTypeLayout->addWidget( buttonGroup1, 2, 0 );
    spacer2_2 = new TQSpacerItem( 31, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    _folderTypeLayout->addItem( spacer2_2, 3, 0 );

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

    _folderTypeLayout->addWidget( textLabel1_2, 0, 0 );
    spacer20 = new TQSpacerItem( 20, 21, TQSizePolicy::Minimum, TQSizePolicy::Fixed );
    _folderTypeLayout->addItem( spacer20, 1, 0 );
    addPage( _folderType, TQString("") );

    _folderParameters = new TQWidget( this, "_folderParameters" );
    _folderParametersLayout = new TQGridLayout( _folderParameters, 1, 1, 11, 6, "_folderParametersLayout"); 

    _informationText = new TQLabel( _folderParameters, "_informationText" );
    _informationText->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );

    _folderParametersLayout->addMultiCellWidget( _informationText, 0, 0, 0, 2 );
    spacer20_2 = new TQSpacerItem( 20, 21, TQSizePolicy::Minimum, TQSizePolicy::Fixed );
    _folderParametersLayout->addItem( spacer20_2, 1, 2 );

    textLabel4_2 = new TQLabel( _folderParameters, "textLabel4_2" );

    _folderParametersLayout->addWidget( textLabel4_2, 2, 0 );

    _connectionName = new KLineEdit( _folderParameters, "_connectionName" );

    _folderParametersLayout->addMultiCellWidget( _connectionName, 2, 2, 1, 2 );

    _port = new TQSpinBox( _folderParameters, "_port" );
    _port->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 1, 0, _port->sizePolicy().hasHeightForWidth() ) );
    _port->setMaxValue( 65535 );
    _port->setMinValue( 1 );

    _folderParametersLayout->addWidget( _port, 5, 1 );

    _path = new KLineEdit( _folderParameters, "_path" );

    _folderParametersLayout->addMultiCellWidget( _path, 6, 6, 1, 2 );

    _userText = new TQLabel( _folderParameters, "_userText" );

    _folderParametersLayout->addWidget( _userText, 3, 0 );

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

    _folderParametersLayout->addWidget( textLabel1, 4, 0 );

    _portText = new TQLabel( _folderParameters, "_portText" );

    _folderParametersLayout->addWidget( _portText, 5, 0 );

    _user = new KLineEdit( _folderParameters, "_user" );
    _user->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 10, 0, _user->sizePolicy().hasHeightForWidth() ) );

    _folderParametersLayout->addMultiCellWidget( _user, 3, 3, 1, 2 );

    _host = new KLineEdit( _folderParameters, "_host" );
    _host->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 10, 0, _host->sizePolicy().hasHeightForWidth() ) );

    _folderParametersLayout->addMultiCellWidget( _host, 4, 4, 1, 2 );

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

    _folderParametersLayout->addWidget( textLabel3, 6, 0 );
    spacer5 = new TQSpacerItem( 560, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    _folderParametersLayout->addMultiCell( spacer5, 9, 9, 0, 2 );

    _createIcon = new TQCheckBox( _folderParameters, "_createIcon" );
    _createIcon->setChecked( true );

    _folderParametersLayout->addMultiCellWidget( _createIcon, 7, 7, 1, 2 );

    _useEncryption = new TQCheckBox( _folderParameters, "_useEncryption" );

    _folderParametersLayout->addMultiCellWidget( _useEncryption, 8, 8, 1, 2 );
    addPage( _folderParameters, TQString("") );
    languageChange();
    resize( TQSize(594, 371).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( _recent, TQ_SIGNAL( toggled(bool) ), _recentConnectionName, TQ_SLOT( setEnabled(bool) ) );
    connect( _user, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( updateParametersPageStatus() ) );
    connect( _host, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( updateParametersPageStatus() ) );
    connect( _path, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( updateParametersPageStatus() ) );
    connect( _useEncryption, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( updatePort(bool) ) );
    connect( _createIcon, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( updateFinishButtonText(bool) ) );

    // tab order
    setTabOrder( _webfolder, _recentConnectionName );
    setTabOrder( _recentConnectionName, _connectionName );
    setTabOrder( _connectionName, _user );
    setTabOrder( _user, _host );
    setTabOrder( _host, _port );
    setTabOrder( _port, _path );
    setTabOrder( _path, _createIcon );
    setTabOrder( _createIcon, _useEncryption );

    // buddies
    textLabel4_2->setBuddy( _connectionName );
    _userText->setBuddy( _user );
    textLabel1->setBuddy( _host );
    _portText->setBuddy( _port );
    textLabel3->setBuddy( _path );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KNetAttach::languageChange()
{
    setCaption( tr2i18n( "Network Folder Wizard" ) );
    buttonGroup1->setTitle( TQString::null );
    _webfolder->setText( tr2i18n( "&WebFolder (webdav)" ) );
    _ftp->setText( tr2i18n( "FT&P" ) );
    _smb->setText( tr2i18n( "&Microsoft® Windows® network drive" ) );
    _sftp->setText( tr2i18n( "&Secure shell (via SFTP)" ) );
    _fish->setText( tr2i18n( "&Secure shell (via FISH)" ) );
    _recent->setText( tr2i18n( "&Recent connection:" ) );
    textLabel1_2->setText( tr2i18n( "Select the type of network folder you wish to connect to and press the Next button." ) );
    setTitle( _folderType, tr2i18n( "Add Network Folder" ) );
    _informationText->setText( tr2i18n( "Enter a name for this <i>%1</i> as well as the server address, port and folder path to use and press the Next button." ) );
    textLabel4_2->setText( tr2i18n( "&Name:" ) );
    _userText->setText( tr2i18n( "&User:" ) );
    textLabel1->setText( tr2i18n( "Se&rver:" ) );
    _portText->setText( tr2i18n( "&Port:" ) );
    textLabel3->setText( tr2i18n( "&Folder:" ) );
    _createIcon->setText( tr2i18n( "Cr&eate an icon for this remote folder" ) );
    _useEncryption->setText( tr2i18n( "&Use encryption" ) );
    setTitle( _folderParameters, tr2i18n( "Network Folder Information" ) );
}

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

TQMetaObject *KNetAttach::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_KNetAttach( "KNetAttach", &KNetAttach::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* KNetAttach::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 = KWizard::staticMetaObject();
    static const TQUParameter param_slot_0[] = {
	{ "type", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_0 = {"setInformationText", 1, param_slot_0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQUMethod slot_2 = {"init", 0, 0 };
    static const TQUParameter param_slot_3[] = {
	{ "page", &static_QUType_ptr, "TQWidget", TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"showPage", 1, param_slot_3 };
    static const TQUMethod slot_4 = {"updateParametersPageStatus", 0, 0 };
    static const TQUMethod slot_5 = {"finished", 0, 0 };
    static const TQUParameter param_slot_6[] = {
	{ "encryption", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_6 = {"updatePort", 1, param_slot_6 };
    static const TQUParameter param_slot_7[] = {
	{ "save", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_7 = {"updateFinishButtonText", 1, param_slot_7 };
    static const TQMetaData slot_tbl[] = {
	{ "setInformationText(const TQString&)", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected },
	{ "init()", &slot_2, TQMetaData::Private },
	{ "showPage(TQWidget*)", &slot_3, TQMetaData::Private },
	{ "updateParametersPageStatus()", &slot_4, TQMetaData::Private },
	{ "finished()", &slot_5, TQMetaData::Private },
	{ "updatePort(bool)", &slot_6, TQMetaData::Private },
	{ "updateFinishButtonText(bool)", &slot_7, TQMetaData::Private }
    };
    metaObj = TQMetaObject::new_metaobject(
	"KNetAttach", parentObject,
	slot_tbl, 8,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_KNetAttach.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool KNetAttach::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setInformationText((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 1: languageChange(); break;
    case 2: init(); break;
    case 3: showPage((TQWidget*)static_QUType_ptr.get(_o+1)); break;
    case 4: updateParametersPageStatus(); break;
    case 5: finished(); break;
    case 6: updatePort((bool)static_QUType_bool.get(_o+1)); break;
    case 7: updateFinishButtonText((bool)static_QUType_bool.get(_o+1)); break;
    default:
	return KWizard::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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