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

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

#include "maindialogbase.h"

#include <ntqvariant.h>
#include <kactivelabel.h>
#include <kcombobox.h>
#include <kdialog.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <tdelistview.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqframe.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

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

    m_serverLabel = new TQLabel( this, "m_serverLabel" );
    m_serverLabel->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, m_serverLabel->sizePolicy().hasHeightForWidth() ) );
    m_serverLabel->setFrameShape( TQLabel::MShape );
    m_serverLabel->setFrameShadow( TQLabel::MShadow );

    MainDialogBaseLayout->addWidget( m_serverLabel, 1, 0 );

    m_serverInput = new KHistoryCombo( this, "m_serverInput" );
    m_serverInput->setMinimumSize( TQSize( 250, 0 ) );
    m_serverInput->setMaxCount( 12 );
    m_serverInput->setDuplicatesEnabled( false );

    MainDialogBaseLayout->addWidget( m_serverInput, 1, 1 );

    m_browseButton = new KPushButton( this, "m_browseButton" );
    m_browseButton->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, m_browseButton->sizePolicy().hasHeightForWidth() ) );

    MainDialogBaseLayout->addWidget( m_browseButton, 1, 2 );

    kActiveLabel2 = new KActiveLabel( this, "kActiveLabel2" );
    kActiveLabel2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, kActiveLabel2->sizePolicy().hasHeightForWidth() ) );

    MainDialogBaseLayout->addMultiCellWidget( kActiveLabel2, 2, 2, 0, 2 );

    m_browsingPanel = new TQFrame( this, "m_browsingPanel" );
    m_browsingPanel->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)3, 0, 0, m_browsingPanel->sizePolicy().hasHeightForWidth() ) );
    m_browsingPanel->setFrameShape( TQFrame::NoFrame );
    m_browsingPanel->setFrameShadow( TQFrame::Plain );
    m_browsingPanelLayout = new TQGridLayout( m_browsingPanel, 1, 1, 0, KDialog::spacingHint(), "m_browsingPanelLayout"); 

    m_rescanButton = new KPushButton( m_browsingPanel, "m_rescanButton" );

    m_browsingPanelLayout->addWidget( m_rescanButton, 0, 0 );
    Spacer3 = new TQSpacerItem( 34, 16, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    m_browsingPanelLayout->addItem( Spacer3, 0, 1 );

    TextLabel1_2 = new TQLabel( m_browsingPanel, "TextLabel1_2" );

    m_browsingPanelLayout->addWidget( TextLabel1_2, 0, 2 );

    m_searchInput = new KLineEdit( m_browsingPanel, "m_searchInput" );

    m_browsingPanelLayout->addWidget( m_searchInput, 0, 3 );
    Spacer4 = new TQSpacerItem( 34, 16, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    m_browsingPanelLayout->addItem( Spacer4, 0, 4 );

    TextLabel1 = new TQLabel( m_browsingPanel, "TextLabel1" );
    TextLabel1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );

    m_browsingPanelLayout->addWidget( TextLabel1, 0, 5 );

    m_scopeCombo = new KComboBox( false, m_browsingPanel, "m_scopeCombo" );
    m_scopeCombo->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, m_scopeCombo->sizePolicy().hasHeightForWidth() ) );
    m_scopeCombo->setMinimumSize( TQSize( 100, 0 ) );

    m_browsingPanelLayout->addWidget( m_scopeCombo, 0, 6 );

    m_browsingView = new TDEListView( m_browsingPanel, "m_browsingView" );
    m_browsingView->addColumn( tr2i18n( "Name" ) );
    m_browsingView->addColumn( tr2i18n( "Type" ) );
    m_browsingView->addColumn( tr2i18n( "Address" ) );
    m_browsingView->addColumn( tr2i18n( "Protocol" ) );
    m_browsingView->setAllColumnsShowFocus( true );
    m_browsingView->setShowToolTips( false );
    m_browsingView->setResizeMode( TDEListView::AllColumns );

    m_browsingPanelLayout->addMultiCellWidget( m_browsingView, 1, 1, 0, 6 );

    MainDialogBaseLayout->addMultiCellWidget( m_browsingPanel, 0, 0, 0, 2 );
    languageChange();
    resize( TQSize(544, 338).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( m_browseButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( toggleBrowsingArea() ) );
    connect( m_rescanButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( rescan() ) );
    connect( m_serverInput, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( hostChanged(const TQString&) ) );
    connect( m_searchInput, TQ_SIGNAL( returnPressed() ), this, TQ_SLOT( rescan() ) );

    // buddies
    m_serverLabel->setBuddy( m_serverInput );
    TextLabel1_2->setBuddy( m_searchInput );
    TextLabel1->setBuddy( m_scopeCombo );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void MainDialogBase::languageChange()
{
    m_serverLabel->setText( tr2i18n( "Remote &desktop:" ) );
    TQToolTip::add( m_serverInput, tr2i18n( "Enter the hostname and display number" ) );
    TQWhatsThis::add( m_serverInput, tr2i18n( "Enter the name and display number of the computer that you want to connect to, separated by a colon, e.g. 'mycomputer:1'. The address can be any valid Internet address. The display numbers usually start at 0. If you do not have a display number, try 0 or 1.\n"
"Remote Desktop Connection only supports systems that use VNC." ) );
    m_browseButton->setText( tr2i18n( "&Browse <<" ) );
    TQWhatsThis::add( m_browseButton, tr2i18n( "Turn on/off the network browsing panel." ) );
    kActiveLabel2->setText( tr2i18n( "Enter the address of the computer to connect to, or browse the network and select one. VNC and RDP compatible servers will be supported. <a href=\"whatsthis:<h3>Examples</h3>for a computer called 'megan':<p><table><tr><td>megan:1</td><td>connect to the VNC server on 'megan' with display number 1</td></tr><tr><td>vnc:/megan:1</td><td>longer form for the same thing</td></tr><tr><td>rdp:/megan</td><td>connect to the RDP server on 'megan'</td></tr></table>\">Examples</a>" ) );
    m_rescanButton->setText( tr2i18n( "&Rescan" ) );
    TQWhatsThis::add( m_rescanButton, tr2i18n( "Rescans the network. Depending on the network configuration this may take a few seconds until all systems have responded." ) );
    TextLabel1_2->setText( tr2i18n( "&Search:" ) );
    TQToolTip::add( m_searchInput, tr2i18n( "Enter a search term" ) );
    TQWhatsThis::add( m_searchInput, tr2i18n( "Enter a search term here if you want to search for a specific system, then press Enter or click Rescan. All systems, whose description matches the search term, will be displayed. The search is not case sensitive. If you leave the field empty all systems will be displayed." ) );
    TextLabel1->setText( tr2i18n( "Scop&e:" ) );
    TQWhatsThis::add( m_scopeCombo, tr2i18n( "An administrator can configure the network to have several scopes. If this is the case, you can select the scope to scan here." ) );
    m_browsingView->header()->setLabel( 0, tr2i18n( "Name" ) );
    m_browsingView->header()->setLabel( 1, tr2i18n( "Type" ) );
    m_browsingView->header()->setLabel( 2, tr2i18n( "Address" ) );
    m_browsingView->header()->setLabel( 3, tr2i18n( "Protocol" ) );
    TQWhatsThis::add( m_browsingView, tr2i18n( "Here you can see the systems on the network that allow you to connect. Note that an administrator can hide systems, so the list is not always complete. Click on an item to select it, double-click it to connect immediately." ) );
}

void MainDialogBase::enableBrowsingArea(bool)
{
    tqWarning( "MainDialogBase::enableBrowsingArea(bool): Not implemented yet" );
}

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

TQMetaObject *MainDialogBase::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_MainDialogBase( "MainDialogBase", &MainDialogBase::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* MainDialogBase::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 = {"languageChange", 0, 0 };
    static const TQUParameter param_slot_1[] = {
	{ "text", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"hostChanged", 1, param_slot_1 };
    static const TQUMethod slot_2 = {"toggleBrowsingArea", 0, 0 };
    static const TQUParameter param_slot_3[] = {
	{ "item", &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_3 = {"itemSelected", 1, param_slot_3 };
    static const TQUParameter param_slot_4[] = {
	{ "item", &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_4 = {"itemDoubleClicked", 1, param_slot_4 };
    static const TQUParameter param_slot_5[] = {
	{ "scope", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_5 = {"scopeSelected", 1, param_slot_5 };
    static const TQUMethod slot_6 = {"rescan", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected },
	{ "hostChanged(const TQString&)", &slot_1, TQMetaData::Protected },
	{ "toggleBrowsingArea()", &slot_2, TQMetaData::Protected },
	{ "itemSelected(TQListViewItem*)", &slot_3, TQMetaData::Protected },
	{ "itemDoubleClicked(TQListViewItem*)", &slot_4, TQMetaData::Protected },
	{ "scopeSelected(const TQString&)", &slot_5, TQMetaData::Protected },
	{ "rescan()", &slot_6, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"MainDialogBase", parentObject,
	slot_tbl, 7,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_MainDialogBase.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool MainDialogBase::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: hostChanged((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 2: toggleBrowsingArea(); break;
    case 3: itemSelected((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 4: itemDoubleClicked((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 5: scopeSelected((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 6: rescan(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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