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

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

#include "cache_ui.h"

#include <ntqvariant.h>
#include <knuminput.h>
#include <ntqlabel.h>
#include <ntqpushbutton.h>
#include <ntqcheckbox.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a CacheDlgUI as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
CacheDlgUI::CacheDlgUI( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "CacheDlgUI" );
    CacheDlgUILayout = new TQGridLayout( this, 1, 1, 1, 6, "CacheDlgUILayout"); 
    spacer1 = new TQSpacerItem( 16, 21, TQSizePolicy::Fixed, TQSizePolicy::Minimum );
    CacheDlgUILayout->addItem( spacer1, 2, 0 );

    lbMaxCacheSize = new TQLabel( this, "lbMaxCacheSize" );
    lbMaxCacheSize->setEnabled( false );

    CacheDlgUILayout->addWidget( lbMaxCacheSize, 2, 1 );

    sbMaxCacheSize = new KIntNumInput( this, "sbMaxCacheSize" );
    sbMaxCacheSize->setEnabled( false );
    sbMaxCacheSize->setMinValue( 1 );
    sbMaxCacheSize->setMaxValue( 999999 );

    CacheDlgUILayout->addWidget( sbMaxCacheSize, 2, 2 );

    pbClearCache = new TQPushButton( this, "pbClearCache" );
    pbClearCache->setEnabled( false );

    CacheDlgUILayout->addWidget( pbClearCache, 2, 3 );
    spacer2 = new TQSpacerItem( 0, 21, TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum );
    CacheDlgUILayout->addItem( spacer2, 2, 4 );

    cbUseCache = new TQCheckBox( this, "cbUseCache" );

    CacheDlgUILayout->addMultiCellWidget( cbUseCache, 0, 0, 0, 4 );

    bgCachePolicy = new TQButtonGroup( this, "bgCachePolicy" );
    bgCachePolicy->setEnabled( false );
    bgCachePolicy->setColumnLayout(0, TQt::Vertical );
    bgCachePolicy->layout()->setSpacing( 6 );
    bgCachePolicy->layout()->setMargin( 11 );
    bgCachePolicyLayout = new TQVBoxLayout( bgCachePolicy->layout() );
    bgCachePolicyLayout->setAlignment( TQt::AlignTop );

    rbVerifyCache = new TQRadioButton( bgCachePolicy, "rbVerifyCache" );
    bgCachePolicyLayout->addWidget( rbVerifyCache );

    rbCacheIfPossible = new TQRadioButton( bgCachePolicy, "rbCacheIfPossible" );
    bgCachePolicyLayout->addWidget( rbCacheIfPossible );

    rbOfflineMode = new TQRadioButton( bgCachePolicy, "rbOfflineMode" );
    bgCachePolicyLayout->addWidget( rbOfflineMode );

    CacheDlgUILayout->addMultiCellWidget( bgCachePolicy, 1, 1, 0, 4 );
    languageChange();
    resize( TQSize(424, 172).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( cbUseCache, TQ_SIGNAL( toggled(bool) ), bgCachePolicy, TQ_SLOT( setEnabled(bool) ) );
    connect( cbUseCache, TQ_SIGNAL( toggled(bool) ), lbMaxCacheSize, TQ_SLOT( setEnabled(bool) ) );
    connect( cbUseCache, TQ_SIGNAL( toggled(bool) ), sbMaxCacheSize, TQ_SLOT( setEnabled(bool) ) );
    connect( cbUseCache, TQ_SIGNAL( toggled(bool) ), pbClearCache, TQ_SLOT( setEnabled(bool) ) );

    // buddies
    lbMaxCacheSize->setBuddy( sbMaxCacheSize );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void CacheDlgUI::languageChange()
{
    lbMaxCacheSize->setText( tr2i18n( "Disk cache &size:" ) );
    sbMaxCacheSize->setSuffix( tr2i18n( " KB" ) );
    pbClearCache->setText( tr2i18n( "C&lear Cache" ) );
    cbUseCache->setText( tr2i18n( "&Use cache" ) );
    TQWhatsThis::add( cbUseCache, tr2i18n( "Check this box if you want the web pages you visit to be stored on your hard disk for quicker access. The stored pages will only be updated as needed instead of on every visit to that site. This is especially useful if you have a slow connection to the Internet." ) );
    bgCachePolicy->setTitle( tr2i18n( "Policy" ) );
    rbVerifyCache->setText( tr2i18n( "&Keep cache in sync" ) );
    TQWhatsThis::add( rbVerifyCache, tr2i18n( "Verify whether the cached web page is valid before attempting to fetch the web page again." ) );
    rbCacheIfPossible->setText( tr2i18n( "Use cache whenever &possible" ) );
    TQWhatsThis::add( rbCacheIfPossible, tr2i18n( "Always use documents from the cache when available. You can still use the reload button to synchronize the cache with the remote host." ) );
    rbOfflineMode->setText( tr2i18n( "O&ffline browsing mode" ) );
    TQWhatsThis::add( rbOfflineMode, tr2i18n( "Do not fetch web pages that are not already stored in the cache. Offline mode prevents you from viewing pages that you have not previously visited." ) );
}

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

TQMetaObject *CacheDlgUI::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_CacheDlgUI( "CacheDlgUI", &CacheDlgUI::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* CacheDlgUI::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 TQMetaData slot_tbl[] = {
	{ "languageChange()", &slot_0, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"CacheDlgUI", parentObject,
	slot_tbl, 1,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_CacheDlgUI.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

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

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

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

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