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

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

#include "controlcenter.h"

#include <ntqvariant.h>
#include <kpushbutton.h>
#include <krichtextlabel.h>
#include <tdelistview.h>
#include <ntqpushbutton.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqframe.h>
#include <ntqcheckbox.h>
#include <ntqgroupbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "controlcenter.ui.h"

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

    infoLbl = new KRichTextLabel( this, "infoLbl" );
    infoLbl->setMargin( 5 );
    infoLbl->setAlignment( int( KRichTextLabel::WordBreak | KRichTextLabel::AlignVCenter ) );
    ControlCenterGUILayout->addWidget( infoLbl );

    shareGrp = new TQButtonGroup( this, "shareGrp" );
    shareGrp->setCheckable( true );
    shareGrp->setChecked( true );
    shareGrp->setColumnLayout(0, TQt::Vertical );
    shareGrp->layout()->setSpacing( 6 );
    shareGrp->layout()->setMargin( 11 );
    shareGrpLayout = new TQVBoxLayout( shareGrp->layout() );
    shareGrpLayout->setAlignment( TQt::AlignTop );

    simpleRadio = new TQRadioButton( shareGrp, "simpleRadio" );
    simpleRadio->setChecked( true );
    shareGrp->insert( simpleRadio, 1 );
    shareGrpLayout->addWidget( simpleRadio );

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

    frame4_2 = new TQFrame( shareGrp, "frame4_2" );
    frame4_2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, frame4_2->sizePolicy().hasHeightForWidth() ) );
    frame4_2->setMinimumSize( TQSize( 11, 0 ) );
    frame4_2->setFrameShape( TQFrame::NoFrame );
    frame4_2->setFrameShadow( TQFrame::Raised );
    frame4_2->setMargin( 0 );
    layout4->addWidget( frame4_2 );

    textLabel1 = new KRichTextLabel( shareGrp, "textLabel1" );
    TQFont textLabel1_font(  textLabel1->font() );
    textLabel1_font.setItalic( true );
    textLabel1->setFont( textLabel1_font ); 
    textLabel1->setAlignment( int( KRichTextLabel::WordBreak | KRichTextLabel::AlignVCenter ) );
    layout4->addWidget( textLabel1 );
    shareGrpLayout->addLayout( layout4 );

    advancedRadio = new TQRadioButton( shareGrp, "advancedRadio" );
    shareGrp->insert( advancedRadio, 1 );
    shareGrpLayout->addWidget( advancedRadio );

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

    frame4_2_2 = new TQFrame( shareGrp, "frame4_2_2" );
    frame4_2_2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, frame4_2_2->sizePolicy().hasHeightForWidth() ) );
    frame4_2_2->setMinimumSize( TQSize( 11, 0 ) );
    frame4_2_2->setFrameShape( TQFrame::NoFrame );
    frame4_2_2->setFrameShadow( TQFrame::Raised );
    frame4_2_2->setMargin( 0 );
    layout4_2->addWidget( frame4_2_2 );

    textLabel1_2 = new KRichTextLabel( shareGrp, "textLabel1_2" );
    TQFont textLabel1_2_font(  textLabel1_2->font() );
    textLabel1_2_font.setItalic( true );
    textLabel1_2->setFont( textLabel1_2_font ); 
    textLabel1_2->setAlignment( int( KRichTextLabel::WordBreak | KRichTextLabel::AlignVCenter ) );
    layout4_2->addWidget( textLabel1_2 );
    shareGrpLayout->addLayout( layout4_2 );

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

    frame4 = new TQFrame( shareGrp, "frame4" );
    frame4->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, frame4->sizePolicy().hasHeightForWidth() ) );
    frame4->setMinimumSize( TQSize( 11, 0 ) );
    frame4->setFrameShape( TQFrame::NoFrame );
    frame4->setFrameShadow( TQFrame::Raised );
    frame4->setMargin( 0 );

    layout3->addMultiCellWidget( frame4, 0, 1, 0, 0 );

    nfsChk = new TQCheckBox( shareGrp, "nfsChk" );
    nfsChk->setEnabled( false );
    nfsChk->setChecked( true );

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

    sambaChk = new TQCheckBox( shareGrp, "sambaChk" );
    sambaChk->setEnabled( false );
    sambaChk->setChecked( true );

    layout3->addWidget( sambaChk, 0, 1 );
    shareGrpLayout->addLayout( layout3 );

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

    allowedUsersBtn = new KPushButton( shareGrp, "allowedUsersBtn" );
    layout10->addWidget( allowedUsersBtn );
    spacer9 = new TQSpacerItem( 40, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout10->addItem( spacer9 );
    shareGrpLayout->addLayout( layout10 );
    ControlCenterGUILayout->addWidget( shareGrp );

    sharedFoldersGroupBox = new TQGroupBox( this, "sharedFoldersGroupBox" );
    sharedFoldersGroupBox->setColumnLayout(0, TQt::Vertical );
    sharedFoldersGroupBox->layout()->setSpacing( 6 );
    sharedFoldersGroupBox->layout()->setMargin( 11 );
    sharedFoldersGroupBoxLayout = new TQHBoxLayout( sharedFoldersGroupBox->layout() );
    sharedFoldersGroupBoxLayout->setAlignment( TQt::AlignTop );

    listView = new TDEListView( sharedFoldersGroupBox, "listView" );
    listView->addColumn( tr2i18n( "Path" ) );
    listView->addColumn( tr2i18n( "Samba" ) );
    listView->addColumn( tr2i18n( "NFS" ) );
    listView->setProperty( "selectionMode", "NoSelection" );
    sharedFoldersGroupBoxLayout->addWidget( listView );

    shareBtnPnl = new TQFrame( sharedFoldersGroupBox, "shareBtnPnl" );
    shareBtnPnl->setEnabled( false );
    shareBtnPnl->setFrameShape( TQFrame::NoFrame );
    shareBtnPnl->setFrameShadow( TQFrame::Plain );
    shareBtnPnlLayout = new TQVBoxLayout( shareBtnPnl, 0, 6, "shareBtnPnlLayout"); 

    addShareBtn = new KPushButton( shareBtnPnl, "addShareBtn" );
    shareBtnPnlLayout->addWidget( addShareBtn );

    changeShareBtn = new KPushButton( shareBtnPnl, "changeShareBtn" );
    changeShareBtn->setEnabled( false );
    shareBtnPnlLayout->addWidget( changeShareBtn );

    removeShareBtn = new KPushButton( shareBtnPnl, "removeShareBtn" );
    removeShareBtn->setEnabled( false );
    shareBtnPnlLayout->addWidget( removeShareBtn );
    spacer2 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    shareBtnPnlLayout->addItem( spacer2 );
    sharedFoldersGroupBoxLayout->addWidget( shareBtnPnl );
    ControlCenterGUILayout->addWidget( sharedFoldersGroupBox );
    languageChange();
    resize( TQSize(525, 535).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( advancedRadio, TQ_SIGNAL( toggled(bool) ), nfsChk, TQ_SLOT( setEnabled(bool) ) );
    connect( advancedRadio, TQ_SIGNAL( toggled(bool) ), sambaChk, TQ_SLOT( setEnabled(bool) ) );
    connect( shareGrp, TQ_SIGNAL( clicked(int) ), this, TQ_SLOT( changedSlot() ) );
    connect( simpleRadio, TQ_SIGNAL( clicked() ), this, TQ_SLOT( changedSlot() ) );
    connect( advancedRadio, TQ_SIGNAL( clicked() ), this, TQ_SLOT( changedSlot() ) );
    connect( sambaChk, TQ_SIGNAL( clicked() ), this, TQ_SLOT( changedSlot() ) );
    connect( nfsChk, TQ_SIGNAL( clicked() ), this, TQ_SLOT( changedSlot() ) );
    connect( listView, TQ_SIGNAL( selectionChanged() ), this, TQ_SLOT( listView_selectionChanged() ) );

    // tab order
    setTabOrder( sambaChk, nfsChk );
    setTabOrder( nfsChk, listView );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void ControlCenterGUI::languageChange()
{
    infoLbl->setText( tr2i18n( "SMB and NFS servers are not installed on this machine, to enable this module the servers must be installed." ) );
    shareGrp->setTitle( tr2i18n( "Enable Local Networ&k File Sharing" ) );
    simpleRadio->setText( tr2i18n( "Si&mple sharing" ) );
    textLabel1->setText( tr2i18n( "Enable simple sharing to allow users to share folders from their HOME folder, without knowing the root password." ) );
    advancedRadio->setText( tr2i18n( "Advanced sharin&g" ) );
    textLabel1_2->setText( tr2i18n( "Enable advanced sharing to allow users to share any folders, as long as they have write access to the needed configuration files, or they know the root password." ) );
    nfsChk->setText( tr2i18n( "Use &NFS (Linux/UNIX)" ) );
    sambaChk->setText( tr2i18n( "Use Sam&ba (Microsoft(R) Windows(R))" ) );
    allowedUsersBtn->setText( tr2i18n( "Allo&wed Users" ) );
    sharedFoldersGroupBox->setTitle( tr2i18n( "Shared Folders" ) );
    listView->header()->setLabel( 0, tr2i18n( "Path" ) );
    listView->header()->setLabel( 1, tr2i18n( "Samba" ) );
    listView->header()->setLabel( 2, tr2i18n( "NFS" ) );
    addShareBtn->setText( tr2i18n( "A&dd..." ) );
    changeShareBtn->setText( tr2i18n( "Chang&e..." ) );
    removeShareBtn->setText( tr2i18n( "Rem&ove" ) );
}

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

TQMetaObject *ControlCenterGUI::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_ControlCenterGUI( "ControlCenterGUI", &ControlCenterGUI::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* ControlCenterGUI::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 = {"listView_selectionChanged", 0, 0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQUMethod slot_2 = {"changedSlot", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "listView_selectionChanged()", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected },
	{ "changedSlot()", &slot_2, TQMetaData::Private }
    };
    static const TQUMethod signal_0 = {"changed", 0, 0 };
    static const TQMetaData signal_tbl[] = {
	{ "changed()", &signal_0, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"ControlCenterGUI", parentObject,
	slot_tbl, 3,
	signal_tbl, 1,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_ControlCenterGUI.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL changed
void ControlCenterGUI::changed()
{
    activate_signal( staticMetaObject()->signalOffset() + 0 );
}

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

bool ControlCenterGUI::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: changed(); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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