#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/cache_ui.ui'
**
** Created by User Interface Compiler
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "cache_ui.h"

#include <qvariant.h>
#include <qlabel.h>
#include <knuminput.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

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

    lbMaxCacheSize = new QLabel( 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 QPushButton( this, "pbClearCache" );
    pbClearCache->setEnabled( FALSE );

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

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

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

    bgCachePolicy = new QButtonGroup( this, "bgCachePolicy" );
    bgCachePolicy->setEnabled( FALSE );
    bgCachePolicy->setColumnLayout(0, Qt::Vertical );
    bgCachePolicy->layout()->setSpacing( 6 );
    bgCachePolicy->layout()->setMargin( 11 );
    bgCachePolicyLayout = new QVBoxLayout( bgCachePolicy->layout() );
    bgCachePolicyLayout->setAlignment( Qt::AlignTop );

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

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

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

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

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

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

/*
 *  Destroys the object and frees any allocated resources
 */
CacheDlgUI::~CacheDlgUI()
{
    // no need to delete child widgets, Qt 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" ) );
    QWhatsThis::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" ) );
    QWhatsThis::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" ) );
    QWhatsThis::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" ) );
    QWhatsThis::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." ) );
}

#include "cache_ui.moc"
